diff --git a/CMakeLists.txt b/CMakeLists.txt index c95457bc6c19b6467eedabcb97f9d332d5442d1d..d7c7318458823c05c9f385c1b5c50118534f6a76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,8 +257,8 @@ else () endif() #------------------------------------------------------ -# C++ 17 flags -set(CMAKE_CXX_STANDARD "17") +# C++ 20 flags +set(CMAKE_CXX_STANDARD "20") #------------------------------------------------------ # Kokkos configuration @@ -286,6 +286,7 @@ add_subdirectory("${PUGS_SOURCE_DIR}/packages/kokkos") include_directories(SYSTEM ${KOKKOS_SOURCE_DIR}/core/src) include_directories(SYSTEM ${KOKKOS_SOURCE_DIR}/containers/src) include_directories(SYSTEM ${KOKKOS_SOURCE_DIR}/tpls/desul/include) +include_directories(SYSTEM ${KOKKOS_BINARY_DIR}/core/src) include_directories(SYSTEM ${KOKKOS_BINARY_DIR}) set(PUGS_BUILD_KOKKOS_DEVICES "") @@ -354,6 +355,8 @@ include_directories(${PUGS_BINARY_DIR}/src) # Pugs tests set(CATCH_MODULE_PATH "${PUGS_SOURCE_DIR}/packages/Catch2") add_subdirectory("${CATCH_MODULE_PATH}") +target_compile_options(Catch2 PRIVATE "-w") +target_compile_options(Catch2WithMain PRIVATE "-w") add_subdirectory(tests) diff --git a/packages/CLI11/.appveyor.yml b/packages/CLI11/.appveyor.yml deleted file mode 100644 index 56b090cd8bda54f606b041d846546dc9a5e24a1f..0000000000000000000000000000000000000000 --- a/packages/CLI11/.appveyor.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: 2.2.0.{build} - -branches: - only: - - main - - v1 - -install: - - git submodule update --init --recursive - - py -3 --version - - set PATH=C:\Python38-x64;C:\Python38-x64\Scripts;%PATH% - - cmake --version - - python --version - - python -m pip --version - - python -m pip install conan - - conan user - - conan --version - -build_script: - - mkdir build - - cd build - - ps: - cmake .. -DCLI11_WARNINGS_AS_ERRORS=ON -DCLI11_SINGLE_FILE_TESTS=ON - -DCMAKE_BUILD_TYPE=Debug -DCMAKE_GENERATOR="Visual Studio 14 2015" - - ps: cmake --build . - - cd .. - - conan create . CLIUtils/CLI11 - -test_script: - - cd build - - ps: ctest --output-on-failure -C Debug - -notifications: - - provider: Webhook - url: https://webhooks.gitter.im/e/0185e91c5d989a476d7b - on_build_success: false - on_build_failure: true - on_build_status_changed: true diff --git a/packages/CLI11/.codecov.yml b/packages/CLI11/.codecov.yml index 185bbad3f47599ffc86429c8dad69f5b61f64c32..61c2e2f21b3be697b43bb3776800b9575baa003f 100644 --- a/packages/CLI11/.codecov.yml +++ b/packages/CLI11/.codecov.yml @@ -1,3 +1,7 @@ ignore: - "tests" - "examples" + - "book" + - "docs" + - "test_package" + - "fuzz" diff --git a/packages/CLI11/.github/CONTRIBUTING.md b/packages/CLI11/.github/CONTRIBUTING.md index 7d376345b11fefd9b30f4069869a0a6ace195f66..93b7651cc8657a6febde2c6cd7a459104f5e3796 100644 --- a/packages/CLI11/.github/CONTRIBUTING.md +++ b/packages/CLI11/.github/CONTRIBUTING.md @@ -60,19 +60,6 @@ name, pre-commit): pre-commit install ``` -## For developers releasing to Conan.io - -This is now done by the CI system on tagged releases. Previously, the steps to -make a Conan.io release were: - -```bash -conan remove '*' # optional, I like to be clean -conan create . cliutils/stable -conan upload "*" -r cli11 --all -``` - -Here I've assumed that the remote is `cli11`. - ## For maintainers: remember to add contributions In a commit to a PR, just add diff --git a/packages/CLI11/.github/actions/quick_cmake/action.yml b/packages/CLI11/.github/actions/quick_cmake/action.yml index 811f73fe277bf4a2a63839790db9e42017e5c35b..8359fb0d01575c5225ab9bc09e657e58e76e4099 100644 --- a/packages/CLI11/.github/actions/quick_cmake/action.yml +++ b/packages/CLI11/.github/actions/quick_cmake/action.yml @@ -13,7 +13,7 @@ runs: using: composite steps: - name: CMake ${{ inputs.cmake-version }} - uses: jwlawson/actions-setup-cmake@v1.12 + uses: jwlawson/actions-setup-cmake@v1.13 with: cmake-version: "${{ inputs.cmake-version }}" - run: | diff --git a/packages/CLI11/.github/codecov.yml b/packages/CLI11/.github/codecov.yml index a0b066745da7867510001d22c19a367acc2ae88e..0e106f7103489b8215629c57ab067af89ca0a4b9 100644 --- a/packages/CLI11/.github/codecov.yml +++ b/packages/CLI11/.github/codecov.yml @@ -1,6 +1,6 @@ codecov: notify: - after_n_builds: 4 + after_n_builds: 8 coverage: status: project: diff --git a/packages/CLI11/.github/dependabot.yml b/packages/CLI11/.github/dependabot.yml index 2c7d1708395e202b3b3316391f35bf4183ebd045..f265d88d94951cbeb868e505d142cfe6232955c4 100644 --- a/packages/CLI11/.github/dependabot.yml +++ b/packages/CLI11/.github/dependabot.yml @@ -4,4 +4,6 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" + interval: "weekly" + target-branch: "main" + open-pull-requests-limit: 10 diff --git a/packages/CLI11/.github/workflows/fuzz.yml b/packages/CLI11/.github/workflows/fuzz.yml new file mode 100644 index 0000000000000000000000000000000000000000..75d161b38a1f06cb91752e7b02e4f81e58071cca --- /dev/null +++ b/packages/CLI11/.github/workflows/fuzz.yml @@ -0,0 +1,54 @@ +name: Fuzz +on: + workflow_dispatch: + push: + branches: + - main + - v* + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + quick_fuzz1: + name: quickfuzz1 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure + run: | + cmake -S . -B build \ + -DCMAKE_CXX_STANDARD=17 \ + -DCLI11_SINGLE_FILE_TESTS=OFF \ + -DCLI11_BUILD_EXAMPLES=OFF \ + -DCLI11_FUZZ_TARGET=ON \ + -DCLI11_BUILD_TESTS=OFF \ + -DCLI11_BUILD_DOCS=OFF \ + -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_FORCED=ON \ + -DCMAKE_CXX_FLAGS="-g -O1 -fsanitize=fuzzer,undefined,address" + + - name: Build + run: cmake --build build -j4 + + - name: Test + run: | + cd build + make QUICK_CLI11_APP_FUZZ + + - name: Test2 + run: | + cd build + make QUICK_CLI11_FILE_FUZZ + + + - name: artifacts + if: failure() + uses: actions/upload-artifact@v3 + with: + name: file_failure + path: ./build/fuzz/cli11_*_fail_artifact.txt diff --git a/packages/CLI11/.github/workflows/tests.yml b/packages/CLI11/.github/workflows/tests.yml index a0b9e6c81282b15389affd44e9f0f5e84f03de54..2ab5a66692d9f433ba88aa12fcfff05c679a1e99 100644 --- a/packages/CLI11/.github/workflows/tests.yml +++ b/packages/CLI11/.github/workflows/tests.yml @@ -20,6 +20,8 @@ jobs: precompile: ["ON", "OFF"] steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Get LCov run: | @@ -46,16 +48,15 @@ jobs: - name: Prepare coverage run: | lcov --directory . --capture --output-file coverage.info - lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' --output-file coverage.info + lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' '*/book/*' '*/fuzz/*' --output-file coverage.info lcov --list coverage.info working-directory: build - - name: Upload coverage - run: | - curl -Os https://uploader.codecov.io/latest/linux/codecov - chmod +x codecov - ./codecov - working-directory: build + - uses: codecov/codecov-action@v3 + with: + files: build/coverage.info + fail_ci_if_error: true + functionalities: fixes clang-tidy: name: Clang-Tidy @@ -73,18 +74,31 @@ jobs: - name: Build run: cmake --build build -j4 -- --keep-going - cuda-build: - name: CUDA build only + cuda11-build: + name: CUDA 11 build only runs-on: ubuntu-latest - container: nvidia/cuda:10.2-devel-ubuntu18.04 + container: nvidia/cuda:11.8.0-devel-ubuntu22.04 steps: - - uses: actions/checkout@v1 + - name: Add build tools + run: apt-get update && apt-get install -y wget git cmake + - uses: actions/checkout@v3 + with: + submodules: true + - name: Configure + run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON + - name: Build + run: cmake --build build -j2 + + cuda12-build: + name: CUDA 12 build only + runs-on: ubuntu-latest + container: nvidia/cuda:12.1.0-devel-ubuntu22.04 + steps: + - name: Add build tools + run: apt-get update && apt-get install -y wget git cmake + - uses: actions/checkout@v3 with: submodules: true - - name: Add wget - run: apt-get update && apt-get install -y wget - - name: Get cmake - uses: jwlawson/actions-setup-cmake@v1.12 - name: Configure run: cmake -S . -B build -DCLI11_CUDA_TESTS=ON - name: Build @@ -92,16 +106,15 @@ jobs: boost-build: name: Boost build - runs-on: ubuntu-latest - container: zouzias/boost:1.76.0 + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 with: submodules: true - - name: Add deps - run: apt-get update && apt-get install make - - name: Get CMake - uses: jwlawson/actions-setup-cmake@v1.12 + - name: Add boost + run: sudo apt-get update && sudo apt-get install -y libboost-dev + # NOTE: If a boost version matching all requirements cannot be found, + # this build step will fail - name: Configure run: cmake -S . -B build -DCLI11_BOOST=ON - name: Build @@ -127,9 +140,9 @@ jobs: - name: Build run: meson compile -C build-meson - cmake-config: - name: CMake config check - runs-on: ubuntu-latest + cmake-config-ubuntu-1804: + name: CMake config check (Ubuntu 18.04) + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v3 @@ -174,6 +187,12 @@ jobs: cmake-version: "3.10" if: success() || failure() + cmake-config-ubuntu-2004: + name: CMake config check (Ubuntu 20.04) + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - name: Check CMake 3.11 (full) uses: ./.github/actions/quick_cmake with: @@ -211,6 +230,12 @@ jobs: cmake-version: "3.16" if: success() || failure() + cmake-config-ubuntu-2204: + name: CMake config check (Ubuntu 22.04) + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Check CMake 3.17 uses: ./.github/actions/quick_cmake with: @@ -235,16 +260,34 @@ jobs: cmake-version: "3.20" if: success() || failure() - - name: Check CMake 3.21 (full) + - name: Check CMake 3.21 uses: ./.github/actions/quick_cmake with: cmake-version: "3.21" - args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON if: success() || failure() - - name: Check CMake 3.22 (full) + - name: Check CMake 3.22 uses: ./.github/actions/quick_cmake with: cmake-version: "3.22" + if: success() || failure() + + - name: Check CMake 3.23 + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.23" + if: success() || failure() + + - name: Check CMake 3.24 (full) + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.24" + args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON + if: success() || failure() + + - name: Check CMake 3.25 (full) + uses: ./.github/actions/quick_cmake + with: + cmake-version: "3.25" args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON if: success() || failure() diff --git a/packages/CLI11/.gitignore b/packages/CLI11/.gitignore index cc1b9d0c7f77776f258bfccbe82224fe588e9582..7b9bcb27f4929ac6cef23bf8df3bc20a4dadf31f 100644 --- a/packages/CLI11/.gitignore +++ b/packages/CLI11/.gitignore @@ -6,10 +6,15 @@ a.out* /CMakeFiles/* /cmake_install.cmake /*.kdev4 +/.vscode /html/* !/meson.build +/CMakeUserPresets.json /node_modules/* /package.json /yarn.lock /CLI11.hpp + +/subprojects/Catch2-* +/subprojects/packagecache diff --git a/packages/CLI11/.gitrepo b/packages/CLI11/.gitrepo index 9d9e10f1cda0a2c2c89c32188c30c3a0d76fad5a..925d8dccefb3a338b66e4a57300b3d1e983bf56a 100644 --- a/packages/CLI11/.gitrepo +++ b/packages/CLI11/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:CLIUtils/CLI11.git branch = main - commit = faea921e4004af91763b8fde905de3baf24d3945 - parent = 8a1fd5ded4230d6e9b9bf69951058fc12a19ad4a + commit = 784fa3ebd387e63feef41d174f587bbe4cfec4da + parent = 164bbb3a73dc902c29aa7ccabfaba50cefa6345d method = merge - cmdver = 0.4.3 + cmdver = 0.4.6 diff --git a/packages/CLI11/.pre-commit-config.yaml b/packages/CLI11/.pre-commit-config.yaml index 0d6d0c0116207798b0c1c88a525ed43359d63789..febf04dd23f4f524d646fefc2b093a35792dfdbe 100644 --- a/packages/CLI11/.pre-commit-config.yaml +++ b/packages/CLI11/.pre-commit-config.yaml @@ -1,27 +1,32 @@ +exclude: ^(.github/workflows/|docs/img/) ci: autoupdate_commit_msg: "chore(deps): pre-commit.ci autoupdate" autofix_commit_msg: "style: pre-commit.ci fixes" repos: - repo: https://github.com/psf/black - rev: 22.6.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files - id: check-case-conflict - id: check-merge-conflict - id: check-symlinks - id: check-yaml + - id: check-toml - id: end-of-file-fixer - id: mixed-line-ending - id: trailing-whitespace + - id: check-shebang-scripts-are-executable + - id: check-executables-have-shebangs + - id: debug-statements - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v14.0.6 + rev: v16.0.3 hooks: - id: clang-format types_or: [c++, c, cuda] @@ -33,17 +38,19 @@ repos: additional_dependencies: [pyyaml] - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v2.7.1" + rev: "v3.0.0-alpha.9-for-vscode" hooks: - id: prettier types_or: [yaml, markdown, html, css, scss, javascript, json] args: [--prose-wrap=always] - repo: https://github.com/markdownlint/markdownlint - rev: v0.11.0 + rev: v0.12.0 hooks: - id: markdownlint args: ["--style=scripts/mdlint_style.rb"] + # Uncomment on macOS - Apple has deprecated Ruby, so macOS is stuck on 2.6 + # language_version: 3.1.2 # - repo: local # hooks: @@ -80,7 +87,7 @@ repos: exclude: .pre-commit-config.yaml - repo: https://github.com/codespell-project/codespell - rev: v2.1.0 + rev: v2.2.4 hooks: - id: codespell args: ["-L", "atleast,ans,doub,inout"] diff --git a/packages/CLI11/CHANGELOG.md b/packages/CLI11/CHANGELOG.md index 04b9cd2a9bee4ccf1845fd689e84b49a8e4ac4f4..4fc3ccdd145c93636f2e98a13f8b157a4ca27d31 100644 --- a/packages/CLI11/CHANGELOG.md +++ b/packages/CLI11/CHANGELOG.md @@ -1,5 +1,75 @@ # Changelog +## Version 2.3: Precompilation Support + +This version adds a pre-compiled mode to CLI11, which allows you to precompile +the library, saving time on incremental rebuilds, making CLI11 more competitive +on compile time with classic compiled CLI libraries. The header-only mode is +still default, and is not yet distributed via binaries. + +- Add `CLI11_PRECOMPILED` as an option. [#762][] +- Bugfix: Include `<functional>` in `FormatterFwd` [#727][] +- Bugfix: Add missing `Macros.hpp` to `Error.hpp` [#755][] +- Bugfix: Fix subcommand callback trigger [#733][] +- Bugfix: Variable rename to avoid warning [#734][] +- Bugfix: `split_program_name` single file name error [#740][] +- Bugfix: Better support for min/max overrides on MSVC [#741][] +- Bugfix: Support MSVC 2022 [#748][] +- Bugfix: Support negated flag in config file [#775][] +- Bugfix: Better errors for some confusing config file situations [#781][] +- Backend: Restore coverage testing (lost with Travis CI) [#747][] + +[#727]: https://github.com/CLIUtils/CLI11/pull/727 +[#733]: https://github.com/CLIUtils/CLI11/pull/733 +[#734]: https://github.com/CLIUtils/CLI11/pull/734 +[#740]: https://github.com/CLIUtils/CLI11/pull/740 +[#741]: https://github.com/CLIUtils/CLI11/pull/741 +[#747]: https://github.com/CLIUtils/CLI11/pull/747 +[#748]: https://github.com/CLIUtils/CLI11/pull/748 +[#755]: https://github.com/CLIUtils/CLI11/pull/755 +[#762]: https://github.com/CLIUtils/CLI11/pull/762 +[#775]: https://github.com/CLIUtils/CLI11/pull/775 +[#781]: https://github.com/CLIUtils/CLI11/pull/781 + +### Version 2.3.1: Missing implementation + +A function implementation was missing after the pre-compile move, missed due to +the fact we lost 100% after losing coverage checking. We are working on filling +out 100% coverage again to ensure this doesn't happen again! + +- Bugfix: `App::get_option_group` implementation missing [#793][] +- Bugfix: Fix spacing when setting an empty footer [#796][] +- Bugfix: Address Klocwork static analysis checking issues [#785][] + +[#785]: https://github.com/CLIUtils/CLI11/pull/785 +[#793]: https://github.com/CLIUtils/CLI11/pull/793 +[#796]: https://github.com/CLIUtils/CLI11/pull/796 + +### Version 2.3.2: Minor maintenance + +This version provides a few fixes collected over the last three months before +adding features for 2.4. + +- Bugfix: Consistently use ADL for `lexical_cast`, making it easier to extend + for custom template types [#820][] +- Bugfix: Tweak the parsing of files for flags with `disable_flag_override` + [#800][] +- Bugfix: Handle out of bounds long long [#807][] +- Bugfix: Spacing of `make_description` min option output [#808][] +- Bugfix: Print last parsed subcommand's help message [#822][] +- Bugfix: Avoid floating point warning in GCC 12 [#803][] +- Bugfix: Fix a few gcc warnings [#813][] +- Backend: Max CMake tested 3.22 -> 3.24 [#823][] + +[#800]: https://github.com/CLIUtils/CLI11/pull/800 +[#803]: https://github.com/CLIUtils/CLI11/pull/803 +[#807]: https://github.com/CLIUtils/CLI11/pull/807 +[#808]: https://github.com/CLIUtils/CLI11/pull/808 +[#813]: https://github.com/CLIUtils/CLI11/pull/813 +[#820]: https://github.com/CLIUtils/CLI11/pull/820 +[#822]: https://github.com/CLIUtils/CLI11/pull/822 +[#823]: https://github.com/CLIUtils/CLI11/pull/823 + ## Version 2.2: Option and Configuration Flexibility New features include support for output of an empty vector, a summing option diff --git a/packages/CLI11/CLI11.hpp.in b/packages/CLI11/CLI11.hpp.in index 83f228ebf0cfeb2eb9da1dd0e18e03ef0c731431..edc16bb15f6468287a4410d9c14fa258e0356003 100644 --- a/packages/CLI11/CLI11.hpp.in +++ b/packages/CLI11/CLI11.hpp.in @@ -5,7 +5,7 @@ // This is a standalone header file generated by MakeSingleHeader.py in CLI11/scripts // from: {git} // -// CLI11 {version} Copyright (c) 2017-2022 University of Cincinnati, developed by Henry +// CLI11 {version} Copyright (c) 2017-2023 University of Cincinnati, developed by Henry // Schreiner under NSF AWARD 1414736. All rights reserved. // // Redistribution and use in source and binary forms of CLI11, with or without @@ -42,8 +42,20 @@ {validators_hpp_filesystem} +{encoding_includes} + +{argv_inl_includes} + namespace {namespace} {{ +{encoding_hpp} + +{encoding_inl_hpp} + +{argv_hpp} + +{argv_inl_hpp} + {string_tools_hpp} {string_tools_inl_hpp} diff --git a/packages/CLI11/CMakeLists.txt b/packages/CLI11/CMakeLists.txt index 31bbbbb6cbf6cdda4b6512eb253a0dfec3868cc6..cdc2011d8800199f8c752523446391905eba808a 100644 --- a/packages/CLI11/CMakeLists.txt +++ b/packages/CLI11/CMakeLists.txt @@ -2,14 +2,14 @@ cmake_minimum_required(VERSION 3.4) # Note: this is a header only library. If you have an older CMake than 3.4, # just add the CLI11/include directory and that's all you need to do. -# Make sure users don't get warnings on a tested (3.4 to 3.22) version +# Make sure users don't get warnings on a tested (3.4 to 3.24) version # of CMake. For most of the policies, the new version is better (hence the change). -# We don't use the 3.4...3.21 syntax because of a bug in an older MSVC's +# We don't use the 3.4...3.24 syntax because of a bug in an older MSVC's # built-in and modified CMake 3.11 -if(${CMAKE_VERSION} VERSION_LESS 3.22) +if(${CMAKE_VERSION} VERSION_LESS 3.25) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) else() - cmake_policy(VERSION 3.22) + cmake_policy(VERSION 3.25) endif() set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"") @@ -132,6 +132,9 @@ endif() include(CLI11Warnings) +# build the fuzzing example or fuzz entry point +add_subdirectory(fuzz) + add_subdirectory(src) # Allow tests to be run on CUDA diff --git a/packages/CLI11/CPPLINT.cfg b/packages/CLI11/CPPLINT.cfg index 24dd86524af1957a994dba4fe53b65f4406d20ad..40bec3714ed59c7101b1d168b9ccdb087a611132 100644 --- a/packages/CLI11/CPPLINT.cfg +++ b/packages/CLI11/CPPLINT.cfg @@ -4,6 +4,7 @@ linelength=120 # As in .clang-format # Unused filters filter=-build/c++11 # Reports e.g. chrono and thread, which overlap with Chromium's API. Not applicable to general C++ projects. filter=-build/include_order # Requires unusual include order that encourages creating not self-contained headers +filter=-build/include_subdir # Prevents including files in current directory for whatever reason filter=-readability/nolint # Conflicts with clang-tidy filter=-readability/check # Catch uses CHECK(a == b) (Tests only) filter=-build/namespaces # Currently using it for one test (Tests only) diff --git a/packages/CLI11/LICENSE b/packages/CLI11/LICENSE index 71c4770317617032abe4bc36a4ab98d470f4d20c..aae15855ecf563d8e62cd6458a0c99b96be4e5b1 100644 --- a/packages/CLI11/LICENSE +++ b/packages/CLI11/LICENSE @@ -1,4 +1,4 @@ -CLI11 2.2 Copyright (c) 2017-2022 University of Cincinnati, developed by Henry +CLI11 2.2 Copyright (c) 2017-2023 University of Cincinnati, developed by Henry Schreiner under NSF AWARD 1414736. All rights reserved. Redistribution and use in source and binary forms of CLI11, with or without diff --git a/packages/CLI11/README.md b/packages/CLI11/README.md index 989ef43b2a665865b897a96243e3d1f8c9c17921..bd9e58db71e02dfe4a479c283783b37bf281193f 100644 --- a/packages/CLI11/README.md +++ b/packages/CLI11/README.md @@ -50,6 +50,7 @@ set with a simple and intuitive interface. - [Formatting](#formatting) - [Subclassing](#subclassing) - [How it works](#how-it-works) + - [Unicode support](#unicode-support) - [Utilities](#utilities) - [Other libraries](#other-libraries) - [API](#api) @@ -164,9 +165,6 @@ this library: option to disable it). - Autocomplete: This might eventually be added to both Plumbum and CLI11, but it is not supported yet. -- Wide strings / unicode: Since this uses the standard library only, it might be - hard to properly implement, but I would be open to suggestions in how to do - this. ## Install @@ -278,13 +276,13 @@ To set up, add options, and run, your main function will look something like this: ```cpp -int main(int argc, char** argv) { +int main() { CLI::App app{"App description"}; std::string filename = "default"; app.add_option("-f,--file", filename, "A help string"); - CLI11_PARSE(app, argc, argv); + CLI11_PARSE(app); return 0; } ``` @@ -293,7 +291,7 @@ int main(int argc, char** argv) { ```cpp try { - app.parse(argc, argv); + app.parse(); } catch (const CLI::ParseError &e) { return app.exit(e); } @@ -306,6 +304,25 @@ inside the catch block; for example, help flags intentionally short-circuit all other processing for speed and to ensure required options and the like do not interfere. +</p></details> + +<details><summary>Note: Why are argc and argv not used? (click to expand)</summary><p> + +`argc` and `argv` may contain incorrect information on Windows when unicode text +is passed in. Check out a section on [unicode support](#unicode-support) below. + +If this is not a concern, you can explicitly pass `argc` and `argv` from main or +from an external preprocessor of CLI arguments to `parse`: + +```cpp +int main(int argc, char** argv) { + // ... + + CLI11_PARSE(app, argc, argv); + return 0; +} +``` + </p></details> </br> @@ -530,7 +547,7 @@ Before parsing, you can set the following options: are `CLI::MultiOptionPolicy::Throw`, `CLI::MultiOptionPolicy::Throw`, `CLI::MultiOptionPolicy::TakeLast`, `CLI::MultiOptionPolicy::TakeFirst`, `CLI::MultiOptionPolicy::Join`, `CLI::MultiOptionPolicy::TakeAll`, and - `CLI::MultiOptionPolicy::Sum` 🚧. + `CLI::MultiOptionPolicy::Sum` 🆕. - `->check(std::string(const std::string &), validator_name="",validator_description="")`: Define a check function. The function should return a non empty string with the error message if the check fails @@ -571,7 +588,7 @@ Before parsing, you can set the following options: - `->trigger_on_parse()`: If set, causes the callback and all associated validation checks for the option to be executed when the option value is parsed vs. at the end of all parsing. This could cause the callback to be - executed multiple times. Also works with positional options 🆕. + executed multiple times. Also works with positional options. These options return the `Option` pointer, so you can chain them together, and even skip storing the pointer entirely. The `each` function takes any function @@ -658,7 +675,7 @@ CLI11 has several Validators built-in that perform some common checks - `CLI::ExistingDirectory`: Requires that the directory exists. - `CLI::ExistingPath`: Requires that the path (file or directory) exists. - `CLI::NonexistentPath`: Requires that the path does not exist. -- `CLI::FileOnDefaultPath`: 🆕 Best used as a transform, Will check that a file +- `CLI::FileOnDefaultPath`: Best used as a transform, Will check that a file exists either directly or in a default path and update the path appropriately. See [Transforming Validators](#transforming-validators) for more details - `CLI::Range(min,max)`: Requires that the option be between min and max (make @@ -938,6 +955,20 @@ nameless subcommands are allowed. Callbacks for nameless subcommands are only triggered if any options from the subcommand were parsed. Subcommand names given through the `add_subcommand` method have the same restrictions as option names. +🚧 Options or flags in a subcommand may be directly specified using dot notation + +- `--subcommand.long=val` (long subcommand option) +- `--subcommand.long val` (long subcommand option) +- `--subcommand.f=val` (short form subcommand option) +- `--subcommand.f val` (short form subcommand option) +- `--subcommand.f` (short form subcommand flag) +- `--subcommand1.subsub.f val` (short form nested subcommand option) + +The use of dot notation in this form is equivalent `--subcommand.long <args>` => +`subcommand --long <args> ++`. Nested subcommands also work `"sub1.subsub"` +would trigger the subsub subcommand in `sub1`. This is equivalent to "sub1 +subsub" + #### Subcommand options There are several options that are supported on the main app and subcommands and @@ -1062,6 +1093,10 @@ option_groups. These are: - `.prefix_command()`: Like `allow_extras`, but stop immediately on the first unrecognized item. It is ideal for allowing your app or subcommand to be a "prefix" to calling another app. +- `.usage(message)`: Replace text to appear at the start of the help string + after description. +- `.usage(std::string())`: Set a callback to generate a string that will appear + at the start of the help string after description. - `.footer(message)`: Set text to appear at the bottom of the help string. - `.footer(std::string())`: Set a callback to generate a string that will appear at the end of the help string. @@ -1356,8 +1391,9 @@ multiple calls or using `|` operations with the transform. Many of the defaults for subcommands and even options are inherited from their creators. The inherited default values for subcommands are `allow_extras`, `prefix_command`, `ignore_case`, `ignore_underscore`, `fallthrough`, `group`, -`footer`,`immediate_callback` and maximum number of required subcommands. The -help flag existence, name, and description are inherited, as well. +`usage`, `footer`, `immediate_callback` and maximum number of required +subcommands. The help flag existence, name, and description are inherited, as +well. Options have defaults for `group`, `required`, `multi_option_policy`, `ignore_case`, `ignore_underscore`, `delimiter`, and `disable_flag_override`. To @@ -1435,11 +1471,10 @@ provide a custom `operator>>` with an `istream` (inside the CLI namespace is fine if you don't want to interfere with an existing `operator>>`). If you wanted to extend this to support a completely new type, use a lambda or -add a specialization of the `lexical_cast` function template in the namespace of -the type you need to convert to. Some examples of some new parsers for -`complex<double>` that support all of the features of a standard `add_options` -call are in [one of the tests](./tests/NewParseTest.cpp). A simpler example is -shown below: +add an overload of the `lexical_cast` function in the namespace of the type you +need to convert to. Some examples of some new parsers for `complex<double>` that +support all of the features of a standard `add_options` call are in +[one of the tests](./tests/NewParseTest.cpp). A simpler example is shown below: #### Example @@ -1450,6 +1485,96 @@ app.add_option("--fancy-count", [](std::vector<std::string> val){ }); ``` +### Unicode support + +CLI11 supports Unicode and wide strings as defined in the +[UTF-8 Everywhere](http://utf8everywhere.org/) manifesto. In particular: + +- The library can parse a wide version of command-line arguments on Windows, + which are converted internally to UTF-8 (more on this below); +- You can store option values in `std::wstring`, in which case they will be + converted to a correct wide string encoding on your system (UTF-16 on Windows + and UTF-32 on most other systems); +- Instead of storing wide strings, it is recommended to use provided `widen` and + `narrow` functions to convert to and from wide strings when actually necessary + (such as when calling into Windows APIs). + +When using the command line on Windows with unicode arguments, your `main` +function may already receive broken Unicode. Parsing `argv` at that point will +not give you a correct string. To fix this, you have three options: + +1. If you pass unmodified command-line arguments to CLI11, call `app.parse()` + instead of `app.parse(argc, argv)` (or `CLI11_PARSE(app)` instead of + `CLI11_PARSE(app, argc, argv)`). The library will find correct arguments + itself. + + ```cpp + int main() { + CLI::App app; + // ... + CLI11_PARSE(app); + } + ``` + +2. Get correct arguments with which the program was originally executed using + provided functions: `CLI::argc()` and `CLI::argv()`. These two methods are + the only cross-platform ways of handling unicode correctly. + + ```cpp + int main() { + CLI::App app; + // ... + CLI11_PARSE(app, CLI::argc(), CLI::argv()); + } + ``` + +3. Use the Windows-only non-standard `wmain` function, which accepts + `wchar_t *argv[]` instead of `char* argv[]`. Parsing this will allow CLI to + convert wide strings to UTF-8 without losing information. + + ```cpp + int wmain(int argc, wchar_t *argv[]) { + CLI::App app; + // ... + CLI11_PARSE(app, argc, argv); + } + ``` + +4. Retrieve arguments yourself by using Windows APIs like + [`CommandLineToArgvW`](https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw) + and pass them to CLI. This is what the library is doing under the hood in + `CLI::argv()`. + +The library provides functions to convert between UTF-8 and wide strings: + +```cpp +namespace CLI { + std::string narrow(const std::wstring &str); + std::string narrow(const wchar_t *str); + std::string narrow(const wchar_t *str, std::size_t size); + std::string narrow(std::wstring_view str); // C++17 + + std::wstring widen(const std::string &str); + std::wstring widen(const char *str); + std::wstring widen(const char *str, std::size_t size); + std::wstring widen(std::string_view str); // C++17 +} +``` + +#### Note on using Unicode paths + +When creating a `filesystem::path` from a UTF-8 path on Windows, you need to +convert it to a wide string first. CLI11 provides a platform-independent +`to_path` function, which will convert a UTF-8 string to path, the right way: + +```cpp +std::string utf8_name = "Hello Halló Привет 你好 👩🚀❤️.txt"; + +std::filesystem::path p = CLI::to_path(utf8_name); +std::ifstream stream(CLI::to_path(utf8_name)); +// etc. +``` + ### Utilities There are a few other utilities that are often useful in CLI programming. These diff --git a/packages/CLI11/azure-pipelines.yml b/packages/CLI11/azure-pipelines.yml index c519e153bada7ff93a1132256f285c5b75c3a053..1bb4d0771abf016d442eaa33300dc31698ca9825 100644 --- a/packages/CLI11/azure-pipelines.yml +++ b/packages/CLI11/azure-pipelines.yml @@ -28,7 +28,6 @@ jobs: - bash: cpplint --counting=detailed --recursive examples include/CLI tests displayName: Checking against google style guide - # TODO: Fix macOS error and windows warning in c++17 mode - job: Native strategy: matrix: @@ -38,13 +37,13 @@ jobs: vmImage: "ubuntu-latest" cli11.precompile: ON macOS17: - vmImage: "macOS-latest" + vmImage: "macOS-12" cli11.std: 17 macOS11: - vmImage: "macOS-latest" + vmImage: "macOS-11" cli11.std: 11 macOS11PC: - vmImage: "macOS-latest" + vmImage: "macOS-11" cli11.std: 11 cli11.precompile: ON Windows17: @@ -57,10 +56,14 @@ jobs: Windows11: vmImage: "windows-2019" cli11.std: 11 - WindowsLatest: - vmImage: "windows-2019" + Windows20: + vmImage: "windows-2022" cli11.std: 20 - cli11.options: -DCMAKE_CXX_FLAGS="/std:c++latest /EHsc" + cli11.options: -DCMAKE_CXX_FLAGS="/EHsc" + WindowsLatest: + vmImage: "windows-2022" + cli11.std: 23 + cli11.options: -DCMAKE_CXX_FLAGS="/EHsc" Linux17nortti: vmImage: "ubuntu-latest" cli11.std: 17 @@ -106,13 +109,14 @@ jobs: gcc11: containerImage: gcc:11 cli11.std: 20 - gcc8: - containerImage: gcc:8 - cli11.std: 17 + cli11.options: -DCMAKE_CXX_FLAGS="-Wredundant-decls -Wconversion" + gcc7: + containerImage: gcc:7 + cli11.std: 14 + cli11.options: -DCMAKE_CXX_FLAGS="-Wconversion" gcc4.8: containerImage: helics/buildenv:gcc4-8-builder cli11.std: 11 - cli11.options: clang3.4: containerImage: silkeh/clang:3.4 cli11.std: 11 diff --git a/packages/CLI11/book/chapters/config.md b/packages/CLI11/book/chapters/config.md index d062c659583a3eee22c53f15e6d6421e6be3442e..30ca48effb6a5370bd6bdba1fc73e521b5737339 100644 --- a/packages/CLI11/book/chapters/config.md +++ b/packages/CLI11/book/chapters/config.md @@ -87,6 +87,10 @@ app.allow_config_extras(CLI::config_extras_mode::ignore_all); will completely ignore any mismatches, extras, or other issues with the config file +Config file extras are stored in the remaining output as two components. The +first is the name of the field including subcommands using dot notation the +second (or more) are the argument fields. + ### Getting the used configuration file name If it is needed to get the configuration file name used this can be obtained via diff --git a/packages/CLI11/book/chapters/internals.md b/packages/CLI11/book/chapters/internals.md index f8479c545fe4489741041f8127d3fab8ee602165..c2c98b75bd8c9d8a9c02a1ca351204a7751834d5 100644 --- a/packages/CLI11/book/chapters/internals.md +++ b/packages/CLI11/book/chapters/internals.md @@ -8,9 +8,9 @@ classes or inheritance. This is accomplished through lambda functions. This looks like: ```cpp -Option* add_option(string name, T item) { +Option* add_option(string name, T &item) { this->function = [&item](string value){ - item = detail::lexical_cast<T>(value); + return lexical_cast(value, item); } } ``` diff --git a/packages/CLI11/conanfile.py b/packages/CLI11/conanfile.py deleted file mode 100644 index 9dc6ce3ade6d55676541b7e789c6a0dd3608f892..0000000000000000000000000000000000000000 --- a/packages/CLI11/conanfile.py +++ /dev/null @@ -1,49 +0,0 @@ -from conans import ConanFile, CMake -from conans.tools import load, cross_building -import re - - -def get_version(): - try: - content = load("include/CLI/Version.hpp") - version = re.search(r'#define CLI11_VERSION "(.*)"', content).group(1) - return version - except Exception: - return None - - -class CLI11Conan(ConanFile): - name = "CLI11" - version = get_version() - description = "Command Line Interface toolkit for C++11" - topics = ("cli", "c++11", "parser", "cli11") - url = "https://github.com/CLIUtils/CLI11" - homepage = "https://github.com/CLIUtils/CLI11" - author = "Henry Schreiner <hschrein@cern.ch>" - license = "BSD-3-Clause" - - settings = "os", "compiler", "arch", "build_type" - exports_sources = ( - "LICENSE", - "README.md", - "include/*", - "src/*", - "extern/*", - "cmake/*", - "CMakeLists.txt", - "CLI11.CPack.Description.txt", - "tests/*", - ) - - def build(self): # this is not building a library, just tests - cmake = CMake(self) - cmake.definitions["CLI11_EXAMPLES"] = "OFF" - cmake.definitions["CLI11_SINGLE_FILE"] = "OFF" - cmake.configure() - cmake.build() - if not cross_building(self.settings): - cmake.test() - cmake.install() - - def package_id(self): - self.info.header_only() diff --git a/packages/CLI11/examples/callback_passthrough.cpp b/packages/CLI11/examples/callback_passthrough.cpp index 833ef6fcf1e7593b34d5d6add8de93468b4c7909..1aac0df6beef22f1431159bda5099e9c6142ad6b 100644 --- a/packages/CLI11/examples/callback_passthrough.cpp +++ b/packages/CLI11/examples/callback_passthrough.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/config_app.cpp b/packages/CLI11/examples/config_app.cpp index 986e80d9e2f468ea2f4857ad4a433c484b57be27..a0426ad616b7221533047ae16c1ae4a0f734712d 100644 --- a/packages/CLI11/examples/config_app.cpp +++ b/packages/CLI11/examples/config_app.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/custom_parse.cpp b/packages/CLI11/examples/custom_parse.cpp index 793ddfab2b665308821309bf4c3fa56392a8e877..eaaedd552f65af734eec6c9d1a2e048cbfa53369 100644 --- a/packages/CLI11/examples/custom_parse.cpp +++ b/packages/CLI11/examples/custom_parse.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/digit_args.cpp b/packages/CLI11/examples/digit_args.cpp index 023be6c63884e6617ab8664a33a1d1889424b503..a0785ddbdf7c1df5c8123e7cb2b24241b0b4be66 100644 --- a/packages/CLI11/examples/digit_args.cpp +++ b/packages/CLI11/examples/digit_args.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/enum.cpp b/packages/CLI11/examples/enum.cpp index 90684333fbb106c84282fbab423d89e5eb394a1a..133adde9aca4c62e755b3597e6e299af2c0b7e54 100644 --- a/packages/CLI11/examples/enum.cpp +++ b/packages/CLI11/examples/enum.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/enum_ostream.cpp b/packages/CLI11/examples/enum_ostream.cpp index 4ccc6a00c42d1c57f1a99641e12d2f9ce75d5b5b..1f8ac57e409d637f1533b4adbadf649d5976a134 100644 --- a/packages/CLI11/examples/enum_ostream.cpp +++ b/packages/CLI11/examples/enum_ostream.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/formatter.cpp b/packages/CLI11/examples/formatter.cpp index 09d6dce10753479111a6ca97a82eda3a166445fb..4973cf95f9ec27334fda2a02fe3aef461d84da43 100644 --- a/packages/CLI11/examples/formatter.cpp +++ b/packages/CLI11/examples/formatter.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/groups.cpp b/packages/CLI11/examples/groups.cpp index 2ebc1e88a5b7cd890a3041b3b107dbabb558c7fb..09c5d6ba2bdfea9108ad9cbc4bbaaf092e4be4c0 100644 --- a/packages/CLI11/examples/groups.cpp +++ b/packages/CLI11/examples/groups.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/inter_argument_order.cpp b/packages/CLI11/examples/inter_argument_order.cpp index 8fe063e396be399bd7ec38b6b933bb3f5d37758c..e8c489c2ad34e7d349655dca9ab9ef5bf2cfb3b1 100644 --- a/packages/CLI11/examples/inter_argument_order.cpp +++ b/packages/CLI11/examples/inter_argument_order.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/modhelp.cpp b/packages/CLI11/examples/modhelp.cpp index ac2ba1759d2952a96f5d4173aaaf8a66dff45d35..d0f8cf87525194e9f3ac69b8b9c80ea5c6efecac 100644 --- a/packages/CLI11/examples/modhelp.cpp +++ b/packages/CLI11/examples/modhelp.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/nested.cpp b/packages/CLI11/examples/nested.cpp index 07aa75fb85f5959619d7caa0a3660722be9c52ed..3587023ac3b813413d033b7ba1b3d80178bcc5dc 100644 --- a/packages/CLI11/examples/nested.cpp +++ b/packages/CLI11/examples/nested.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/option_groups.cpp b/packages/CLI11/examples/option_groups.cpp index 9799bdc6e4ac6f07ecbcf85526acfc1b4bcc3aaa..3a282536bc00ee11e97a15dbde36f6b846cf1e09 100644 --- a/packages/CLI11/examples/option_groups.cpp +++ b/packages/CLI11/examples/option_groups.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/positional_arity.cpp b/packages/CLI11/examples/positional_arity.cpp index e8c45c4d61016596bfbdcd98d45a588d31a53e8d..d2d9b9c89a108cd82a04ae86f1375962889a90c9 100644 --- a/packages/CLI11/examples/positional_arity.cpp +++ b/packages/CLI11/examples/positional_arity.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/positional_validation.cpp b/packages/CLI11/examples/positional_validation.cpp index ce676d9d185b812545f990a975f26ca4c03c8463..6b552daa536a4842b6600ced176ad37d30a3f0c1 100644 --- a/packages/CLI11/examples/positional_validation.cpp +++ b/packages/CLI11/examples/positional_validation.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/prefix_command.cpp b/packages/CLI11/examples/prefix_command.cpp index 61639411fd0ca18065d4331147e35639934109e4..843f40374616283f9208004237f8e95fdf651bb8 100644 --- a/packages/CLI11/examples/prefix_command.cpp +++ b/packages/CLI11/examples/prefix_command.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/ranges.cpp b/packages/CLI11/examples/ranges.cpp index 42b1659c3bf88897a5a732cf0e7c68c4631357fe..ec14905bf4be51920b6aee7df10cdb3dea3909aa 100644 --- a/packages/CLI11/examples/ranges.cpp +++ b/packages/CLI11/examples/ranges.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/retired.cpp b/packages/CLI11/examples/retired.cpp index 0a3a5fbeee541fca69701dae47be5af1074e160c..28f61da04dfc5f867e5f6c79cd67cf4c1fc35c2c 100644 --- a/packages/CLI11/examples/retired.cpp +++ b/packages/CLI11/examples/retired.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/shapes.cpp b/packages/CLI11/examples/shapes.cpp index d9f47cab101261afee5c23118a539c70a3e0a10a..d3f48ac73c40bb395321fbc88532b341af33eddc 100644 --- a/packages/CLI11/examples/shapes.cpp +++ b/packages/CLI11/examples/shapes.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/simple.cpp b/packages/CLI11/examples/simple.cpp index 5f94bc835186f619362b5d304fd4c27a9fcdb8cc..b7095dd2cc703648668e8921efa43b01c6308ad2 100644 --- a/packages/CLI11/examples/simple.cpp +++ b/packages/CLI11/examples/simple.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_help.cpp b/packages/CLI11/examples/subcom_help.cpp index 952060de9a4b345d4c5343956acc41da5b88d22f..65030eb86aa0bae0f9c6a29fe0fdc71ccc967adc 100644 --- a/packages/CLI11/examples/subcom_help.cpp +++ b/packages/CLI11/examples/subcom_help.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_in_files/subcommand_a.cpp b/packages/CLI11/examples/subcom_in_files/subcommand_a.cpp index 9ad65e01e2021212d8de3e68be82fe6d954ea8f8..bb1a6a13d4bc1c6a7d2acffc2998caae8c8bb2f0 100644 --- a/packages/CLI11/examples/subcom_in_files/subcommand_a.cpp +++ b/packages/CLI11/examples/subcom_in_files/subcommand_a.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_in_files/subcommand_a.hpp b/packages/CLI11/examples/subcom_in_files/subcommand_a.hpp index cfa4883ea0f1770c1be703c76d163217e9faf65e..6a8395d1a3219efc67417b563ecf75da3eea1943 100644 --- a/packages/CLI11/examples/subcom_in_files/subcommand_a.hpp +++ b/packages/CLI11/examples/subcom_in_files/subcommand_a.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_in_files/subcommand_main.cpp b/packages/CLI11/examples/subcom_in_files/subcommand_main.cpp index 1ff5fdad9af3e98601ad182d5541895a9d79be4f..e65339c901c52689c3e3b1b045d6d8ca463a70f0 100644 --- a/packages/CLI11/examples/subcom_in_files/subcommand_main.cpp +++ b/packages/CLI11/examples/subcom_in_files/subcommand_main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcom_partitioned.cpp b/packages/CLI11/examples/subcom_partitioned.cpp index 493ac0e383be0a2775ec1d9131562635926cb039..b6273eaed6fdd1737e0a92008958a81237a457d2 100644 --- a/packages/CLI11/examples/subcom_partitioned.cpp +++ b/packages/CLI11/examples/subcom_partitioned.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/subcommands.cpp b/packages/CLI11/examples/subcommands.cpp index 44d4df925e7256012365a47ecea4fc3948babf2d..e69c04eed06971905c53d0b4490028d373fd704b 100644 --- a/packages/CLI11/examples/subcommands.cpp +++ b/packages/CLI11/examples/subcommands.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/testEXE.cpp b/packages/CLI11/examples/testEXE.cpp index b63fa9499ac49d9e841036247b6842e854b5b773..b2cac7fbae1d93ef91eeb09a593c8bf8ee1e0e35 100644 --- a/packages/CLI11/examples/testEXE.cpp +++ b/packages/CLI11/examples/testEXE.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/examples/validators.cpp b/packages/CLI11/examples/validators.cpp index 050be00fb8b5b7e64d82be0d8888c5762255904c..87eb07ab20e09fbe3558c122406aa03ec52ca7e0 100644 --- a/packages/CLI11/examples/validators.cpp +++ b/packages/CLI11/examples/validators.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/fuzz/CMakeLists.txt b/packages/CLI11/fuzz/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..21df4028f53bcb747c1716260238863dfb2c60b8 --- /dev/null +++ b/packages/CLI11/fuzz/CMakeLists.txt @@ -0,0 +1,48 @@ +# Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +# under NSF AWARD 1414736 and by the respective contributors. +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +if(CMAKE_CXX_STANDARD GREATER 16) + if(CLI11_FUZZ_TARGET) + + add_executable(cli11_app_fuzzer cli11_app_fuzz.cpp fuzzApp.cpp fuzzApp.hpp) + target_link_libraries(cli11_app_fuzzer PUBLIC CLI11) + set_property(TARGET cli11_app_fuzzer PROPERTY FOLDER "Tests") + + add_executable(cli11_file_fuzzer cli11_file_fuzz.cpp fuzzApp.cpp fuzzApp.hpp) + target_link_libraries(cli11_file_fuzzer PUBLIC CLI11) + set_property(TARGET cli11_file_fuzzer PROPERTY FOLDER "Tests") + + if(NOT CLI11_FUZZ_ARTIFACT_PATH) + set(CLI11_FUZZ_ARTIFACT_PATH ${PROJECT_BINARY_DIR}/fuzz) + endif() + + if(NOT CLI11_FUZZ_TIME) + set(CLI11_FUZZ_TIME 360) + endif() + add_custom_target( + QUICK_CLI11_APP_FUZZ + COMMAND ${CMAKE_COMMAND} -E make_directory corp + COMMAND + cli11_app_fuzzer corp -max_total_time=${CLI11_FUZZ_TIME} -max_len=2048 + -dict=${CMAKE_CURRENT_SOURCE_DIR}/fuzz_dictionary1.txt + -exact_artifact_path=${CLI11_FUZZ_ARTIFACT_PATH}/cli11_app_fail_artifact.txt) + + add_custom_target( + QUICK_CLI11_FILE_FUZZ + COMMAND ${CMAKE_COMMAND} -E make_directory corp + COMMAND + cli11_file_fuzzer corp -max_total_time=${CLI11_FUZZ_TIME} -max_len=2048 + -dict=${CMAKE_CURRENT_SOURCE_DIR}/fuzz_dictionary2.txt + -exact_artifact_path=${CLI11_FUZZ_ARTIFACT_PATH}/cli11_file_fail_artifact.txt) + + else() + if(CLI11_BUILD_EXAMPLES) + add_executable(cli11Fuzz fuzzCommand.cpp fuzzApp.cpp fuzzApp.hpp) + target_link_libraries(cli11Fuzz PUBLIC CLI11) + set_property(TARGET cli11Fuzz PROPERTY FOLDER "Examples") + endif() + endif() +endif() diff --git a/packages/CLI11/fuzz/cli11_app_fuzz.cpp b/packages/CLI11/fuzz/cli11_app_fuzz.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7cd10b889899141bd09d7811ea8c0106fb95b8ae --- /dev/null +++ b/packages/CLI11/fuzz/cli11_app_fuzz.cpp @@ -0,0 +1,30 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#include "fuzzApp.hpp" +#include <CLI/CLI.hpp> +#include <cstring> +#include <exception> +#include <string> + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + if(Size == 0) { + return 0; + } + std::string parseString(reinterpret_cast<const char *>(Data), Size); + + CLI::FuzzApp fuzzdata; + + auto app = fuzzdata.generateApp(); + try { + app->parse(parseString); + } catch(const CLI::ParseError &e) { + //(app)->exit(e); + // this just indicates we caught an error known by CLI + } + + return 0; // Non-zero return values are reserved for future use. +} diff --git a/packages/CLI11/fuzz/cli11_file_fuzz.cpp b/packages/CLI11/fuzz/cli11_file_fuzz.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e769114eb9b1ab5ee2fcd8ffc60fed9b29f1710f --- /dev/null +++ b/packages/CLI11/fuzz/cli11_file_fuzz.cpp @@ -0,0 +1,31 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#include "fuzzApp.hpp" +#include <CLI/CLI.hpp> +#include <cstring> +#include <exception> +#include <sstream> +#include <string> + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + if(Size == 0) { + return 0; + } + std::string parseString(reinterpret_cast<const char *>(Data), Size); + std::stringstream out(parseString); + CLI::FuzzApp fuzzdata; + + auto app = fuzzdata.generateApp(); + try { + app->parse_from_stream(out); + } catch(const CLI::ParseError &e) { + (app)->exit(e); + // this just indicates we caught an error known by CLI + } + + return 0; // Non-zero return values are reserved for future use. +} diff --git a/packages/CLI11/fuzz/fuzzApp.cpp b/packages/CLI11/fuzz/fuzzApp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dc401f933a56921c37a45201e767c60fadbfde00 --- /dev/null +++ b/packages/CLI11/fuzz/fuzzApp.cpp @@ -0,0 +1,85 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#include "fuzzApp.hpp" + +namespace CLI { +/* +int32_t val32{0}; + int16_t val16{0}; + int8_t val8{0}; + int64_t val64{0}; + + uint32_t uval32{0}; + uint16_t uval16{0}; + uint8_t uval8{0}; + uint64_t uval64{0}; + + std::atomic<int64_t> atomicval64{0}; + std::atomic<uint64_t> atomicuval64{0}; + + double v1{0}; + float v2{0}; + + std::vector<double> vv1; + std::vector<std::string> vstr; + std::vector<std::vector<double>> vecvecd; + std::vector<std::vector<std::string>> vvs; + std::optional<double> od1; + std::optional<std::string> ods; + std::pair<double, std::string> p1; + std::pair<std::vector<double>, std::string> p2; + std::tuple<int64_t, uint16_t, std::optional<double>> t1; + std::tuple<std::tuple<std::tuple<std::string, double, std::vector<int>>,std::string, double>,std::vector<int>, +std::optional<std::string>> tcomplex; std::string_view vstrv; + + bool flag1{false}; + int flagCnt{0}; + std::atomic<bool> flagAtomic{false}; + */ +std::shared_ptr<CLI::App> FuzzApp::generateApp() { + auto fApp = std::make_shared<CLI::App>("fuzzing App", "fuzzer"); + fApp->set_config("--config"); + fApp->add_flag("-a,--flag"); + fApp->add_flag("-b,--flag2", flag1); + fApp->add_flag("-c{34},--flag3{1}", flagCnt)->disable_flag_override(); + fApp->add_flag("-e,--flagA", flagAtomic); + + fApp->add_option("-d,--opt1", val8); + fApp->add_option("--opt2", val16); + fApp->add_option("--opt3", val32); + fApp->add_option("--opt4", val64); + + fApp->add_option("--opt5", uval8); + fApp->add_option("--opt6", uval16); + fApp->add_option("--opt7", uval32); + fApp->add_option("--opt8", uval64); + + fApp->add_option("--aopt1", atomicval64); + fApp->add_option("--aopt2", atomicuval64); + + fApp->add_option("--dopt1", v1); + fApp->add_option("--dopt2", v2); + + fApp->add_option("--vopt1", vv1); + fApp->add_option("--vopt2", vvs); + fApp->add_option("--vopt3", vstr); + fApp->add_option("--vopt4", vecvecd); + + fApp->add_option("--oopt1", od1); + fApp->add_option("--oopt2", ods); + + fApp->add_option("--tup1", p1); + fApp->add_option("--tup2", t1); + fApp->add_option("--tup4", tcomplex); + + fApp->add_option("--dwrap", dwrap); + fApp->add_option("--iwrap", iwrap); + + return fApp; +} + +} // namespace CLI diff --git a/packages/CLI11/fuzz/fuzzApp.hpp b/packages/CLI11/fuzz/fuzzApp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..01600cc259dce0697c5202bc30a321920a9c36e9 --- /dev/null +++ b/packages/CLI11/fuzz/fuzzApp.hpp @@ -0,0 +1,92 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause +#pragma once + +#ifdef CLI11_SINGLE_FILE +#include "CLI11.hpp" +#else +#include "CLI/CLI.hpp" +#endif + +#include <atomic> +#include <iostream> +#include <memory> +#include <optional> +#include <string> +#include <string_view> +#include <vector> + +namespace CLI { + +class intWrapper64 { + public: + intWrapper64() = default; + explicit intWrapper64(int64_t v) : val(v){}; + CLI11_NODISCARD int64_t value() const { return val; } + + private: + int64_t val{0}; +}; + +class doubleWrapper { + public: + doubleWrapper() = default; + explicit doubleWrapper(double v) : val(v){}; + CLI11_NODISCARD double value() const { return val; } + + private: + double val{0.0}; +}; + +class FuzzApp { + public: + FuzzApp() = default; + + std::shared_ptr<CLI::App> generateApp(); + + int32_t val32{0}; + int16_t val16{0}; + int8_t val8{0}; + int64_t val64{0}; + + uint32_t uval32{0}; + uint16_t uval16{0}; + uint8_t uval8{0}; + uint64_t uval64{0}; + + std::atomic<int64_t> atomicval64{0}; + std::atomic<uint64_t> atomicuval64{0}; + + double v1{0}; + float v2{0}; + + std::vector<double> vv1{}; + std::vector<std::string> vstr{}; + std::vector<std::vector<double>> vecvecd{}; + std::vector<std::vector<std::string>> vvs{}; + std::optional<double> od1{}; + std::optional<std::string> ods{}; + std::pair<double, std::string> p1{}; + std::pair<std::vector<double>, std::string> p2{}; + std::tuple<int64_t, uint16_t, std::optional<double>> t1{}; + std::tuple<std::tuple<std::tuple<std::string, double, std::vector<int>>, std::string, double>, + std::vector<int>, + std::optional<std::string>> + tcomplex{}; + std::tuple<std::tuple<std::tuple<std::string, double, std::vector<int>>, std::string, double>, + std::vector<int>, + std::optional<std::string>> + tcomplex2{}; + std::string_view vstrv = ""; + + bool flag1{false}; + int flagCnt{0}; + std::atomic<bool> flagAtomic{false}; + + intWrapper64 iwrap{0}; + doubleWrapper dwrap{0.0}; +}; +} // namespace CLI diff --git a/packages/CLI11/fuzz/fuzzCommand.cpp b/packages/CLI11/fuzz/fuzzCommand.cpp new file mode 100644 index 0000000000000000000000000000000000000000..07ab0df2e24d8390ef490fa09597cc991430d8a8 --- /dev/null +++ b/packages/CLI11/fuzz/fuzzCommand.cpp @@ -0,0 +1,24 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#include "fuzzApp.hpp" +#include <CLI/CLI.hpp> +#include <iostream> + +int main(int argc, char **argv) { + + CLI::FuzzApp fuzzdata; + + auto app = fuzzdata.generateApp(); + try { + + app->parse(argc, argv); + } catch(const CLI::ParseError &e) { + (app)->exit(e); + // this just indicates we caught an error known by CLI + } + return 0; +} diff --git a/packages/CLI11/fuzz/fuzz_dictionary1.txt b/packages/CLI11/fuzz/fuzz_dictionary1.txt new file mode 100644 index 0000000000000000000000000000000000000000..c044eecd4b56e798960acdbfb87220203fa43031 --- /dev/null +++ b/packages/CLI11/fuzz/fuzz_dictionary1.txt @@ -0,0 +1,34 @@ +###### Recommended dictionary. +"-a" +"-b" +"-c" +"-d" +"-e" +"--flag1" +"--flag" +"--flag2" +"--flagA" +"--opt1" +"--opt2" +"--opt3" +"--opt4" +"--opt5" +"--opt6" +"--opt7" +"--opt8" +"--opt9" +"--aopt1" +"--aopt2" +"--dopt1" +"--dopt2" +"--vopt1" +"--vopt2" +"--vopt3" +"--vopt4" +"--oopt1" +"--oopt2" +"--tup1" +"--tup2" +"--tup4" +"--dwrap" +"--iwrap" diff --git a/packages/CLI11/fuzz/fuzz_dictionary2.txt b/packages/CLI11/fuzz/fuzz_dictionary2.txt new file mode 100644 index 0000000000000000000000000000000000000000..12dd8f1f6c8fb74cb207817ebd0ea5169354b512 --- /dev/null +++ b/packages/CLI11/fuzz/fuzz_dictionary2.txt @@ -0,0 +1,37 @@ +###### Recommended dictionary. +"a" +"b" +"c" +"d" +"e" +"flag1" +"flag" +"flag2" +"flagA" +"opt1" +"opt2" +"opt3" +"opt4" +"opt5" +"opt6" +"opt7" +"opt8" +"opt9" +"aopt1" +"aopt2" +"dopt1" +"dopt2" +"vopt1" +"vopt2" +"vopt3" +"vopt4" +"=" +"oopt1" +"oopt2" +"tup1" +"tup2" +"tup4" +"tup2" +"tup4" +"dwrap" +"iwrap" diff --git a/packages/CLI11/include/CLI/App.hpp b/packages/CLI11/include/CLI/App.hpp index d29aa6a89ca7c9c9af9ce6c29eefd1c8e037df8d..2676445d155562f77aee64738768c64d024e5ec3 100644 --- a/packages/CLI11/include/CLI/App.hpp +++ b/packages/CLI11/include/CLI/App.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -35,9 +35,9 @@ namespace CLI { // [CLI11:app_hpp:verbatim] #ifndef CLI11_PARSE -#define CLI11_PARSE(app, argc, argv) \ +#define CLI11_PARSE(app, ...) \ try { \ - (app).parse((argc), (argv)); \ + (app).parse(__VA_ARGS__); \ } catch(const CLI::ParseError &e) { \ return (app).exit(e); \ } @@ -49,8 +49,11 @@ struct AppFriend; } // namespace detail namespace FailureMessage { -std::string simple(const App *app, const Error &e); -std::string help(const App *app, const Error &e); +/// Printout a clean, simple message on error (the default in CLI11 1.5+) +CLI11_INLINE std::string simple(const App *app, const Error &e); + +/// Printout the full help string on error (if this fn is set, the old default for CLI11) +CLI11_INLINE std::string help(const App *app, const Error &e); } // namespace FailureMessage /// enumeration of modes of how to deal with extras in config files @@ -147,6 +150,12 @@ class App { /// @name Help ///@{ + /// Usage to put after program/subcommand description in the help output INHERITABLE + std::string usage_{}; + + /// This is a function that generates a usage to put after program/subcommand description in help output + std::function<std::string()> usage_callback_{}; + /// Footer to put after all options in the help output INHERITABLE std::string footer_{}; @@ -623,7 +632,8 @@ class App { std::string flag_description = "") { CLI::callback_t fun = [&flag_result](const CLI::results_t &res) { - return CLI::detail::lexical_cast(res[0], flag_result); + using CLI::detail::lexical_cast; + return lexical_cast(res[0], flag_result); }; auto *opt = _add_flag_internal(flag_name, std::move(fun), std::move(flag_description)); return detail::default_flag_modifiers<T>(opt); @@ -639,8 +649,9 @@ class App { CLI::callback_t fun = [&flag_results](const CLI::results_t &res) { bool retval = true; for(const auto &elem : res) { + using CLI::detail::lexical_cast; flag_results.emplace_back(); - retval &= detail::lexical_cast(elem, flag_results.back()); + retval &= lexical_cast(elem, flag_results.back()); } return retval; }; @@ -826,15 +837,25 @@ class App { /// Reset the parsed data void clear(); + /// Parse the command-line arguments passed to the main function of the executable. + /// This overload will correctly parse unicode arguments on Windows. + void parse(); + /// Parses the command line - throws errors. /// This must be called after the options are in but before the rest of the program. void parse(int argc, const char *const *argv); + void parse(int argc, const wchar_t *const *argv); + + private: + template <class CharT> void parse_char_t(int argc, const CharT *const *argv); + public: /// Parse a single string as if it contained command line arguments. /// This function splits the string into arguments then calls parse(std::vector<std::string> &) /// the function takes an optional boolean argument specifying if the programName is included in the string to /// process void parse(std::string commandline, bool program_name_included = false); + void parse(std::wstring commandline, bool program_name_included = false); /// The real work is done here. Expects a reversed vector. /// Changes the vector to the remaining options. @@ -942,6 +963,16 @@ class App { /// @name Help ///@{ + /// Set usage. + App *usage(std::string usage_string) { + usage_ = std::move(usage_string); + return this; + } + /// Set usage. + App *usage(std::function<std::string()> usage_function) { + usage_callback_ = std::move(usage_function); + return this; + } /// Set footer. App *footer(std::string footer_string) { footer_ = std::move(footer_string); @@ -1050,6 +1081,11 @@ class App { /// Get the group of this subcommand CLI11_NODISCARD const std::string &get_group() const { return group_; } + /// Generate and return the usage. + CLI11_NODISCARD std::string get_usage() const { + return (usage_callback_) ? usage_callback_() + '\n' + usage_ : usage_; + } + /// Generate and return the footer. CLI11_NODISCARD std::string get_footer() const { return (footer_callback_) ? footer_callback_() + '\n' + footer_ : footer_; @@ -1259,8 +1295,9 @@ class App { bool _parse_subcommand(std::vector<std::string> &args); /// Parse a short (false) or long (true) argument, must be at the top of the list + /// if local_processing_only is set to true then fallthrough is disabled will return false if not found /// return true if the argument was processed or false if nothing was done - bool _parse_arg(std::vector<std::string> &args, detail::Classifier current_type); + bool _parse_arg(std::vector<std::string> &args, detail::Classifier current_type, bool local_processing_only); /// Trigger the pre_parse callback if needed void _trigger_pre_parse(std::size_t remaining_args); @@ -1352,16 +1389,6 @@ CLI11_INLINE void retire_option(App *app, const std::string &option_name); /// Helper function to mark an option as retired CLI11_INLINE void retire_option(App &app, const std::string &option_name); -namespace FailureMessage { - -/// Printout a clean, simple message on error (the default in CLI11 1.5+) -CLI11_INLINE std::string simple(const App *app, const Error &e); - -/// Printout the full help string on error (if this fn is set, the old default for CLI11) -CLI11_INLINE std::string help(const App *app, const Error &e); - -} // namespace FailureMessage - namespace detail { /// This class is simply to allow tests access to App's protected functions struct AppFriend { diff --git a/packages/CLI11/include/CLI/Argv.hpp b/packages/CLI11/include/CLI/Argv.hpp new file mode 100644 index 0000000000000000000000000000000000000000..35d81a6eaf3d888ccd245469bce2386800053b95 --- /dev/null +++ b/packages/CLI11/include/CLI/Argv.hpp @@ -0,0 +1,25 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +#include <CLI/Macros.hpp> + +namespace CLI { +// [CLI11:argv_hpp:verbatim] + +/// argc as passed in to this executable. +CLI11_INLINE int argc(); + +/// argv as passed in to this executable, converted to utf-8 on Windows. +CLI11_INLINE const char *const *argv(); + +// [CLI11:argv_hpp:end] +} // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/Argv_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/CLI.hpp b/packages/CLI11/include/CLI/CLI.hpp index 0b6c3448a450497948a480ebf18200f792098874..fa9d4bb5394e6a88f146ffde82b01bcfc2e26f75 100644 --- a/packages/CLI11/include/CLI/CLI.hpp +++ b/packages/CLI11/include/CLI/CLI.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -13,6 +13,10 @@ #include "Macros.hpp" +#include "Encoding.hpp" + +#include "Argv.hpp" + #include "StringTools.hpp" #include "Error.hpp" diff --git a/packages/CLI11/include/CLI/Config.hpp b/packages/CLI11/include/CLI/Config.hpp index 685981c2fbd9eb62356a242780ae29a4e3c7804e..a91f0da6e8d371d6002066020df9f396260f32dd 100644 --- a/packages/CLI11/include/CLI/Config.hpp +++ b/packages/CLI11/include/CLI/Config.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -14,7 +14,7 @@ #include <string> #include <utility> #include <vector> -// [CLI11:public_includes:set] +// [CLI11:public_includes:end] #include "App.hpp" #include "ConfigFwd.hpp" diff --git a/packages/CLI11/include/CLI/ConfigFwd.hpp b/packages/CLI11/include/CLI/ConfigFwd.hpp index 44454b41a0ec9ba07a3410c6fbf035f5b32c3e51..a9ae2176a953c40cd0f41cc5eb85c408f6174721 100644 --- a/packages/CLI11/include/CLI/ConfigFwd.hpp +++ b/packages/CLI11/include/CLI/ConfigFwd.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -61,7 +61,7 @@ class Config { if(item.inputs.empty()) { return "{}"; } - throw ConversionError::TooManyInputsFlag(item.fullname()); + throw ConversionError::TooManyInputsFlag(item.fullname()); // LCOV_EXCL_LINE } /// Parse a config file, throw an error (ParseError:ConfigParseError or FileError) on failure diff --git a/packages/CLI11/include/CLI/Encoding.hpp b/packages/CLI11/include/CLI/Encoding.hpp new file mode 100644 index 0000000000000000000000000000000000000000..379e33b20ce9e4ae58b49f15ce1f06eee4427107 --- /dev/null +++ b/packages/CLI11/include/CLI/Encoding.hpp @@ -0,0 +1,54 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +#include <CLI/Macros.hpp> + +// [CLI11:public_includes:set] +#include <string> +// [CLI11:public_includes:end] + +// [CLI11:encoding_includes:verbatim] +#ifdef CLI11_CPP17 +#include <string_view> +#endif // CLI11_CPP17 + +#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 +#include <filesystem> +#include <string_view> // NOLINT(build/include) +#endif // CLI11_HAS_FILESYSTEM +// [CLI11:encoding_includes:end] + +namespace CLI { +// [CLI11:encoding_hpp:verbatim] + +/// Convert a wide string to a narrow string. +CLI11_INLINE std::string narrow(const std::wstring &str); +CLI11_INLINE std::string narrow(const wchar_t *str); +CLI11_INLINE std::string narrow(const wchar_t *str, std::size_t size); + +/// Convert a narrow string to a wide string. +CLI11_INLINE std::wstring widen(const std::string &str); +CLI11_INLINE std::wstring widen(const char *str); +CLI11_INLINE std::wstring widen(const char *str, std::size_t size); + +#ifdef CLI11_CPP17 +CLI11_INLINE std::string narrow(std::wstring_view str); +CLI11_INLINE std::wstring widen(std::string_view str); +#endif // CLI11_CPP17 + +#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 +/// Convert a char-string to a native path correctly. +CLI11_INLINE std::filesystem::path to_path(std::string_view str); +#endif // CLI11_HAS_FILESYSTEM + +// [CLI11:encoding_hpp:end] +} // namespace CLI + +#ifndef CLI11_COMPILE +#include "impl/Encoding_inl.hpp" +#endif diff --git a/packages/CLI11/include/CLI/Error.hpp b/packages/CLI11/include/CLI/Error.hpp index 45df83bb60264209ed1dbc043f99948db71804df..0900da53ce374d07fa1cceaa23a55bf4e19b2875 100644 --- a/packages/CLI11/include/CLI/Error.hpp +++ b/packages/CLI11/include/CLI/Error.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/Formatter.hpp b/packages/CLI11/include/CLI/Formatter.hpp index c1eceac1224bdefbbe2d20418e7cfbbec585b9d4..f58058f27add2842b57d776b54e91b7ea930e62a 100644 --- a/packages/CLI11/include/CLI/Formatter.hpp +++ b/packages/CLI11/include/CLI/Formatter.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/FormatterFwd.hpp b/packages/CLI11/include/CLI/FormatterFwd.hpp index 792ebbc888dba07f2f36a2f19aa8461d597a7ad7..5ef0a5b585e377554c036ea5e7f41994e476105a 100644 --- a/packages/CLI11/include/CLI/FormatterFwd.hpp +++ b/packages/CLI11/include/CLI/FormatterFwd.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -57,6 +57,8 @@ class FormatterBase { FormatterBase() = default; FormatterBase(const FormatterBase &) = default; FormatterBase(FormatterBase &&) = default; + FormatterBase &operator=(const FormatterBase &) = default; + FormatterBase &operator=(FormatterBase &&) = default; /// Adding a destructor in this form to work around bug in GCC 4.7 virtual ~FormatterBase() noexcept {} // NOLINT(modernize-use-equals-default) @@ -118,6 +120,8 @@ class Formatter : public FormatterBase { Formatter() = default; Formatter(const Formatter &) = default; Formatter(Formatter &&) = default; + Formatter &operator=(const Formatter &) = default; + Formatter &operator=(Formatter &&) = default; /// @name Overridables ///@{ diff --git a/packages/CLI11/include/CLI/Macros.hpp b/packages/CLI11/include/CLI/Macros.hpp index 690670619a2d8ef56f21740d12f4506c4718183c..c7ac94e8741370f3a1633dfcf8568af8ac8339d8 100644 --- a/packages/CLI11/include/CLI/Macros.hpp +++ b/packages/CLI11/include/CLI/Macros.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -66,6 +66,62 @@ #endif #endif +/** <filesystem> availability */ +#if defined CLI11_CPP17 && defined __has_include && !defined CLI11_HAS_FILESYSTEM +#if __has_include(<filesystem>) +// Filesystem cannot be used if targeting macOS < 10.15 +#if defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 +#define CLI11_HAS_FILESYSTEM 0 +#elif defined(__wasi__) +// As of wasi-sdk-14, filesystem is not implemented +#define CLI11_HAS_FILESYSTEM 0 +#else +#include <filesystem> +#if defined __cpp_lib_filesystem && __cpp_lib_filesystem >= 201703 +#if defined _GLIBCXX_RELEASE && _GLIBCXX_RELEASE >= 9 +#define CLI11_HAS_FILESYSTEM 1 +#elif defined(__GLIBCXX__) +// if we are using gcc and Version <9 default to no filesystem +#define CLI11_HAS_FILESYSTEM 0 +#else +#define CLI11_HAS_FILESYSTEM 1 +#endif +#else +#define CLI11_HAS_FILESYSTEM 0 +#endif +#endif +#endif +#endif + +/** <codecvt> availability */ +#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && __GNUC__ < 5 +#define CLI11_HAS_CODECVT 0 +#else +#define CLI11_HAS_CODECVT 1 +#include <codecvt> +#endif + +/** disable deprecations */ +#if defined(__GNUC__) // GCC or clang +#define CLI11_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") +#define CLI11_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") + +#define CLI11_DIAGNOSTIC_IGNORE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") + +#elif defined(_MSC_VER) +#define CLI11_DIAGNOSTIC_PUSH __pragma(warning(push)) +#define CLI11_DIAGNOSTIC_POP __pragma(warning(pop)) + +#define CLI11_DIAGNOSTIC_IGNORE_DEPRECATED __pragma(warning(disable : 4996)) + +#else +#define CLI11_DIAGNOSTIC_PUSH +#define CLI11_DIAGNOSTIC_POP + +#define CLI11_DIAGNOSTIC_IGNORE_DEPRECATED + +#endif + /** Inline macro **/ #ifdef CLI11_COMPILE #define CLI11_INLINE diff --git a/packages/CLI11/include/CLI/Option.hpp b/packages/CLI11/include/CLI/Option.hpp index 458d9ffcbbc2d74a58d65a3a9e61e129d5b1606a..d32350738e34031a14c3be68e59d75a09b20831b 100644 --- a/packages/CLI11/include/CLI/Option.hpp +++ b/packages/CLI11/include/CLI/Option.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/Split.hpp b/packages/CLI11/include/CLI/Split.hpp index 14be822893b010b76f80ce1b2eb5b89e1596197a..d00e7f8cbe6b5bd5f0c395de7b96164e575e20e1 100644 --- a/packages/CLI11/include/CLI/Split.hpp +++ b/packages/CLI11/include/CLI/Split.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/StringTools.hpp b/packages/CLI11/include/CLI/StringTools.hpp index a891b1279d8d6fc0a3cd61501dd21b6874483efc..2a31005c858a00a71f489cf4c485d7805cb410cb 100644 --- a/packages/CLI11/include/CLI/StringTools.hpp +++ b/packages/CLI11/include/CLI/StringTools.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/Timer.hpp b/packages/CLI11/include/CLI/Timer.hpp index c6898204e203bf1e860ab07e164849a2b60ba9f2..b185d3302a7ef82703bc642a635f5224c6dcdf6d 100644 --- a/packages/CLI11/include/CLI/Timer.hpp +++ b/packages/CLI11/include/CLI/Timer.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/TypeTools.hpp b/packages/CLI11/include/CLI/TypeTools.hpp index e3c97b17e9990bdc539f39e659807f4886a87f48..9d43ea3614011db9e59f9827676b5a34ed976294 100644 --- a/packages/CLI11/include/CLI/TypeTools.hpp +++ b/packages/CLI11/include/CLI/TypeTools.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -7,6 +7,7 @@ #pragma once // [CLI11:public_includes:set] +#include <cmath> #include <cstdint> #include <exception> #include <limits> @@ -17,6 +18,7 @@ #include <vector> // [CLI11:public_includes:end] +#include "Encoding.hpp" #include "StringTools.hpp" namespace CLI { @@ -42,7 +44,9 @@ constexpr enabler dummy = {}; template <bool B, class T = void> using enable_if_t = typename std::enable_if<B, T>::type; /// A copy of std::void_t from C++17 (helper for C++11 and C++14) -template <typename... Ts> struct make_void { using type = void; }; +template <typename... Ts> struct make_void { + using type = void; +}; /// A copy of std::void_t from C++17 - same reasoning as enable_if_t, it does not hurt to redefine template <typename... Ts> using void_t = typename make_void<Ts...>::type; @@ -71,10 +75,14 @@ template <typename T> struct is_copyable_ptr { }; /// This can be specialized to override the type deduction for IsMember. -template <typename T> struct IsMemberType { using type = T; }; +template <typename T> struct IsMemberType { + using type = T; +}; /// The main custom type needed here is const char * should be a string. -template <> struct IsMemberType<const char *> { using type = std::string; }; +template <> struct IsMemberType<const char *> { + using type = std::string; +}; namespace detail { @@ -84,7 +92,9 @@ namespace detail { /// pointer_traits<T> be valid. /// not a pointer -template <typename T, typename Enable = void> struct element_type { using type = T; }; +template <typename T, typename Enable = void> struct element_type { + using type = T; +}; template <typename T> struct element_type<T, typename std::enable_if<is_copyable_ptr<T>::value>::type> { using type = typename std::pointer_traits<T>::element_type; @@ -92,7 +102,9 @@ template <typename T> struct element_type<T, typename std::enable_if<is_copyable /// Combination of the element type and value type - remove pointer (including smart pointers) and get the value_type of /// the container -template <typename T> struct element_value_type { using type = typename element_type<T>::type::value_type; }; +template <typename T> struct element_value_type { + using type = typename element_type<T>::type::value_type; +}; /// Adaptor for set-like structure: This just wraps a normal container in a few utilities that do almost nothing. template <typename T, typename _ = void> struct pair_adaptor : std::false_type { @@ -147,11 +159,19 @@ template <typename T, typename C> class is_direct_constructible { static auto test(int, std::true_type) -> decltype( // NVCC warns about narrowing conversions here #ifdef __CUDACC__ +#ifdef __NVCC_DIAG_PRAGMA_SUPPORT__ +#pragma nv_diag_suppress 2361 +#else #pragma diag_suppress 2361 +#endif #endif TT{std::declval<CC>()} #ifdef __CUDACC__ +#ifdef __NVCC_DIAG_PRAGMA_SUPPORT__ +#pragma nv_diag_default 2361 +#else #pragma diag_default 2361 +#endif #endif , std::is_move_assignable<TT>()); @@ -231,8 +251,10 @@ struct is_mutable_container< decltype(std::declval<T>().clear()), decltype(std::declval<T>().insert(std::declval<decltype(std::declval<T>().end())>(), std::declval<const typename T::value_type &>()))>, - void>> - : public conditional_t<std::is_constructible<T, std::string>::value, std::false_type, std::true_type> {}; + void>> : public conditional_t<std::is_constructible<T, std::string>::value || + std::is_constructible<T, std::wstring>::value, + std::false_type, + std::true_type> {}; // check to see if an object is a mutable container (fail by default) template <typename T, typename _ = void> struct is_readable_container : std::false_type {}; @@ -353,7 +375,9 @@ auto value_string(const T &value) -> decltype(to_string(value)) { } /// template to get the underlying value type if it exists or use a default -template <typename T, typename def, typename Enable = void> struct wrapped_type { using type = def; }; +template <typename T, typename def, typename Enable = void> struct wrapped_type { + using type = def; +}; /// Type size for regular object types that do not look like a tuple template <typename T, typename def> struct wrapped_type<T, def, typename std::enable_if<is_wrapper<T>::value>::type> { @@ -361,7 +385,9 @@ template <typename T, typename def> struct wrapped_type<T, def, typename std::en }; /// This will only trigger for actual void type -template <typename T, typename Enable = void> struct type_count_base { static const int value{0}; }; +template <typename T, typename Enable = void> struct type_count_base { + static const int value{0}; +}; /// Type size for regular object types that do not look like a tuple template <typename T> @@ -391,7 +417,9 @@ template <typename T> struct subtype_count; template <typename T> struct subtype_count_min; /// This will only trigger for actual void type -template <typename T, typename Enable = void> struct type_count { static const int value{0}; }; +template <typename T, typename Enable = void> struct type_count { + static const int value{0}; +}; /// Type size for regular object types that do not look like a tuple template <typename T> @@ -442,7 +470,9 @@ template <typename T> struct subtype_count { }; /// This will only trigger for actual void type -template <typename T, typename Enable = void> struct type_count_min { static const int value{0}; }; +template <typename T, typename Enable = void> struct type_count_min { + static const int value{0}; +}; /// Type size for regular object types that do not look like a tuple template <typename T> @@ -491,7 +521,9 @@ template <typename T> struct subtype_count_min { }; /// This will only trigger for actual void type -template <typename T, typename Enable = void> struct expected_count { static const int value{0}; }; +template <typename T, typename Enable = void> struct expected_count { + static const int value{0}; +}; /// For most types the number of expected items is 1 template <typename T> @@ -525,6 +557,8 @@ enum class object_category : int { // string like types string_assignable = 23, string_constructible = 24, + wstring_assignable = 25, + wstring_constructible = 26, other = 45, // special wrapper or container types wrapper_value = 50, @@ -592,6 +626,27 @@ struct classify_object< static constexpr object_category value{object_category::string_constructible}; }; +/// Wide strings +template <typename T> +struct classify_object<T, + typename std::enable_if<!std::is_floating_point<T>::value && !std::is_integral<T>::value && + !std::is_assignable<T &, std::string>::value && + !std::is_constructible<T, std::string>::value && + std::is_assignable<T &, std::wstring>::value>::type> { + static constexpr object_category value{object_category::wstring_assignable}; +}; + +template <typename T> +struct classify_object< + T, + typename std::enable_if<!std::is_floating_point<T>::value && !std::is_integral<T>::value && + !std::is_assignable<T &, std::string>::value && + !std::is_constructible<T, std::string>::value && + !std::is_assignable<T &, std::wstring>::value && (type_count<T>::value == 1) && + std::is_constructible<T, std::wstring>::value>::type> { + static constexpr object_category value{object_category::wstring_constructible}; +}; + /// Enumerations template <typename T> struct classify_object<T, typename std::enable_if<std::is_enum<T>::value>::type> { static constexpr object_category value{object_category::enumeration}; @@ -604,12 +659,13 @@ template <typename T> struct classify_object<T, typename std::enable_if<is_compl /// Handy helper to contain a bunch of checks that rule out many common types (integers, string like, floating point, /// vectors, and enumerations template <typename T> struct uncommon_type { - using type = typename std::conditional<!std::is_floating_point<T>::value && !std::is_integral<T>::value && - !std::is_assignable<T &, std::string>::value && - !std::is_constructible<T, std::string>::value && !is_complex<T>::value && - !is_mutable_container<T>::value && !std::is_enum<T>::value, - std::true_type, - std::false_type>::type; + using type = typename std::conditional< + !std::is_floating_point<T>::value && !std::is_integral<T>::value && + !std::is_assignable<T &, std::string>::value && !std::is_constructible<T, std::string>::value && + !std::is_assignable<T &, std::wstring>::value && !std::is_constructible<T, std::wstring>::value && + !is_complex<T>::value && !is_mutable_container<T>::value && !std::is_enum<T>::value, + std::true_type, + std::false_type>::type; static constexpr bool value = type::value; }; @@ -655,7 +711,8 @@ struct classify_object< typename std::enable_if<is_tuple_like<T>::value && ((type_count<T>::value >= 2 && !is_wrapper<T>::value) || (uncommon_type<T>::value && !is_direct_constructible<T, double>::value && - !is_direct_constructible<T, int>::value))>::type> { + !is_direct_constructible<T, int>::value) || + (uncommon_type<T>::value && type_count<T>::value >= 2))>::type> { static constexpr object_category value{object_category::tuple_value}; // the condition on this class requires it be like a tuple, but on some compilers (like Xcode) tuples can be // constructed from just the first element so tuples of <string, int,int> can be constructed from a string, which @@ -794,11 +851,15 @@ inline std::string type_name() { /// Convert to an unsigned integral template <typename T, enable_if_t<std::is_unsigned<T>::value, detail::enabler> = detail::dummy> bool integral_conversion(const std::string &input, T &output) noexcept { - if(input.empty()) { + if(input.empty() || input.front() == '-') { return false; } char *val = nullptr; + errno = 0; std::uint64_t output_ll = std::strtoull(input.c_str(), &val, 0); + if(errno == ERANGE) { + return false; + } output = static_cast<T>(output_ll); if(val == (input.c_str() + input.size()) && static_cast<std::uint64_t>(output) == output_ll) { return true; @@ -819,7 +880,11 @@ bool integral_conversion(const std::string &input, T &output) noexcept { return false; } char *val = nullptr; + errno = 0; std::int64_t output_ll = std::strtoll(input.c_str(), &val, 0); + if(errno == ERANGE) { + return false; + } output = static_cast<T>(output_ll); if(val == (input.c_str() + input.size()) && static_cast<std::int64_t>(output) == output_ll) { return true; @@ -936,18 +1001,18 @@ bool lexical_cast(const std::string &input, T &output) { bool worked = false; auto nloc = str1.find_last_of("+-"); if(nloc != std::string::npos && nloc > 0) { - worked = detail::lexical_cast(str1.substr(0, nloc), x); + worked = lexical_cast(str1.substr(0, nloc), x); str1 = str1.substr(nloc); if(str1.back() == 'i' || str1.back() == 'j') str1.pop_back(); - worked = worked && detail::lexical_cast(str1, y); + worked = worked && lexical_cast(str1, y); } else { if(str1.back() == 'i' || str1.back() == 'j') { str1.pop_back(); - worked = detail::lexical_cast(str1, y); + worked = lexical_cast(str1, y); x = XC{0}; } else { - worked = detail::lexical_cast(str1, x); + worked = lexical_cast(str1, x); y = XC{0}; } } @@ -975,6 +1040,23 @@ bool lexical_cast(const std::string &input, T &output) { return true; } +/// Wide strings +template < + typename T, + enable_if_t<classify_object<T>::value == object_category::wstring_assignable, detail::enabler> = detail::dummy> +bool lexical_cast(const std::string &input, T &output) { + output = widen(input); + return true; +} + +template < + typename T, + enable_if_t<classify_object<T>::value == object_category::wstring_constructible, detail::enabler> = detail::dummy> +bool lexical_cast(const std::string &input, T &output) { + output = T{widen(input)}; + return true; +} + /// Enumerations template <typename T, enable_if_t<classify_object<T>::value == object_category::enumeration, detail::enabler> = detail::dummy> @@ -1103,7 +1185,9 @@ template <typename AssignTo, typename ConvertTo, enable_if_t<std::is_same<AssignTo, ConvertTo>::value && (classify_object<AssignTo>::value == object_category::string_assignable || - classify_object<AssignTo>::value == object_category::string_constructible), + classify_object<AssignTo>::value == object_category::string_constructible || + classify_object<AssignTo>::value == object_category::wstring_assignable || + classify_object<AssignTo>::value == object_category::wstring_constructible), detail::enabler> = detail::dummy> bool lexical_assign(const std::string &input, AssignTo &output) { return lexical_cast(input, output); @@ -1114,7 +1198,9 @@ template <typename AssignTo, typename ConvertTo, enable_if_t<std::is_same<AssignTo, ConvertTo>::value && std::is_assignable<AssignTo &, AssignTo>::value && classify_object<AssignTo>::value != object_category::string_assignable && - classify_object<AssignTo>::value != object_category::string_constructible, + classify_object<AssignTo>::value != object_category::string_constructible && + classify_object<AssignTo>::value != object_category::wstring_assignable && + classify_object<AssignTo>::value != object_category::wstring_constructible, detail::enabler> = detail::dummy> bool lexical_assign(const std::string &input, AssignTo &output) { if(input.empty()) { @@ -1153,9 +1239,17 @@ bool lexical_assign(const std::string &input, AssignTo &output) { output = 0; return true; } - int val = 0; + int val{0}; if(lexical_cast(input, val)) { +#if defined(__clang__) +/* on some older clang compilers */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-conversion" +#endif output = val; +#if defined(__clang__) +#pragma clang diagnostic pop +#endif return true; } return false; @@ -1168,7 +1262,7 @@ template <typename AssignTo, detail::enabler> = detail::dummy> bool lexical_assign(const std::string &input, AssignTo &output) { ConvertTo val{}; - bool parse_result = (!input.empty()) ? lexical_cast<ConvertTo>(input, val) : true; + bool parse_result = (!input.empty()) ? lexical_cast(input, val) : true; if(parse_result) { output = val; } @@ -1184,7 +1278,7 @@ template < detail::enabler> = detail::dummy> bool lexical_assign(const std::string &input, AssignTo &output) { ConvertTo val{}; - bool parse_result = input.empty() ? true : lexical_cast<ConvertTo>(input, val); + bool parse_result = input.empty() ? true : lexical_cast(input, val); if(parse_result) { output = AssignTo(val); // use () form of constructor to allow some implicit conversions } @@ -1210,11 +1304,13 @@ template <typename AssignTo, detail::enabler> = detail::dummy> bool lexical_conversion(const std::vector<std ::string> &strings, AssignTo &output) { // the remove const is to handle pair types coming from a container - typename std::remove_const<typename std::tuple_element<0, ConvertTo>::type>::type v1; - typename std::tuple_element<1, ConvertTo>::type v2; - bool retval = lexical_assign<decltype(v1), decltype(v1)>(strings[0], v1); + using FirstType = typename std::remove_const<typename std::tuple_element<0, ConvertTo>::type>::type; + using SecondType = typename std::tuple_element<1, ConvertTo>::type; + FirstType v1; + SecondType v2; + bool retval = lexical_assign<FirstType, FirstType>(strings[0], v1); if(strings.size() > 1) { - retval = retval && lexical_assign<decltype(v2), decltype(v2)>(strings[1], v2); + retval = retval && lexical_assign<SecondType, SecondType>(strings[1], v2); } if(retval) { output = AssignTo{v1, v2}; @@ -1262,7 +1358,7 @@ bool lexical_conversion(const std::vector<std::string> &strings, AssignTo &outpu if(str1.back() == 'i' || str1.back() == 'j') { str1.pop_back(); } - auto worked = detail::lexical_cast(strings[0], x) && detail::lexical_cast(str1, y); + auto worked = lexical_cast(strings[0], x) && lexical_cast(str1, y); if(worked) { output = ConvertTo{x, y}; } @@ -1374,7 +1470,7 @@ tuple_type_conversion(std::vector<std::string> &strings, AssignTo &output) { std::size_t index{subtype_count_min<ConvertTo>::value}; const std::size_t mx_count{subtype_count<ConvertTo>::value}; - const std::size_t mx{(std::max)(mx_count, strings.size())}; + const std::size_t mx{(std::min)(mx_count, strings.size() - 1)}; while(index < mx) { if(is_separator(strings[index])) { @@ -1384,7 +1480,11 @@ tuple_type_conversion(std::vector<std::string> &strings, AssignTo &output) { } bool retval = lexical_conversion<AssignTo, ConvertTo>( std::vector<std::string>(strings.begin(), strings.begin() + static_cast<std::ptrdiff_t>(index)), output); - strings.erase(strings.begin(), strings.begin() + static_cast<std::ptrdiff_t>(index) + 1); + if(strings.size() > index) { + strings.erase(strings.begin(), strings.begin() + static_cast<std::ptrdiff_t>(index) + 1); + } else { + strings.clear(); + } return retval; } @@ -1526,7 +1626,7 @@ inline std::string sum_string_vector(const std::vector<std::string> &values) { std::string output; for(const auto &arg : values) { double tv{0.0}; - auto comp = detail::lexical_cast<double>(arg, tv); + auto comp = lexical_cast(arg, tv); if(!comp) { try { tv = static_cast<double>(detail::to_flag_value(arg)); @@ -1544,8 +1644,7 @@ inline std::string sum_string_vector(const std::vector<std::string> &values) { } else { if(val <= static_cast<double>((std::numeric_limits<std::int64_t>::min)()) || val >= static_cast<double>((std::numeric_limits<std::int64_t>::max)()) || - // NOLINTNEXTLINE(clang-diagnostic-float-equal,bugprone-narrowing-conversions) - val == static_cast<std::int64_t>(val)) { + std::ceil(val) == std::floor(val)) { output = detail::value_string(static_cast<int64_t>(val)); } else { output = detail::value_string(val); diff --git a/packages/CLI11/include/CLI/Validators.hpp b/packages/CLI11/include/CLI/Validators.hpp index 9a6a364e35225fcfcd98d4a9db66da57c859e7a7..59d800de860e70b98005038038d77729cc895d33 100644 --- a/packages/CLI11/include/CLI/Validators.hpp +++ b/packages/CLI11/include/CLI/Validators.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -26,34 +26,6 @@ // [CLI11:validators_hpp_filesystem:verbatim] -// C standard library -// Only needed for existence checking -#if defined CLI11_CPP17 && defined __has_include && !defined CLI11_HAS_FILESYSTEM -#if __has_include(<filesystem>) -// Filesystem cannot be used if targeting macOS < 10.15 -#if defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 -#define CLI11_HAS_FILESYSTEM 0 -#elif defined(__wasi__) -// As of wasi-sdk-14, filesystem is not implemented -#define CLI11_HAS_FILESYSTEM 0 -#else -#include <filesystem> -#if defined __cpp_lib_filesystem && __cpp_lib_filesystem >= 201703 -#if defined _GLIBCXX_RELEASE && _GLIBCXX_RELEASE >= 9 -#define CLI11_HAS_FILESYSTEM 1 -#elif defined(__GLIBCXX__) -// if we are using gcc and Version <9 default to no filesystem -#define CLI11_HAS_FILESYSTEM 0 -#else -#define CLI11_HAS_FILESYSTEM 1 -#endif -#else -#define CLI11_HAS_FILESYSTEM 0 -#endif -#endif -#endif -#endif - #if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 #include <filesystem> // NOLINT(build/include) #else @@ -270,8 +242,9 @@ template <typename DesiredType> class TypeValidator : public Validator { public: explicit TypeValidator(const std::string &validator_name) : Validator(validator_name, [](std::string &input_string) { + using CLI::detail::lexical_cast; auto val = DesiredType(); - if(!detail::lexical_cast(input_string, val)) { + if(!lexical_cast(input_string, val)) { return std::string("Failed parsing ") + input_string + " as a " + detail::type_name<DesiredType>(); } return std::string(); @@ -305,8 +278,9 @@ class Range : public Validator { } func_ = [min_val, max_val](std::string &input) { + using CLI::detail::lexical_cast; T val; - bool converted = detail::lexical_cast(input, val); + bool converted = lexical_cast(input, val); if((!converted) || (val < min_val || val > max_val)) { std::stringstream out; out << "Value " << input << " not in range ["; @@ -342,8 +316,9 @@ class Bound : public Validator { description(out.str()); func_ = [min_val, max_val](std::string &input) { + using CLI::detail::lexical_cast; T val; - bool converted = detail::lexical_cast(input, val); + bool converted = lexical_cast(input, val); if(!converted) { return std::string("Value ") + input + " could not be converted"; } @@ -534,8 +509,9 @@ class IsMember : public Validator { // This is the function that validates // It stores a copy of the set pointer-like, so shared_ptr will stay alive func_ = [set, filter_fn](std::string &input) { + using CLI::detail::lexical_cast; local_item_t b; - if(!detail::lexical_cast(input, b)) { + if(!lexical_cast(input, b)) { throw ValidationError(input); // name is added later } if(filter_fn) { @@ -602,8 +578,9 @@ class Transformer : public Validator { desc_function_ = [mapping]() { return detail::generate_map(detail::smart_deref(mapping)); }; func_ = [mapping, filter_fn](std::string &input) { + using CLI::detail::lexical_cast; local_item_t b; - if(!detail::lexical_cast(input, b)) { + if(!lexical_cast(input, b)) { return std::string(); // there is no possible way we can match anything in the mapping if we can't convert so just return } @@ -671,8 +648,9 @@ class CheckedTransformer : public Validator { desc_function_ = tfunc; func_ = [mapping, tfunc, filter_fn](std::string &input) { + using CLI::detail::lexical_cast; local_item_t b; - bool converted = detail::lexical_cast(input, b); + bool converted = lexical_cast(input, b); if(converted) { if(filter_fn) { b = filter_fn(b); @@ -750,7 +728,7 @@ class AsNumberWithUnit : public Validator { // transform function func_ = [mapping, opts](std::string &input) -> std::string { - Number num; + Number num{}; detail::rtrim(input); if(input.empty()) { @@ -774,7 +752,8 @@ class AsNumberWithUnit : public Validator { unit = detail::to_lower(unit); } if(unit.empty()) { - if(!detail::lexical_cast(input, num)) { + using CLI::detail::lexical_cast; + if(!lexical_cast(input, num)) { throw ValidationError(std::string("Value ") + input + " could not be converted to " + detail::type_name<Number>()); } @@ -792,7 +771,8 @@ class AsNumberWithUnit : public Validator { } if(!input.empty()) { - bool converted = detail::lexical_cast(input, num); + using CLI::detail::lexical_cast; + bool converted = lexical_cast(input, num); if(!converted) { throw ValidationError(std::string("Value ") + input + " could not be converted to " + detail::type_name<Number>()); diff --git a/packages/CLI11/include/CLI/Version.hpp b/packages/CLI11/include/CLI/Version.hpp index b03141b82829ef47539bd048bccfee71a70a9ae3..d5c817a9c3d84c2b17d40e3d61e20d57e2697bf4 100644 --- a/packages/CLI11/include/CLI/Version.hpp +++ b/packages/CLI11/include/CLI/Version.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -9,8 +9,8 @@ // [CLI11:version_hpp:verbatim] #define CLI11_VERSION_MAJOR 2 -#define CLI11_VERSION_MINOR 2 -#define CLI11_VERSION_PATCH 0 -#define CLI11_VERSION "2.2.0" +#define CLI11_VERSION_MINOR 3 +#define CLI11_VERSION_PATCH 2 +#define CLI11_VERSION "2.3.2" // [CLI11:version_hpp:end] diff --git a/packages/CLI11/include/CLI/impl/App_inl.hpp b/packages/CLI11/include/CLI/impl/App_inl.hpp index bbda621df0a5bf9f6f34c8a8e7a452e789ac6ad7..7d487442f924d56758e68d8d88eae1767a26daf0 100644 --- a/packages/CLI11/include/CLI/impl/App_inl.hpp +++ b/packages/CLI11/include/CLI/impl/App_inl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -9,6 +9,9 @@ // This include is only needed for IDEs to discover symbols #include <CLI/App.hpp> +#include <CLI/Argv.hpp> +#include <CLI/Encoding.hpp> + // [CLI11:public_includes:set] #include <algorithm> #include <memory> @@ -46,6 +49,7 @@ CLI11_INLINE App::App(std::string app_description, std::string app_name, App *pa configurable_ = parent_->configurable_; allow_windows_style_options_ = parent_->allow_windows_style_options_; group_ = parent_->group_; + usage_ = parent_->usage_; footer_ = parent_->footer_; formatter_ = parent_->formatter_; config_formatter_ = parent_->config_formatter_; @@ -265,8 +269,9 @@ CLI11_INLINE Option *App::add_flag_callback(std::string flag_name, std::string flag_description) { CLI::callback_t fun = [function](const CLI::results_t &res) { + using CLI::detail::lexical_cast; bool trigger{false}; - auto result = CLI::detail::lexical_cast(res[0], trigger); + auto result = lexical_cast(res[0], trigger); if(result && trigger) { function(); } @@ -281,8 +286,9 @@ App::add_flag_function(std::string flag_name, std::string flag_description) { CLI::callback_t fun = [function](const CLI::results_t &res) { + using CLI::detail::lexical_cast; std::int64_t flag_count{0}; - CLI::detail::lexical_cast(res[0], flag_count); + lexical_cast(res[0], flag_count); function(flag_count); return true; }; @@ -433,6 +439,15 @@ CLI11_NODISCARD CLI11_INLINE CLI::App_p App::get_subcommand_ptr(int index) const throw OptionNotFound(std::to_string(index)); } +CLI11_NODISCARD CLI11_INLINE CLI::App *App::get_option_group(std::string group_name) const { + for(const App_p &app : subcommands_) { + if(app->name_.empty() && app->group_ == group_name) { + return app.get(); + } + } + throw OptionNotFound(group_name); +} + CLI11_NODISCARD CLI11_INLINE std::size_t App::count_all() const { std::size_t cnt{0}; for(const auto &opt : options_) { @@ -462,17 +477,31 @@ CLI11_INLINE void App::clear() { } } -CLI11_INLINE void App::parse(int argc, const char *const *argv) { +CLI11_INLINE void App::parse() { parse(argc(), argv()); } // LCOV_EXCL_LINE + +CLI11_INLINE void App::parse(int argc, const char *const *argv) { parse_char_t(argc, argv); } +CLI11_INLINE void App::parse(int argc, const wchar_t *const *argv) { parse_char_t(argc, argv); } + +namespace detail { + +// Do nothing or perform narrowing +CLI11_INLINE const char *maybe_narrow(const char *str) { return str; } +CLI11_INLINE std::string maybe_narrow(const wchar_t *str) { return narrow(str); } + +} // namespace detail + +template <class CharT> CLI11_INLINE void App::parse_char_t(int argc, const CharT *const *argv) { // If the name is not set, read from command line if(name_.empty() || has_automatic_name_) { has_automatic_name_ = true; - name_ = argv[0]; + name_ = detail::maybe_narrow(argv[0]); } std::vector<std::string> args; args.reserve(static_cast<std::size_t>(argc) - 1U); for(auto i = static_cast<std::size_t>(argc) - 1U; i > 0U; --i) - args.emplace_back(argv[i]); + args.emplace_back(detail::maybe_narrow(argv[i])); + parse(std::move(args)); } @@ -503,6 +532,10 @@ CLI11_INLINE void App::parse(std::string commandline, bool program_name_included parse(std::move(args)); } +CLI11_INLINE void App::parse(std::wstring commandline, bool program_name_included) { + parse(narrow(commandline), program_name_included); +} + CLI11_INLINE void App::parse(std::vector<std::string> &args) { // Clear if parsed if(parsed_ > 0) @@ -657,7 +690,7 @@ CLI11_NODISCARD CLI11_INLINE std::string App::help(std::string prev, AppFormatMo // Delegate to subcommand if needed auto selected_subcommands = get_subcommands(); if(!selected_subcommands.empty()) { - return selected_subcommands.at(0)->help(prev, mode); + return selected_subcommands.back()->help(prev, mode); } return formatter_->make_help(this, prev, mode); } @@ -964,6 +997,16 @@ CLI11_NODISCARD CLI11_INLINE detail::Classifier App::_recognize(const std::strin return detail::Classifier::WINDOWS_STYLE; if((current == "++") && !name_.empty() && parent_ != nullptr) return detail::Classifier::SUBCOMMAND_TERMINATOR; + auto dotloc = current.find_first_of('.'); + if(dotloc != std::string::npos) { + auto *cm = _find_subcommand(current.substr(0, dotloc), true, ignore_used_subcommands); + if(cm != nullptr) { + auto res = cm->_recognize(current.substr(dotloc + 1), ignore_used_subcommands); + if(res == detail::Classifier::SUBCOMMAND) { + return res; + } + } + } return detail::Classifier::NONE; } @@ -1371,6 +1414,9 @@ CLI11_INLINE bool App::_parse_single_config(const ConfigItem &item, std::size_t if(get_allow_config_extras() == config_extras_mode::capture) // Should we worry about classifying the extras properly? missing_.emplace_back(detail::Classifier::NONE, item.fullname()); + for(const auto &input : item.inputs) { + missing_.emplace_back(detail::Classifier::NONE, input); + } return false; } @@ -1384,16 +1430,38 @@ CLI11_INLINE bool App::_parse_single_config(const ConfigItem &item, std::size_t if(op->empty()) { if(op->get_expected_min() == 0) { - // Flag parsing - auto res = config_formatter_->to_flag(item); - res = op->get_flag_value(item.name, res); + if(item.inputs.size() <= 1) { + // Flag parsing + auto res = config_formatter_->to_flag(item); + bool converted{false}; + if(op->get_disable_flag_override()) { + + try { + auto val = detail::to_flag_value(res); + if(val == 1) { + res = op->get_flag_value(item.name, "{}"); + converted = true; + } + } catch(...) { + } + } - op->add_result(res); + if(!converted) { + res = op->get_flag_value(item.name, res); + } - } else { - op->add_result(item.inputs); - op->run_callback(); + op->add_result(res); + return true; + } + if(static_cast<int>(item.inputs.size()) > op->get_items_expected_max()) { + if(op->get_items_expected_max() > 1) { + throw ArgumentMismatch::AtMost(item.fullname(), op->get_items_expected_max(), item.inputs.size()); + } + throw ConversionError::TooManyInputsFlag(item.fullname()); + } } + op->add_result(item.inputs); + op->run_callback(); } return true; @@ -1424,7 +1492,7 @@ CLI11_INLINE bool App::_parse_single(std::vector<std::string> &args, bool &posit case detail::Classifier::SHORT: case detail::Classifier::WINDOWS_STYLE: // If already parsed a subcommand, don't accept options_ - _parse_arg(args, classifier); + _parse_arg(args, classifier, false); break; case detail::Classifier::NONE: // Probably a positional or something for a parent (sub)command @@ -1612,6 +1680,17 @@ CLI11_INLINE bool App::_parse_subcommand(std::vector<std::string> &args) { return true; } auto *com = _find_subcommand(args.back(), true, true); + if(com == nullptr) { + // the main way to get here is using .notation + auto dotloc = args.back().find_first_of('.'); + if(dotloc != std::string::npos) { + com = _find_subcommand(args.back().substr(0, dotloc), true, true); + if(com != nullptr) { + args.back() = args.back().substr(dotloc + 1); + args.push_back(com->get_display_name()); + } + } + } if(com != nullptr) { args.pop_back(); if(!com->silent_) { @@ -1634,7 +1713,8 @@ CLI11_INLINE bool App::_parse_subcommand(std::vector<std::string> &args) { return false; } -CLI11_INLINE bool App::_parse_arg(std::vector<std::string> &args, detail::Classifier current_type) { +CLI11_INLINE bool +App::_parse_arg(std::vector<std::string> &args, detail::Classifier current_type, bool local_processing_only) { std::string current = args.back(); @@ -1676,7 +1756,7 @@ CLI11_INLINE bool App::_parse_arg(std::vector<std::string> &args, detail::Classi if(op_ptr == std::end(options_)) { for(auto &subc : subcommands_) { if(subc->name_.empty() && !subc->disabled_) { - if(subc->_parse_arg(args, current_type)) { + if(subc->_parse_arg(args, current_type, local_processing_only)) { if(!subc->pre_parse_called_) { subc->_trigger_pre_parse(args.size()); } @@ -1690,9 +1770,57 @@ CLI11_INLINE bool App::_parse_arg(std::vector<std::string> &args, detail::Classi return false; } + // now check for '.' notation of subcommands + auto dotloc = arg_name.find_first_of('.', 1); + if(dotloc != std::string::npos) { + // using dot notation is equivalent to single argument subcommand + auto *sub = _find_subcommand(arg_name.substr(0, dotloc), true, false); + if(sub != nullptr) { + auto v = args.back(); + args.pop_back(); + arg_name = arg_name.substr(dotloc + 1); + if(arg_name.size() > 1) { + args.push_back(std::string("--") + v.substr(dotloc + 3)); + current_type = detail::Classifier::LONG; + } else { + auto nval = v.substr(dotloc + 2); + nval.front() = '-'; + if(nval.size() > 2) { + // '=' not allowed in short form arguments + args.push_back(nval.substr(3)); + nval.resize(2); + } + args.push_back(nval); + current_type = detail::Classifier::SHORT; + } + auto val = sub->_parse_arg(args, current_type, true); + if(val) { + if(!sub->silent_) { + parsed_subcommands_.push_back(sub); + } + // deal with preparsing + increment_parsed(); + _trigger_pre_parse(args.size()); + // run the parse complete callback since the subcommand processing is now complete + if(sub->parse_complete_callback_) { + sub->_process_env(); + sub->_process_callbacks(); + sub->_process_help_flags(); + sub->_process_requirements(); + sub->run_callback(false, true); + } + return true; + } + args.pop_back(); + args.push_back(v); + } + } + if(local_processing_only) { + return false; + } // If a subcommand, try the main command if(parent_ != nullptr && fallthrough_) - return _get_fallthrough_parent()->_parse_arg(args, current_type); + return _get_fallthrough_parent()->_parse_arg(args, current_type, false); // Otherwise, add to missing args.pop_back(); diff --git a/packages/CLI11/include/CLI/impl/Argv_inl.hpp b/packages/CLI11/include/CLI/impl/Argv_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3d00a570d1e5032ed72bd4a255c8e60be50934d2 --- /dev/null +++ b/packages/CLI11/include/CLI/impl/Argv_inl.hpp @@ -0,0 +1,183 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +// This include is only needed for IDEs to discover symbols +#include <CLI/Argv.hpp> + +#include <CLI/Encoding.hpp> + +// [CLI11:public_includes:set] +#include <algorithm> +#include <memory> +#include <stdexcept> +#include <string> +#include <vector> +// [CLI11:public_includes:end] + +// [CLI11:argv_inl_includes:verbatim] +#if defined(_WIN32) +#if !(defined(_AMD64_) || defined(_X86_) || defined(_ARM_)) +#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || \ + defined(_M_AMD64) +#define _AMD64_ +#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(__i386__) || defined(_M_IX86) +#define _X86_ +#elif defined(__arm__) || defined(_M_ARM) || defined(_M_ARMT) +#define _ARM_ +#endif +#endif + +// first +#ifndef NOMINMAX +// if NOMINMAX is already defined we don't want to mess with that either way +#define NOMINMAX +#include <windef.h> +#undef NOMINMAX +#else +#include <windef.h> +#endif + +// second +#include <winbase.h> +// third +#include <processthreadsapi.h> +#include <shellapi.h> + +#elif defined(__APPLE__) +#include <crt_externs.h> +#endif +// [CLI11:argv_inl_includes:end] + +namespace CLI { +// [CLI11:argv_inl_hpp:verbatim] + +namespace detail { + +#ifdef __APPLE__ +// Copy argc and argv as early as possible to avoid modification +static const std::vector<const char *> static_args = [] { + static const std::vector<std::string> static_args_as_strings = [] { + std::vector<std::string> args_as_strings; + int argc = *_NSGetArgc(); + char **argv = *_NSGetArgv(); + + args_as_strings.reserve(static_cast<size_t>(argc)); + for(size_t i = 0; i < static_cast<size_t>(argc); i++) { + args_as_strings.push_back(argv[i]); + } + + return args_as_strings; + }(); + + std::vector<const char *> static_args_result; + static_args_result.reserve(static_args_as_strings.size()); + + for(const auto &arg : static_args_as_strings) { + static_args_result.push_back(arg.data()); + } + + return static_args_result; +}(); +#endif + +/// Command-line arguments, as passed in to this executable, converted to utf-8 on Windows. +CLI11_INLINE const std::vector<const char *> &args() { + // This function uses initialization via lambdas extensively to take advantage of the thread safety of static + // variable initialization [stmt.dcl.3] + +#ifdef _WIN32 + static const std::vector<const char *> static_args = [] { + static const std::vector<std::string> static_args_as_strings = [] { + // On Windows, take arguments from GetCommandLineW and convert them to utf-8. + std::vector<std::string> args_as_strings; + int argc = 0; + + auto deleter = [](wchar_t **ptr) { LocalFree(ptr); }; + // NOLINTBEGIN(*-avoid-c-arrays) + auto wargv = + std::unique_ptr<wchar_t *[], decltype(deleter)>(CommandLineToArgvW(GetCommandLineW(), &argc), deleter); + // NOLINTEND(*-avoid-c-arrays) + + if(wargv == nullptr) { + throw std::runtime_error("CommandLineToArgvW failed with code " + std::to_string(GetLastError())); + } + + args_as_strings.reserve(static_cast<size_t>(argc)); + for(size_t i = 0; i < static_cast<size_t>(argc); ++i) { + args_as_strings.push_back(narrow(wargv[i])); + } + + return args_as_strings; + }(); + + std::vector<const char *> static_args_result; + static_args_result.reserve(static_args_as_strings.size()); + + for(const auto &arg : static_args_as_strings) { + static_args_result.push_back(arg.data()); + } + + return static_args_result; + }(); + + return static_args; + +#elif defined(__APPLE__) + + return static_args; + +#else + static const std::vector<const char *> static_args = [] { + static const std::vector<char> static_cmdline = [] { + // On posix, retrieve arguments from /proc/self/cmdline, separated by null terminators. + std::vector<char> cmdline; + + auto deleter = [](FILE *f) { std::fclose(f); }; + std::unique_ptr<FILE, decltype(deleter)> fp_unique(std::fopen("/proc/self/cmdline", "r"), deleter); + FILE *fp = fp_unique.get(); + if(!fp) { + throw std::runtime_error("could not open /proc/self/cmdline for reading"); // LCOV_EXCL_LINE + } + + size_t size = 0; + while(std::feof(fp) == 0) { + cmdline.resize(size + 128); + size += std::fread(cmdline.data() + size, 1, 128, fp); + + if(std::ferror(fp) != 0) { + throw std::runtime_error("error during reading /proc/self/cmdline"); // LCOV_EXCL_LINE + } + } + cmdline.resize(size); + + return cmdline; + }(); + + std::size_t argc = static_cast<std::size_t>(std::count(static_cmdline.begin(), static_cmdline.end(), '\0')); + std::vector<const char *> static_args_result; + static_args_result.reserve(argc); + + for(auto it = static_cmdline.begin(); it != static_cmdline.end(); + it = std::find(it, static_cmdline.end(), '\0') + 1) { + static_args_result.push_back(static_cmdline.data() + (it - static_cmdline.begin())); + } + + return static_args_result; + }(); + + return static_args; +#endif +} + +} // namespace detail + +CLI11_INLINE const char *const *argv() { return detail::args().data(); } +CLI11_INLINE int argc() { return static_cast<int>(detail::args().size()); } + +// [CLI11:argv_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/include/CLI/impl/Config_inl.hpp b/packages/CLI11/include/CLI/impl/Config_inl.hpp index 0f9695f2922384cc938df24ad26aaa15ab030984..8021d5f63aa34e1cfeac43e37b274829c49a7dd1 100644 --- a/packages/CLI11/include/CLI/impl/Config_inl.hpp +++ b/packages/CLI11/include/CLI/impl/Config_inl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -31,8 +31,9 @@ CLI11_INLINE std::string convert_arg_for_ini(const std::string &arg, char string } // floating point conversion can convert some hex codes, but don't try that here if(arg.compare(0, 2, "0x") != 0 && arg.compare(0, 2, "0X") != 0) { + using CLI::detail::lexical_cast; double val = 0.0; - if(detail::lexical_cast(arg, val)) { + if(lexical_cast(arg, val)) { return arg; } } @@ -344,6 +345,9 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description, } if(!value.empty()) { + if(!opt->get_fnames().empty()) { + value = opt->get_flag_value(name, value); + } if(write_description && opt->has_description()) { out << '\n'; out << commentLead << detail::fix_newlines(commentLead, opt->get_description()) << '\n'; diff --git a/packages/CLI11/include/CLI/impl/Encoding_inl.hpp b/packages/CLI11/include/CLI/impl/Encoding_inl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f5d7e9a83fbb42f7b47408cb02b67c9be48d8b3c --- /dev/null +++ b/packages/CLI11/include/CLI/impl/Encoding_inl.hpp @@ -0,0 +1,154 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#pragma once + +// This include is only needed for IDEs to discover symbols +#include <CLI/Encoding.hpp> +#include <CLI/Macros.hpp> + +// [CLI11:public_includes:set] +#include <array> +#include <clocale> +#include <cstdlib> +#include <cstring> +#include <cwchar> +#include <locale> +#include <stdexcept> +#include <string> +#include <type_traits> +#include <utility> +// [CLI11:public_includes:end] + +namespace CLI { +// [CLI11:encoding_inl_hpp:verbatim] + +namespace detail { + +#if !CLI11_HAS_CODECVT +/// Attempt to set one of the acceptable unicode locales for conversion +CLI11_INLINE void set_unicode_locale() { + static const std::array<const char *, 3> unicode_locales{{"C.UTF-8", "en_US.UTF-8", ".UTF-8"}}; + + for(const auto &locale_name : unicode_locales) { + if(std::setlocale(LC_ALL, locale_name) != nullptr) { + return; + } + } + throw std::runtime_error("CLI::narrow: could not set locale to C.UTF-8"); +} + +template <typename F> struct scope_guard_t { + F closure; + + explicit scope_guard_t(F closure_) : closure(closure_) {} + ~scope_guard_t() { closure(); } +}; + +template <typename F> CLI11_NODISCARD CLI11_INLINE scope_guard_t<F> scope_guard(F &&closure) { + return scope_guard_t<F>{std::forward<F>(closure)}; +} + +#endif // !CLI11_HAS_CODECVT + +CLI11_DIAGNOSTIC_PUSH +CLI11_DIAGNOSTIC_IGNORE_DEPRECATED + +CLI11_INLINE std::string narrow_impl(const wchar_t *str, std::size_t str_size) { +#if CLI11_HAS_CODECVT +#ifdef _WIN32 + return std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>().to_bytes(str, str + str_size); + +#else + return std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(str, str + str_size); + +#endif // _WIN32 +#else // CLI11_HAS_CODECVT + (void)str_size; + std::mbstate_t state = std::mbstate_t(); + const wchar_t *it = str; + + std::string old_locale = std::setlocale(LC_ALL, nullptr); + auto sg = scope_guard([&] { std::setlocale(LC_ALL, old_locale.c_str()); }); + set_unicode_locale(); + + std::size_t new_size = std::wcsrtombs(nullptr, &it, 0, &state); + if(new_size == static_cast<std::size_t>(-1)) { + throw std::runtime_error("CLI::narrow: conversion error in std::wcsrtombs at offset " + + std::to_string(it - str)); + } + std::string result(new_size, '\0'); + std::wcsrtombs(const_cast<char *>(result.data()), &str, new_size, &state); + + return result; + +#endif // CLI11_HAS_CODECVT +} + +CLI11_INLINE std::wstring widen_impl(const char *str, std::size_t str_size) { +#if CLI11_HAS_CODECVT +#ifdef _WIN32 + return std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>().from_bytes(str, str + str_size); + +#else + return std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(str, str + str_size); + +#endif // _WIN32 +#else // CLI11_HAS_CODECVT + (void)str_size; + std::mbstate_t state = std::mbstate_t(); + const char *it = str; + + std::string old_locale = std::setlocale(LC_ALL, nullptr); + auto sg = scope_guard([&] { std::setlocale(LC_ALL, old_locale.c_str()); }); + set_unicode_locale(); + + std::size_t new_size = std::mbsrtowcs(nullptr, &it, 0, &state); + if(new_size == static_cast<std::size_t>(-1)) { + throw std::runtime_error("CLI::widen: conversion error in std::mbsrtowcs at offset " + + std::to_string(it - str)); + } + std::wstring result(new_size, L'\0'); + std::mbsrtowcs(const_cast<wchar_t *>(result.data()), &str, new_size, &state); + + return result; + +#endif // CLI11_HAS_CODECVT +} + +CLI11_DIAGNOSTIC_POP + +} // namespace detail + +CLI11_INLINE std::string narrow(const wchar_t *str, std::size_t str_size) { return detail::narrow_impl(str, str_size); } +CLI11_INLINE std::string narrow(const std::wstring &str) { return detail::narrow_impl(str.data(), str.size()); } +// Flawfinder: ignore +CLI11_INLINE std::string narrow(const wchar_t *str) { return detail::narrow_impl(str, std::wcslen(str)); } + +CLI11_INLINE std::wstring widen(const char *str, std::size_t str_size) { return detail::widen_impl(str, str_size); } +CLI11_INLINE std::wstring widen(const std::string &str) { return detail::widen_impl(str.data(), str.size()); } +// Flawfinder: ignore +CLI11_INLINE std::wstring widen(const char *str) { return detail::widen_impl(str, std::strlen(str)); } + +#ifdef CLI11_CPP17 +CLI11_INLINE std::string narrow(std::wstring_view str) { return detail::narrow_impl(str.data(), str.size()); } +CLI11_INLINE std::wstring widen(std::string_view str) { return detail::widen_impl(str.data(), str.size()); } +#endif // CLI11_CPP17 + +#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 +CLI11_INLINE std::filesystem::path to_path(std::string_view str) { + return std::filesystem::path{ +#ifdef _WIN32 + widen(str) +#else + str +#endif // _WIN32 + }; +} +#endif // CLI11_HAS_FILESYSTEM + +// [CLI11:encoding_inl_hpp:end] +} // namespace CLI diff --git a/packages/CLI11/include/CLI/impl/Formatter_inl.hpp b/packages/CLI11/include/CLI/impl/Formatter_inl.hpp index 37249e082e23d9e3bf947eceb0dd8eb721d11391..84652fefa4aebcb2ef5257c887d0e5494d40c5f1 100644 --- a/packages/CLI11/include/CLI/impl/Formatter_inl.hpp +++ b/packages/CLI11/include/CLI/impl/Formatter_inl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -69,13 +69,13 @@ CLI11_INLINE std::string Formatter::make_description(const App *app) const { auto min_options = app->get_require_option_min(); auto max_options = app->get_require_option_max(); if(app->get_required()) { - desc += " REQUIRED "; + desc += " " + get_label("REQUIRED") + " "; } if((max_options == min_options) && (min_options > 0)) { if(min_options == 1) { desc += " \n[Exactly 1 of the following options is required]"; } else { - desc += " \n[Exactly " + std::to_string(min_options) + "options from the following list are required]"; + desc += " \n[Exactly " + std::to_string(min_options) + " options from the following list are required]"; } } else if(max_options > 0) { if(min_options > 0) { @@ -91,6 +91,11 @@ CLI11_INLINE std::string Formatter::make_description(const App *app) const { } CLI11_INLINE std::string Formatter::make_usage(const App *app, std::string name) const { + std::string usage = app->get_usage(); + if(!usage.empty()) { + return usage + "\n"; + } + std::stringstream out; out << get_label("Usage") << ":" << (name.empty() ? "" : " ") << name; @@ -137,7 +142,7 @@ CLI11_INLINE std::string Formatter::make_footer(const App *app) const { if(footer.empty()) { return std::string{}; } - return footer + "\n"; + return "\n" + footer + "\n"; } CLI11_INLINE std::string Formatter::make_help(const App *app, std::string name, AppFormatMode mode) const { @@ -159,7 +164,7 @@ CLI11_INLINE std::string Formatter::make_help(const App *app, std::string name, out << make_positionals(app); out << make_groups(app, mode); out << make_subcommands(app, mode); - out << '\n' << make_footer(app); + out << make_footer(app); return out.str(); } @@ -208,7 +213,10 @@ CLI11_INLINE std::string Formatter::make_subcommands(const App *app, AppFormatMo CLI11_INLINE std::string Formatter::make_subcommand(const App *sub) const { std::stringstream out; - detail::format_help(out, sub->get_display_name(true), sub->get_description(), column_width_); + detail::format_help(out, + sub->get_display_name(true) + (sub->get_required() ? " " + get_label("REQUIRED") : ""), + sub->get_description(), + column_width_); return out.str(); } diff --git a/packages/CLI11/include/CLI/impl/Option_inl.hpp b/packages/CLI11/include/CLI/impl/Option_inl.hpp index a97346235a417acad32b764a8efeb4f0ff1b6559..a24df9ab293700a31bba830581247d5b01d5b412 100644 --- a/packages/CLI11/include/CLI/impl/Option_inl.hpp +++ b/packages/CLI11/include/CLI/impl/Option_inl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/impl/Split_inl.hpp b/packages/CLI11/include/CLI/impl/Split_inl.hpp index 03478b209bf95afaf6a8aca43a10fdcc636560a4..d974f80a6f7618de7a8fb2cdf2ddade30cb48fc7 100644 --- a/packages/CLI11/include/CLI/impl/Split_inl.hpp +++ b/packages/CLI11/include/CLI/impl/Split_inl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -34,7 +34,7 @@ CLI11_INLINE bool split_short(const std::string ¤t, std::string &name, std } CLI11_INLINE bool split_long(const std::string ¤t, std::string &name, std::string &value) { - if(current.size() > 2 && current.substr(0, 2) == "--" && valid_first_char(current[2])) { + if(current.size() > 2 && current.compare(0, 2, "--") == 0 && valid_first_char(current[2])) { auto loc = current.find_first_of('='); if(loc != std::string::npos) { name = current.substr(2, loc - 2); diff --git a/packages/CLI11/include/CLI/impl/StringTools_inl.hpp b/packages/CLI11/include/CLI/impl/StringTools_inl.hpp index 1a7cdd818a5f0a9053bae2f3e59cc7c77fcfea5d..9b81fbde3475b03f67bc1f4330b6efdfe0d87d93 100644 --- a/packages/CLI11/include/CLI/impl/StringTools_inl.hpp +++ b/packages/CLI11/include/CLI/impl/StringTools_inl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/include/CLI/impl/Validators_inl.hpp b/packages/CLI11/include/CLI/impl/Validators_inl.hpp index f2fe5e55de7258ef29535d0b6339221c41572641..a2295ecdf8954d63cede377731710397ecd85de3 100644 --- a/packages/CLI11/include/CLI/impl/Validators_inl.hpp +++ b/packages/CLI11/include/CLI/impl/Validators_inl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -8,6 +8,7 @@ #include <CLI/Validators.hpp> +#include <CLI/Encoding.hpp> #include <CLI/Macros.hpp> #include <CLI/StringTools.hpp> #include <CLI/TypeTools.hpp> @@ -127,12 +128,12 @@ namespace detail { #if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 CLI11_INLINE path_type check_path(const char *file) noexcept { std::error_code ec; - auto stat = std::filesystem::status(file, ec); + auto stat = std::filesystem::status(to_path(file), ec); if(ec) { return path_type::nonexistent; } switch(stat.type()) { - case std::filesystem::file_type::none: + case std::filesystem::file_type::none: // LCOV_EXCL_LINE case std::filesystem::file_type::not_found: return path_type::nonexistent; case std::filesystem::file_type::directory: @@ -219,7 +220,8 @@ CLI11_INLINE IPV4Validator::IPV4Validator() : Validator("IPV4") { } int num = 0; for(const auto &var : result) { - bool retval = detail::lexical_cast(var, num); + using CLI::detail::lexical_cast; + bool retval = lexical_cast(var, num); if(!retval) { return std::string("Failed parsing number (") + var + ')'; } diff --git a/packages/CLI11/scripts/MakeSingleHeader.py b/packages/CLI11/scripts/MakeSingleHeader.py index 4bc53dd1509d144e5255434cab7e8056a00d8c8d..7cca6f70ae6e0cb07632bb2e6c6658f018077509 100755 --- a/packages/CLI11/scripts/MakeSingleHeader.py +++ b/packages/CLI11/scripts/MakeSingleHeader.py @@ -80,7 +80,7 @@ class HeaderGroups(dict): """ for key in self: if isinstance(self[key], set): - self[key] = "\n".join(self[key]) + self[key] = "\n".join(sorted(self[key])) def make_header(output, main_header, files, tag, namespace, macro=None, version=None): @@ -100,6 +100,8 @@ def make_header(output, main_header, files, tag, namespace, macro=None, version= groups["git"] = "" for f in files: + if os.path.isdir(f): + continue groups.read_header(f) groups["namespace"] = namespace diff --git a/packages/CLI11/scripts/mdlint_style.rb b/packages/CLI11/scripts/mdlint_style.rb index 6fca85b1a3d05a43aba1fca2e3aa256676e1f11d..5cb3a9792d9dc4beb7b1cc93c59b6104c1d20a5d 100644 --- a/packages/CLI11/scripts/mdlint_style.rb +++ b/packages/CLI11/scripts/mdlint_style.rb @@ -6,3 +6,4 @@ exclude_rule 'MD034' # Bare URL (for now) rule 'MD026', punctuation: '.,;:!' # Trailing punctuation in header (& in this case) rule 'MD029', style: :ordered +rule 'MD007', indent: 2 diff --git a/packages/CLI11/src/CMakeLists.txt b/packages/CLI11/src/CMakeLists.txt index 341cae42c5233649106f11d55557af4d938d6b70..4f7af6ad190295688e2cdad3d8bd6fa7845ede5a 100644 --- a/packages/CLI11/src/CMakeLists.txt +++ b/packages/CLI11/src/CMakeLists.txt @@ -2,7 +2,6 @@ set(CLI11_headerLoc "${PROJECT_SOURCE_DIR}/include/CLI") set(CLI11_headers ${CLI11_headerLoc}/App.hpp - ${CLI11_headerLoc}/CLI.hpp ${CLI11_headerLoc}/Config.hpp ${CLI11_headerLoc}/ConfigFwd.hpp ${CLI11_headerLoc}/Error.hpp @@ -12,10 +11,11 @@ set(CLI11_headers ${CLI11_headerLoc}/Option.hpp ${CLI11_headerLoc}/Split.hpp ${CLI11_headerLoc}/StringTools.hpp - ${CLI11_headerLoc}/Timer.hpp ${CLI11_headerLoc}/TypeTools.hpp ${CLI11_headerLoc}/Validators.hpp - ${CLI11_headerLoc}/Version.hpp) + ${CLI11_headerLoc}/Version.hpp + ${CLI11_headerLoc}/Encoding.hpp + ${CLI11_headerLoc}/Argv.hpp) set(CLI11_implLoc "${PROJECT_SOURCE_DIR}/include/CLI/impl") @@ -26,12 +26,17 @@ set(CLI11_impl_headers ${CLI11_implLoc}/Option_inl.hpp ${CLI11_implLoc}/Split_inl.hpp ${CLI11_implLoc}/StringTools_inl.hpp - ${CLI11_implLoc}/Validators_inl.hpp) + ${CLI11_implLoc}/Validators_inl.hpp + ${CLI11_implLoc}/Encoding_inl.hpp + ${CLI11_implLoc}/Argv_inl.hpp) + +set(CLI11_library_headers ${CLI11_headerLoc}/CLI.hpp ${CLI11_headerLoc}/Timer.hpp) if(CLI11_PRECOMPILED) # Create static lib file(GLOB CLI11_precompile_sources "${PROJECT_SOURCE_DIR}/src/*.cpp") - add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_impl_headers} ${CLI11_precompile_sources}) + add_library(CLI11 STATIC ${CLI11_headers} ${CLI11_library_headers} ${CLI11_impl_headers} + ${CLI11_precompile_sources}) target_compile_definitions(CLI11 PUBLIC -DCLI11_COMPILE) set(PUBLIC_OR_INTERFACE PUBLIC) @@ -39,7 +44,7 @@ else() add_library(CLI11 INTERFACE) if(CMAKE_VERSION VERSION_GREATER 3.19) # This is only useful for visual studio and other IDE builds - target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_impl_headers}) + target_sources(CLI11 PRIVATE ${CLI11_headers} ${CLI11_library_headers} ${CLI11_impl_headers}) endif() set(PUBLIC_OR_INTERFACE INTERFACE) @@ -48,25 +53,35 @@ endif() # Allow IDE's to group targets into folders add_library(CLI11::CLI11 ALIAS CLI11) # for add_subdirectory calls +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + set(SYSTEM_INCL "") +else() + # If this project is included from somewhere else, we mark our headers as system headers to avoid + # the compiler emitting any warnings about them + set(SYSTEM_INCL "SYSTEM") +endif() + # Duplicated because CMake adds the current source dir if you don't. target_include_directories( - CLI11 ${PUBLIC_OR_INTERFACE} $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> + CLI11 ${SYSTEM_INCL} ${PUBLIC_OR_INTERFACE} $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>) -if(CMAKE_VERSION VERSION_LESS 3.8) - # This might not be a complete list - target_compile_features( - CLI11 - INTERFACE cxx_lambdas - cxx_nullptr - cxx_override - cxx_range_for - cxx_right_angle_brackets - cxx_strong_enums - cxx_constexpr - cxx_auto_type) -else() - target_compile_features(CLI11 INTERFACE cxx_std_11) +if(CMAKE_CXX_STANDARD LESS 14) + if(CMAKE_VERSION VERSION_LESS 3.8) + # This might not be a complete list + target_compile_features( + CLI11 + INTERFACE cxx_lambdas + cxx_nullptr + cxx_override + cxx_range_for + cxx_right_angle_brackets + cxx_strong_enums + cxx_constexpr + cxx_auto_type) + else() + target_compile_features(CLI11 INTERFACE cxx_std_11) + endif() endif() if(CLI11_SINGLE_FILE) @@ -112,7 +127,8 @@ if(CLI11_INSTALL) # Make an export target install(TARGETS CLI11 EXPORT CLI11Targets) if(NOT CLI11_SINGLE_FILE) - install(FILES ${CLI11_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI") + install(FILES ${CLI11_headers} ${CLI11_library_headers} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI") if(NOT CLI11_COMPILE) install(FILES ${CLI11_impl_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/CLI/impl") endif() diff --git a/packages/CLI11/src/Precompile.cpp b/packages/CLI11/src/Precompile.cpp index 81900ced37e7edf8a5f37bc37aeac659e1946944..5afd54cb99b1a9511a36e7b30de3a5317d1d8bad 100644 --- a/packages/CLI11/src/Precompile.cpp +++ b/packages/CLI11/src/Precompile.cpp @@ -1,11 +1,13 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // // SPDX-License-Identifier: BSD-3-Clause #include <CLI/impl/App_inl.hpp> +#include <CLI/impl/Argv_inl.hpp> #include <CLI/impl/Config_inl.hpp> +#include <CLI/impl/Encoding_inl.hpp> #include <CLI/impl/Formatter_inl.hpp> #include <CLI/impl/Option_inl.hpp> #include <CLI/impl/Split_inl.hpp> diff --git a/packages/CLI11/test_package/CMakeLists.txt b/packages/CLI11/test_package/CMakeLists.txt deleted file mode 100644 index 48f6d9903248c09c1c897f5266dab257f42907e2..0000000000000000000000000000000000000000 --- a/packages/CLI11/test_package/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -project(PackageTest CXX) -cmake_minimum_required(VERSION 3.1) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -message(STATUS "${CMAKE_PREFIX_PATH}") - -find_package(CLI11 CONFIG REQUIRED) - -add_executable(example example.cpp) -target_link_libraries(example CLI11::CLI11) diff --git a/packages/CLI11/test_package/conanfile.py b/packages/CLI11/test_package/conanfile.py deleted file mode 100644 index 4c5c028ecee13664aaad7ca19cd9f74f271896ea..0000000000000000000000000000000000000000 --- a/packages/CLI11/test_package/conanfile.py +++ /dev/null @@ -1,21 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class HelloTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - - def test(self): - if not tools.cross_building(self.settings): - os.chdir("bin") - self.run(".%sexample" % os.sep) diff --git a/packages/CLI11/test_package/example.cpp b/packages/CLI11/test_package/example.cpp deleted file mode 100644 index 464cf751896f183fa1bba19d965ac521c8b60a52..0000000000000000000000000000000000000000 --- a/packages/CLI11/test_package/example.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// This file is a "Hello, world!" CLI11 program - -#include "CLI/CLI.hpp" - -#include <iostream> - -int main(int argc, char **argv) { - - CLI::App app("Some nice description"); - - int x = 0; - app.add_option("-x", x, "an integer value")->capture_default_str(); - - bool flag; - app.add_flag("-f,--flag", flag, "a flag option"); - - CLI11_PARSE(app, argc, argv); - - return 0; -} diff --git a/packages/CLI11/tests/AppTest.cpp b/packages/CLI11/tests/AppTest.cpp index 994c890ca5a605fb58f657f5ff656b426bf398a1..2cdefc4ee61d0770802c491d698e52c9a8b8e4a3 100644 --- a/packages/CLI11/tests/AppTest.cpp +++ b/packages/CLI11/tests/AppTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -7,6 +7,7 @@ #include "app_helper.hpp" #include <cmath> +#include <array> #include <complex> #include <cstdint> #include <cstdlib> @@ -141,8 +142,6 @@ TEST_CASE_METHOD(TApp, "StrangeFlagNames", "[app]") { } TEST_CASE_METHOD(TApp, "RequireOptionsError", "[app]") { - using Catch::Matchers::Contains; - app.add_flag("-c"); app.add_flag("--q"); app.add_flag("--this,--that"); @@ -261,6 +260,28 @@ TEST_CASE_METHOD(TApp, "OneString", "[app]") { CHECK("mystring" == str); } +TEST_CASE_METHOD(TApp, "OneWideString", "[app]") { + std::wstring str; + app.add_option("-s,--string", str); + args = {"--string", "mystring"}; + run(); + CHECK(app.count("-s") == 1u); + CHECK(app.count("--string") == 1u); + CHECK(L"mystring" == str); +} + +TEST_CASE_METHOD(TApp, "OneStringWideInput", "[app][unicode]") { + std::string str; + app.add_option("-s,--string", str); + + std::array<const wchar_t *, 3> cmdline{{L"app", L"--string", L"mystring"}}; + app.parse(static_cast<int>(cmdline.size()), cmdline.data()); + + CHECK(app.count("-s") == 1u); + CHECK(app.count("--string") == 1u); + CHECK("mystring" == str); +} + TEST_CASE_METHOD(TApp, "OneStringWindowsStyle", "[app]") { std::string str; app.add_option("-s,--string", str); @@ -282,6 +303,16 @@ TEST_CASE_METHOD(TApp, "OneStringSingleStringInput", "[app]") { CHECK("mystring" == str); } +TEST_CASE_METHOD(TApp, "OneStringSingleWideStringInput", "[app][unicode]") { + std::string str; + app.add_option("-s,--string", str); + + app.parse(L"--string mystring"); + CHECK(app.count("-s") == 1u); + CHECK(app.count("--string") == 1u); + CHECK("mystring" == str); +} + TEST_CASE_METHOD(TApp, "OneStringEqualVersion", "[app]") { std::string str; app.add_option("-s,--string", str); @@ -981,7 +1012,9 @@ TEST_CASE_METHOD(TApp, "emptyVectorReturn", "[app]") { std::vector<std::string> strs; std::vector<std::string> strs2; + std::vector<std::string> strs3; auto *opt1 = app.add_option("--str", strs)->required()->expected(0, 2); + app.add_option("--str3", strs3)->expected(1, 3); app.add_option("--str2", strs2); args = {"--str"}; @@ -1004,6 +1037,11 @@ TEST_CASE_METHOD(TApp, "emptyVectorReturn", "[app]") { CHECK_NOTHROW(run()); CHECK(strs.empty()); + opt1->required(false); + args = {"--str3", "{}"}; + + CHECK_NOTHROW(run()); + CHECK_FALSE(strs3.empty()); } TEST_CASE_METHOD(TApp, "RequiredOptsDoubleShort", "[app]") { @@ -1988,6 +2026,31 @@ TEST_CASE_METHOD(TApp, "typeCheck", "[app]") { CHECK_THROWS_AS(run(), CLI::ValidationError); } +TEST_CASE_METHOD(TApp, "NeedsTrue", "[app]") { + std::string str; + app.add_option("-s,--string", str); + app.add_flag("--opt1")->check([&](const std::string &) { + return (str != "val_with_opt1") ? std::string("--opt1 requires --string val_with_opt1") : std::string{}; + }); + + run(); + + args = {"--opt1"}; + CHECK_THROWS_AS(run(), CLI::ValidationError); + + args = {"--string", "val"}; + run(); + + args = {"--string", "val", "--opt1"}; + CHECK_THROWS_AS(run(), CLI::ValidationError); + + args = {"--string", "val_with_opt1", "--opt1"}; + run(); + + args = {"--opt1", "--string", "val_with_opt1"}; // order is not revelant + run(); +} + // Check to make sure programmatic access to left over is available TEST_CASE_METHOD(TApp, "AllowExtras", "[app]") { @@ -2086,21 +2149,23 @@ TEST_CASE_METHOD(TApp, "AllowExtrasArgModify", "[app]") { TEST_CASE_METHOD(TApp, "CheckShortFail", "[app]") { args = {"--two"}; - CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::SHORT), CLI::HorribleError); + CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::SHORT, false), + CLI::HorribleError); } // Test horrible error TEST_CASE_METHOD(TApp, "CheckLongFail", "[app]") { args = {"-t"}; - CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::LONG), CLI::HorribleError); + CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::LONG, false), + CLI::HorribleError); } // Test horrible error TEST_CASE_METHOD(TApp, "CheckWindowsFail", "[app]") { args = {"-t"}; - CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::WINDOWS_STYLE), + CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::WINDOWS_STYLE, false), CLI::HorribleError); } @@ -2108,7 +2173,8 @@ TEST_CASE_METHOD(TApp, "CheckWindowsFail", "[app]") { TEST_CASE_METHOD(TApp, "CheckOtherFail", "[app]") { args = {"-t"}; - CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::NONE), CLI::HorribleError); + CHECK_THROWS_AS(CLI::detail::AppFriend::parse_arg(&app, args, CLI::detail::Classifier::NONE, false), + CLI::HorribleError); } // Test horrible error @@ -2428,3 +2494,21 @@ TEST_CASE("C20_compile", "simple") { app.parse("--flag"); CHECK_FALSE(flag->empty()); } + +// #14 +TEST_CASE("System Args", "[app]") { + const char *commandline = CLI11_SYSTEM_ARGS_EXE " 1234 false \"hello world\""; + int retval = std::system(commandline); + + if(retval == -1) { + FAIL("Executable '" << commandline << "' reported different argc count"); + } + + if(retval > 0) { + FAIL("Executable '" << commandline << "' reported different argv at index " << (retval - 1)); + } + + if(retval != 0) { + FAIL("Executable '" << commandline << "' failed with an unknown return code"); + } +} diff --git a/packages/CLI11/tests/BoostOptionTypeTest.cpp b/packages/CLI11/tests/BoostOptionTypeTest.cpp index c3cd81852a8124bb3bb1427a1a667d1f13176703..1dabc37da9204b754bca3dc923a4e6a431e65507 100644 --- a/packages/CLI11/tests/BoostOptionTypeTest.cpp +++ b/packages/CLI11/tests/BoostOptionTypeTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/CMakeLists.txt b/packages/CLI11/tests/CMakeLists.txt index 7d89e128b713ac91de5b03d56db0cec355fcea7e..7bd47744cb7e6e625b55e6fccad83faf4eedf565 100644 --- a/packages/CLI11/tests/CMakeLists.txt +++ b/packages/CLI11/tests/CMakeLists.txt @@ -4,7 +4,7 @@ if(CLI11_SANITIZERS) sanitizers GIT_REPOSITORY https://github.com/arsenm/sanitizers-cmake.git GIT_SHALLOW 1 - GIT_TAG 99e159e) + GIT_TAG c3dc841) FetchContent_GetProperties(sanitizers) @@ -49,46 +49,92 @@ set(CLI11_TESTS StringParseTest ComplexTypeTest TrueFalseTest - OptionGroupTest) + OptionGroupTest + EncodingTest) if(WIN32) list(APPEND CLI11_TESTS WindowsTest) endif() +if(CMAKE_CXX_STANDARD GREATER 16) + list(APPEND CLI11_TESTS FuzzFailTest) +endif() + if(Boost_FOUND) list(APPEND CLI11_TESTS BoostOptionTypeTest) endif() set(CLI11_MULTIONLY_TESTS TimerTest) -add_library(catch_main main.cpp catch.hpp) -target_include_directories(catch_main PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") - find_package(Catch2 CONFIG) if(Catch2_FOUND) if(NOT TARGET Catch2::Catch2) message(FATAL_ERROR "Found Catch2 at ${Catch2_DIR} but targets are missing.") endif() - message(STATUS "Found Catch2") - target_link_libraries(catch_main PUBLIC Catch2::Catch2) + message(STATUS "Found Catch2 ${Catch2_VERSION}") + + if(Catch2_VERSION VERSION_LESS 3) + add_library(catch_main main.cpp catch.hpp) + target_include_directories(catch_main PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") + target_link_libraries(catch_main PUBLIC Catch2::Catch2) + else() + add_library(catch_main ALIAS Catch2::Catch2WithMain) + target_compile_definitions(Catch2::Catch2WithMain INTERFACE -DCLI11_CATCH3) + endif() else() message(STATUS "Downloading Catch2") # FetchContent would be better, but requires newer CMake. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/catch2") - set(url https://github.com/philsquared/Catch/releases/download/v2.13.7/catch.hpp) + set(url https://github.com/philsquared/Catch/releases/download/v2.13.10/catch.hpp) file( DOWNLOAD ${url} "${CMAKE_CURRENT_BINARY_DIR}/catch2/catch.hpp" STATUS status - EXPECTED_HASH SHA256=ea379c4a3cb5799027b1eb451163dff065a3d641aaba23bf4e24ee6b536bd9bc) + EXPECTED_HASH SHA256=3725c0f0a75f376a5005dde31ead0feb8f7da7507644c201b814443de8355170) list(GET status 0 error) if(error) message(FATAL_ERROR "Could not download ${url}, and Catch2 not found on your system.") endif() - target_include_directories(catch_main PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") + add_library(catch_main main.cpp catch.hpp) + target_include_directories(catch_main PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}") endif() +# Add special target that copies the data directory for tests +file( + GLOB_RECURSE DATA_FILES + LIST_DIRECTORIES false + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/data/*") + +foreach(DATA_FILE IN LISTS DATA_FILES) + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${DATA_FILE}" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${DATA_FILE}" + "${CMAKE_CURRENT_BINARY_DIR}/${DATA_FILE}" + MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${DATA_FILE}" + VERBATIM) + target_sources(catch_main PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${DATA_FILE}") +endforeach() + +# Build dependent applications which are launched from test code +set(CLI11_DEPENDENT_APPLICATIONS system_args) + +foreach(APP IN LISTS CLI11_DEPENDENT_APPLICATIONS) + add_executable(${APP} applications/${APP}.cpp) + target_include_directories(${APP} PRIVATE ${CMAKE_SOURCE_DIR}/include) + add_dependencies(catch_main ${APP}) +endforeach() + +function(add_dependent_application_definitions TARGET) + foreach(APP IN LISTS CLI11_DEPENDENT_APPLICATIONS) + string(TOUPPER ${APP} APP_UPPERCASE) + target_compile_definitions(${TARGET} + PRIVATE CLI11_${APP_UPPERCASE}_EXE="$<TARGET_FILE:${APP}>") + endforeach() +endfunction() + # Target must already exist macro(add_catch_test TESTNAME) target_link_libraries(${TESTNAME} PUBLIC catch_main) @@ -108,6 +154,8 @@ foreach(T IN LISTS CLI11_TESTS) set_property(SOURCE ${T}.cpp PROPERTY LANGUAGE CUDA) endif() add_executable(${T} ${T}.cpp) + + add_dependent_application_definitions(${T}) add_sanitizers(${T}) if(NOT CLI11_CUDA_TESTS) target_link_libraries(${T} PRIVATE CLI11_warnings) @@ -117,6 +165,7 @@ foreach(T IN LISTS CLI11_TESTS) if(CLI11_SINGLE_FILE AND CLI11_SINGLE_FILE_TESTS) add_executable(${T}_Single ${T}.cpp) + add_dependent_application_definitions(${T}_Single) target_link_libraries(${T}_Single PRIVATE CLI11_SINGLE) add_catch_test(${T}_Single) set_property(TARGET ${T}_Single PROPERTY FOLDER "Tests Single File") @@ -125,11 +174,22 @@ endforeach() foreach(T IN LISTS CLI11_MULTIONLY_TESTS) add_executable(${T} ${T}.cpp) + add_dependent_application_definitions(${T}) add_sanitizers(${T}) target_link_libraries(${T} PUBLIC CLI11) add_catch_test(${T}) endforeach() +if(CMAKE_CXX_STANDARD GREATER 16) + set(TEST_FILE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}) + target_compile_definitions(FuzzFailTest PUBLIC -DTEST_FILE_FOLDER="${TEST_FILE_FOLDER}") + target_sources(FuzzFailTest PUBLIC ${PROJECT_SOURCE_DIR}/fuzz/fuzzApp.cpp) + if(CLI11_SINGLE_FILE AND CLI11_SINGLE_FILE_TESTS) + target_compile_definitions(FuzzFailTest_Single PUBLIC -DTEST_FILE_FOLDER="${TEST_FILE_FOLDER}") + target_sources(FuzzFailTest_Single PUBLIC ${PROJECT_SOURCE_DIR}/fuzz/fuzzApp.cpp) + endif() +endif() + # Add -Wno-deprecated-declarations to DeprecatedTest set(no-deprecated-declarations $<$<CXX_COMPILER_ID:MSVC>:/wd4996> $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated-declarations>) diff --git a/packages/CLI11/tests/ComplexTypeTest.cpp b/packages/CLI11/tests/ComplexTypeTest.cpp index 156798badc6bfbb30b01160e7b0fb88c780be8b3..adcd26c4b24da2a5d4205a8a3d262b0d8c237dcc 100644 --- a/packages/CLI11/tests/ComplexTypeTest.cpp +++ b/packages/CLI11/tests/ComplexTypeTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -9,8 +9,6 @@ #include <complex> #include <cstdint> -using Catch::Matchers::Contains; - using cx = std::complex<double>; CLI::Option * diff --git a/packages/CLI11/tests/ConfigFileTest.cpp b/packages/CLI11/tests/ConfigFileTest.cpp index 0b11ffefbd9a4076be7febce20cd43481e801248..206872728c1734d1632000d9f9c208cb23839060 100644 --- a/packages/CLI11/tests/ConfigFileTest.cpp +++ b/packages/CLI11/tests/ConfigFileTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -9,8 +9,6 @@ #include <cstdio> #include <sstream> -using Catch::Matchers::Contains; - TEST_CASE("StringBased: convert_arg_for_ini", "[config]") { CHECK("\"\"" == CLI::detail::convert_arg_for_ini(std::string{})); @@ -435,6 +433,8 @@ TEST_CASE("StringBased: file_error", "[config]") { CHECK_THROWS_AS(CLI::ConfigINI().from_file("nonexist_file"), CLI::FileError); } +static const int fclear1 = fileClear("TestIniTmp.ini"); + TEST_CASE_METHOD(TApp, "IniNotRequired", "[config]") { TempFile tmpini{"TestIniTmp.ini"}; @@ -507,10 +507,47 @@ TEST_CASE_METHOD(TApp, "IniGetRemainingOption", "[config]") { int two{0}; app.add_option("--two", two); REQUIRE_NOTHROW(run()); - std::vector<std::string> ExpectedRemaining = {ExtraOption}; + std::vector<std::string> ExpectedRemaining = {ExtraOption, "3"}; CHECK(ExpectedRemaining == app.remaining()); } +TEST_CASE_METHOD(TApp, "IniRemainingSub", "[config]") { + TempFile tmpini{"TestIniTmp.ini"}; + + app.set_config("--config", tmpini); + auto *map = app.add_subcommand("map"); + map->allow_config_extras(); + + { + std::ofstream out{tmpini}; + out << "[map]\n"; + out << "a = 1\n"; + out << "b=[1,2,3]\n"; + out << "c = 3" << std::endl; + } + + REQUIRE_NOTHROW(run()); + std::vector<std::string> rem = map->remaining(); + REQUIRE(rem.size() == 8U); + CHECK(rem[0] == "map.a"); + CHECK(rem[2] == "map.b"); + CHECK(rem[6] == "map.c"); + CHECK(rem[5] == "3"); + + int a{0}; + int c{0}; + std::vector<int> b; + map->add_option("-a", a); + map->add_option("-b", b); + map->add_option("-c", c); + + CHECK_NOTHROW(app.parse(app.remaining_for_passthrough())); + CHECK(a == 1); + CHECK(c == 3); + REQUIRE(b.size() == 3U); + CHECK(b[1] == 2); +} + TEST_CASE_METHOD(TApp, "IniGetNoRemaining", "[config]") { TempFile tmpini{"TestIniTmp.ini"}; @@ -595,6 +632,8 @@ TEST_CASE_METHOD(TApp, "IniNotRequiredbadConfigurator", "[config]") { REQUIRE_NOTHROW(run()); } +static const int fclear2 = fileClear("TestIniTmp2.ini"); + TEST_CASE_METHOD(TApp, "IniNotRequiredNotDefault", "[config]") { TempFile tmpini{"TestIniTmp.ini"}; @@ -1017,17 +1056,19 @@ TEST_CASE_METHOD(TApp, "TOMLStringVector", "[config]") { out << "zero1=[]\n"; out << "zero2={}\n"; out << "zero3={}\n"; + out << "zero4=[\"{}\",\"\"]\n"; out << "nzero={}\n"; out << "one=[\"1\"]\n"; out << "two=[\"2\",\"3\"]\n"; out << "three=[\"1\",\"2\",\"3\"]\n"; } - std::vector<std::string> nzero, zero1, zero2, zero3, one, two, three; + std::vector<std::string> nzero, zero1, zero2, zero3, zero4, one, two, three; app.add_option("--zero1", zero1)->required()->expected(0, 99)->default_str("{}"); app.add_option("--zero2", zero2)->required()->expected(0, 99)->default_val(std::vector<std::string>{}); // if no default is specified the argument results in an empty string app.add_option("--zero3", zero3)->required()->expected(0, 99); + app.add_option("--zero4", zero4)->required()->expected(0, 99); app.add_option("--nzero", nzero)->required(); app.add_option("--one", one)->required(); app.add_option("--two", two)->required(); @@ -1038,6 +1079,7 @@ TEST_CASE_METHOD(TApp, "TOMLStringVector", "[config]") { CHECK(zero1 == std::vector<std::string>({})); CHECK(zero2 == std::vector<std::string>({})); CHECK(zero3 == std::vector<std::string>({""})); + CHECK(zero4 == std::vector<std::string>({"{}"})); CHECK(nzero == std::vector<std::string>({"{}"})); CHECK(one == std::vector<std::string>({"1"})); CHECK(two == std::vector<std::string>({"2", "3"})); @@ -1735,6 +1777,23 @@ TEST_CASE_METHOD(TApp, "IniFlagDual", "[config]") { CHECK_THROWS_AS(run(), CLI::ConversionError); } +TEST_CASE_METHOD(TApp, "IniVectorMax", "[config]") { + + TempFile tmpini{"TestIniTmp.ini"}; + + std::vector<std::string> v1; + app.config_formatter(std::make_shared<CLI::ConfigINI>()); + app.add_option("--vec", v1)->expected(0, 2); + app.set_config("--config", tmpini); + + { + std::ofstream out{tmpini}; + out << "vec=[a,b,c]" << std::endl; + } + + CHECK_THROWS_AS(run(), CLI::ArgumentMismatch); +} + TEST_CASE_METHOD(TApp, "IniShort", "[config]") { TempFile tmpini{"TestIniTmp.ini"}; @@ -2000,6 +2059,51 @@ TEST_CASE_METHOD(TApp, "IniFalseFlagsDefDisableOverrideSuccess", "[config]") { CHECK(val == 15); } +static const int fclear3 = fileClear("TestIniTmp3.ini"); + +TEST_CASE_METHOD(TApp, "IniDisableFlagOverride", "[config]") { + + TempFile tmpini{"TestIniTmp.ini"}; + TempFile tmpini2{"TestIniTmp2.ini"}; + TempFile tmpini3{"TestIniTmp3.ini"}; + + app.set_config("--config", tmpini); + + { + std::ofstream out{tmpini}; + out << "[default]" << std::endl; + out << "two=2" << std::endl; + } + + { + std::ofstream out{tmpini2}; + out << "[default]" << std::endl; + out << "two=7" << std::endl; + } + + { + std::ofstream out{tmpini3}; + out << "[default]" << std::endl; + out << "three=true" << std::endl; + } + + int val{0}; + app.add_flag("--one{1},--two{2},--three{3}", val)->disable_flag_override(); + + run(); + CHECK(tmpini.c_str() == app["--config"]->as<std::string>()); + CHECK(val == 2); + + args = {"--config", tmpini2}; + CHECK_THROWS_AS(run(), CLI::ArgumentMismatch); + + args = {"--config", tmpini3}; + run(); + + CHECK(val == 3); + CHECK(tmpini3.c_str() == app.get_config_ptr()->as<std::string>()); +} + TEST_CASE_METHOD(TApp, "TomlOutputSimple", "[config]") { int v{0}; @@ -2497,6 +2601,29 @@ TEST_CASE_METHOD(TApp, "ConfigWriteReadWrite", "[config]") { CHECK(config2 == config1); } +TEST_CASE_METHOD(TApp, "ConfigWriteReadNegated", "[config]") { + + TempFile tmpini{"TestIniTmp.ini"}; + bool flag{true}; + app.add_flag("!--no-flag", flag); + args = {"--no-flag"}; + run(); + + // Save config, with default values too + std::string config1 = app.config_to_str(false, false); + { + std::ofstream out{tmpini}; + out << config1 << std::endl; + } + CHECK_FALSE(flag); + args.clear(); + flag = true; + app.set_config("--config", tmpini, "Read an ini file", true); + run(); + + CHECK_FALSE(flag); +} + /////// INI output tests TEST_CASE_METHOD(TApp, "IniOutputSimple", "[config]") { diff --git a/packages/CLI11/tests/CreationTest.cpp b/packages/CLI11/tests/CreationTest.cpp index b58e0aabe07325a37dbe9ba76e4b4507a9cd2bfd..a51abd4889244d4fbd453db9b98d7a6a0d9c7ba0 100644 --- a/packages/CLI11/tests/CreationTest.cpp +++ b/packages/CLI11/tests/CreationTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -455,6 +455,7 @@ TEST_CASE_METHOD(TApp, "SubcommandDefaults", "[creation]") { CHECK(!app.get_configurable()); CHECK(!app.get_validate_positionals()); + CHECK(app.get_usage().empty()); CHECK(app.get_footer().empty()); CHECK("Subcommands" == app.get_group()); CHECK(0u == app.get_require_subcommand_min()); @@ -474,6 +475,7 @@ TEST_CASE_METHOD(TApp, "SubcommandDefaults", "[creation]") { app.fallthrough(); app.validate_positionals(); + app.usage("ussy"); app.footer("footy"); app.group("Stuff"); app.require_subcommand(2, 3); @@ -494,6 +496,7 @@ TEST_CASE_METHOD(TApp, "SubcommandDefaults", "[creation]") { CHECK(app2->get_fallthrough()); CHECK(app2->get_validate_positionals()); CHECK(app2->get_configurable()); + CHECK("ussy" == app2->get_usage()); CHECK("footy" == app2->get_footer()); CHECK("Stuff" == app2->get_group()); CHECK(0u == app2->get_require_subcommand_min()); @@ -549,6 +552,25 @@ TEST_CASE_METHOD(TApp, "GetOptionList", "[creation]") { } } +TEST_CASE_METHOD(TApp, "GetOptionListFilter", "[creation]") { + int two{0}; + auto *flag = app.add_flag("--one"); + app.add_option("--two", two); + + const CLI::App &const_app = app; // const alias to force use of const-methods + std::vector<const CLI::Option *> opt_listc = + const_app.get_options([](const CLI::Option *opt) { return opt->get_name() == "--one"; }); + + REQUIRE(static_cast<std::size_t>(1) == opt_listc.size()); + CHECK(flag == opt_listc.at(0)); + + std::vector<CLI::Option *> opt_list = + app.get_options([](const CLI::Option *opt) { return opt->get_name() == "--one"; }); + + REQUIRE(static_cast<std::size_t>(1) == opt_list.size()); + CHECK(flag == opt_list.at(0)); +} + TEST_CASE("ValidatorTests: TestValidatorCreation", "[creation]") { std::function<std::string(std::string &)> op1 = [](std::string &val) { return (val.size() >= 5) ? std::string{} : val; diff --git a/packages/CLI11/tests/DeprecatedTest.cpp b/packages/CLI11/tests/DeprecatedTest.cpp index 8c45f24950e392d03b4eaf13b1afde1da3d1879a..063c67e5e884dc6f004b23176eabb9b57bc63f3c 100644 --- a/packages/CLI11/tests/DeprecatedTest.cpp +++ b/packages/CLI11/tests/DeprecatedTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -6,8 +6,6 @@ #include "app_helper.hpp" -using Catch::Matchers::Contains; - TEST_CASE("Deprecated: Empty", "[deprecated]") { // No deprecated features at this time. CHECK(true); diff --git a/packages/CLI11/tests/EncodingTest.cpp b/packages/CLI11/tests/EncodingTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b026ee0143dc3331f8b49f306358db7031233bf2 --- /dev/null +++ b/packages/CLI11/tests/EncodingTest.cpp @@ -0,0 +1,104 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#include "app_helper.hpp" + +#include <array> +#include <string> + +#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 +#include <filesystem> +#endif // CLI11_HAS_FILESYSTEM + +// "abcd" +static const std::string abcd_str = "abcd"; // NOLINT(runtime/string) +static const std::wstring abcd_wstr = L"abcd"; // NOLINT(runtime/string) + +// "𓂀𓂀𓂀" - 4-byte utf8 characters +static const std::array<uint8_t, 12 + 1> egypt_utf8_codeunits{ + {0xF0, 0x93, 0x82, 0x80, 0xF0, 0x93, 0x82, 0x80, 0xF0, 0x93, 0x82, 0x80}}; +static const std::string egypt_str(reinterpret_cast<const char *>(egypt_utf8_codeunits.data())); + +#ifdef _WIN32 +static const std::array<uint16_t, 6 + 1> egypt_utf16_codeunits{{0xD80C, 0xDC80, 0xD80C, 0xDC80, 0xD80C, 0xDC80}}; +static const std::wstring egypt_wstr(reinterpret_cast<const wchar_t *>(egypt_utf16_codeunits.data())); + +#else +static const std::array<uint32_t, 3 + 1> egypt_utf32_codeunits{{0x00013080, 0x00013080, 0x00013080}}; +static const std::wstring egypt_wstr(reinterpret_cast<const wchar_t *>(egypt_utf32_codeunits.data())); + +#endif + +// "Hello Halló Привет 你好 👩🚀❤️" - many languages and complex emojis +static const std::array<uint8_t, 50 + 1> hello_utf8_codeunits{ + {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x48, 0x61, 0x6c, 0x6c, 0xc3, 0xb3, 0x20, 0xd0, 0x9f, 0xd1, 0x80, + 0xd0, 0xb8, 0xd0, 0xb2, 0xd0, 0xb5, 0xd1, 0x82, 0x20, 0xe4, 0xbd, 0xa0, 0xe5, 0xa5, 0xbd, 0x20, 0xf0, + 0x9f, 0x91, 0xa9, 0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x9a, 0x80, 0xe2, 0x9d, 0xa4, 0xef, 0xb8, 0x8f}}; +static const std::string hello_str(reinterpret_cast<const char *>(hello_utf8_codeunits.data())); + +#ifdef _WIN32 +static const std::array<uint16_t, 29 + 1> hello_utf16_codeunits{ + {0x0048, 0x0065, 0x006c, 0x006c, 0x006f, 0x0020, 0x0048, 0x0061, 0x006c, 0x006c, + 0x00f3, 0x0020, 0x041f, 0x0440, 0x0438, 0x0432, 0x0435, 0x0442, 0x0020, 0x4f60, + 0x597d, 0x0020, 0xd83d, 0xdc69, 0x200d, 0xd83d, 0xde80, 0x2764, 0xfe0f}}; +static const std::wstring hello_wstr(reinterpret_cast<const wchar_t *>(hello_utf16_codeunits.data())); + +#else +static const std::array<uint32_t, 27 + 1> hello_utf32_codeunits{ + {0x00000048, 0x00000065, 0x0000006c, 0x0000006c, 0x0000006f, 0x00000020, 0x00000048, 0x00000061, 0x0000006c, + 0x0000006c, 0x000000f3, 0x00000020, 0x0000041f, 0x00000440, 0x00000438, 0x00000432, 0x00000435, 0x00000442, + 0x00000020, 0x00004f60, 0x0000597d, 0x00000020, 0x0001f469, 0x0000200d, 0x0001f680, 0x00002764, 0x0000fe0f}}; +static const std::wstring hello_wstr(reinterpret_cast<const wchar_t *>(hello_utf32_codeunits.data())); + +#endif + +// #14 +TEST_CASE("Encoding: Widen", "[unicode]") { + using CLI::widen; + + CHECK(abcd_wstr == widen(abcd_str)); + CHECK(egypt_wstr == widen(egypt_str)); + CHECK(hello_wstr == widen(hello_str)); + + CHECK(hello_wstr == widen(hello_str.c_str())); + CHECK(hello_wstr == widen(hello_str.c_str(), hello_str.size())); + +#ifdef CLI11_CPP17 + CHECK(hello_wstr == widen(std::string_view{hello_str})); +#endif // CLI11_CPP17 +} + +// #14 +TEST_CASE("Encoding: Narrow", "[unicode]") { + using CLI::narrow; + + CHECK(abcd_str == narrow(abcd_wstr)); + CHECK(egypt_str == narrow(egypt_wstr)); + CHECK(hello_str == narrow(hello_wstr)); + + CHECK(hello_str == narrow(hello_wstr.c_str())); + CHECK(hello_str == narrow(hello_wstr.c_str(), hello_wstr.size())); + +#ifdef CLI11_CPP17 + CHECK(hello_str == narrow(std::wstring_view{hello_wstr})); +#endif // CLI11_CPP17 +} + +#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 +// #14 +TEST_CASE("Encoding: to_path roundtrip", "[unicode]") { + using std::filesystem::path; + +#ifdef _WIN32 + std::wstring native_str = CLI::widen(hello_str); +#else + std::string native_str = hello_str; +#endif // _WIN32 + + CHECK(CLI::to_path(hello_str).native() == native_str); +} + +#endif // CLI11_HAS_FILESYSTEM diff --git a/packages/CLI11/tests/FormatterTest.cpp b/packages/CLI11/tests/FormatterTest.cpp index 7f68cf17659ec0d6e3591520298e6fd17395a7a7..2563c9421c54ea03c2a5a9ea7284a8a42db11288 100644 --- a/packages/CLI11/tests/FormatterTest.cpp +++ b/packages/CLI11/tests/FormatterTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -13,8 +13,6 @@ #include "catch.hpp" #include <fstream> -using Catch::Matchers::Contains; - class SimpleFormatter : public CLI::FormatterBase { public: SimpleFormatter() : FormatterBase() {} @@ -63,7 +61,7 @@ TEST_CASE("Formatter: OptCustomize", "[formatter]") { "Usage: [OPTIONS]\n\n" "Options:\n" " -h,--help Print this help message and exit\n" - " --opt INT (MUST HAVE) Something\n\n"); + " --opt INT (MUST HAVE) Something\n"); } TEST_CASE("Formatter: OptCustomizeSimple", "[formatter]") { @@ -82,7 +80,7 @@ TEST_CASE("Formatter: OptCustomizeSimple", "[formatter]") { "Usage: [OPTIONS]\n\n" "Options:\n" " -h,--help Print this help message and exit\n" - " --opt INT (MUST HAVE) Something\n\n"); + " --opt INT (MUST HAVE) Something\n"); } TEST_CASE("Formatter: OptCustomizeOptionText", "[formatter]") { @@ -100,7 +98,7 @@ TEST_CASE("Formatter: OptCustomizeOptionText", "[formatter]") { "Usage: [OPTIONS]\n\n" "Options:\n" " -h,--help Print this help message and exit\n" - " --opt (ARG) Something\n\n"); + " --opt (ARG) Something\n"); } TEST_CASE("Formatter: FalseFlagExample", "[formatter]") { @@ -140,7 +138,7 @@ TEST_CASE("Formatter: AppCustomize", "[formatter]") { " -h,--help Print this help message and exit\n\n" "Subcommands:\n" " subcom1 This\n" - " subcom2 This\n\n"); + " subcom2 This\n"); } TEST_CASE("Formatter: AppCustomizeSimple", "[formatter]") { @@ -159,7 +157,7 @@ TEST_CASE("Formatter: AppCustomizeSimple", "[formatter]") { " -h,--help Print this help message and exit\n\n" "Subcommands:\n" " subcom1 This\n" - " subcom2 This\n\n"); + " subcom2 This\n"); } TEST_CASE("Formatter: AllSub", "[formatter]") { diff --git a/packages/CLI11/tests/FuzzFailTest.cpp b/packages/CLI11/tests/FuzzFailTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..22148368819a9a4763dde949b68c5082c445694d --- /dev/null +++ b/packages/CLI11/tests/FuzzFailTest.cpp @@ -0,0 +1,37 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#include "../fuzz/fuzzApp.hpp" +#include "app_helper.hpp" + +std::string loadFailureFile(const std::string &type, int index) { + std::string fileName(TEST_FILE_FOLDER "/fuzzFail/"); + fileName.append(type); + fileName += std::to_string(index); + std::ifstream crashFile(fileName, std::ios::in | std::ios::binary); + if(crashFile) { + std::vector<char> buffer(std::istreambuf_iterator<char>(crashFile), {}); + + std::string cdata(buffer.begin(), buffer.end()); + return cdata; + } + return std::string{}; +} + +TEST_CASE("app_fail") { + CLI::FuzzApp fuzzdata; + + auto app = fuzzdata.generateApp(); + + int index = GENERATE(range(1, 3)); + + auto parseData = loadFailureFile("fuzz_app_fail", index); + try { + + app->parse(parseData); + } catch(const CLI::ParseError & /*e*/) { + } +} diff --git a/packages/CLI11/tests/HelpTest.cpp b/packages/CLI11/tests/HelpTest.cpp index eb0edd6a0ba8f8be54fc3402bacdcf601c3838ed..c4403f754f48ed99c8188bf3cdecae64448da4ac 100644 --- a/packages/CLI11/tests/HelpTest.cpp +++ b/packages/CLI11/tests/HelpTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -13,8 +13,6 @@ #include "catch.hpp" #include <fstream> -using Catch::Matchers::Contains; - TEST_CASE("THelp: Basic", "[help]") { CLI::App app{"My prog"}; @@ -26,6 +24,43 @@ TEST_CASE("THelp: Basic", "[help]") { CHECK_THAT(help, Contains("Usage:")); } +TEST_CASE("THelp: Usage", "[help]") { + CLI::App app{"My prog"}; + app.usage("use: just use it"); + + std::string help = app.help(); + + CHECK_THAT(help, Contains("My prog")); + CHECK_THAT(help, Contains("-h,--help")); + CHECK_THAT(help, Contains("Options:")); + CHECK_THAT(help, Contains("use: just use it")); +} + +TEST_CASE("THelp: UsageCallback", "[help]") { + CLI::App app{"My prog"}; + app.usage([]() { return "use: just use it"; }); + + std::string help = app.help(); + + CHECK_THAT(help, Contains("My prog")); + CHECK_THAT(help, Contains("-h,--help")); + CHECK_THAT(help, Contains("Options:")); + CHECK_THAT(help, Contains("use: just use it")); +} + +TEST_CASE("THelp: UsageCallbackBoth", "[help]") { + CLI::App app{"My prog"}; + app.usage([]() { return "use: just use it"; }); + app.usage("like 1, 2, and 3"); + std::string help = app.help(); + + CHECK_THAT(help, Contains("My prog")); + CHECK_THAT(help, Contains("-h,--help")); + CHECK_THAT(help, Contains("Options:")); + CHECK_THAT(help, Contains("use: just use it")); + CHECK_THAT(help, Contains("like 1, 2, and 3")); +} + TEST_CASE("THelp: Footer", "[help]") { CLI::App app{"My prog"}; app.footer("Report bugs to bugs@example.com"); @@ -813,7 +848,7 @@ TEST_CASE_METHOD(CapturedHelp, "CallForAllHelpOutput", "[help]") { " One description\n\n" "two\n" " Options:\n" - " --three \n\n\n"); + " --three \n\n"); } TEST_CASE_METHOD(CapturedHelp, "NewFormattedHelp", "[help]") { app.formatter_fn([](const CLI::App *, std::string, CLI::AppFormatMode) { return "New Help"; }); @@ -974,6 +1009,16 @@ TEST_CASE("THelp: GroupOrder", "[help]") { CHECK(aee_loc > zee_loc); } +TEST_CASE("THelp: GroupNameError", "[help]") { + CLI::App app; + + auto *f1 = app.add_flag("--one"); + auto *f2 = app.add_flag("--two"); + + CHECK_THROWS_AS(f1->group("evil group name\non two lines"), CLI::IncorrectConstruction); + CHECK_THROWS_AS(f2->group(std::string(5, '\0')), CLI::IncorrectConstruction); +} + TEST_CASE("THelp: ValidatorsText", "[help]") { CLI::App app; @@ -1266,7 +1311,7 @@ TEST_CASE("TVersion: parse_throw", "[help]") { try { app.parse("--Version"); } catch(const CLI::CallForVersion &v) { - CHECK_THAT(CLI11_VERSION, Catch::Equals(v.what())); + CHECK_THAT(CLI11_VERSION, Equals(v.what())); CHECK(0 == v.get_exit_code()); const auto &appc = app; const auto *cptr = appc.get_version_ptr(); diff --git a/packages/CLI11/tests/HelpersTest.cpp b/packages/CLI11/tests/HelpersTest.cpp index 798a6d13d5e06767946f76863dc32fa6edd942ba..5186b47fcfc2a5648048d42cb82570437d1962ac 100644 --- a/packages/CLI11/tests/HelpersTest.cpp +++ b/packages/CLI11/tests/HelpersTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -525,6 +525,10 @@ TEST_CASE("Validators: ProgramNameSplit", "[helpers]") { res = CLI::detail::split_program_name(std::string(" ./") + std::string(myfile) + " "); CHECK(std::string("./") + std::string(myfile) == res.first); CHECK(res.second.empty()); + + res = CLI::detail::split_program_name("'odd_program_name.exe --arg --arg2=5"); + CHECK("'odd_program_name.exe" == res.first); + CHECK_FALSE(res.second.empty()); } TEST_CASE("CheckedMultiply: Int", "[helpers]") { @@ -1065,6 +1069,10 @@ TEST_CASE("Types: LexicalCastInt", "[helpers]") { std::string extra_input = "912i"; CHECK_FALSE(CLI::detail::lexical_cast(extra_input, y)); + extra_input = "true"; + CHECK(CLI::detail::lexical_cast(extra_input, x_signed)); + CHECK(x_signed != 0); + std::string empty_input{}; CHECK_FALSE(CLI::detail::lexical_cast(empty_input, x_signed)); CHECK_FALSE(CLI::detail::lexical_cast(empty_input, x_unsigned)); @@ -1228,6 +1236,8 @@ TEST_CASE("Types: LexicalConversionTuple3", "[helpers]") { TEST_CASE("Types: LexicalConversionTuple4", "[helpers]") { CLI::results_t input = {"9.12", "19", "18.6", "5.87"}; std::array<double, 4> x; + auto tsize = CLI::detail::type_count<decltype(x)>::value; + CHECK(tsize == 4); bool res = CLI::detail::lexical_conversion<decltype(x), decltype(x)>(input, x); CHECK(res); CHECK(19 == Approx(std::get<1>(x))); diff --git a/packages/CLI11/tests/NewParseTest.cpp b/packages/CLI11/tests/NewParseTest.cpp index a4ca09987afebfbfdcac84fdeb08f75f8aa532f7..a72af823bb8ce9c596351f3bb77fa67dde750325 100644 --- a/packages/CLI11/tests/NewParseTest.cpp +++ b/packages/CLI11/tests/NewParseTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -10,8 +10,6 @@ #include <cstdint> #include <utility> -using Catch::Matchers::Contains; - using cx = std::complex<double>; TEST_CASE_METHOD(TApp, "ComplexOption", "[newparse]") { @@ -163,14 +161,10 @@ class spair { std::string first{}; std::string second{}; }; -// an example of custom converter that can be used to add new parsing options -// On MSVC and possibly some other new compilers this can be a free standing function without the template -// specialization but this is compiler dependent -namespace CLI { -namespace detail { - -template <> bool lexical_cast<spair>(const std::string &input, spair &output) { +// Example of a custom converter that can be used to add new parsing options. +// It will be found via argument-dependent lookup, so should be in the same namespace as the `spair` type. +bool lexical_cast(const std::string &input, spair &output) { auto sep = input.find_first_of(':'); if((sep == std::string::npos) && (sep > 0)) { return false; @@ -178,8 +172,6 @@ template <> bool lexical_cast<spair>(const std::string &input, spair &output) { output = {input.substr(0, sep), input.substr(sep + 1)}; return true; } -} // namespace detail -} // namespace CLI TEST_CASE_METHOD(TApp, "custom_string_converter", "[newparse]") { spair val; @@ -201,6 +193,96 @@ TEST_CASE_METHOD(TApp, "custom_string_converterFail", "[newparse]") { CHECK_THROWS_AS(run(), CLI::ConversionError); } +/// Wrapper with an unconvenient interface +template <class T> class badlywrapped { + public: + badlywrapped() : value() {} + + CLI11_NODISCARD T get() const { return value; } + + void set(T val) { value = val; } + + private: + T value; +}; + +// Example of a custom converter for a template type. +// It will be found via argument-dependent lookup, so should be in the same namespace as the `badlywrapped` type. +template <class T> bool lexical_cast(const std::string &input, badlywrapped<T> &output) { + // This using declaration lets us use an unqualified call to lexical_cast below. This is important because + // unqualified call finds the proper overload via argument-dependent lookup, and thus it will be able to find + // an overload for `spair` type, which is not in `CLI::detail`. + using CLI::detail::lexical_cast; + + T value; + if(!lexical_cast(input, value)) + return false; + output.set(value); + return true; +} + +TEST_CASE_METHOD(TApp, "custom_string_converter_flag", "[newparse]") { + badlywrapped<bool> val; + std::vector<badlywrapped<bool>> vals; + app.add_flag("-1", val); + app.add_flag("-2", vals); + + val.set(false); + args = {"-1"}; + run(); + CHECK(true == val.get()); + + args = {"-2", "-2"}; + run(); + CHECK(2 == vals.size()); + CHECK(true == vals[0].get()); + CHECK(true == vals[1].get()); +} + +TEST_CASE_METHOD(TApp, "custom_string_converter_adl", "[newparse]") { + // This test checks that the lexical_cast calls route as expected. + badlywrapped<spair> val; + + app.add_option("-d,--dual_string", val); + + args = {"-d", "string1:string2"}; + + run(); + CHECK("string1" == val.get().first); + CHECK("string2" == val.get().second); +} + +/// Another wrapper to test that specializing CLI::detail::lexical_cast works +struct anotherstring { + anotherstring() = default; + std::string s{}; +}; + +// This is a custom converter done via specializing the CLI::detail::lexical_cast template. This was the recommended +// mechanism for extending the library before, so we need to test it. Don't do this in your code, use +// argument-dependent lookup as outlined in the examples for spair and template badlywrapped. +namespace CLI { +namespace detail { +template <> bool lexical_cast<anotherstring>(const std::string &input, anotherstring &output) { + bool result = lexical_cast(input, output.s); + if(result) + output.s += "!"; + return result; +} +} // namespace detail +} // namespace CLI + +TEST_CASE_METHOD(TApp, "custom_string_converter_specialize", "[newparse]") { + anotherstring s; + + app.add_option("-s", s); + + args = {"-s", "something"}; + + run(); + CHECK("something!" == s.s); +} + /// simple class to wrap another with a very specific type constructor and assignment operators to test out some of the /// option assignments template <class X> class objWrapper { @@ -221,6 +303,27 @@ template <class X> class objWrapper { X val_{}; }; +/// simple class to wrap another with a very specific type constructor and assignment operators to test out some of the +/// option assignments +template <class X> class objWrapperRestricted { + public: + objWrapperRestricted() = default; + explicit objWrapperRestricted(int val) : val_{val} {}; + objWrapperRestricted(const objWrapperRestricted &) = delete; + objWrapperRestricted(objWrapperRestricted &&) = delete; + objWrapperRestricted &operator=(const objWrapperRestricted &) = delete; + objWrapperRestricted &operator=(objWrapperRestricted &&) = delete; + + objWrapperRestricted &operator=(int val) { + val_ = val; + return *this; + } + CLI11_NODISCARD const X &value() const { return val_; } + + private: + X val_{}; +}; + // I think there is a bug with the is_assignable in visual studio 2015 it is fixed in later versions // so this test will not compile in that compiler #if !defined(_MSC_VER) || _MSC_VER >= 1910 @@ -263,6 +366,26 @@ TEST_CASE_METHOD(TApp, "doubleWrapper", "[newparse]") { CHECK_THROWS_AS(run(), CLI::ConversionError); } +TEST_CASE_METHOD(TApp, "intWrapperRestricted", "[newparse]") { + objWrapperRestricted<double> dWrapper; + app.add_option("-v", dWrapper); + args = {"-v", "4"}; + + run(); + + CHECK(4.0 == dWrapper.value()); + + args = {"-v", "thing"}; + + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-v", ""}; + + run(); + + CHECK(0.0 == dWrapper.value()); +} + static_assert(CLI::detail::is_direct_constructible<objWrapper<int>, int>::value, "int wrapper is not constructible from int64"); diff --git a/packages/CLI11/tests/OptionGroupTest.cpp b/packages/CLI11/tests/OptionGroupTest.cpp index bc3a9455ff71bcfaaa35edb8acfd18a238818edd..ab4d3c638d29c07ba0d0c54f3d9b216b870f6af3 100644 --- a/packages/CLI11/tests/OptionGroupTest.cpp +++ b/packages/CLI11/tests/OptionGroupTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -6,8 +6,6 @@ #include "app_helper.hpp" -using Catch::Matchers::Contains; - using vs_t = std::vector<std::string>; TEST_CASE_METHOD(TApp, "BasicOptionGroup", "[optiongroup]") { @@ -448,6 +446,12 @@ TEST_CASE_METHOD(ManyGroups, "SingleGroup", "[optiongroup]") { CHECK_THROWS_AS(run(), CLI::RequiredError); } +TEST_CASE_METHOD(ManyGroups, "getGroup", "[optiongroup]") { + auto *mn = app.get_option_group("main"); + CHECK(mn == main); + CHECK_THROWS_AS(app.get_option_group("notfound"), CLI::OptionNotFound); +} + TEST_CASE_METHOD(ManyGroups, "ExcludesGroup", "[optiongroup]") { // only 1 group can be used g1->excludes(g2); diff --git a/packages/CLI11/tests/OptionTypeTest.cpp b/packages/CLI11/tests/OptionTypeTest.cpp index b48ba6d5bb85252c5f2593420783bca7aee9c790..6d06a5af3ebabbe695825183d936cb81f0c2a4d2 100644 --- a/packages/CLI11/tests/OptionTypeTest.cpp +++ b/packages/CLI11/tests/OptionTypeTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -336,6 +336,36 @@ TEST_CASE_METHOD(TApp, "pair_check", "[optiontype]") { CHECK_THROWS_AS(run(), CLI::ValidationError); } +TEST_CASE_METHOD(TApp, "pair_check_string", "[optiontype]") { + std::string myfile{"pair_check_file.txt"}; + bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file + CHECK(ok); + + CHECK(CLI::ExistingFile(myfile).empty()); + std::pair<std::string, std::string> findex; + + auto v0 = CLI::ExistingFile; + v0.application_index(0); + auto v1 = CLI::PositiveNumber; + v1.application_index(1); + app.add_option("--file", findex)->check(v0)->check(v1); + + args = {"--file", myfile, "2"}; + + CHECK_NOTHROW(run()); + + CHECK(myfile == findex.first); + CHECK("2" == findex.second); + + args = {"--file", myfile, "-3"}; + + CHECK_THROWS_AS(run(), CLI::ValidationError); + + args = {"--file", myfile, "2"}; + std::remove(myfile.c_str()); + CHECK_THROWS_AS(run(), CLI::ValidationError); +} + TEST_CASE_METHOD(TApp, "pair_check_take_first", "[optiontype]") { std::string myfile{"pair_check_file2.txt"}; bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file @@ -405,6 +435,86 @@ TEST_CASE_METHOD(TApp, "VectorIndexedValidator", "[optiontype]") { CHECK_THROWS_AS(run(), CLI::ValidationError); } +TEST_CASE_METHOD(TApp, "IntegerOverFlowShort", "[optiontype]") { + std::int16_t A{0}; + std::uint16_t B{0}; + + app.add_option("-a", A); + app.add_option("-b", B); + + args = {"-a", "2626254242"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "2626254242"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "-26262"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "-262624262525"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); +} + +TEST_CASE_METHOD(TApp, "IntegerOverFlowInt", "[optiontype]") { + int A{0}; + unsigned int B{0}; + + app.add_option("-a", A); + app.add_option("-b", B); + + args = {"-a", "262625424225252"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "262625424225252"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "-2626225252"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "-26262426252525252"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); +} + +TEST_CASE_METHOD(TApp, "IntegerOverFlowLong", "[optiontype]") { + std::int32_t A{0}; + std::uint32_t B{0}; + + app.add_option("-a", A); + app.add_option("-b", B); + + args = {"-a", "1111111111111111111111111111"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "1111111111111111111111111111"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "-2626225252"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "-111111111111111111111111"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); +} + +TEST_CASE_METHOD(TApp, "IntegerOverFlowLongLong", "[optiontype]") { + std::int64_t A{0}; + std::uint64_t B{0}; + + app.add_option("-a", A); + app.add_option("-b", B); + + args = {"-a", "1111111111111111111111111111111111111111111111111111111111"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "1111111111111111111111111111111111111111111111111111111111"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "-2626225252"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); + + args = {"-b", "-111111111111111111111111111111111111111111111111111111111"}; + CHECK_THROWS_AS(run(), CLI::ConversionError); +} + TEST_CASE_METHOD(TApp, "VectorUnlimString", "[optiontype]") { std::vector<std::string> strvec; std::vector<std::string> answer{"mystring", "mystring2", "mystring3"}; diff --git a/packages/CLI11/tests/OptionalTest.cpp b/packages/CLI11/tests/OptionalTest.cpp index 4094c44b6c4687bcc928bd06d24187fb3082509a..3d78e3498c9a3ff99096867786552fc548d40212 100644 --- a/packages/CLI11/tests/OptionalTest.cpp +++ b/packages/CLI11/tests/OptionalTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/SetTest.cpp b/packages/CLI11/tests/SetTest.cpp index 8184350dc92dcbc68bccae95cba20ac294ea9534..b326989997824f18fdca60c47a09b38c243df9e0 100644 --- a/packages/CLI11/tests/SetTest.cpp +++ b/packages/CLI11/tests/SetTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -492,6 +492,23 @@ TEST_CASE_METHOD(TApp, "FailSet", "[set]") { CHECK_THROWS_AS(run(), CLI::ValidationError); } +TEST_CASE_METHOD(TApp, "shortStringCheck", "[set]") { + + std::string choice; + app.add_option("-q,--quick", choice)->check([](const std::string &v) { + if(v.size() > 5) { + return std::string{"string too long"}; + } + return std::string{}; + }); + + args = {"--quick", "3"}; + CHECK_NOTHROW(run()); + + args = {"--quick=hello_goodbye"}; + CHECK_THROWS_AS(run(), CLI::ValidationError); +} + TEST_CASE_METHOD(TApp, "FailMutableSet", "[set]") { int choice{0}; diff --git a/packages/CLI11/tests/SimpleTest.cpp b/packages/CLI11/tests/SimpleTest.cpp index 84ec6f0c409d50fae2af0e07f759f2687fc8dce0..14d6558b46c843a10763a0c6e0891b37806bf184 100644 --- a/packages/CLI11/tests/SimpleTest.cpp +++ b/packages/CLI11/tests/SimpleTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/StringParseTest.cpp b/packages/CLI11/tests/StringParseTest.cpp index 6a889e45c7b297b0ece75e465584544b9b0581c0..cc1205fe3b7b6050e4e2e56f242dc024c3694b8b 100644 --- a/packages/CLI11/tests/StringParseTest.cpp +++ b/packages/CLI11/tests/StringParseTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/SubcommandTest.cpp b/packages/CLI11/tests/SubcommandTest.cpp index a01b8863d76ec2a33fc55f3430cffa6153e5e62d..25415eaa7cf1241f46ac6788f6cfca285543c594 100644 --- a/packages/CLI11/tests/SubcommandTest.cpp +++ b/packages/CLI11/tests/SubcommandTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -6,8 +6,6 @@ #include "app_helper.hpp" -using Catch::Matchers::Contains; - using vs_t = std::vector<std::string>; TEST_CASE_METHOD(TApp, "BasicSubcommands", "[subcom]") { @@ -916,6 +914,10 @@ TEST_CASE_METHOD(TApp, "SubcomInheritCaseCheck", "[subcom]") { CHECK(app.get_subcommands({}).size() == 2u); CHECK(app.get_subcommands([](const CLI::App *s) { return s->get_name() == "sub1"; }).size() == 1u); + // check the const version of get_subcommands + const auto &app_const = app; + CHECK(app_const.get_subcommands([](const CLI::App *s) { return s->get_name() == "sub1"; }).size() == 1u); + args = {"SuB1"}; run(); CHECK(app.get_subcommands().at(0) == sub1); @@ -1192,6 +1194,18 @@ TEST_CASE_METHOD(ManySubcommands, "manyIndexQueryPtr", "[subcom]") { CHECK_THROWS_AS(app.get_subcommand_ptr(4), CLI::OptionNotFound); } +TEST_CASE_METHOD(ManySubcommands, "manyIndexQueryPtrByName", "[subcom]") { + auto s1 = app.get_subcommand_ptr("sub1"); + auto s2 = app.get_subcommand_ptr("sub2"); + auto s3 = app.get_subcommand_ptr("sub3"); + auto s4 = app.get_subcommand_ptr("sub4"); + CHECK(sub1 == s1.get()); + CHECK(sub2 == s2.get()); + CHECK(sub3 == s3.get()); + CHECK(sub4 == s4.get()); + CHECK_THROWS_AS(app.get_subcommand_ptr("sub5"), CLI::OptionNotFound); +} + TEST_CASE_METHOD(ManySubcommands, "Required1Fuzzy", "[subcom]") { app.require_subcommand(0, 1); @@ -1394,6 +1408,15 @@ TEST_CASE_METHOD(ManySubcommands, "SubcommandNeedsOptionsCallbackOrdering", "[su CHECK_NOTHROW(run()); } +TEST_CASE_METHOD(ManySubcommands, "SubcommandParseCompleteDotNotation", "[subcom]") { + int count{0}; + sub1->add_flag("--flag1"); + sub1->parse_complete_callback([&count]() { ++count; }); + args = {"--sub1.flag1", "--sub1.flag1"}; + run(); + CHECK(count == 2); +} + TEST_CASE_METHOD(ManySubcommands, "SubcommandNeedsFail", "[subcom]") { auto *opt = app.add_flag("--subactive"); @@ -1968,3 +1991,126 @@ TEST_CASE_METHOD(TApp, "SubcommandInOptionGroupCallbackCount", "[subcom]") { run(); CHECK(subcount == 1); } + +TEST_CASE_METHOD(TApp, "DotNotationSubcommand", "[subcom]") { + std::string v1, v2, vbase; + + auto *sub1 = app.add_subcommand("sub1"); + auto *sub2 = app.add_subcommand("sub2"); + sub1->add_option("--value", v1); + sub2->add_option("--value", v2); + app.add_option("--value", vbase); + args = {"--sub1.value", "val1"}; + run(); + CHECK(v1 == "val1"); + + args = {"--sub2.value", "val2", "--value", "base"}; + run(); + CHECK(v2 == "val2"); + CHECK(vbase == "base"); + v1.clear(); + v2.clear(); + vbase.clear(); + + args = {"--sub2.value=val2", "--value=base"}; + run(); + CHECK(v2 == "val2"); + CHECK(vbase == "base"); + + auto subs = app.get_subcommands(); + REQUIRE(!subs.empty()); + CHECK(subs.front()->get_name() == "sub2"); +} + +TEST_CASE_METHOD(TApp, "DotNotationSubcommandSingleChar", "[subcom]") { + std::string v1, v2, vbase; + + auto *sub1 = app.add_subcommand("sub1"); + auto *sub2 = app.add_subcommand("sub2"); + sub1->add_option("-v", v1); + sub2->add_option("-v", v2); + app.add_option("-v", vbase); + args = {"--sub1.v", "val1"}; + run(); + CHECK(v1 == "val1"); + + args = {"--sub2.v", "val2", "-v", "base"}; + run(); + CHECK(v2 == "val2"); + CHECK(vbase == "base"); + v1.clear(); + v2.clear(); + vbase.clear(); + + args = {"--sub2.v=val2", "-vbase"}; + run(); + CHECK(v2 == "val2"); + CHECK(vbase == "base"); + + auto subs = app.get_subcommands(); + REQUIRE(!subs.empty()); + CHECK(subs.front()->get_name() == "sub2"); +} + +TEST_CASE_METHOD(TApp, "DotNotationSubcommandRecusive", "[subcom]") { + std::string v1, v2, v3, vbase; + + auto *sub1 = app.add_subcommand("sub1"); + auto *sub2 = sub1->add_subcommand("sub2"); + auto *sub3 = sub2->add_subcommand("sub3"); + + sub1->add_option("--value", v1); + sub2->add_option("--value", v2); + sub3->add_option("--value", v3); + app.add_option("--value", vbase); + args = {"--sub1.sub2.sub3.value", "val1"}; + run(); + CHECK(v3 == "val1"); + + args = {"--sub1.sub2.value", "val2"}; + run(); + CHECK(v2 == "val2"); + + args = {"--sub1.sub2.bob", "val2"}; + CHECK_THROWS_AS(run(), CLI::ExtrasError); + app.allow_extras(); + CHECK_NOTHROW(run()); + auto extras = app.remaining(); + CHECK(extras.size() == 2); + CHECK(extras.front() == "--sub1.sub2.bob"); +} + +TEST_CASE_METHOD(TApp, "DotNotationSubcommandRecusive2", "[subcom]") { + std::string v1, v2, v3, vbase; + + auto *sub1 = app.add_subcommand("sub1"); + auto *sub2 = sub1->add_subcommand("sub2"); + auto *sub3 = sub2->add_subcommand("sub3"); + + sub1->add_option("--value", v1); + sub2->add_option("--value", v2); + sub3->add_option("--value", v3); + app.add_option("--value", vbase); + args = {"sub1.sub2.sub3", "--value", "val1"}; + run(); + CHECK(v3 == "val1"); + + args = {"sub1.sub2", "--value", "val2"}; + run(); + CHECK(v2 == "val2"); + + args = {"sub1.bob", "--value", "val2"}; + CHECK_THROWS_AS(run(), CLI::ExtrasError); + + args = {"sub1.sub2.bob", "--value", "val2"}; + CHECK_THROWS_AS(run(), CLI::ExtrasError); + + args = {"sub1.sub2.sub3.bob", "--value", "val2"}; + CHECK_THROWS_AS(run(), CLI::ExtrasError); + + app.allow_extras(); + CHECK_NOTHROW(run()); + auto extras = app.remaining(); + CHECK(extras.size() == 1); + CHECK(extras.front() == "sub1.sub2.sub3.bob"); +} diff --git a/packages/CLI11/tests/TimerTest.cpp b/packages/CLI11/tests/TimerTest.cpp index a3d8c1d9ee9b9af7919e152b480e4668690cc260..e15d928cf7ee2a49d5176641e77d601bf74c76eb 100644 --- a/packages/CLI11/tests/TimerTest.cpp +++ b/packages/CLI11/tests/TimerTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -12,8 +12,6 @@ #include <string> #include <thread> -using Catch::Matchers::Contains; - TEST_CASE("Timer: MSTimes", "[timer]") { CLI::Timer timer{"My Timer"}; std::this_thread::sleep_for(std::chrono::milliseconds(123)); diff --git a/packages/CLI11/tests/TransformTest.cpp b/packages/CLI11/tests/TransformTest.cpp index 5ace484ecce831b21013bf02b64d2d7dc42f5687..9406e0254d0a5d57b34ff005aa6c2bd89cb727a8 100644 --- a/packages/CLI11/tests/TransformTest.cpp +++ b/packages/CLI11/tests/TransformTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/TrueFalseTest.cpp b/packages/CLI11/tests/TrueFalseTest.cpp index d7d2f2cd0bfc599bbcb625d1eec49bd99f5b4dee..93f2f3fb8109ccb40370bbf7ed330b3360c33e89 100644 --- a/packages/CLI11/tests/TrueFalseTest.cpp +++ b/packages/CLI11/tests/TrueFalseTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/WindowsTest.cpp b/packages/CLI11/tests/WindowsTest.cpp index 0527cfb082fedc498ab0903a431b743218ef6d4c..a17d58735a66a29fa5b2a02d614420396f6943eb 100644 --- a/packages/CLI11/tests/WindowsTest.cpp +++ b/packages/CLI11/tests/WindowsTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/app_helper.hpp b/packages/CLI11/tests/app_helper.hpp index f8d7e7221b395777f60088308c2bfaf11cef86b5..5479e486392ba432f6f2d25f45d6bcf40812a315 100644 --- a/packages/CLI11/tests/app_helper.hpp +++ b/packages/CLI11/tests/app_helper.hpp @@ -13,6 +13,9 @@ #endif #include "catch.hpp" +#include <array> +#include <fstream> +#include <iomanip> #include <iostream> #include <string> #include <utility> @@ -33,6 +36,8 @@ class TApp { } }; +CLI11_INLINE int fileClear(const std::string &name) { return std::remove(name.c_str()); } + class TempFile { std::string _name{}; @@ -65,3 +70,54 @@ inline void unset_env(std::string name) { unsetenv(name.c_str()); #endif } + +CLI11_INLINE void check_identical_files(const char *path1, const char *path2) { + std::string err1 = CLI::ExistingFile(path1); + if(!err1.empty()) { + FAIL("Could not open " << path1 << ": " << err1); + } + + std::string err2 = CLI::ExistingFile(path2); + if(!err2.empty()) { + FAIL("Could not open " << path2 << ": " << err2); + } + + // open files at the end to compare size first + std::ifstream file1(path1, std::ifstream::ate | std::ifstream::binary); + std::ifstream file2(path2, std::ifstream::ate | std::ifstream::binary); + + if(!file1.good()) { + FAIL("File " << path1 << " is corrupted"); + } + + if(!file2.good()) { + FAIL("File " << path2 << " is corrupted"); + } + + if(file1.tellg() != file2.tellg()) { + FAIL("Different file sizes:\n " << file1.tellg() << " bytes in " << path1 << "\n " << file2.tellg() + << " bytes in " << path2); + } + + // rewind files + file1.seekg(0); + file2.seekg(0); + + std::array<uint8_t, 10240> buffer1; + std::array<uint8_t, 10240> buffer2; + + for(size_t ibuffer = 0; file1.good(); ++ibuffer) { + // Flawfinder: ignore + file1.read(reinterpret_cast<char *>(buffer1.data()), static_cast<std::streamsize>(buffer1.size())); + // Flawfinder: ignore + file2.read(reinterpret_cast<char *>(buffer2.data()), static_cast<std::streamsize>(buffer2.size())); + + for(size_t i = 0; i < static_cast<size_t>(file1.gcount()); ++i) { + if(buffer1[i] != buffer2[i]) { + FAIL(std::hex << std::setfill('0') << "Different bytes at position " << (ibuffer * 10240 + i) << ":\n " + << "0x" << std::setw(2) << static_cast<int>(buffer1[i]) << " in " << path1 << "\n " + << "0x" << std::setw(2) << static_cast<int>(buffer2[i]) << " in " << path2); + } + } + } +} diff --git a/packages/CLI11/tests/applications/system_args.cpp b/packages/CLI11/tests/applications/system_args.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e1e77ba673ce56f69117569b731475372d618a02 --- /dev/null +++ b/packages/CLI11/tests/applications/system_args.cpp @@ -0,0 +1,22 @@ +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner +// under NSF AWARD 1414736 and by the respective contributors. +// All rights reserved. +// +// SPDX-License-Identifier: BSD-3-Clause + +#include <CLI/CLI.hpp> +#include <cstring> + +int main(int argc, char **argv) { + if(argc != CLI::argc()) { + return -1; + } + + for(int i = 0; i < argc; i++) { + if(std::strcmp(argv[i], CLI::argv()[i]) != 0) { + return i + 1; + } + } + + return 0; +} diff --git a/packages/CLI11/tests/catch.hpp b/packages/CLI11/tests/catch.hpp index da41d685d1ec30e5d278595dca96403831713524..e6de667325f48d65ea5145207bb4a608ae22c209 100644 --- a/packages/CLI11/tests/catch.hpp +++ b/packages/CLI11/tests/catch.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // @@ -6,4 +6,26 @@ #pragma once +#include <string> + +#ifdef CLI11_CATCH3 + +#include <catch2/catch_approx.hpp> +#include <catch2/catch_template_test_macros.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> + +using Catch::Approx; // NOLINT(google-global-names-in-headers) +using Catch::Matchers::Equals; // NOLINT(google-global-names-in-headers) + +inline auto Contains(const std::string &x) { return Catch::Matchers::ContainsSubstring(x); } + +#else + #include <catch2/catch.hpp> + +using Catch::Equals; // NOLINT(google-global-names-in-headers) +using Catch::Matchers::Contains; // NOLINT(google-global-names-in-headers) + +#endif diff --git a/packages/CLI11/tests/data/unicode.txt b/packages/CLI11/tests/data/unicode.txt new file mode 100644 index 0000000000000000000000000000000000000000..f430f542318bc153a004b5235eb23eb6a915825b --- /dev/null +++ b/packages/CLI11/tests/data/unicode.txt @@ -0,0 +1 @@ +Hello Halló Привет 你好 👩🚀❤️ diff --git a/packages/CLI11/tests/fuzzFail/fuzz_app_fail1 b/packages/CLI11/tests/fuzzFail/fuzz_app_fail1 new file mode 100644 index 0000000000000000000000000000000000000000..d133524b2731b74ba6845719bae4200eda67c09a Binary files /dev/null and b/packages/CLI11/tests/fuzzFail/fuzz_app_fail1 differ diff --git a/packages/CLI11/tests/fuzzFail/fuzz_app_fail2 b/packages/CLI11/tests/fuzzFail/fuzz_app_fail2 new file mode 100644 index 0000000000000000000000000000000000000000..ac301930cd0f7e04764af2a100d2feed860e0c76 --- /dev/null +++ b/packages/CLI11/tests/fuzzFail/fuzz_app_fail2 @@ -0,0 +1 @@ +1 c e g0 g0 �� --tup4 N3CLI10ParseErrorE% 0 %% 0 i��������������wrap $ \ No newline at end of file diff --git a/packages/CLI11/tests/informational.cpp b/packages/CLI11/tests/informational.cpp index 9df227fab8f053eefa765e81a53befd9f0023181..4f7f27b52b89a1742df5fd1d2fd7fa01f698b8c0 100644 --- a/packages/CLI11/tests/informational.cpp +++ b/packages/CLI11/tests/informational.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/link_test_1.cpp b/packages/CLI11/tests/link_test_1.cpp index 1cbec7b772c602177f1cf5941282fcc4b68ed943..ba1b2d83767f4e66825529312512aaeb59fb09cc 100644 --- a/packages/CLI11/tests/link_test_1.cpp +++ b/packages/CLI11/tests/link_test_1.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/link_test_2.cpp b/packages/CLI11/tests/link_test_2.cpp index 9dcc3db230db2eb78fba82f3218f2a45a2279ae9..46d77be26308976e07dd8025451f3d24bc620b05 100644 --- a/packages/CLI11/tests/link_test_2.cpp +++ b/packages/CLI11/tests/link_test_2.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/main.cpp b/packages/CLI11/tests/main.cpp index 20bb46d615f52eb8a62dc836e8e6292926ff364f..451f65038588121bdb253ac2071bc3f09e0fe93a 100644 --- a/packages/CLI11/tests/main.cpp +++ b/packages/CLI11/tests/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/CLI11/tests/meson.build b/packages/CLI11/tests/meson.build index 27e221619f3c7bf733e4755fcac3a142a4021aa0..4847985550397356655366953240b526a5c3d768 100644 --- a/packages/CLI11/tests/meson.build +++ b/packages/CLI11/tests/meson.build @@ -1,14 +1,21 @@ catch2 = dependency('catch2') -testmain = static_library( - 'catch_main', - 'main.cpp', 'catch.hpp', - dependencies: catch2, -) -testdep = declare_dependency( - link_with: testmain, - dependencies: [catch2, CLI11_dep] -) +if catch2.version().version_compare('<3') + testmain = static_library( + 'catch_main', + 'main.cpp', 'catch.hpp', + dependencies: catch2, + ) + testdep = declare_dependency( + link_with: testmain, + dependencies: [catch2, CLI11_dep] + ) +else + testdep = declare_dependency( + dependencies: [CLI11_dep, dependency('catch2-with-main')], + compile_args: '-DCLI11_CATCH3' + ) +endif link_test_lib = library( 'link_test_1', @@ -57,6 +64,20 @@ testnames = [ ['link_test_2', {'link_with': link_test_lib}], ] +dependent_applications = [ + 'system_args' +] +dependent_applications_definitions = [] +#dependent_applications_targets = [] +foreach app: dependent_applications + app_target = executable(app, 'applications'/app + '.cpp', + build_by_default: false + ) + + #dependent_applications_targets += dependency(app_target) + dependent_applications_definitions += '-DCLI11_@0@_EXE="@1@"'.format(app.to_upper(), app_target) +endforeach + if host_machine.system() == 'windows' testnames += [['WindowsTest', {}]] endif @@ -69,7 +90,7 @@ foreach n: testnames name = n[0] kwargs = n[1] t = executable(name, name + '.cpp', - cpp_args: kwargs.get('cpp_args', []), + cpp_args: kwargs.get('cpp_args', []) + dependent_applications_definitions, build_by_default: false, dependencies: [testdep] + kwargs.get('dependencies', []), link_with: kwargs.get('link_with', []) diff --git a/packages/CLI11/tests/mesonTest/main.cpp b/packages/CLI11/tests/mesonTest/main.cpp index 64d45eb6f1e7e909c64a5540f7bcd60ebe878327..39bb7845cc3fcfab96731000dcda7611402e5441 100644 --- a/packages/CLI11/tests/mesonTest/main.cpp +++ b/packages/CLI11/tests/mesonTest/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, University of Cincinnati, developed by Henry Schreiner +// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner // under NSF AWARD 1414736 and by the respective contributors. // All rights reserved. // diff --git a/packages/Catch2/.bazelrc b/packages/Catch2/.bazelrc index 55f17a67d6143ba16b89d5ae9ddb155fe1ca65d9..c01cb39f1d38a40ecaa7351113286de1da321aa7 100644 --- a/packages/Catch2/.bazelrc +++ b/packages/Catch2/.bazelrc @@ -1,4 +1,10 @@ +build --enable_platform_specific_config + build:gcc9 --cxxopt=-std=c++2a +build:gcc11 --cxxopt=-std=c++2a build:clang13 --cxxopt=-std=c++17 build:vs2019 --cxxopt=/std:c++17 -build:vs2022 --cxxopt=/std:c++17 \ No newline at end of file +build:vs2022 --cxxopt=/std:c++17 + +build:windows --config=vs2022 +build:linux --config=gcc11 diff --git a/packages/Catch2/.clang-format b/packages/Catch2/.clang-format index 2a82aacfdcf07382b720d7706bf9ad60f4fc8402..9efb854dd2f49695e2f8c76e32143b178907bf61 100644 --- a/packages/Catch2/.clang-format +++ b/packages/Catch2/.clang-format @@ -1,25 +1,45 @@ --- -AccessModifierOffset: '-4' +Language: Cpp +Standard: c++14 + +# Note that we cannot use IncludeIsMainRegex functionality, because it +# does not support includes in angle brackets (<>) +SortIncludes: true +IncludeBlocks: Regroup +IncludeCategories: + - Regex: <catch2/.*\.hpp> + Priority: 1 + - Regex: <.*/.*\.hpp> + Priority: 2 + - Regex: <.*> + Priority: 3 + +AllowShortBlocksOnASingleLine: Always +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: Inline + +AccessModifierOffset: "-4" AlignEscapedNewlines: Left -AllowAllConstructorInitializersOnNextLine: 'true' -BinPackArguments: 'false' -BinPackParameters: 'false' +AllowAllConstructorInitializersOnNextLine: "true" +BinPackArguments: "false" +BinPackParameters: "false" BreakConstructorInitializers: AfterColon -ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' -DerivePointerAlignment: 'false' -FixNamespaceComments: 'true' -IncludeBlocks: Regroup -IndentCaseLabels: 'false' +ConstructorInitializerAllOnOneLineOrOnePerLine: "true" +DerivePointerAlignment: "false" +FixNamespaceComments: "true" +IndentCaseLabels: "false" IndentPPDirectives: AfterHash -IndentWidth: '4' -Language: Cpp +IndentWidth: "4" NamespaceIndentation: All PointerAlignment: Left -SpaceBeforeCtorInitializerColon: 'false' -SpaceInEmptyParentheses: 'false' -SpacesInParentheses: 'true' -Standard: Cpp11 -TabWidth: '4' +SpaceBeforeCtorInitializerColon: "false" +SpaceInEmptyParentheses: "false" +SpacesInParentheses: "true" +TabWidth: "4" UseTab: Never - -... +AlwaysBreakTemplateDeclarations: Yes +SpaceAfterTemplateKeyword: true +SortUsingDeclarations: true +ReflowComments: true diff --git a/packages/Catch2/.github/workflows/linux-bazel-builds.yml b/packages/Catch2/.github/workflows/linux-bazel-builds.yml new file mode 100644 index 0000000000000000000000000000000000000000..9006652e2c2874cd026725710eb061d77dd81ea2 --- /dev/null +++ b/packages/Catch2/.github/workflows/linux-bazel-builds.yml @@ -0,0 +1,24 @@ +name: Bazel build + +on: [push, pull_request] + +jobs: + build_and_test_ubuntu: + name: Linux Ubuntu 22.04 Bazel build <GCC 11.2.0> + runs-on: ubuntu-22.04 + strategy: + matrix: + compilation_mode: [fastbuild, dbg, opt] + + steps: + - uses: actions/checkout@v3 + + - name: Mount bazel cache + uses: actions/cache@v3 + with: + path: "/home/runner/.cache/bazel" + key: bazel-ubuntu22-gcc11 + + - name: Build Catch2 + run: | + bazelisk build --compilation_mode=${{matrix.compilation_mode}} //... diff --git a/packages/Catch2/.github/workflows/linux-meson-builds.yml b/packages/Catch2/.github/workflows/linux-meson-builds.yml new file mode 100644 index 0000000000000000000000000000000000000000..dec701b61b22217856030ebb1eb8773db0b1ccfc --- /dev/null +++ b/packages/Catch2/.github/workflows/linux-meson-builds.yml @@ -0,0 +1,43 @@ +name: Linux builds (meson) + +on: [push, pull_request] + +jobs: + build: + name: meson ${{matrix.cxx}}, C++${{matrix.std}}, ${{matrix.build_type}} + runs-on: ubuntu-22.04 + strategy: + matrix: + cxx: + - g++-11 + - clang++-11 + build_type: [debug, release] + std: [14, 17] + include: + - cxx: clang++-11 + other_pkgs: clang-11 + + steps: + - uses: actions/checkout@v2 + + - name: Prepare environment + run: sudo apt-get install -y meson ninja-build ${{matrix.other_pkgs}} + + - name: Configure build + env: + CXX: ${{matrix.cxx}} + CXXFLAGS: -std=c++${{matrix.std}} ${{matrix.cxxflags}} + # Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}. + # This is important + run: | + meson -Dbuildtype=${{matrix.build_type}} ${{runner.workspace}}/meson-build + + - name: Build tests + lib + working-directory: ${{runner.workspace}}/meson-build + run: ninja + + - name: Run tests + working-directory: ${{runner.workspace}}/meson-build + # Hardcode 2 cores we know are there + run: | + meson test --verbose diff --git a/packages/Catch2/.github/workflows/linux-other-builds.yml b/packages/Catch2/.github/workflows/linux-other-builds.yml index 31dcb92195bd6b61d7adef2a5b3274d4ac434476..cf4e2c06b755e6bbc0fdc7443f70d98e4420f29f 100644 --- a/packages/Catch2/.github/workflows/linux-other-builds.yml +++ b/packages/Catch2/.github/workflows/linux-other-builds.yml @@ -86,6 +86,7 @@ jobs: cmake -Bbuild -H$GITHUB_WORKSPACE \ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ -DCMAKE_CXX_STANDARD=${{matrix.std}} \ + -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -DCMAKE_CXX_EXTENSIONS=OFF \ -DCATCH_DEVELOPMENT_BUILD=ON \ ${{matrix.cmake_configurations}} \ diff --git a/packages/Catch2/.github/workflows/linux-simple-builds.yml b/packages/Catch2/.github/workflows/linux-simple-builds.yml index d7d4bb07f37d249ed49c84f808e70147f1b6fb1f..989c4942e221c4cdf8241f573f2f02a8d1f32546 100644 --- a/packages/Catch2/.github/workflows/linux-simple-builds.yml +++ b/packages/Catch2/.github/workflows/linux-simple-builds.yml @@ -9,7 +9,8 @@ jobs: strategy: matrix: cxx: -# - g++-6 + - g++-5 + - g++-6 - g++-7 - g++-8 - g++-9 @@ -22,9 +23,10 @@ jobs: build_type: [Debug, Release] std: [14] include: - # cannot be installed on ubuntu-20.04 be default? -# - cxx: g++-6 -# other_pkgs: g++-6 + - cxx: g++-5 + other_pkgs: g++-5 + - cxx: g++-6 + other_pkgs: g++-6 - cxx: g++-7 other_pkgs: g++-7 - cxx: g++-8 @@ -63,10 +65,32 @@ jobs: build_type: Release std: 17 other_pkgs: clang-10 + - cxx: clang++-10 + build_type: Debug + std: 20 + other_pkgs: clang-10 + - cxx: clang++-10 + build_type: Release + std: 20 + other_pkgs: clang-10 + - cxx: g++-10 + build_type: Debug + std: 20 + other_pkgs: g++-10 + - cxx: g++-10 + build_type: Release + std: 20 + other_pkgs: g++-10 steps: - uses: actions/checkout@v2 + - name: Add repositories for older GCC + run: | + sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic main' + sudo apt-add-repository 'deb http://azure.archive.ubuntu.com/ubuntu/ bionic universe' + if: ${{ matrix.cxx == 'g++-5' || matrix.cxx == 'g++-6' }} + - name: Prepare environment run: sudo apt-get install -y ninja-build ${{matrix.other_pkgs}} @@ -81,6 +105,7 @@ jobs: cmake -Bbuild -H$GITHUB_WORKSPACE \ -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ -DCMAKE_CXX_STANDARD=${{matrix.std}} \ + -DCMAKE_CXX_STANDARD_REQUIRED=ON \ -DCMAKE_CXX_EXTENSIONS=OFF \ -DCATCH_DEVELOPMENT_BUILD=ON \ -G Ninja diff --git a/packages/Catch2/.github/workflows/mac-builds.yml b/packages/Catch2/.github/workflows/mac-builds.yml index 0ad5982dcc9b817790bf6472a63371adf7038355..955b81fcc6ea8514d84498ddd8123f2202561608 100644 --- a/packages/Catch2/.github/workflows/mac-builds.yml +++ b/packages/Catch2/.github/workflows/mac-builds.yml @@ -4,7 +4,11 @@ on: [push, pull_request] jobs: build: - runs-on: macos-12 + # macos-12 updated to a toolchain that crashes when linking the + # test binary. This seems to be a known bug in that version, + # and will eventually get fixed in an update. After that, we can go + # back to newer macos images. + runs-on: macos-11 strategy: matrix: cxx: @@ -29,8 +33,11 @@ jobs: # This is important run: | cmake -Bbuild -H$GITHUB_WORKSPACE \ - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{matrix.std}} \ - -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=${{matrix.examples}} \ + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -DCMAKE_CXX_STANDARD=${{matrix.std}} \ + -DCMAKE_CXX_STANDARD_REQUIRED=ON \ + -DCATCH_DEVELOPMENT_BUILD=ON \ + -DCATCH_BUILD_EXAMPLES=${{matrix.examples}} \ -DCATCH_BUILD_EXTRA_TESTS=${{matrix.examples}} - name: Build tests + lib diff --git a/packages/Catch2/.github/workflows/windows-simple-builds.yml b/packages/Catch2/.github/workflows/windows-simple-builds.yml new file mode 100644 index 0000000000000000000000000000000000000000..197fa219e3b2ac81d6734b2097b3eba8f69c5e87 --- /dev/null +++ b/packages/Catch2/.github/workflows/windows-simple-builds.yml @@ -0,0 +1,37 @@ +name: Windows builds (basic) + +on: [push, pull_request] + +jobs: + build: + name: ${{matrix.os}}, ${{matrix.std}}, ${{matrix.build_type}}, ${{matrix.platform}} + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [windows-2019, windows-2022] + platform: [Win32, x64] + build_type: [Debug, Release] + std: [14, 17] + steps: + - uses: actions/checkout@v2 + + - name: Configure build + working-directory: ${{runner.workspace}} + run: | + cmake -S $Env:GITHUB_WORKSPACE ` + -B ${{runner.workspace}}/build ` + -DCMAKE_CXX_STANDARD=${{matrix.std}} ` + -A ${{matrix.platform}} ` + --preset all-tests + + - name: Build tests + working-directory: ${{runner.workspace}} + run: cmake --build build --config ${{matrix.build_type}} --parallel %NUMBER_OF_PROCESSORS% + shell: cmd + + - name: Run tests + working-directory: ${{runner.workspace}}/build + env: + CTEST_OUTPUT_ON_FAILURE: 1 + run: ctest -C ${{matrix.build_type}} -j %NUMBER_OF_PROCESSORS% + shell: cmd diff --git a/packages/Catch2/.gitignore b/packages/Catch2/.gitignore index cafbd6b2979e841e857fe6b942525d70bf538c83..27f6bc0b30189079bc3cdd3cbbf2f0d96f50a9b4 100644 --- a/packages/Catch2/.gitignore +++ b/packages/Catch2/.gitignore @@ -1,4 +1,5 @@ *.build +!meson.build *.pbxuser *.mode1v3 *.ncb diff --git a/packages/Catch2/.gitrepo b/packages/Catch2/.gitrepo index de961c79fcf1019990fc65996d7ebf36934f9eae..0b35a79b5e86abab214ceed2e6f119ed2eab73fc 100644 --- a/packages/Catch2/.gitrepo +++ b/packages/Catch2/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:catchorg/Catch2.git branch = devel - commit = 7b2e7d623b626ed2cae1d4b7f2b5480bdabbefd8 - parent = 95b3a702d689cb12fed8c321811e8afcff4485d4 + commit = 0631b607ee2bbc07c7c238f0b15b23ef21926960 + parent = 446a6502fc29873ba84cd5964ea2e0787dc48e49 method = merge - cmdver = 0.4.3 + cmdver = 0.4.6 diff --git a/packages/Catch2/BUILD.bazel b/packages/Catch2/BUILD.bazel index 7c4435163104f15a226566e8f07ed68a47b29e33..02ec92265648334d09c039877202b2686609397e 100644 --- a/packages/Catch2/BUILD.bazel +++ b/packages/Catch2/BUILD.bazel @@ -1,14 +1,13 @@ -# Load the cc_library rule. -load("@rules_cc//cc:defs.bzl", "cc_library") load("@bazel_skylib//rules:expand_template.bzl", "expand_template") expand_template( name = "catch_user_config", out = "catch2/catch_user_config.hpp", substitutions = { + "@CATCH_CONFIG_CONSOLE_WIDTH@": "80", + "@CATCH_CONFIG_DEFAULT_REPORTER@": "console", "#cmakedefine CATCH_CONFIG_ANDROID_LOGWRITE": "", "#cmakedefine CATCH_CONFIG_BAZEL_SUPPORT": "#define CATCH_CONFIG_BAZEL_SUPPORT", - "#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "", "#cmakedefine CATCH_CONFIG_COLOUR_WIN32": "", "#cmakedefine CATCH_CONFIG_COUNTER": "", "#cmakedefine CATCH_CONFIG_CPP11_TO_STRING": "", @@ -29,7 +28,10 @@ expand_template( "#cmakedefine CATCH_CONFIG_EXPERIMENTAL_REDIRECT": "", "#cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@": "", "#cmakedefine CATCH_CONFIG_FAST_COMPILE": "", + "#cmakedefine CATCH_CONFIG_GETENV": "", "#cmakedefine CATCH_CONFIG_GLOBAL_NEXTAFTER": "", + "#cmakedefine CATCH_CONFIG_NO_ANDROID_LOGWRITE": "", + "#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "", "#cmakedefine CATCH_CONFIG_NO_COUNTER": "", "#cmakedefine CATCH_CONFIG_NO_CPP11_TO_STRING": "", "#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE": "", @@ -37,21 +39,22 @@ expand_template( "#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW": "", "#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS": "", "#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT": "", + "#cmakedefine CATCH_CONFIG_NO_GETENV": "", "#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER": "", "#cmakedefine CATCH_CONFIG_NO_POSIX_SIGNALS": "", "#cmakedefine CATCH_CONFIG_NO_USE_ASYNC": "", + "#cmakedefine CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT": "", "#cmakedefine CATCH_CONFIG_NO_WCHAR": "", "#cmakedefine CATCH_CONFIG_NO_WINDOWS_SEH": "", "#cmakedefine CATCH_CONFIG_NOSTDOUT": "", "#cmakedefine CATCH_CONFIG_POSIX_SIGNALS": "", "#cmakedefine CATCH_CONFIG_PREFIX_ALL": "", + "#cmakedefine CATCH_CONFIG_SHARED_LIBRARY": "", + "#cmakedefine CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT": "", "#cmakedefine CATCH_CONFIG_USE_ASYNC": "", "#cmakedefine CATCH_CONFIG_WCHAR": "", "#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG": "", "#cmakedefine CATCH_CONFIG_WINDOWS_SEH": "", - "#cmakedefine CATCH_CONFIG_NO_ANDROID_LOGWRITE": "", - "@CATCH_CONFIG_DEFAULT_REPORTER@": "console", - "@CATCH_CONFIG_CONSOLE_WIDTH@": "80", }, template = "src/catch2/catch_user_config.hpp.in", ) @@ -88,4 +91,4 @@ cc_library( linkstatic = True, visibility = ["//visibility:public"], deps = [":catch2"], -) \ No newline at end of file +) diff --git a/packages/Catch2/CMake/CatchConfigOptions.cmake b/packages/Catch2/CMake/CatchConfigOptions.cmake index a8ae93d43e7837caac719f75018a6b4d089d2252..067739dc9962a9349211dd735e7c93ea42964591 100644 --- a/packages/Catch2/CMake/CatchConfigOptions.cmake +++ b/packages/Catch2/CMake/CatchConfigOptions.cmake @@ -1,7 +1,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 @@ -40,6 +40,8 @@ set(_OverridableOptions "USE_ASYNC" "WCHAR" "WINDOWS_SEH" + "GETENV" + "EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT" ) foreach(OptionName ${_OverridableOptions}) @@ -67,6 +69,11 @@ set(_OtherConfigOptions foreach(OptionName ${_OtherConfigOptions}) AddConfigOption(${OptionName}) endforeach() +if(DEFINED BUILD_SHARED_LIBS) + set(CATCH_CONFIG_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) +else() + set(CATCH_CONFIG_SHARED_LIBRARY "") +endif() set(CATCH_CONFIG_DEFAULT_REPORTER "console" CACHE STRING "Read docs/configuration.md for details. The name of the reporter should be without quotes.") set(CATCH_CONFIG_CONSOLE_WIDTH "80" CACHE STRING "Read docs/configuration.md for details. Must form a valid integer literal.") diff --git a/packages/Catch2/CMake/CatchMiscFunctions.cmake b/packages/Catch2/CMake/CatchMiscFunctions.cmake index 73c8b4dd26a780e3276ec54fc6fec42a81dfa651..44c875007ff0717a1fea908d41c67dc8b22082f8 100644 --- a/packages/Catch2/CMake/CatchMiscFunctions.cmake +++ b/packages/Catch2/CMake/CatchMiscFunctions.cmake @@ -1,18 +1,19 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 include(CheckCXXCompilerFlag) function(add_cxx_flag_if_supported_to_targets flagname targets) - check_cxx_compiler_flag("${flagname}" HAVE_FLAG_${flagname}) + string(MAKE_C_IDENTIFIER ${flagname} flag_identifier ) + check_cxx_compiler_flag("${flagname}" HAVE_FLAG_${flag_identifier}) - if (HAVE_FLAG_${flagname}) + if (HAVE_FLAG_${flag_identifier}) foreach(target ${targets}) - target_compile_options(${target} PUBLIC ${flagname}) + target_compile_options(${target} PRIVATE ${flagname}) endforeach() endif() endfunction() @@ -73,6 +74,7 @@ function(add_warnings_to_targets targets) "-Woverloaded-virtual" "-Wparentheses" "-Wpedantic" + "-Wredundant-decls" "-Wreorder" "-Wreturn-std-move" "-Wshadow" @@ -82,7 +84,7 @@ function(add_warnings_to_targets targets) "-Wundef" "-Wuninitialized" "-Wunneeded-internal-declaration" - "-Wunreachable-code" + "-Wunreachable-code-aggressive" "-Wunused" "-Wunused-function" "-Wunused-parameter" @@ -112,9 +114,8 @@ endfunction() # Adds flags required for reproducible build to the target # Currently only supports GCC and Clang function(add_build_reproducibility_settings target) -# Make the build reproducible on versions of g++ and clang that supports -ffile-prefix-map - if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 8) OR - ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 10)) - target_compile_options(${target} PRIVATE "-ffile-prefix-map=${CATCH_DIR}=.") + # Make the build reproducible on versions of g++ and clang that supports -ffile-prefix-map + if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + add_cxx_flag_if_supported_to_targets("-ffile-prefix-map=${CATCH_DIR}/=" "${target}") endif() endfunction() diff --git a/packages/Catch2/CMakeLists.txt b/packages/Catch2/CMakeLists.txt index ae8e86b9b9564ea914660612ceaaa5f642dc5f0f..b3e811538b11edc5f639f2f26abea21bc5e3a1bf 100644 --- a/packages/Catch2/CMakeLists.txt +++ b/packages/Catch2/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.10) # detect if Catch is being bundled, # disable testsuite in that case @@ -30,23 +30,15 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt") endif() -if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.9) - # Enable IPO for CMake versions that support it - cmake_policy(SET CMP0069 NEW) - project(Catch2 - VERSION 3.1.0 # CML version placeholder, don't delete - LANGUAGES CXX - # HOMEPAGE_URL is not supported until CMake version 3.12, which - # we do not target yet. - # HOMEPAGE_URL "https://github.com/catchorg/Catch2" - DESCRIPTION "A modern, C++-native, unit test framework." - ) -else() - project(Catch2 - VERSION 3.1.0 # CML version placeholder, don't delete - LANGUAGES CXX - ) -endif() +project(Catch2 + VERSION 3.3.2 # CML version placeholder, don't delete + LANGUAGES CXX + # HOMEPAGE_URL is not supported until CMake version 3.12, which + # we do not target yet. + # HOMEPAGE_URL "https://github.com/catchorg/Catch2" + DESCRIPTION "A modern, C++-native, unit test framework." +) + # Provide path for scripts. We first add path to the scripts we don't use, # but projects including us might, and set the path up to parent scope. @@ -156,6 +148,8 @@ if (NOT_SUBPROJECT) "extras/ParseAndAddCatchTests.cmake" "extras/Catch.cmake" "extras/CatchAddTests.cmake" + "extras/CatchShardTests.cmake" + "extras/CatchShardTestsImpl.cmake" DESTINATION ${CATCH_CMAKE_CONFIG_DESTINATION} ) diff --git a/packages/Catch2/Doxyfile b/packages/Catch2/Doxyfile index 6831841678725d6a4486a498d9a4c4acba9bad22..07b385ec10afb1a58a9647d1f4fb7882a3d0bf36 100644 --- a/packages/Catch2/Doxyfile +++ b/packages/Catch2/Doxyfile @@ -1319,7 +1319,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. diff --git a/packages/Catch2/README.md b/packages/Catch2/README.md index 83fdf7b31a13bb12694c3a22b54b57dec7c1eb0a..3ea54a5d2c1423052b5959e023b0985d5411466c 100644 --- a/packages/Catch2/README.md +++ b/packages/Catch2/README.md @@ -1,5 +1,5 @@ <a id="top"></a> - + [](https://github.com/catchorg/catch2/releases) [](https://github.com/catchorg/Catch2/actions/workflows/linux-simple-builds.yml) @@ -11,31 +11,82 @@ [](https://discord.gg/4CWS9zD) -## What's the Catch2? +## What is Catch2? Catch2 is mainly a unit testing framework for C++, but it also provides basic micro-benchmarking features, and simple BDD macros. Catch2's main advantage is that using it is both simple and natural. -Tests autoregister themselves and do not have to be named with valid -identifiers, assertions look like normal C++ code, and sections provide -a nice way to share set-up and tear-down code in tests. +Test names do not have to be valid identifiers, assertions look like +normal C++ boolean expressions, and sections provide a nice and local way +to share set-up and tear-down code in tests. +**Example unit test** +```cpp +#include <catch2/catch_test_macros.hpp> -## Catch2 v3 is being developed! +#include <cstdint> -You are on the `devel` branch, where the next major version, v3, of -Catch2 is being developed. As it is a significant rework, you will -find that parts of this documentation are likely still stuck on v2. +uint32_t factorial( uint32_t number ) { + return number <= 1 ? number : factorial(number-1) * number; +} -For stable (and documentation-matching) version of Catch2, [go to the -`v2.x` branch](https://github.com/catchorg/Catch2/tree/v2.x). +TEST_CASE( "Factorials are computed", "[factorial]" ) { + REQUIRE( factorial( 1) == 1 ); + REQUIRE( factorial( 2) == 2 ); + REQUIRE( factorial( 3) == 6 ); + REQUIRE( factorial(10) == 3'628'800 ); +} +``` + +**Example microbenchmark** +```cpp +#include <catch2/catch_test_macros.hpp> +#include <catch2/benchmark/catch_benchmark.hpp> + +#include <cstdint> + +uint64_t fibonacci(uint64_t number) { + return number < 2 ? number : fibonacci(number - 1) + fibonacci(number - 2); +} + +TEST_CASE("Benchmark Fibonacci", "[!benchmark]") { + REQUIRE(fibonacci(5) == 5); + + REQUIRE(fibonacci(20) == 6'765); + BENCHMARK("fibonacci 20") { + return fibonacci(20); + }; + + REQUIRE(fibonacci(25) == 75'025); + BENCHMARK("fibonacci 25") { + return fibonacci(25); + }; +} +``` + +_Note that benchmarks are not run by default, so you need to run it explicitly +with the `[!benchmark]` tag._ + + +## Catch2 v3 has been released! + +You are on the `devel` branch, where the v3 version is being developed. +v3 brings a bunch of significant changes, the big one being that Catch2 +is no longer a single-header library. Catch2 now behaves as a normal +library, with multiple headers and separately compiled implementation. + +The documentation is slowly being updated to take these changes into +account, but this work is currently still ongoing. For migrating from the v2 releases to v3, you should look at [our documentation](docs/migrate-v2-to-v3.md#top). It provides a simple guidelines on getting started, and collects most common migration problems. +For the previous major version of Catch2 [look into the `v2.x` branch +here on GitHub](https://github.com/catchorg/Catch2/tree/v2.x). + ## How to use it This documentation comprises these three parts: diff --git a/packages/Catch2/WORKSPACE b/packages/Catch2/WORKSPACE deleted file mode 100644 index 2f265da0a095573e5ce933ea5c44483506ee5acb..0000000000000000000000000000000000000000 --- a/packages/Catch2/WORKSPACE +++ /dev/null @@ -1,14 +0,0 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -http_archive( - name = "bazel_skylib", - strip_prefix = "bazel-skylib-2a87d4a62af886fb320883aba102255aba87275e", - urls = [ - "https://github.com/bazelbuild/bazel-skylib/archive/2a87d4a62af886fb320883aba102255aba87275e.tar.gz", - ], - sha256 = "d847b08d6702d2779e9eb399b54ff8920fa7521dc45e3e53572d1d8907767de7", -) - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() \ No newline at end of file diff --git a/packages/Catch2/WORKSPACE.bazel b/packages/Catch2/WORKSPACE.bazel new file mode 100644 index 0000000000000000000000000000000000000000..d962a99543e93cb4b43b46e7b051c02034eb4d43 --- /dev/null +++ b/packages/Catch2/WORKSPACE.bazel @@ -0,0 +1,16 @@ +workspace(name = "catch2") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "bazel_skylib", + sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz", + ], +) + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() diff --git a/packages/Catch2/appveyor.yml b/packages/Catch2/appveyor.yml index a8f77df09a4ad9fdbcaeb8bf35db531351eb6795..3b6580d8bd7ab55ef9bbad9dda1bb0454c443677 100644 --- a/packages/Catch2/appveyor.yml +++ b/packages/Catch2/appveyor.yml @@ -51,18 +51,6 @@ test_script: # build explicitly. environment: matrix: - - FLAVOR: VS 2019 x64 Debug Surrogates Configure Tests - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - surrogates: 1 - configure_tests: 1 - platform: x64 - configuration: Debug - - - FLAVOR: VS 2019 x64 Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - platform: x64 - configuration: Release - - FLAVOR: VS 2019 x64 Debug Coverage Examples APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 examples: 1 @@ -77,11 +65,6 @@ environment: platform: x64 configuration: Debug - - FLAVOR: VS 2019 Win32 Debug - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - platform: Win32 - configuration: Debug - - FLAVOR: VS 2019 x64 Debug Latest Strict APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 additional_flags: "/permissive- /std:c++latest" @@ -92,38 +75,9 @@ environment: APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 platform: x64 configuration: Debug - - - FLAVOR: VS 2017 x64 Release - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - platform: x64 - configuration: Release - FLAVOR: VS 2017 x64 Release Coverage APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 coverage: 1 platform: x64 - configuration: Debug - - - FLAVOR: VS 2017 Win32 Debug - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - platform: Win32 - configuration: Debug - - - FLAVOR: VS 2017 Win32 Debug Examples - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - examples: 1 - platform: Win32 - configuration: Debug - - - FLAVOR: VS 2017 Win32 Debug WMain - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - wmain: 1 - additional_flags: "/D_UNICODE /DUNICODE" - platform: Win32 - configuration: Debug - - - FLAVOR: VS 2017 x64 Debug Latest Strict - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - additional_flags: "/permissive- /std:c++latest" - platform: x64 - configuration: Debug + configuration: Debug \ No newline at end of file diff --git a/packages/Catch2/data/artwork/catch2-logo-small-with-background.png b/packages/Catch2/data/artwork/catch2-logo-small-with-background.png new file mode 100644 index 0000000000000000000000000000000000000000..963eaf492dcebd18a7fc1c9209f6e93c09d6ef18 Binary files /dev/null and b/packages/Catch2/data/artwork/catch2-logo-small-with-background.png differ diff --git a/packages/Catch2/docs/Readme.md b/packages/Catch2/docs/Readme.md index 1e59cf97ab32c2d81b66d4ee6b554f1cc6de2c81..d84b4bfdcc5bb785b51b4870eef7b8ee938b456a 100644 --- a/packages/Catch2/docs/Readme.md +++ b/packages/Catch2/docs/Readme.md @@ -4,34 +4,36 @@ To get the most out of Catch2, start with the [tutorial](tutorial.md#top). Once you're up and running consider the following reference material. -Writing tests: +**Writing tests:** * [Assertion macros](assertions.md#top) -* [Matchers](matchers.md#top) +* [Matchers (asserting complex properties)](matchers.md#top) +* [Comparing floating point numbers](comparing-floating-point-numbers.md#top) * [Logging macros](logging.md#top) * [Test cases and sections](test-cases-and-sections.md#top) * [Test fixtures](test-fixtures.md#top) -* [Reporters](reporters.md#top) +* [Explicitly skipping, passing, and failing tests at runtime](skipping-passing-failing.md#top) +* [Reporters (output customization)](reporters.md#top) * [Event Listeners](event-listeners.md#top) -* [Data Generators](generators.md#top) +* [Data Generators (value parameterized tests)](generators.md#top) * [Other macros](other-macros.md#top) * [Micro benchmarking](benchmarks.md#top) -Fine tuning: +**Fine tuning:** * [Supplying your own main()](own-main.md#top) * [Compile-time configuration](configuration.md#top) * [String Conversions](tostring.md#top) -Running: +**Running:** * [Command line](command-line.md#top) -Odds and ends: +**Odds and ends:** * [Frequently Asked Questions (FAQ)](faq.md#top) * [Best practices and other tips](usage-tips.md#top) * [CMake integration](cmake-integration.md#top) -* [CI and other miscellaneous pieces](ci-and-misc.md#top) +* [Tooling integration (CI, test runners, other)](ci-and-misc.md#top) * [Known limitations](limitations.md#top) - -Other: + +**Other:** * [Why Catch2?](why-catch.md#top) * [Migrating from v2 to v3](migrate-v2-to-v3.md#top) * [Open Source Projects using Catch2](opensource-users.md#top) diff --git a/packages/Catch2/docs/assertions.md b/packages/Catch2/docs/assertions.md index 682eb6e7ce34615ee615e449e53acc2ccf42e9ac..40faa5ebcac2f0c94ca82edd98774a7a55f8274a 100644 --- a/packages/Catch2/docs/assertions.md +++ b/packages/Catch2/docs/assertions.md @@ -3,6 +3,7 @@ **Contents**<br> [Natural Expressions](#natural-expressions)<br> +[Floating point comparisons](#floating-point-comparisons)<br> [Exceptions](#exceptions)<br> [Matcher expressions](#matcher-expressions)<br> [Thread Safety](#thread-safety)<br> @@ -19,7 +20,7 @@ Most of these macros come in two forms: The ```REQUIRE``` family of macros tests an expression and aborts the test case if it fails. The ```CHECK``` family are equivalent but execution continues in the same test case even if the assertion fails. This is useful if you have a series of essentially orthogonal assertions and it is useful to see all the results rather than stopping at the first failure. -* **REQUIRE(** _expression_ **)** and +* **REQUIRE(** _expression_ **)** and * **CHECK(** _expression_ **)** Evaluates the expression and records the result. If an exception is thrown, it is caught, reported, and counted as a failure. These are the macros you will use most of the time. @@ -31,98 +32,78 @@ CHECK( thisReturnsTrue() ); REQUIRE( i == 42 ); ``` -* **REQUIRE_FALSE(** _expression_ **)** and +Expressions prefixed with `!` cannot be decomposed. If you have a type +that is convertible to bool and you want to assert that it evaluates to +false, use the two forms below: + + +* **REQUIRE_FALSE(** _expression_ **)** and * **CHECK_FALSE(** _expression_ **)** -Evaluates the expression and records the _logical NOT_ of the result. If an exception is thrown it is caught, reported, and counted as a failure. -(these forms exist as a workaround for the fact that ! prefixed expressions cannot be decomposed). +Note that there is no reason to use these forms for plain bool variables, +because there is no added value in decomposing them. Example: +```cpp +Status ret = someFunction(); +REQUIRE_FALSE(ret); // ret must evaluate to false, and Catch2 will print + // out the value of ret if possibly ``` -REQUIRE_FALSE( thisReturnsFalse() ); -``` - -Do note that "overly complex" expressions cannot be decomposed and thus will not compile. This is done partly for practical reasons (to keep the underlying expression template machinery to minimum) and partly for philosophical reasons (assertions should be simple and deterministic). - -Examples: -* `CHECK(a == 1 && b == 2);` -This expression is too complex because of the `&&` operator. If you want to check that 2 or more properties hold, you can either put the expression into parenthesis, which stops decomposition from working, or you need to decompose the expression into two assertions: `CHECK( a == 1 ); CHECK( b == 2);` -* `CHECK( a == 2 || b == 1 );` -This expression is too complex because of the `||` operator. If you want to check that one of several properties hold, you can put the expression into parenthesis (unlike with `&&`, expression decomposition into several `CHECK`s is not possible). - -### Floating point comparisons -When comparing floating point numbers - especially if at least one of them has been computed - great care must be taken to allow for rounding errors and inexact representations. +### Other limitations -Catch provides a way to perform tolerant comparisons of floating point values through use of a wrapper class called `Approx`. `Approx` can be used on either side of a comparison expression. It overloads the comparisons operators to take a tolerance into account. Here's a simple example: +Note that expressions containing either of the binary logical operators, +`&&` or `||`, cannot be decomposed and will not compile. The reason behind +this is that it is impossible to overload `&&` and `||` in a way that +keeps their short-circuiting semantics, and expression decomposition +relies on overloaded operators to work. -```cpp -REQUIRE( performComputation() == Approx( 2.1 ) ); -``` +Simple example of an issue with overloading binary logical operators +is a common pointer idiom, `p && p->foo == 2`. Using the built-in `&&` +operator, `p` is only dereferenced if it is not null. With overloaded +`&&`, `p` is always dereferenced, thus causing a segfault if +`p == nullptr`. -Catch also provides a user-defined literal for `Approx`; `_a`. It resides in -the `Catch::literals` namespace and can be used like so: -```cpp -using namespace Catch::literals; -REQUIRE( performComputation() == 2.1_a ); -``` +If you want to test expression that contains `&&` or `||`, you have two +options. -`Approx` is constructed with defaults that should cover most simple cases. -For the more complex cases, `Approx` provides 3 customization points: +1) Enclose it in parentheses. Parentheses force evaluation of the expression + before the expression decomposition can touch it, and thus it cannot + be used. -* __epsilon__ - epsilon serves to set the coefficient by which a result -can differ from `Approx`'s value before it is rejected. -_By default set to `std::numeric_limits<float>::epsilon()*100`._ -* __margin__ - margin serves to set the the absolute value by which -a result can differ from `Approx`'s value before it is rejected. -_By default set to `0.0`._ -* __scale__ - scale is used to change the magnitude of `Approx` for relative check. -_By default set to `0.0`._ +2) Rewrite the expression. `REQUIRE(a == 1 && b == 2)` can always be split + into `REQUIRE(a == 1); REQUIRE(b == 2);`. Alternatively, if this is a + common pattern in your tests, think about using [Matchers](#matcher-expressions). + instead. There is no simple rewrite rule for `||`, but I generally + believe that if you have `||` in your test expression, you should rethink + your tests. -#### epsilon example -```cpp -Approx target = Approx(100).epsilon(0.01); -100.0 == target; // Obviously true -200.0 == target; // Obviously still false -100.5 == target; // True, because we set target to allow up to 1% difference -``` -#### margin example -```cpp -Approx target = Approx(100).margin(5); -100.0 == target; // Obviously true -200.0 == target; // Obviously still false -104.0 == target; // True, because we set target to allow absolute difference of at most 5 -``` +## Floating point comparisons -#### scale -Scale can be useful if the computation leading to the result worked -on different scale than is used by the results. Since allowed difference -between Approx's value and compared value is based primarily on Approx's value -(the allowed difference is computed as -`(Approx::scale + Approx::value) * epsilon`), the resulting comparison could -need rescaling to be correct. +Comparing floating point numbers is complex, and [so it has its own +documentation page](comparing-floating-point-numbers.md#top). ## Exceptions -* **REQUIRE_NOTHROW(** _expression_ **)** and +* **REQUIRE_NOTHROW(** _expression_ **)** and * **CHECK_NOTHROW(** _expression_ **)** Expects that no exception is thrown during evaluation of the expression. -* **REQUIRE_THROWS(** _expression_ **)** and +* **REQUIRE_THROWS(** _expression_ **)** and * **CHECK_THROWS(** _expression_ **)** Expects that an exception (of any type) is be thrown during evaluation of the expression. -* **REQUIRE_THROWS_AS(** _expression_, _exception type_ **)** and +* **REQUIRE_THROWS_AS(** _expression_, _exception type_ **)** and * **CHECK_THROWS_AS(** _expression_, _exception type_ **)** Expects that an exception of the _specified type_ is thrown during evaluation of the expression. Note that the _exception type_ is extended with `const&` and you should not include it yourself. -* **REQUIRE_THROWS_WITH(** _expression_, _string or string matcher_ **)** and +* **REQUIRE_THROWS_WITH(** _expression_, _string or string matcher_ **)** and * **CHECK_THROWS_WITH(** _expression_, _string or string matcher_ **)** Expects that an exception is thrown that, when converted to a string, matches the _string_ or _string matcher_ provided (see next section for Matchers). @@ -158,8 +139,8 @@ REQUIRE_NOTHROW([&](){ To support Matchers a slightly different form is used. Matchers have [their own documentation](matchers.md#top). -* **REQUIRE_THAT(** _lhs_, _matcher expression_ **)** and -* **CHECK_THAT(** _lhs_, _matcher expression_ **)** +* **REQUIRE_THAT(** _lhs_, _matcher expression_ **)** and +* **CHECK_THAT(** _lhs_, _matcher expression_ **)** Matchers can be composed using `&&`, `||` and `!` operators. diff --git a/packages/Catch2/docs/ci-and-misc.md b/packages/Catch2/docs/ci-and-misc.md index ef9dff24cafacc3109d1dd948377512e67729746..c07da29f056a8ab3df96863475436f757e814e66 100644 --- a/packages/Catch2/docs/ci-and-misc.md +++ b/packages/Catch2/docs/ci-and-misc.md @@ -1,8 +1,15 @@ <a id="top"></a> -# CI and other odd pieces +# Tooling integration (CI, test runners and so on) + +**Contents**<br> +[Continuous Integration systems](#continuous-integration-systems)<br> +[Bazel test runner integration](#bazel-test-runner-integration)<br> +[Low-level tools](#low-level-tools)<br> +[CMake](#cmake)<br> + +This page talks about Catch2's integration with other related tooling, +like Continuous Integration and 3rd party test runners. -This page talks about how Catch integrates with Continuous Integration -Build Systems may refer to low-level tools, like CMake, or larger systems that run on servers, like Jenkins or TeamCity. This page will talk about both. ## Continuous Integration systems @@ -11,9 +18,9 @@ Probably the most important aspect to using Catch with a build server is the use Two of these reporters are built in (XML and JUnit) and the third (TeamCity) is included as a separate header. It's possible that the other two may be split out in the future too - as that would make the core of Catch smaller for those that don't need them. ### XML Reporter -```-r xml``` +```-r xml``` -The XML Reporter writes in an XML format that is specific to Catch. +The XML Reporter writes in an XML format that is specific to Catch. The advantage of this format is that it corresponds well to the way Catch works (especially the more unusual features, such as nested sections) and is a fully streaming format - that is it writes output as it goes, without having to store up all its results before it can start writing. @@ -51,6 +58,26 @@ Because of the incremental nature of Catch's test suites and ability to run spec [SonarQube Generic Test Data](https://docs.sonarqube.org/latest/analysis/generic-test/) XML format for tests metrics. +## Bazel test runner integration + +Catch2 understands some of the environment variables Bazel uses to control +test execution. Specifically it understands + + * JUnit output path via `XML_OUTPUT_FILE` + * Test filtering via `TESTBRIDGE_TEST_ONLY` + * Test sharding via `TEST_SHARD_INDEX`, `TEST_TOTAL_SHARDS`, and `TEST_SHARD_STATUS_FILE` + +> Support for `XML_OUTPUT_FILE` was [introduced](https://github.com/catchorg/Catch2/pull/2399) in Catch2 3.0.1 + +> Support for `TESTBRIDGE_TEST_ONLY` and sharding was introduced in Catch2 3.2.0 + +This integration is enabled via either a [compile time configuration +option](configuration.md#bazel-support), or via `BAZEL_TEST` environment +variable set to "1". + +> Support for `BAZEL_TEST` was [introduced](https://github.com/catchorg/Catch2/pull/2459) in Catch2 3.1.0 + + ## Low-level tools ### CodeCoverage module (GCOV, LCOV...) diff --git a/packages/Catch2/docs/cmake-integration.md b/packages/Catch2/docs/cmake-integration.md index dc3efc9d9f4c578476d33fe54b20b6564eaddc54..e38d5c2f40d28a46aa6b65c22a6c9c6ce0e32bea 100644 --- a/packages/Catch2/docs/cmake-integration.md +++ b/packages/Catch2/docs/cmake-integration.md @@ -90,12 +90,12 @@ cmake_minimum_required(VERSION 3.5) project(baz LANGUAGES CXX VERSION 0.0.1) find_package(Catch2 REQUIRED) -add_executable(foo test.cpp) -target_link_libraries(foo PRIVATE Catch2::Catch2) +add_executable(tests test.cpp) +target_link_libraries(tests PRIVATE Catch2::Catch2) include(CTest) include(Catch) -catch_discover_tests(foo) +catch_discover_tests(tests) ``` When using `FetchContent`, `include(Catch)` will fail unless @@ -108,11 +108,11 @@ directory. list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras) include(CTest) include(Catch) -catch_discover_tests() +catch_discover_tests(tests) ``` #### Customization -`catch_discover_tests` can be given several extra argumets: +`catch_discover_tests` can be given several extra arguments: ```cmake catch_discover_tests(target [TEST_SPEC arg1...] @@ -126,6 +126,7 @@ catch_discover_tests(target [OUTPUT_DIR dir] [OUTPUT_PREFIX prefix] [OUTPUT_SUFFIX suffix] + [DISCOVERY_MODE <POST_BUILD|PRE_TEST>] ) ``` @@ -198,6 +199,16 @@ If specified, `suffix` is added to each output file name, like so `--out dir/<test_name>suffix`. This can be used to add a file extension to the output file name e.g. ".xml". +* `DISCOVERY_MODE mode` + +If specified allows control over when test discovery is performed. +For a value of `POST_BUILD` (default) test discovery is performed at build time. +For a a value of `PRE_TEST` test discovery is delayed until just prior to test +execution (useful e.g. in cross-compilation environments). +``DISCOVERY_MODE`` defaults to the value of the +``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when +calling ``catch_discover_tests``. This provides a mechanism for globally +selecting a preferred test discovery behavior. ### `ParseAndAddCatchTests.cmake` @@ -222,12 +233,12 @@ cmake_minimum_required(VERSION 3.5) project(baz LANGUAGES CXX VERSION 0.0.1) find_package(Catch2 REQUIRED) -add_executable(foo test.cpp) -target_link_libraries(foo PRIVATE Catch2::Catch2) +add_executable(tests test.cpp) +target_link_libraries(tests PRIVATE Catch2::Catch2) include(CTest) include(ParseAndAddCatchTests) -ParseAndAddCatchTests(foo) +ParseAndAddCatchTests(tests) ``` diff --git a/packages/Catch2/docs/command-line.md b/packages/Catch2/docs/command-line.md index 218e2f596e4ec89c68fbeaee9f93d5d22f0b6584..a15a213147b3b4ed8a34a8402fd287f0d82ef5cd 100644 --- a/packages/Catch2/docs/command-line.md +++ b/packages/Catch2/docs/command-line.md @@ -148,7 +148,7 @@ validity, and throw an error if they are wrong._ > Support for passing arguments to reporters through the `-r`, `--reporter` flag was introduced in Catch2 3.0.1 There are multiple built-in reporters, you can see what they do by using the -[`--list-reporter`](command-line.md#listing-available-tests-tags-or-reporters) +[`--list-reporters`](command-line.md#listing-available-tests-tags-or-reporters) flag. If you need a reporter providing custom format outside of the already provided ones, look at the ["write your own reporter" part of the reporter documentation](reporters.md#writing-your-own-reporter). @@ -284,7 +284,7 @@ This option transforms tabs and newline characters into ```\t``` and ```\n``` re <pre>-w, --warn <warning name></pre> You can think of Catch2's warnings as the equivalent of `-Werror` (`/WX`) -flag for C++ compilers. It turns some suspicious occurences, like a section +flag for C++ compilers. It turns some suspicious occurrences, like a section without assertions, into errors. Because these might be intended, warnings are not enabled by default, but user can opt in. @@ -313,7 +313,7 @@ When set to ```yes``` Catch will report the duration of each test case, in milli > `--min-duration` was [introduced](https://github.com/catchorg/Catch2/pull/1910) in Catch2 2.13.0 When set, Catch will report the duration of each test case that took more -than <value> seconds, in milliseconds. This option is overriden by both +than <value> seconds, in milliseconds. This option is overridden by both `-d yes` and `-d no`, so that either all durations are reported, or none are. @@ -339,8 +339,8 @@ Test cases are ordered one of three ways: ### decl Declaration order (this is the default order if no --order argument is provided). -Tests in the same TU are sorted using their declaration orders, different -TUs are in an implementation (linking) dependent order. +Tests in the same translation unit are sorted using their declaration orders, +different TUs are sorted in an implementation (linking) dependent order. ### lex @@ -507,10 +507,13 @@ start of the first section.</br> ## Filenames as tags <pre>-#, --filenames-as-tags</pre> -When this option is used then every test is given an additional tag which is formed of the unqualified -filename it is found in, with any extension stripped, prefixed with the `#` character. +This option adds an extra tag to all test cases. The tag is `#` followed +by the unqualified filename the test case is defined in, with the _last_ +extension stripped out. + +For example, tests within the file `tests\SelfTest\UsageTests\BDD.tests.cpp` +will be given the `[#BDD.tests]` tag. -So, for example, tests within the file `~\Dev\MyProject\Ferrets.cpp` would be tagged `[#Ferrets]`. <a id="colour-mode"></a> ## Override output colouring @@ -548,7 +551,8 @@ starting at 0. The tests in the set given by `--shard-index <#shard index to run>` will be executed. The default shard count is `1`, and the default index to run is `0`. -_It is an error to specify a shard index greater than the number of shards._ +_Shard index must be less than number of shards. As the name suggests, +it is treated as an index of the shard to run._ Sharding is useful when you want to split test execution across multiple processes, as is done with the [Bazel test sharding](https://docs.bazel.build/versions/main/test-encyclopedia.html#test-sharding). @@ -560,17 +564,17 @@ processes, as is done with the [Bazel test sharding](https://docs.bazel.build/ve > Introduced in Catch2 3.0.1. -By default, Catch2 test binaries return non-0 exit code if no tests were -run, e.g. if the binary was compiled with no tests, or the provided test -spec matched no tests. This flag overrides that, so a test run with no -tests still returns 0. +By default, Catch2 test binaries return non-0 exit code if no tests were run, +e.g. if the binary was compiled with no tests, the provided test spec matched no +tests, or all tests [were skipped at runtime](skipping-passing-failing.md#top). This flag +overrides that, so a test run with no tests still returns 0. ## Output verbosity ``` -v, --verbosity <quiet|normal|high> ``` -Changing verbosity might change how much details Catch2's reporters output. +Changing verbosity might change how many details Catch2's reporters output. However, you should consider changing the verbosity level as a _suggestion_. Not all reporters support all verbosity levels, e.g. because the reporter's format cannot meaningfully change. In that case, the verbosity level is diff --git a/packages/Catch2/docs/commercial-users.md b/packages/Catch2/docs/commercial-users.md index bb41e741e7e84f17f0291ddbb85f95488de748c1..020eaefcb3d2ed158e28a50effb7c7d1159dec83 100644 --- a/packages/Catch2/docs/commercial-users.md +++ b/packages/Catch2/docs/commercial-users.md @@ -6,7 +6,7 @@ some of them that are willing to share this information. If you want to add your organisation, please check that there is no issue with you sharing this fact. - + - Bloomberg - [Bloomlife](https://bloomlife.com) - [Inscopix Inc.](https://www.inscopix.com/) @@ -16,7 +16,7 @@ with you sharing this fact. - [Nexus Software Systems](https://nexwebsites.com) - [UX3D](https://ux3d.io) - [King](https://king.com) - + --- diff --git a/packages/Catch2/docs/comparing-floating-point-numbers.md b/packages/Catch2/docs/comparing-floating-point-numbers.md new file mode 100644 index 0000000000000000000000000000000000000000..ab5ba6df6cbc3181c977973856b64d37e165da21 --- /dev/null +++ b/packages/Catch2/docs/comparing-floating-point-numbers.md @@ -0,0 +1,192 @@ +<a id="top"></a> +# Comparing floating point numbers with Catch2 + +If you are not deeply familiar with them, floating point numbers can be +unintuitive. This also applies to comparing floating point numbers for +(in)equality. + +This page assumes that you have some understanding of both FP, and the +meaning of different kinds of comparisons, and only goes over what +functionality Catch2 provides to help you with comparing floating point +numbers. If you do not have this understanding, we recommend that you first +study up on floating point numbers and their comparisons, e.g. by [reading +this blog post](https://codingnest.com/the-little-things-comparing-floating-point-numbers/). + + +## Floating point matchers + +``` +#include <catch2/matchers/catch_matchers_floating_point.hpp> +``` + +[Matchers](matchers.md#top) are the preferred way of comparing floating +point numbers in Catch2. We provide 3 of them: + +* `WithinAbs(double target, double margin)`, +* `WithinRel(FloatingPoint target, FloatingPoint eps)`, and +* `WithinULP(FloatingPoint target, uint64_t maxUlpDiff)`. + +> `WithinRel` matcher was introduced in Catch2 2.10.0 + +As with all matchers, you can combine multiple floating point matchers +in a single assertion. For example, to check that some computation matches +a known good value within 0.1% or is close enough (no different to 5 +decimal places) to zero, we would write this assertion: + +```cpp + REQUIRE_THAT( computation(input), + Catch::Matchers::WithinRel(expected, 0.001) + || Catch::Matchers::WithinAbs(0, 0.000001) ); +``` + + +### WithinAbs + +`WithinAbs` creates a matcher that accepts floating point numbers whose +difference with `target` is less-or-equal to the `margin`. Since `float` +can be converted to `double` without losing precision, only `double` +overload exists. + +```cpp +REQUIRE_THAT(1.0, WithinAbs(1.2, 0.2)); +REQUIRE_THAT(0.f, !WithinAbs(1.0, 0.5)); +// Notice that infinity == infinity for WithinAbs +REQUIRE_THAT(INFINITY, WithinAbs(INFINITY, 0)); +``` + + +### WithinRel + +`WithinRel` creates a matcher that accepts floating point numbers that +are _approximately equal_ to the `target` with a tolerance of `eps.` +Specifically, it matches if +`|arg - target| <= eps * max(|arg|, |target|)` holds. If you do not +specify `eps`, `std::numeric_limits<FloatingPoint>::epsilon * 100` +is used as the default. + +```cpp +// Notice that WithinRel comparison is symmetric, unlike Approx's. +REQUIRE_THAT(1.0, WithinRel(1.1, 0.1)); +REQUIRE_THAT(1.1, WithinRel(1.0, 0.1)); +// Notice that inifnity == infinity for WithinRel +REQUIRE_THAT(INFINITY, WithinRel(INFINITY)); +``` + + +### WithinULP + +`WithinULP` creates a matcher that accepts floating point numbers that +are no more than `maxUlpDiff` +[ULPs](https://en.wikipedia.org/wiki/Unit_in_the_last_place) +away from the `target` value. The short version of what this means +is that there is no more than `maxUlpDiff - 1` representable floating +point numbers between the argument for matching and the `target` value. + +When using the ULP matcher in Catch2, it is important to keep in mind +that Catch2 interprets ULP distance slightly differently than +e.g. `std::nextafter` does. + +Catch2's ULP calculation obeys these relations: + * `ulpDistance(-x, x) == 2 * ulpDistance(x, 0)` + * `ulpDistance(-0, 0) == 0` (due to the above) + * `ulpDistance(DBL_MAX, INFINITY) == 1` + * `ulpDistancE(NaN, x) == infinity` + + +**Important**: The WithinULP matcher requires the platform to use the +[IEEE-754](https://en.wikipedia.org/wiki/IEEE_754) representation for +floating point numbers. + +```cpp +REQUIRE_THAT( -0.f, WithinULP( 0.f, 0 ) ); +``` + + +## `Approx` + +``` +#include <catch2/catch_approx.hpp> +``` + +**We strongly recommend against using `Approx` when writing new code.** +You should be using floating point matchers instead. + +Catch2 provides one more way to handle floating point comparisons. It is +`Approx`, a special type with overloaded comparison operators, that can +be used in standard assertions, e.g. + +```cpp +REQUIRE(0.99999 == Catch::Approx(1)); +``` + +`Approx` supports four comparison operators, `==`, `!=`, `<=`, `>=`, and can +also be used with strong typedefs over `double`s. It can be used for both +relative and margin comparisons by using its three customization points. +Note that the semantics of this is always that of an _or_, so if either +the relative or absolute margin comparison passes, then the whole comparison +passes. + +The downside to `Approx` is that it has a couple of issues that we cannot +fix without breaking backwards compatibility. Because Catch2 also provides +complete set of matchers that implement different floating point comparison +methods, `Approx` is left as-is, is considered deprecated, and should +not be used in new code. + +The issues are + * All internal computation is done in `double`s, leading to slightly + different results if the inputs were floats. + * `Approx`'s relative margin comparison is not symmetric. This means + that `Approx( 10 ).epsilon(0.1) != 11.1` but `Approx( 11.1 ).epsilon(0.1) == 10`. + * By default, `Approx` only uses relative margin comparison. This means + that `Approx(0) == X` only passes for `X == 0`. + + +### Approx details + +If you still want/need to know more about `Approx`, read on. + +Catch2 provides a UDL for `Approx`; `_a`. It resides in the `Catch::literals` +namespace, and can be used like this: + +```cpp +using namespace Catch::literals; +REQUIRE( performComputation() == 2.1_a ); +``` + +`Approx` has three customization points for the comparison: + +* **epsilon** - epsilon sets the coefficient by which a result +can differ from `Approx`'s value before it is rejected. +_Defaults to `std::numeric_limits<float>::epsilon()*100`._ + +```cpp +Approx target = Approx(100).epsilon(0.01); +100.0 == target; // Obviously true +200.0 == target; // Obviously still false +100.5 == target; // True, because we set target to allow up to 1% difference +``` + + +* **margin** - margin sets the absolute value by which +a result can differ from `Approx`'s value before it is rejected. +_Defaults to `0.0`._ + +```cpp +Approx target = Approx(100).margin(5); +100.0 == target; // Obviously true +200.0 == target; // Obviously still false +104.0 == target; // True, because we set target to allow absolute difference of at most 5 +``` + +* **scale** - scale is used to change the magnitude of `Approx` for the relative check. +_By default, set to `0.0`._ + +Scale could be useful if the computation leading to the result worked +on a different scale than is used by the results. Approx's scale is added +to Approx's value when computing the allowed relative margin from the +Approx's value. + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/configuration.md b/packages/Catch2/docs/configuration.md index 9fd7f58b6d9e964ccf3d26ddb067a5f0889147fe..d6e159e529e159eaf8a736aff0dcf8732d691c34 100644 --- a/packages/Catch2/docs/configuration.md +++ b/packages/Catch2/docs/configuration.md @@ -15,11 +15,12 @@ [Enabling stringification](#enabling-stringification)<br> [Disabling exceptions](#disabling-exceptions)<br> [Overriding Catch's debug break (`-b`)](#overriding-catchs-debug-break--b)<br> +[Static analysis support](#static-analysis-support)<br> Catch2 is designed to "just work" as much as possible, and most of the configuration options below are changed automatically during compilation, according to the detected environment. However, this detection can also -be overriden by users, using macros documented below, and/or CMake options +be overridden by users, using macros documented below, and/or CMake options with the same name. @@ -98,13 +99,19 @@ is equivalent with the out-of-the-box experience. ## Bazel support -When `CATCH_CONFIG_BAZEL_SUPPORT` is defined or when `BAZEL_TEST=1` (which is set by the Bazel inside of a test environment), -Catch2 will register a `JUnit` reporter writing to a path pointed by `XML_OUTPUT_FILE` provided by Bazel. + +Compiling Catch2 with `CATCH_CONFIG_BAZEL_SUPPORT` force-enables Catch2's +support for Bazel's environment variables (normally Catch2 looks for +`BAZEL_TEST=1` env var first). + +This can be useful if you are using older versions of Bazel, that do not +yet have `BAZEL_TEST` env var support. > `CATCH_CONFIG_BAZEL_SUPPORT` was [introduced](https://github.com/catchorg/Catch2/pull/2399) in Catch2 3.0.1. > `CATCH_CONFIG_BAZEL_SUPPORT` was [deprecated](https://github.com/catchorg/Catch2/pull/2459) in Catch2 3.1.0. + ## C++11 toggles CATCH_CONFIG_CPP11_TO_STRING // Use `std::to_string` @@ -149,13 +156,20 @@ by using `_NO_` in the macro, e.g. `CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS`. CATCH_CONFIG_USE_ASYNC // Force parallel statistical processing of samples during benchmarking CATCH_CONFIG_ANDROID_LOGWRITE // Use android's logging system for debug output CATCH_CONFIG_GLOBAL_NEXTAFTER // Use nextafter{,f,l} instead of std::nextafter + CATCH_CONFIG_GETENV // System has a working `getenv` > [`CATCH_CONFIG_ANDROID_LOGWRITE`](https://github.com/catchorg/Catch2/issues/1743) and [`CATCH_CONFIG_GLOBAL_NEXTAFTER`](https://github.com/catchorg/Catch2/pull/1739) were introduced in Catch2 2.10.0 +> `CATCH_CONFIG_GETENV` was [introduced](https://github.com/catchorg/Catch2/pull/2562) in Catch2 3.2.0 + Currently Catch enables `CATCH_CONFIG_WINDOWS_SEH` only when compiled with MSVC, because some versions of MinGW do not have the necessary Win32 API support. `CATCH_CONFIG_POSIX_SIGNALS` is on by default, except when Catch is compiled under `Cygwin`, where it is disabled by default (but can be force-enabled by defining `CATCH_CONFIG_POSIX_SIGNALS`). +`CATCH_CONFIG_GETENV` is on by default, except when Catch2 is compiled for +platforms that lacks working `std::getenv` (currently Windows UWP and +Playstation). + `CATCH_CONFIG_WINDOWS_CRTDBG` is off by default. If enabled, Windows's CRT is used to check for memory leaks, and displays them after the tests finish running. This option only works when linking against the default @@ -251,6 +265,31 @@ The macro will be used as is, that is, `CATCH_BREAK_INTO_DEBUGGER();` must compile and must break into debugger. +## Static analysis support + +> Introduced in Catch2 X.Y.Z. + +Some parts of Catch2, e.g. `SECTION`s, can be hard for static analysis +tools to reason about. Catch2 can change its internals to help static +analysis tools reason about the tests. + +Catch2 automatically detects some static analysis tools (initial +implementation checks for clang-tidy and Coverity), but you can override +its detection (in either direction) via + +``` +CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT // force enables static analysis help +CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT // force disables static analysis help +``` + +_As the name suggests, this is currently experimental, and thus we provide +no backwards compatibility guarantees._ + +**DO NOT ENABLE THIS FOR BUILDS YOU INTEND TO RUN.** The changed internals +are not meant to be runnable, only "scannable". + + + --- [Home](Readme.md#top) diff --git a/packages/Catch2/docs/contributing.md b/packages/Catch2/docs/contributing.md index addeb5c9a44e7d1ad29e436a4b558d8dd3f3f960..d9f87fc1a138d92f9779317d1e9b1e99a341ef91 100644 --- a/packages/Catch2/docs/contributing.md +++ b/packages/Catch2/docs/contributing.md @@ -55,6 +55,15 @@ tests from `SelfTest` through a specific reporter and then compare the generated output with a known good output ("Baseline"). By default, new tests should be placed here. +To configure a Catch2 build with just the basic tests, use the `basic-tests` +preset, like so: + +``` +# Assuming you are in Catch2's root folder + +cmake -B basic-test-build -S . -DCMAKE_BUILD_TYPE=Debug --preset basic-tests +``` + However, not all tests can be written as plain unit tests. For example, checking that Catch2 orders tests randomly when asked to, and that this random ordering is subset-invariant, is better done as an integration @@ -76,21 +85,23 @@ configuration and require separate compilation. Finally, CMake config tests test that you set Catch2's compile-time configuration options through CMake, using CMake options of the same name. -None of these tests are enabled by default. To enable them, add +These test categories can be enabled one by one, by passing `-DCATCH_BUILD_EXAMPLES=ON`, `-DCATCH_BUILD_EXTRA_TESTS=ON`, and -`-DCATCH_ENABLE_CONFIGURE_TESTS=ON` when configuration the CMake build. +`-DCATCH_ENABLE_CONFIGURE_TESTS=ON` when configuring the build. -Bringing this all together, the steps below should configure, build, -and run all tests in the `Debug` compilation. +Catch2 also provides a preset that promises to enable _all_ test types, +`all-tests`. + +The snippet below will build & run all tests, in `Debug` compilation mode. <!-- snippet: catch2-build-and-test --> <a id='snippet-catch2-build-and-test'></a> ```sh -# 1. Regenerate the amalgamated distribution +# 1. Regenerate the amalgamated distribution (some tests are built against it) ./tools/scripts/generateAmalgamatedFiles.py # 2. Configure the full test build -cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON +cmake -B debug-build -S . -DCMAKE_BUILD_TYPE=Debug --preset all-tests # 3. Run the actual build cmake --build debug-build @@ -125,7 +136,7 @@ information that you will need for updating Catch2's documentation, and possibly some generic advise as well. -### Technicalities +### Technicalities First, the technicalities: @@ -203,7 +214,7 @@ and so on. Catch2 currently targets C++14 as the minimum supported C++ version. Features from higher language versions should be used only sparingly, -when the benefits from using them outweight the maintenance overhead. +when the benefits from using them outweigh the maintenance overhead. Example of good use of polyfilling features is our use of `conjunction`, where if available we use `std::conjunction` and otherwise provide our @@ -291,7 +302,7 @@ Specifically, every source file should start with the licence header: // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. - // (See accompanying file LICENSE_1_0.txt or copy at + // (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -303,6 +314,20 @@ be `CATCH_MATCHERS_FOO_HPP_INCLUDED`, for `catch_generators_bar.hpp`, the includ guard should be `CATCH_GENERATORS_BAR_HPP_INCLUDED`, and so on. +### Adding new `CATCH_CONFIG` option + +When adding new `CATCH_CONFIG` option, there are multiple places to edit: + * `CMake/CatchConfigOptions.cmake` - this is used to generate the + configuration options in CMake, so that CMake frontends know about them. + * `docs/configuration.md` - this is where the options are documented + * `src/catch2/catch_user_config.hpp.in` - this is template for generating + `catch_user_config.hpp` which contains the materialized configuration + * `BUILD.bazel` - Bazel does not have configuration support like CMake, + and all expansions need to be done manually + * other files as needed, e.g. `catch2/internal/catch_config_foo.hpp` + for the logic that guards the configuration + + ## CoC This project has a [CoC](../CODE_OF_CONDUCT.md). Please adhere to it diff --git a/packages/Catch2/docs/deprecations.md b/packages/Catch2/docs/deprecations.md index 2c9bf5517bb342188c62c3909239acc8c45c7f7b..1fb79aaa0fc723d39ceb21513b0d1456e26c22dc 100644 --- a/packages/Catch2/docs/deprecations.md +++ b/packages/Catch2/docs/deprecations.md @@ -26,6 +26,15 @@ to accurately probe the environment for this information so the flag where it will export `BAZEL_TEST=1` for purposes like the above. Catch2 will now instead inspect the environment instead of relying on build configuration. +### `IEventLister::skipTest( TestCaseInfo const& testInfo )` + +This event (including implementations in derived classes such as `ReporterBase`) +is deprecated and will be removed in the next major release. It is currently +invoked for all test cases that are not going to be executed due to the test run +being aborted (when using `--abort` or `--abortx`). It is however +**NOT** invoked for test cases that are [explicitly skipped using the `SKIP` +macro](skipping-passing-failing.md#top). + --- [Home](Readme.md#top) diff --git a/packages/Catch2/docs/event-listeners.md b/packages/Catch2/docs/event-listeners.md index 9b706948d1f5adf26ec3efe6072fba2b23a46f9b..71db3e183aaafcb2e82512da7b62f1b855b895fd 100644 --- a/packages/Catch2/docs/event-listeners.md +++ b/packages/Catch2/docs/event-listeners.md @@ -33,7 +33,7 @@ public: CATCH_REGISTER_LISTENER(testRunListener) ``` -_Note that you should not use any assertion macros within a Listener!_ +_Note that you should not use any assertion macros within a Listener!_ [You can find the list of events that the listeners can react to on its own page](reporter-events.md#top). diff --git a/packages/Catch2/docs/faq.md b/packages/Catch2/docs/faq.md index 81d8be680fa2af90df03b6a20abda6ca72106ed3..a7d0455a35c94e8dbb7e0f4eb37858747ed4b854 100644 --- a/packages/Catch2/docs/faq.md +++ b/packages/Catch2/docs/faq.md @@ -8,6 +8,9 @@ [What is Catch2's ABI stability policy?](#what-is-catch2s-abi-stability-policy)<br> [What is Catch2's API stability policy?](#what-is-catch2s-api-stability-policy)<br> [Does Catch2 support running tests in parallel?](#does-catch2-support-running-tests-in-parallel)<br> +[Can I compile Catch2 into a dynamic library?](#can-i-compile-catch2-into-a-dynamic-library)<br> +[What repeatability guarantees does Catch2 provide?](#what-repeatability-guarantees-does-catch2-provide)<br> + ## How do I run global setup/teardown only if tests will be run? @@ -24,8 +27,8 @@ depending on how often the cleanup needs to happen. ## Why cannot I derive from the built-in reporters? -They are not made to be overriden, in that we do not attempt to maintain -a consistent internal state if a member function is overriden, and by +They are not made to be overridden, in that we do not attempt to maintain +a consistent internal state if a member function is overridden, and by forbidding users from using them as a base class, we can refactor them as needed later. @@ -58,6 +61,34 @@ runners easier. [See the relevant section in our page on best practices](usage-tips.md#parallel-tests). +## Can I compile Catch2 into a dynamic library? + +Yes, Catch2 supports the [standard CMake `BUILD_SHARED_LIBS` +option](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html). +However, the dynamic library support is provided as-is. Catch2 does not +provide API export annotations, and so you can only use it as a dynamic +library on platforms that default to public visibility, or with tooling +support to force export Catch2's API. + + +## What repeatability guarantees does Catch2 provide? + +There are two places where it is meaningful to talk about Catch2's +repeatability guarantees without taking into account user-provided +code. First one is in the test case shuffling, and the second one is +the output from random generators. + +Test case shuffling is repeatable across different platforms since v2.12.0, +and it is also generally repeatable across versions, but we might break +it from time to time. E.g. we broke repeatability with previous versions +in v2.13.4 so that test cases with similar names are shuffled better. + +Random generators currently rely on platform's stdlib, specifically +the distributions from `<random>`. We thus provide no extra guarantee +above what your platform does. **Important: `<random>`'s distributions +are not specified to be repeatable across different platforms.** + + --- [Home](Readme.md#top) diff --git a/packages/Catch2/docs/generators.md b/packages/Catch2/docs/generators.md index 7a865d4364a7c39340086edae8064c54a0dac842..097997521c09705cc549db61ad42705429bf42e9 100644 --- a/packages/Catch2/docs/generators.md +++ b/packages/Catch2/docs/generators.md @@ -134,7 +134,7 @@ type, making their usage much nicer. These are * `map<T>(func, GeneratorWrapper<U>&&)` for `MapGenerator<T, U, Func>` (map `U` to `T`) * `chunk(chunk-size, GeneratorWrapper<T>&&)` for `ChunkGenerator<T>` * `random(IntegerOrFloat a, IntegerOrFloat b)` for `RandomIntegerGenerator` or `RandomFloatGenerator` -* `range(Arithemtic start, Arithmetic end)` for `RangeGenerator<Arithmetic>` with a step size of `1` +* `range(Arithmetic start, Arithmetic end)` for `RangeGenerator<Arithmetic>` with a step size of `1` * `range(Arithmetic start, Arithmetic end, Arithmetic step)` for `RangeGenerator<Arithmetic>` with a custom step size * `from_range(InputIterator from, InputIterator to)` for `IteratorGenerator<T>` * `from_range(Container const&)` for `IteratorGenerator<T>` @@ -205,15 +205,37 @@ struct IGenerator : GeneratorUntypedBase { // Precondition: // The generator is either freshly constructed or the last call to next() returned true virtual T const& get() const = 0; + + // Returns user-friendly string showing the current generator element + // Does not have to be overridden, IGenerator provides default implementation + virtual std::string stringifyImpl() const; }; ``` However, to be able to use your custom generator inside `GENERATE`, it will need to be wrapped inside a `GeneratorWrapper<T>`. `GeneratorWrapper<T>` is a value wrapper around a -`std::unique_ptr<IGenerator<T>>`. +`Catch::Detail::unique_ptr<IGenerator<T>>`. For full example of implementing your own generator, look into Catch2's examples, specifically [Generators: Create your own generator](../examples/300-Gen-OwnGenerator.cpp). + +### Handling empty generators + +The generator interface assumes that a generator always has at least one +element. This is not always true, e.g. if the generator depends on an external +datafile, the file might be missing. + +There are two ways to handle this, depending on whether you want this +to be an error or not. + + * If empty generator **is** an error, throw an exception in constructor. + * If empty generator **is not** an error, use the [`SKIP`](skipping-passing-failing.md#skipping-test-cases-at-runtime) in constructor. + + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/limitations.md b/packages/Catch2/docs/limitations.md index 55c54738a6d66a3b621957886949732fbe9cc923..cc0ed05d1370d2c910c439da74944f228ce0af51 100644 --- a/packages/Catch2/docs/limitations.md +++ b/packages/Catch2/docs/limitations.md @@ -88,8 +88,8 @@ because only one thread passes the `REQUIRE` macro and this is not REQUIRE(cnt == 16); ``` -Because C++11 provides the necessary tools to do this, we are planning -to remove this limitation in the future. +We currently do not plan to support thread-safe assertions. + ### Process isolation in a test Catch does not support running tests in isolated (forked) processes. While this might in the future, the fact that Windows does not support forking and only allows full-on process creation and the desire to keep code as similar as possible across platforms, mean that this is likely to take significant development time, that is not currently available. @@ -99,7 +99,7 @@ Catch does not support running tests in isolated (forked) processes. While this Catch2 keeps test execution in one process strictly serial, and there are no plans to change this. If you find yourself with a test suite -that takes too long to run and yo uwant to make it parallel, you have +that takes too long to run and you want to make it parallel, you have to run multiple processes side by side. There are 2 basic ways to do that, @@ -155,7 +155,7 @@ with expansion: ### Clang/G++ -- skipping leaf sections after an exception -Some versions of `libc++` and `libstdc++` (or their runtimes) have a bug with `std::uncaught_exception()` getting stuck returning `true` after rethrow, even if there are no active exceptions. One such case is this snippet, which skipped the sections "a" and "b", when compiled against `libcxxrt` from master +Some versions of `libc++` and `libstdc++` (or their runtimes) have a bug with `std::uncaught_exception()` getting stuck returning `true` after rethrow, even if there are no active exceptions. One such case is this snippet, which skipped the sections "a" and "b", when compiled against `libcxxrt` from the master branch ```cpp #include <catch2/catch_test_macros.hpp> @@ -171,7 +171,7 @@ TEST_CASE("b") { } ``` -If you are seeing a problem like this, i.e. a weird test paths that trigger only under Clang with `libc++`, or only under very specific version of `libstdc++`, it is very likely you are seeing this. The only known workaround is to use a fixed version of your standard library. +If you are seeing a problem like this, i.e. weird test paths that trigger only under Clang with `libc++`, or only under very specific version of `libstdc++`, it is very likely you are seeing this. The only known workaround is to use a fixed version of your standard library. ### libstdc++, `_GLIBCXX_DEBUG` macro and random ordering of tests diff --git a/packages/Catch2/docs/matchers.md b/packages/Catch2/docs/matchers.md index 0060bfd172307af534a7389eb684bffd3118d654..14c1589821d3ae82b145e67568e3655ebf35b45a 100644 --- a/packages/Catch2/docs/matchers.md +++ b/packages/Catch2/docs/matchers.md @@ -141,58 +141,26 @@ are a permutation of the ones in `some_vec`. ### Floating point matchers -Catch2 provides 3 matchers that target floating point numbers. These +Catch2 provides 4 matchers that target floating point numbers. These are: * `WithinAbs(double target, double margin)`, * `WithinULP(FloatingPoint target, uint64_t maxUlpDiff)`, and * `WithinRel(FloatingPoint target, FloatingPoint eps)`. +* `IsNaN()` > `WithinRel` matcher was introduced in Catch2 2.10.0 +> `IsNaN` matcher was introduced in Catch2 3.3.2. -`WithinAbs` creates a matcher that accepts floating point numbers whose -difference with `target` is less than the `margin`. +The first three serve to compare two floating pointe numbers. For more +details about how they work, read [the docs on comparing floating point +numbers](comparing-floating-point-numbers.md#floating-point-matchers). -`WithinULP` creates a matcher that accepts floating point numbers that -are no more than `maxUlpDiff` -[ULPs](https://en.wikipedia.org/wiki/Unit_in_the_last_place) -away from the `target` value. The short version of what this means -is that there is no more than `maxUlpDiff - 1` representeable floating -point numbers between the argument for matching and the `target` value. - -**Important**: The WithinULP matcher requires the platform to use the -[IEEE-754](https://en.wikipedia.org/wiki/IEEE_754) representation for -floating point numbers. - - -`WithinRel` creates a matcher that accepts floating point numbers that -are _approximately equal_ with the `target` with tolerance of `eps.` -Specifically, it matches if -`|arg - target| <= eps * max(|arg|, |target|)` holds. If you do not -specify `eps`, `std::numeric_limits<FloatingPoint>::epsilon * 100` -is used as the default. - - -In practice, you will often want to combine multiple of these matchers, -together for an assertion, because all 3 options have edge cases where -they behave differently than you would expect. As an example, under -the `WithinRel` matcher, a `0.` only ever matches a `0.` (or `-0.`), -regardless of the relative tolerance specified. Thus, if you want to -handle numbers that are "close enough to 0 to be 0", you have to combine -it with the `WithinAbs` matcher. - -For example, to check that our computation matches known good value -within 0.1%, or is close enough (no different to 5 decimal places) -to zero, we would write this assertion: -```cpp - REQUIRE_THAT( computation(input), - Catch::Matchers::WithinRel(expected, 0.001) - || Catch::Matchers::WithinAbs(0, 0.000001) ); -``` - - -> floating point matchers live in `catch2/matchers/catch_matchers_floating.hpp` +`IsNaN` then does exactly what it says on the tin. It matches the input +if it is a NaN (Not a Number). The advantage of using it over just plain +`REQUIRE(std::isnan(x))`, is that if the check fails, with `REQUIRE` you +won't see the value of `x`, but with `REQUIRE_THAT(x, IsNaN())`, you will. ### Miscellaneous matchers @@ -224,20 +192,30 @@ The other miscellaneous matcher utility is exception matching. #### Matching exceptions -Catch2 provides an utility macro for asserting that an expression +Catch2 provides a utility macro for asserting that an expression throws exception of specific type, and that the exception has desired properties. The macro is `REQUIRE_THROWS_MATCHES(expr, ExceptionType, Matcher)`. > `REQUIRE_THROWS_MATCHES` macro lives in `catch2/matchers/catch_matchers.hpp` -Catch2 currently provides only one matcher for exceptions, -`Message(std::string message)`. `Message` checks that the exception's +Catch2 currently provides two matchers for exceptions. +These are: +* `Message(std::string message)`. +* `MessageMatches(Matcher matcher)`. + +> `MessageMatches` was [introduced](https://github.com/catchorg/Catch2/pull/2570) in Catch2 3.3.0 + +`Message` checks that the exception's message, as returned from `what` is exactly equal to `message`. +`MessageMatches` applies the provided matcher on the exception's +message, as returned from `what`. This is useful in conjunctions with the `std::string` matchers (e.g. `StartsWith`) + Example use: ```cpp REQUIRE_THROWS_MATCHES(throwsDerivedException(), DerivedException, Message("DerivedException::what")); +REQUIRE_THROWS_MATCHES(throwsDerivedException(), DerivedException, MessageMatches(StartsWith("DerivedException"))); ``` Note that `DerivedException` in the example above has to derive from @@ -259,11 +237,19 @@ definitions to handle generic range-like types. These are: * `Contains(T&& target_element, Comparator = std::equal_to<>{})` * `Contains(Matcher element_matcher)` * `AllMatch(Matcher element_matcher)` -* `NoneMatch(Matcher element_matcher)` * `AnyMatch(Matcher element_matcher)` -* `AllTrue()` -* `NoneTrue()` -* `AnyTrue()` +* `NoneMatch(Matcher element_matcher)` +* `AllTrue()`, `AnyTrue()`, `NoneTrue()` +* `RangeEquals(TargetRangeLike&&, Comparator = std::equal_to<>{})` +* `UnorderedRangeEquals(TargetRangeLike&&, Comparator = std::equal_to<>{})` + +> `IsEmpty`, `SizeIs`, `Contains` were introduced in Catch2 3.0.1 + +> `All/Any/NoneMatch` were introduced in Catch2 3.0.1 + +> `All/Any/NoneTrue` were introduced in Catch2 3.1.0 + +> `RangeEquals` and `UnorderedRangeEquals` matchers were [introduced](https://github.com/catchorg/Catch2/pull/2377) in Catch2 3.3.0 `IsEmpty` should be self-explanatory. It successfully matches objects that are empty according to either `std::empty`, or ADL-found `empty` @@ -282,14 +268,33 @@ in which case a range is accepted if any of its elements is accepted by the provided matcher. `AllMatch`, `NoneMatch`, and `AnyMatch` match ranges for which either -all, none, or any of the contained elements matches the given matcher, +all, none, or any of the contained elements matches the given matcher, respectively. `AllTrue`, `NoneTrue`, and `AnyTrue` match ranges for which either -all, none, or any of the contained elements are `true`, respectively. -It works for ranges of `bool`s and ranges of elements (explicitly) +all, none, or any of the contained elements are `true`, respectively. +It works for ranges of `bool`s and ranges of elements (explicitly) convertible to `bool`. +`RangeEquals` compares the range that the matcher is constructed with +(the "target range") against the range to be tested, element-wise. The +match succeeds if all elements from the two ranges compare equal (using +`operator==` by default). The ranges do not need to be the same type, +and the element types do not need to be the same, as long as they are +comparable. (e.g. you may compare `std::vector<int>` to `std::array<char>`). + +`UnorderedRangeEquals` is similar to `RangeEquals`, but the order +does not matter. For example "1, 2, 3" would match "3, 2, 1", but not +"1, 1, 2, 3" As with `RangeEquals`, `UnorderedRangeEquals` compares +the individual elements using using `operator==` by default. + +Both `RangeEquals` and `UnorderedRangeEquals` optionally accept a +predicate which can be used to compare the containers element-wise. + +To check a container elementwise against a given matcher, use +`AllMatch`. + + ## Writing custom matchers (old style) The old style of writing matchers has been introduced back in Catch @@ -368,7 +373,7 @@ style matchers arbitrarily. To create a new-style matcher, you have to create your own type that derives from `Catch::Matchers::MatcherGenericBase`. Your type has to -also provide two methods, `bool match( ... ) const` and overriden +also provide two methods, `bool match( ... ) const` and overridden `std::string describe() const`. Unlike with old-style matchers, there are no requirements on how diff --git a/packages/Catch2/docs/migrate-v2-to-v3.md b/packages/Catch2/docs/migrate-v2-to-v3.md index a9c2bb6300cf8e3525f5a5c4bece2642c3c715eb..84ed76904a1f156df846f61a42265214a0c13290 100644 --- a/packages/Catch2/docs/migrate-v2-to-v3.md +++ b/packages/Catch2/docs/migrate-v2-to-v3.md @@ -21,9 +21,10 @@ reduced by roughly 80%. The improved ease of maintenance also led to various runtime performance improvements and the introduction of new features. For details, look at [the release notes of 3.0.1](release-notes.md#301). -_Note that we still provide one header + one TU distribution but do -not consider it the primarily supported option. You should also expect -that the compilation times will be worse if you use this option._ +_Note that we still provide one header + one translation unit (TU) +distribution but do not consider it the primarily supported option. You +should also expect that the compilation times will be worse if you use +this option._ ## How to migrate projects from v2 to v3 diff --git a/packages/Catch2/docs/opensource-users.md b/packages/Catch2/docs/opensource-users.md index c65f71851a01a5b9573eee1b0b1686b9a1372351..a02d0b98e2453cb97b2bc765ee3f8df91f533186 100644 --- a/packages/Catch2/docs/opensource-users.md +++ b/packages/Catch2/docs/opensource-users.md @@ -72,7 +72,7 @@ A header-only template engine for modern C++. A C++17 template header-only library for the abstraction of memory access patterns. ### [libcluon](https://github.com/chrberger/libcluon) -A single-header-only library written in C++14 to glue distributed software components (UDP, TCP, shared memory) supporting natively Protobuf, LCM/ZCM, MsgPack, and JSON for dynamic message transformations in-between. +A single-header-only library written in C++14 to glue distributed software components (UDP, TCP, shared memory) supporting natively Protobuf, LCM/ZCM, MsgPack, and JSON for dynamic message transformations in-between. ### [MNMLSTC Core](https://github.com/mnmlstc/core) A small and easy to use C++11 library that adds a functionality set that will be available in C++14 and later, as well as some useful additions. @@ -95,6 +95,9 @@ A C++ client library for Consul. Consul is a distributed tool for discovering an ### [Reactive-Extensions/ RxCpp](https://github.com/Reactive-Extensions/RxCpp) A library of algorithms for values-distributed-in-time. +### [SFML](https://github.com/SFML/SFML) +Simple and Fast Multimedia Library. + ### [SOCI](https://github.com/SOCI/soci) The C++ Database Access Library. @@ -110,6 +113,12 @@ A header-only TOML parser and serializer for modern C++. ### [Trompeloeil](https://github.com/rollbear/trompeloeil) A thread-safe header-only mocking framework for C++14. +### [wxWidgets](https://www.wxwidgets.org/) +Cross-Platform C++ GUI Library. + +### [xmlwrapp](https://github.com/vslavik/xmlwrapp) +C++ XML parsing library using libxml2. + ## Applications & Tools ### [App Mesh](https://github.com/laoshanxi/app-mesh) @@ -137,7 +146,7 @@ Newsbeuter is an open-source RSS/Atom feed reader for text terminals. A 2D, Zombie, RPG game which is being made on our own engine. ### [raspigcd](https://github.com/pantadeusz/raspigcd) -Low level CLI app and library for execution of GCODE on Raspberry Pi without any additional microcontrolers (just RPi + Stepsticks). +Low level CLI app and library for execution of GCODE on Raspberry Pi without any additional microcontrollers (just RPi + Stepsticks). ### [SpECTRE](https://github.com/sxs-collaboration/spectre) SpECTRE is a code for multi-scale, multi-physics problems in astrophysics and gravitational physics. diff --git a/packages/Catch2/docs/release-notes.md b/packages/Catch2/docs/release-notes.md index da2c598cebbaa352c1a3bc33804ae66ada3366ca..8b413b1560fbe2670a90cfb6cc29380e94009c8f 100644 --- a/packages/Catch2/docs/release-notes.md +++ b/packages/Catch2/docs/release-notes.md @@ -2,6 +2,12 @@ # Release notes **Contents**<br> +[3.3.2](#332)<br> +[3.3.1](#331)<br> +[3.3.0](#330)<br> +[3.2.1](#321)<br> +[3.2.0](#320)<br> +[3.1.1](#311)<br> [3.1.0](#310)<br> [3.0.1](#301)<br> [2.13.7](#2137)<br> @@ -50,6 +56,143 @@ [Even Older versions](#even-older-versions)<br> + +## 3.3.2 + +### Improvements +* Further reduced allocations + * The compact, console, TAP and XML reporters perform less allocations in various cases + * Removed 1 allocation per entered `SECTION`/`TEST_CASE`. + * Removed 2 allocations per test case exit, if stdout/stderr is captured +* Improved performance + * Section tracking is 10%-25% faster than in v3.3.0 + * Assertion handling is 5%-10% faster than in v3.3.0 + * Test case registration is 1%-2% faster than in v3.3.0 + * Tiny speedup for registering listeners + * Tiny speedup for `CAPTURE`, `TEST_CASE_METHOD`, `METHOD_AS_TEST_CASE`, and `TEMPLATE_LIST_TEST_*` macros. +* `Contains`, `RangeEquals` and `UnorderedRangeEquals` matchers now support ranges with iterator + sentinel pair +* Added `IsNaN` matcher + * Unlike `REQUIRE(isnan(x))`, `REQUIRE_THAT(x, IsNaN())` shows you the value of `x`. +* Suppressed `declared_but_not_referenced` warning for NVHPC (#2637) + +### Fixes +* Fixed performance regression in section tracking introduced in v3.3.1 + * Extreme cases would cause the tracking to run about 4x slower than in 3.3.0 + + +## 3.3.1 + +### Improvements +* Reduced allocations and improved performance + * The exact improvements are dependent on your usage of Catch2. + * For example running Catch2's SelfTest binary performs 8k less allocations. + * The main improvement comes from smarter handling of `SECTION`s, especially sibling `SECTION`s + + +## 3.3.0 + +### Improvements + +* Added `MessageMatches` exception matcher (#2570) +* Added `RangeEquals` and `UnorderedRangeEquals` generic range matchers (#2377) +* Added `SKIP` macro for skipping tests from within the test body (#2360) + * All built-in reporters have been extended to handle it properly, whether your custom reporter needs changes depends on how it was written + * `skipTest` reporter event **is unrelated** to this, and has been deprecated since it has practically no uses +* Restored support for PPC Macs in the break-into-debugger functionality (#2619) +* Made our warning suppression compatible with CUDA toolkit pre 11.5 (#2626) +* Cleaned out some static analysis complaints + + +### Fixes + +* Fixed macro redefinition warning when NVCC was reporting as MSVC (#2603) +* Fixed throws in generator constructor causing the whole binary to abort (#2615) + * Now it just fails the test +* Fixed missing transitive include with libstdc++13 (#2611) + + +### Miscellaneous + +* Improved support for dynamic library build with non-MSVC compilers on Windows (#2630) +* When used as a subproject, Catch2 keeps its generated header in a separate directory from the main project (#2604) + + + +## 3.2.1 + +### Improvements +* Fix the reworked decomposer to work with older (pre 9) GCC versions (#2571) + * **This required more significant changes to properly support C++20, there might be bugs.** + + +## 3.2.0 + +### Improvements +* Catch2 now compiles on PlayStation (#2562) +* Added `CATCH_CONFIG_GETENV` compile-time toggle (#2562) + * This toggle guards whether Catch2 calls `std::getenv` when reading env variables +* Added support for more Bazel test environment variables + * `TESTBRIDGE_TEST_ONLY` is now supported (#2490) + * Sharding variables, `TEST_SHARD_INDEX`, `TEST_TOTAL_SHARDS`, `TEST_SHARD_STATUS_FILE`, are now all supported (#2491) +* Bunch of small tweaks and improvements in reporters + * The TAP and SonarQube reporters output the used test filters + * The XML reporter now also reports the version of its output format + * The compact reporter now uses the same summary output as the console reporter (#878, #2554) +* Added support for asserting on types that can only be compared with literal 0 (#2555) + * A canonical example is C++20's `std::*_ordering` types, which cannot be compared with an `int` variable, only `0` + * The support extends to any type with this property, not just the ones in stdlib + * This change imposes 2-3% slowdown on compiling files that are heavy on `REQUIRE` and friends + * **This required significant rewrite of decomposition, there might be bugs** +* Simplified internals of matcher related macros + * This provides about ~2% speed up compiling files that are heavy on `REQUIRE_THAT` and friends + + +### Fixes +* Cleaned out some warnings and static analysis issues + * Suppressed `-Wcomma` warning rarely occurring in templated test cases (#2543) + * Constified implementation details in `INFO` (#2564) + * Made `MatcherGenericBase` copy constructor const (#2566) +* Fixed serialization of test filters so the output roundtrips + * This means that e.g. `./tests/SelfTest "aaa bbb", [approx]` outputs `Filters: "aaa bbb",[approx]` + + +### Miscellaneous +* Catch2's build no longer leaks `-ffile-prefix-map` setting to dependees (#2533) + + + +## 3.1.1 + +### Improvements +* Added `Catch::getSeed` function that user code can call to retrieve current rng-seed +* Better detection of compiler support for `-ffile-prefix-map` (#2517) +* Catch2's shared libraries now have `SOVERSION` set (#2516) +* `catch2/catch_all.hpp` convenience header no longer transitively includes `windows.h` (#2432, #2526) + + +### Fixes +* Fixed compilation on Universal Windows Platform +* Fixed compilation on VxWorks (#2515) +* Fixed compilation on Cygwin (#2540) +* Remove unused variable in reporter registration (#2538) +* Fixed some symbol visibility issues with dynamic library on Windows (#2527) +* Suppressed `-Wuseless-cast` warnings in `REQUIRE_THROWS*` macros (#2520, #2521) + * This was triggered when the potentially throwing expression evaluates to `void` +* Fixed "warning: storage class is not first" with `nvc++` (#2533) +* Fixed handling of `DL_PATHS` argument to `catch_discover_tests` on MacOS (#2483) +* Suppressed `*-avoid-c-arrays` clang-tidy warning in `TEMPLATE_TEST_CASE` (#2095, #2536) + + +### Miscellaneous +* Fixed CMake install step for Catch2 build as dynamic library (#2485) +* Raised minimum CMake version to 3.10 (#2523) + * Expect the minimum CMake version to increase once more in next few releases. +* Whole bunch of doc updates and fixes + * #1444, #2497, #2547, #2549, and more +* Added support for building Catch2 with Meson (#2530, #2539) + + + ## 3.1.0 ### Improvements @@ -374,7 +517,7 @@ v3 releases. * The `SECTION`(s) before the `GENERATE` will not be run multiple times, the following ones will. * Added `-D`/`--min-duration` command line flag (#1910) * If a test takes longer to finish than the provided value, its name and duration will be printed. - * This flag is overriden by setting `-d`/`--duration`. + * This flag is overridden by setting `-d`/`--duration`. ### Fixes * `TAPReporter` no longer skips successful assertions (#1983) @@ -415,7 +558,7 @@ v3 releases. ### Improvements * `std::result_of` is not used if `std::invoke_result` is available (#1934) * JUnit reporter writes out `status` attribute for tests (#1899) -* Suppresed clang-tidy's `hicpp-vararg` warning (#1921) +* Suppressed clang-tidy's `hicpp-vararg` warning (#1921) * Catch2 was already suppressing the `cppcoreguidelines-pro-type-vararg` alias of the warning @@ -442,7 +585,7 @@ v3 releases. ### Fixes * Fixed computation of benchmarking column widths in ConsoleReporter (#1885, #1886) * Suppressed clang-tidy's `cppcoreguidelines-pro-type-vararg` in assertions (#1901) - * It was a false positive trigered by the new warning support workaround + * It was a false positive triggered by the new warning support workaround * Fixed bug in test specification parser handling of OR'd patterns using escaping (#1905) ### Miscellaneous @@ -779,7 +922,7 @@ v3 releases. ### Contrib * `ParseAndAddCatchTests` has learned how to use `DISABLED` CTest property (#1452) -* `ParseAndAddCatchTests` now works when there is a whitspace before the test name (#1493) +* `ParseAndAddCatchTests` now works when there is a whitespace before the test name (#1493) ### Miscellaneous diff --git a/packages/Catch2/docs/reporter-events.md b/packages/Catch2/docs/reporter-events.md index 7adae53cab29785d5a61f7fa99c668e0868caa0a..015f67be4f174468f82e04f3ed32823a8ba1ed75 100644 --- a/packages/Catch2/docs/reporter-events.md +++ b/packages/Catch2/docs/reporter-events.md @@ -96,12 +96,12 @@ void assertionStarting( AssertionInfo const& assertionInfo ); void assertionEnded( AssertionStats const& assertionStats ); ``` -`assertionStarting` is called after the expression is captured, but before -the assertion expression is evaluated. This might seem like a minor -distinction, but what it means is that if you have assertion like -`REQUIRE( a + b == c + d )`, then what happens is that `a + b` and `c + d` -are evaluated before `assertionStarting` is emitted, while the `==` is -evaluated after the event. +The `assertionStarting` event is emitted before the expression in the +assertion is captured or evaluated and `assertionEnded` is emitted +afterwards. This means that given assertion like `REQUIRE(a + b == c + d)`, +Catch2 first emits `assertionStarting` event, then `a + b` and `c + d` +are evaluated, then their results are captured, the comparison is evaluated, +and then `assertionEnded` event is emitted. ## Benchmarking events @@ -138,7 +138,7 @@ benchmarking itself fails. > Introduced in Catch2 3.0.1. Listings events are events that correspond to the test binary being -invoked with `--list-foo` flag. +invoked with `--list-foo` flag. There are currently 3 listing events, one for reporters, one for tests, and one for tags. Note that they are not exclusive to each other. diff --git a/packages/Catch2/docs/skipping-passing-failing.md b/packages/Catch2/docs/skipping-passing-failing.md new file mode 100644 index 0000000000000000000000000000000000000000..d866b418d1b572756e914e6c9d7da8ea12e6c0c1 --- /dev/null +++ b/packages/Catch2/docs/skipping-passing-failing.md @@ -0,0 +1,135 @@ +<a id="top"></a> +# Explicitly skipping, passing, and failing tests at runtime + +## Skipping Test Cases at Runtime + +> [Introduced](https://github.com/catchorg/Catch2/pull/2360) in Catch2 3.3.0. + +In some situations it may not be possible to meaningfully execute a test case, +for example when the system under test is missing certain hardware capabilities. +If the required conditions can only be determined at runtime, it often +doesn't make sense to consider such a test case as either passed or failed, +because it simply can not run at all. + +To properly express such scenarios, Catch2 provides a way to explicitly +_skip_ test cases, using the `SKIP` macro: + +``` +SKIP( [streamable expression] ) +``` + +Example usage: + +```c++ +TEST_CASE("copy files between drives") { + if(getNumberOfHardDrives() < 2) { + SKIP("at least two hard drives required"); + } + // ... +} +``` + +This test case is then reported as _skipped_ instead of _passed_ or _failed_. + +The `SKIP` macro behaves similarly to an explicit [`FAIL`](#passing-and-failing-test-cases), +in that it is the last expression that will be executed: + +```c++ +TEST_CASE("my test") { + printf("foo"); + SKIP(); + printf("bar"); // not printed +} +``` + +However a failed assertion _before_ a `SKIP` still causes the entire +test case to fail: + +```c++ +TEST_CASE("failing test") { + CHECK(1 == 2); + SKIP(); +} +``` + +### Interaction with Sections and Generators + +Sections, nested sections as well as specific outputs from [generators](generators.md#top) +can all be individually skipped, with the rest executing as usual: + +```c++ +TEST_CASE("complex test case") { + int value = GENERATE(2, 4, 6); + SECTION("a") { + SECTION("a1") { CHECK(value < 8); } + SECTION("a2") { + if (value == 4) { + SKIP(); + } + CHECK(value % 2 == 0); + } + } +} +``` + +This test case will report 5 passing assertions; one for each of the three +values in section `a1`, and then two in section `a2`, from values 2 and 4. + +Note that as soon as one section is skipped, the entire test case will +be reported as _skipped_ (unless there is a failing assertion, in which +case the test is handled as _failed_ instead). + +Note that if all test cases in a run are skipped, Catch2 returns a non-zero +exit code, same as it does if no test cases have run. This behaviour can +be overridden using the [--allow-running-no-tests](command-line.md#no-tests-override) +flag. + +### `SKIP` inside generators + +You can also use the `SKIP` macro inside generator's constructor to handle +cases where the generator is empty, but you do not want to fail the test +case. + + +## Passing and failing test cases + +Test cases can also be explicitly passed or failed, without the use of +assertions, and with a specific message. This can be useful to handle +complex preconditions/postconditions and give useful error messages +when they fail. + +* `SUCCEED( [streamable expression] )` + +`SUCCEED` is morally equivalent with `INFO( [streamable expression] ); REQUIRE( true );`. +Note that it does not stop further test execution, so it cannot be used +to guard failing assertions from being executed. + +_In practice, `SUCCEED` is usually used as a test placeholder, to avoid +[failing a test case due to missing assertions](command-line.md#warnings)._ + +```cpp +TEST_CASE( "SUCCEED showcase" ) { + int I = 1; + SUCCEED( "I is " << I ); + // ... execution continues here ... +} +``` + +* `FAIL( [streamable expression] )` + +`FAIL` is morally equivalent with `INFO( [streamable expression] ); REQUIRE( false );`. + +_In practice, `FAIL` is usually used to stop executing test that is currently +known to be broken, but has to be fixed later._ + +```cpp +TEST_CASE( "FAIL showcase" ) { + FAIL( "This test case causes segfault, which breaks CI." ); + // ... this will not be executed ... +} +``` + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/test-cases-and-sections.md b/packages/Catch2/docs/test-cases-and-sections.md index 613bbd14f307c884ea4512186aec3587fd770279..acebcc51d76419413b2e7a1fc6f873562d158585 100644 --- a/packages/Catch2/docs/test-cases-and-sections.md +++ b/packages/Catch2/docs/test-cases-and-sections.md @@ -25,7 +25,8 @@ _section description_ can be used to provide long form description of a section while keeping the _section name_ short for use with the [`-c` command line parameter](command-line.md#specify-the-section-to-run). -**Test names must be unique within the Catch executable.** +**The combination of test names and tags must be unique within the Catch2 +executable.** For examples see the [Tutorial](tutorial.md#top) @@ -68,7 +69,8 @@ All tag names beginning with non-alphanumeric characters are reserved by Catch. * `[!nonportable]` - Indicates that behaviour may vary between platforms or compilers. -* `[#<filename>]` - running with `-#` or `--filenames-as-tags` causes Catch to add the filename, prefixed with `#` (and with any extension stripped), as a tag to all contained tests, e.g. tests in testfile.cpp would all be tagged `[#testfile]`. +* `[#<filename>]` - these tags are added to test cases when you run Catch2 + with [`-#` or `--filenames-as-tags`](command-line.md#filenames-as-tags). * `[@<alias>]` - tag aliases all begin with `@` (see below). @@ -167,7 +169,11 @@ Other than the additional prefixes and the formatting in the console reporter th In addition to `TEST_CASE`s, Catch2 also supports test cases parametrised by types, in the form of `TEMPLATE_TEST_CASE`, -`TEMPLATE_PRODUCT_TEST_CASE` and `TEMPLATE_LIST_TEST_CASE`. +`TEMPLATE_PRODUCT_TEST_CASE` and `TEMPLATE_LIST_TEST_CASE`. These macros +are defined in the `catch_template_test_macros.hpp` header, so compiling +the code examples below also requires +`#include <catch2/catch_template_test_macros.hpp>`. + * **TEMPLATE_TEST_CASE(** _test name_ , _tags_, _type1_, _type2_, ..., _typen_ **)** @@ -289,7 +295,9 @@ TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside std In addition to [type parametrised test cases](#type-parametrised-test-cases) Catch2 also supports signature base parametrised test cases, in form of `TEMPLATE_TEST_CASE_SIG` and `TEMPLATE_PRODUCT_TEST_CASE_SIG`. These test cases have similar syntax like [type parametrised test cases](#type-parametrised-test-cases), with one -additional positional argument which specifies the signature. +additional positional argument which specifies the signature. These macros are defined in the +`catch_template_test_macros.hpp` header, so compiling the code examples below also requires +`#include <catch2/catch_template_test_macros.hpp>`. ### Signature Signature has some strict rules for these tests cases to work properly: diff --git a/packages/Catch2/docs/test-fixtures.md b/packages/Catch2/docs/test-fixtures.md index e4747c269ca6941451214d00475983aa0ac7b68e..9c9eaa18c01b7db429da21c311d0565ac6677ab3 100644 --- a/packages/Catch2/docs/test-fixtures.md +++ b/packages/Catch2/docs/test-fixtures.md @@ -3,7 +3,7 @@ ## Defining test fixtures -Although Catch allows you to group tests together as sections within a test case, it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too. You define the test fixture as a simple structure: +Although Catch allows you to group tests together as [sections within a test case](test-cases-and-sections.md), it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too. You define the test fixture as a simple structure: ```c++ class UniqueTestsFixture { @@ -130,9 +130,9 @@ struct Template_Foo_2 { }; TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( - Template_Fixture_2, - "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds", - "[class][template][product][nttp]", + Template_Fixture_2, + "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds", + "[class][template][product][nttp]", ((typename T, size_t S), T, S), (std::array, Template_Foo_2), ((int,2), (float,6))) { diff --git a/packages/Catch2/docs/tutorial.md b/packages/Catch2/docs/tutorial.md index 55a11714cafedaf6cb3900c949173e707b0f651e..342c7381812820a1b8a32955e83369a6f7f7ce96 100644 --- a/packages/Catch2/docs/tutorial.md +++ b/packages/Catch2/docs/tutorial.md @@ -13,9 +13,10 @@ ## Getting Catch2 Ideally you should be using Catch2 through its [CMake integration](cmake-integration.md#top). -Catch2 also provides pkg-config files and single TU distribution, but this -documentation will assume you are using CMake. If you are using single-TU -distribution instead, remember to replace the included header with `catch_amalgamated.hpp`. +Catch2 also provides pkg-config files and two file (header + cpp) +distribution, but this documentation will assume you are using CMake. If +you are using the two file distribution instead, remember to replace +the included header with `catch_amalgamated.hpp`. ## Writing tests @@ -99,7 +100,7 @@ before we move on. It accepts a boolean expression, and uses expression templates to internally decompose it, so that it can be individually stringified on test failure. - + On the last point, note that there are more testing macros available, because not all useful checks can be expressed as a simple boolean expression. As an example, checking that an expression throws an exception @@ -177,7 +178,7 @@ To continue on the vector example above, you could add a check that } ``` -Another way to look at sections is that they are a way to define a tree +Another way to look at sections is that they are a way to define a tree of paths through the test. Each section represents a node, and the final tree is walked in depth-first manner, with each path only visiting only one leaf node. diff --git a/packages/Catch2/docs/usage-tips.md b/packages/Catch2/docs/usage-tips.md index 8e5c3df11a1f8f77a1fc27ab954de50996d0c53b..6be01ee632140179fe47642c733efca685178fb5 100644 --- a/packages/Catch2/docs/usage-tips.md +++ b/packages/Catch2/docs/usage-tips.md @@ -47,7 +47,7 @@ Catch2 also supports [splitting tests in a binary into multiple shards](command-line.md#test-sharding). This can be used by any test runner to run batches of tests in parallel. Do note that when selecting on the number of shards, you should have more shards than there are cores, -to avoid issues with long running tests getting accidentally grouped in +to avoid issues with long-running tests getting accidentally grouped in the same shard, and causing long-tailed execution time. **Note that naively composing sharding and random ordering of tests will break.** diff --git a/packages/Catch2/docs/why-catch.md b/packages/Catch2/docs/why-catch.md index a4b8c2e2852ef987d6bec34cb034ccb585bb9ac9..2c0178ca5decacbc7bd5214a70e6e8bcc435d121 100644 --- a/packages/Catch2/docs/why-catch.md +++ b/packages/Catch2/docs/why-catch.md @@ -41,7 +41,7 @@ So what does Catch2 bring to the party that differentiates it from these? Apart ## Who else is using Catch2? -A whole lot of people. According to the 2021 Jetbrains C++ ecosystem survey, +A whole lot of people. According to the 2021 JetBrains C++ ecosystem survey, about 11% of C++ programmers use Catch2 for unit testing, making it the second most popular unit testing framework. diff --git a/packages/Catch2/examples/302-Gen-Table.cpp b/packages/Catch2/examples/302-Gen-Table.cpp index 74319518372296cac498e3ddc25fc954611f346f..97809889ce1d979fce6e817329c1967c5671b384 100644 --- a/packages/Catch2/examples/302-Gen-Table.cpp +++ b/packages/Catch2/examples/302-Gen-Table.cpp @@ -44,11 +44,11 @@ TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][genera /* Possible simplifications where less legacy toolchain support is needed: * - * - With libstdc++6 or newer, the make_tuple() calls can be ommitted + * - With libstdc++6 or newer, the make_tuple() calls can be omitted * (technically C++17 but does not require -std in GCC/Clang). See * https://stackoverflow.com/questions/12436586/tuple-vector-and-initializer-list * - * - In C++17 mode std::tie() and the preceding variable delcarations can be + * - In C++17 mode std::tie() and the preceding variable declarations can be * replaced by structured bindings: auto [test_input, expected] = GENERATE( * table<std::string, size_t>({ ... */ diff --git a/packages/Catch2/examples/CMakeLists.txt b/packages/Catch2/examples/CMakeLists.txt index b934aa7cd7718f469fea9e4ba426347e199effc3..f993334180452305fb8c0e4f3356f1e1d07a3e33 100644 --- a/packages/Catch2/examples/CMakeLists.txt +++ b/packages/Catch2/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.5 ) +cmake_minimum_required( VERSION 3.10 ) project( Catch2Examples LANGUAGES CXX ) @@ -54,8 +54,6 @@ set(ALL_EXAMPLE_TARGETS foreach( name ${ALL_EXAMPLE_TARGETS} ) target_link_libraries( ${name} Catch2 Catch2WithMain ) - set_property(TARGET ${name} PROPERTY CXX_STANDARD 14) - set_property(TARGET ${name} PROPERTY CXX_EXTENSIONS OFF) endforeach() diff --git a/packages/Catch2/extras/Catch.cmake b/packages/Catch2/extras/Catch.cmake index bc553591b25d9efbc460e7d0409fb9289c8d6200..b37b0bf6db6c64d1114b2b507dc0950f9bfa92af 100644 --- a/packages/Catch2/extras/Catch.cmake +++ b/packages/Catch2/extras/Catch.cmake @@ -35,8 +35,9 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``. [TEST_LIST var] [REPORTER reporter] [OUTPUT_DIR dir] - [OUTPUT_PREFIX prefix} + [OUTPUT_PREFIX prefix] [OUTPUT_SUFFIX suffix] + [DISCOVERY_MODE <POST_BUILD|PRE_TEST>] ) ``catch_discover_tests`` sets up a post-build command on the test executable @@ -123,14 +124,28 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``. test executable and when the tests are executed themselves. This requires cmake/ctest >= 3.22. + `DISCOVERY_MODE mode`` + Provides control over when ``catch_discover_tests`` performs test discovery. + By default, ``POST_BUILD`` sets up a post-build command to perform test discovery + at build time. In certain scenarios, like cross-compiling, this ``POST_BUILD`` + behavior is not desirable. By contrast, ``PRE_TEST`` delays test discovery until + just prior to test execution. This way test discovery occurs in the target environment + where the test has a better chance at finding appropriate runtime dependencies. + + ``DISCOVERY_MODE`` defaults to the value of the + ``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when + calling ``catch_discover_tests``. This provides a mechanism for globally selecting + a preferred test discovery behavior without having to modify each call site. + #]=======================================================================] #------------------------------------------------------------------------------ function(catch_discover_tests TARGET) + cmake_parse_arguments( "" "" - "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX" + "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX;DISCOVERY_MODE" "TEST_SPEC;EXTRA_ARGS;PROPERTIES;DL_PATHS" ${ARGN} ) @@ -141,12 +156,20 @@ function(catch_discover_tests TARGET) if(NOT _TEST_LIST) set(_TEST_LIST ${TARGET}_TESTS) endif() - if (_DL_PATHS) if(${CMAKE_VERSION} VERSION_LESS "3.22.0") message(FATAL_ERROR "The DL_PATHS option requires at least cmake 3.22") endif() endif() + if(NOT _DISCOVERY_MODE) + if(NOT CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE) + set(CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE "POST_BUILD") + endif() + set(_DISCOVERY_MODE ${CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE}) + endif() + if (NOT _DISCOVERY_MODE MATCHES "^(POST_BUILD|PRE_TEST)$") + message(FATAL_ERROR "Unknown DISCOVERY_MODE: ${_DISCOVERY_MODE}") + endif() ## Generate a unique name based on the extra arguments string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS} ${_REPORTER} ${_OUTPUT_DIR} ${_OUTPUT_PREFIX} ${_OUTPUT_SUFFIX}") @@ -159,39 +182,77 @@ function(catch_discover_tests TARGET) TARGET ${TARGET} PROPERTY CROSSCOMPILING_EMULATOR ) - add_custom_command( - TARGET ${TARGET} POST_BUILD - BYPRODUCTS "${ctest_tests_file}" - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TARGET=${TARGET}" - -D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>" - -D "TEST_EXECUTOR=${crosscompiling_emulator}" - -D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}" - -D "TEST_SPEC=${_TEST_SPEC}" - -D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}" - -D "TEST_PROPERTIES=${_PROPERTIES}" - -D "TEST_PREFIX=${_TEST_PREFIX}" - -D "TEST_SUFFIX=${_TEST_SUFFIX}" - -D "TEST_LIST=${_TEST_LIST}" - -D "TEST_REPORTER=${_REPORTER}" - -D "TEST_OUTPUT_DIR=${_OUTPUT_DIR}" - -D "TEST_OUTPUT_PREFIX=${_OUTPUT_PREFIX}" - -D "TEST_OUTPUT_SUFFIX=${_OUTPUT_SUFFIX}" - -D "TEST_DL_PATHS=${_DL_PATHS}" - -D "CTEST_FILE=${ctest_tests_file}" - -P "${_CATCH_DISCOVER_TESTS_SCRIPT}" - VERBATIM - ) - file(WRITE "${ctest_include_file}" - "if(EXISTS \"${ctest_tests_file}\")\n" - " include(\"${ctest_tests_file}\")\n" - "else()\n" - " add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n" - "endif()\n" - ) + if(_DISCOVERY_MODE STREQUAL "POST_BUILD") + add_custom_command( + TARGET ${TARGET} POST_BUILD + BYPRODUCTS "${ctest_tests_file}" + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TARGET=${TARGET}" + -D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>" + -D "TEST_EXECUTOR=${crosscompiling_emulator}" + -D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}" + -D "TEST_SPEC=${_TEST_SPEC}" + -D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}" + -D "TEST_PROPERTIES=${_PROPERTIES}" + -D "TEST_PREFIX=${_TEST_PREFIX}" + -D "TEST_SUFFIX=${_TEST_SUFFIX}" + -D "TEST_LIST=${_TEST_LIST}" + -D "TEST_REPORTER=${_REPORTER}" + -D "TEST_OUTPUT_DIR=${_OUTPUT_DIR}" + -D "TEST_OUTPUT_PREFIX=${_OUTPUT_PREFIX}" + -D "TEST_OUTPUT_SUFFIX=${_OUTPUT_SUFFIX}" + -D "TEST_DL_PATHS=${_DL_PATHS}" + -D "CTEST_FILE=${ctest_tests_file}" + -P "${_CATCH_DISCOVER_TESTS_SCRIPT}" + VERBATIM + ) + + file(WRITE "${ctest_include_file}" + "if(EXISTS \"${ctest_tests_file}\")\n" + " include(\"${ctest_tests_file}\")\n" + "else()\n" + " add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n" + "endif()\n" + ) + + elseif(_DISCOVERY_MODE STREQUAL "PRE_TEST") + + string(CONCAT ctest_include_content + "if(EXISTS \"$<TARGET_FILE:${TARGET}>\")" "\n" + " if(NOT EXISTS \"${ctest_tests_file}\" OR" "\n" + " NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"$<TARGET_FILE:${TARGET}>\" OR\n" + " NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"\${CMAKE_CURRENT_LIST_FILE}\")\n" + " include(\"${_CATCH_DISCOVER_TESTS_SCRIPT}\")" "\n" + " catch_discover_tests_impl(" "\n" + " TEST_EXECUTABLE" " [==[" "$<TARGET_FILE:${TARGET}>" "]==]" "\n" + " TEST_EXECUTOR" " [==[" "${crosscompiling_emulator}" "]==]" "\n" + " TEST_WORKING_DIR" " [==[" "${_WORKING_DIRECTORY}" "]==]" "\n" + " TEST_SPEC" " [==[" "${_TEST_SPEC}" "]==]" "\n" + " TEST_EXTRA_ARGS" " [==[" "${_EXTRA_ARGS}" "]==]" "\n" + " TEST_PROPERTIES" " [==[" "${_PROPERTIES}" "]==]" "\n" + " TEST_PREFIX" " [==[" "${_TEST_PREFIX}" "]==]" "\n" + " TEST_SUFFIX" " [==[" "${_TEST_SUFFIX}" "]==]" "\n" + " TEST_LIST" " [==[" "${_TEST_LIST}" "]==]" "\n" + " TEST_REPORTER" " [==[" "${_REPORTER}" "]==]" "\n" + " TEST_OUTPUT_DIR" " [==[" "${_OUTPUT_DIR}" "]==]" "\n" + " TEST_OUTPUT_PREFIX" " [==[" "${_OUTPUT_PREFIX}" "]==]" "\n" + " TEST_OUTPUT_SUFFIX" " [==[" "${_OUTPUT_SUFFIX}" "]==]" "\n" + " CTEST_FILE" " [==[" "${ctest_tests_file}" "]==]" "\n" + " TEST_DL_PATHS" " [==[" "${_DL_PATHS}" "]==]" "\n" + " CTEST_FILE" " [==[" "${CTEST_FILE}" "]==]" "\n" + " )" "\n" + " endif()" "\n" + " include(\"${ctest_tests_file}\")" "\n" + "else()" "\n" + " add_test(${TARGET}_NOT_BUILT ${TARGET}_NOT_BUILT)" "\n" + "endif()" "\n" + ) + + file(GENERATE OUTPUT "${ctest_include_file}" CONTENT "${ctest_include_content}") + endif() - if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") + if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") # Add discovered tests to directory TEST_INCLUDE_FILES set_property(DIRECTORY APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}" @@ -204,9 +265,7 @@ function(catch_discover_tests TARGET) PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}" ) else() - message(FATAL_ERROR - "Cannot set more than one TEST_INCLUDE_FILE" - ) + message(FATAL_ERROR "Cannot set more than one TEST_INCLUDE_FILE") endif() endif() diff --git a/packages/Catch2/extras/CatchAddTests.cmake b/packages/Catch2/extras/CatchAddTests.cmake index beec3aede51f3606ba931f7fe2c819af990aceef..91f79f3c5ba2ec2d9bad8eede892642dc110687f 100644 --- a/packages/Catch2/extras/CatchAddTests.cmake +++ b/packages/Catch2/extras/CatchAddTests.cmake @@ -1,28 +1,6 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -set(prefix "${TEST_PREFIX}") -set(suffix "${TEST_SUFFIX}") -set(spec ${TEST_SPEC}) -set(extra_args ${TEST_EXTRA_ARGS}) -set(properties ${TEST_PROPERTIES}) -set(reporter ${TEST_REPORTER}) -set(output_dir ${TEST_OUTPUT_DIR}) -set(output_prefix ${TEST_OUTPUT_PREFIX}) -set(output_suffix ${TEST_OUTPUT_SUFFIX}) -set(dl_paths ${TEST_DL_PATHS}) -set(script) -set(suite) -set(tests) - -if(WIN32) - set(dl_paths_variable_name PATH) -elseif(APPLE) - set(dl_paths_variable_name DYLD_LIBRARY_PATH) -else() - set(dl_paths_variable_name LD_LIBRARY_PATH) -endif() - function(add_command NAME) set(_args "") # use ARGV* instead of ARGN, because ARGN splits arrays into multiple arguments @@ -38,119 +16,172 @@ function(add_command NAME) set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE) endfunction() -# Run test executable to get list of available tests -if(NOT EXISTS "${TEST_EXECUTABLE}") - message(FATAL_ERROR - "Specified test executable '${TEST_EXECUTABLE}' does not exist" +function(catch_discover_tests_impl) + + cmake_parse_arguments( + "" + "" + "TEST_EXECUTABLE;TEST_WORKING_DIR;TEST_DL_PATHS;TEST_OUTPUT_DIR;TEST_OUTPUT_PREFIX;TEST_OUTPUT_SUFFIX;TEST_PREFIX;TEST_REPORTER;TEST_SPEC;TEST_SUFFIX;TEST_LIST;CTEST_FILE" + "TEST_EXTRA_ARGS;TEST_PROPERTIES;TEST_EXECUTOR" + ${ARGN} ) -endif() -if(dl_paths) - cmake_path(CONVERT "${dl_paths}" TO_NATIVE_PATH_LIST paths) - set(ENV{${dl_paths_variable_name}} "${paths}") -endif() + set(prefix "${_TEST_PREFIX}") + set(suffix "${_TEST_SUFFIX}") + set(spec ${_TEST_SPEC}) + set(extra_args ${_TEST_EXTRA_ARGS}) + set(properties ${_TEST_PROPERTIES}) + set(reporter ${_TEST_REPORTER}) + set(output_dir ${_TEST_OUTPUT_DIR}) + set(output_prefix ${_TEST_OUTPUT_PREFIX}) + set(output_suffix ${_TEST_OUTPUT_SUFFIX}) + set(dl_paths ${_TEST_DL_PATHS}) + set(script) + set(suite) + set(tests) + + if(WIN32) + set(dl_paths_variable_name PATH) + elseif(APPLE) + set(dl_paths_variable_name DYLD_LIBRARY_PATH) + else() + set(dl_paths_variable_name LD_LIBRARY_PATH) + endif() -execute_process( - COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-tests --verbosity quiet - OUTPUT_VARIABLE output - RESULT_VARIABLE result - WORKING_DIRECTORY "${TEST_WORKING_DIR}" -) -if(NOT ${result} EQUAL 0) - message(FATAL_ERROR - "Error running test executable '${TEST_EXECUTABLE}':\n" - " Result: ${result}\n" - " Output: ${output}\n" - ) -endif() + # Run test executable to get list of available tests + if(NOT EXISTS "${_TEST_EXECUTABLE}") + message(FATAL_ERROR + "Specified test executable '${_TEST_EXECUTABLE}' does not exist" + ) + endif() -string(REPLACE "\n" ";" output "${output}") - -# Run test executable to get list of available reporters -execute_process( - COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-reporters - OUTPUT_VARIABLE reporters_output - RESULT_VARIABLE reporters_result - WORKING_DIRECTORY "${TEST_WORKING_DIR}" -) -if(NOT ${reporters_result} EQUAL 0) - message(FATAL_ERROR - "Error running test executable '${TEST_EXECUTABLE}':\n" - " Result: ${reporters_result}\n" - " Output: ${reporters_output}\n" - ) -endif() -string(FIND "${reporters_output}" "${reporter}" reporter_is_valid) -if(reporter AND ${reporter_is_valid} EQUAL -1) - message(FATAL_ERROR - "\"${reporter}\" is not a valid reporter!\n" - ) -endif() + if(dl_paths) + cmake_path(CONVERT "${dl_paths}" TO_NATIVE_PATH_LIST paths) + set(ENV{${dl_paths_variable_name}} "${paths}") + endif() -# Prepare reporter -if(reporter) - set(reporter_arg "--reporter ${reporter}") -endif() + execute_process( + COMMAND ${_TEST_EXECUTOR} "${_TEST_EXECUTABLE}" ${spec} --list-tests --verbosity quiet + OUTPUT_VARIABLE output + RESULT_VARIABLE result + WORKING_DIRECTORY "${_TEST_WORKING_DIR}" + ) + if(NOT ${result} EQUAL 0) + message(FATAL_ERROR + "Error running test executable '${_TEST_EXECUTABLE}':\n" + " Result: ${result}\n" + " Output: ${output}\n" + ) + endif() -# Prepare output dir -if(output_dir AND NOT IS_ABSOLUTE ${output_dir}) - set(output_dir "${TEST_WORKING_DIR}/${output_dir}") - if(NOT EXISTS ${output_dir}) - file(MAKE_DIRECTORY ${output_dir}) + string(REPLACE "\n" ";" output "${output}") + + # Prepare reporter + if(reporter) + set(reporter_arg "--reporter ${reporter}") + + # Run test executable to check whether reporter is available + # note that the use of --list-reporters is not the important part, + # we only want to check whether the execution succeeds with ${reporter_arg} + execute_process( + COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} ${reporter_arg} --list-reporters + OUTPUT_VARIABLE reporter_check_output + RESULT_VARIABLE reporter_check_result + WORKING_DIRECTORY "${TEST_WORKING_DIR}" + ) + if(${reporter_check_result} EQUAL 255) + message(FATAL_ERROR + "\"${reporter}\" is not a valid reporter!\n" + ) + elseif(NOT ${reporter_check_result} EQUAL 0) + message(FATAL_ERROR + "Error running test executable '${TEST_EXECUTABLE}':\n" + " Result: ${reporter_check_result}\n" + " Output: ${reporter_check_output}\n" + ) + endif() endif() -endif() -if(dl_paths) - foreach(path ${dl_paths}) - cmake_path(NATIVE_PATH path native_path) - list(APPEND environment_modifications "${dl_paths_variable_name}=path_list_prepend:${native_path}") - endforeach() -endif() + # Prepare output dir + if(output_dir AND NOT IS_ABSOLUTE ${output_dir}) + set(output_dir "${_TEST_WORKING_DIR}/${output_dir}") + if(NOT EXISTS ${output_dir}) + file(MAKE_DIRECTORY ${output_dir}) + endif() + endif() -# Parse output -foreach(line ${output}) - set(test ${line}) - # Escape characters in test case names that would be parsed by Catch2 - set(test_name ${test}) - foreach(char , [ ]) - string(REPLACE ${char} "\\${char}" test_name ${test_name}) - endforeach(char) - # ...add output dir - if(output_dir) - string(REGEX REPLACE "[^A-Za-z0-9_]" "_" test_name_clean ${test_name}) - set(output_dir_arg "--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}") + if(dl_paths) + foreach(path ${dl_paths}) + cmake_path(NATIVE_PATH path native_path) + list(APPEND environment_modifications "${dl_paths_variable_name}=path_list_prepend:${native_path}") + endforeach() endif() - - # ...and add to script - add_command(add_test - "${prefix}${test}${suffix}" - ${TEST_EXECUTOR} - "${TEST_EXECUTABLE}" - "${test_name}" - ${extra_args} - "${reporter_arg}" - "${output_dir_arg}" - ) - add_command(set_tests_properties - "${prefix}${test}${suffix}" - PROPERTIES - WORKING_DIRECTORY "${TEST_WORKING_DIR}" - ${properties} - ) - if(environment_modifications) - add_command(set_tests_properties - "${prefix}${test}${suffix}" - PROPERTIES - ENVIRONMENT_MODIFICATION "${environment_modifications}") - endif() + # Parse output + foreach(line ${output}) + set(test ${line}) + # Escape characters in test case names that would be parsed by Catch2 + set(test_name ${test}) + foreach(char , [ ]) + string(REPLACE ${char} "\\${char}" test_name ${test_name}) + endforeach(char) + # ...add output dir + if(output_dir) + string(REGEX REPLACE "[^A-Za-z0-9_]" "_" test_name_clean ${test_name}) + set(output_dir_arg "--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}") + endif() + + # ...and add to script + add_command(add_test + "${prefix}${test}${suffix}" + ${_TEST_EXECUTOR} + "${_TEST_EXECUTABLE}" + "${test_name}" + ${extra_args} + "${reporter_arg}" + "${output_dir_arg}" + ) + add_command(set_tests_properties + "${prefix}${test}${suffix}" + PROPERTIES + WORKING_DIRECTORY "${_TEST_WORKING_DIR}" + ${properties} + ) + + if(environment_modifications) + add_command(set_tests_properties + "${prefix}${test}${suffix}" + PROPERTIES + ENVIRONMENT_MODIFICATION "${environment_modifications}") + endif() + + list(APPEND tests "${prefix}${test}${suffix}") + endforeach() - list(APPEND tests "${prefix}${test}${suffix}") -endforeach() + # Create a list of all discovered tests, which users may use to e.g. set + # properties on the tests + add_command(set ${_TEST_LIST} ${tests}) -# Create a list of all discovered tests, which users may use to e.g. set -# properties on the tests -add_command(set ${TEST_LIST} ${tests}) + # Write CTest script + file(WRITE "${_CTEST_FILE}" "${script}") +endfunction() -# Write CTest script -file(WRITE "${CTEST_FILE}" "${script}") +if(CMAKE_SCRIPT_MODE_FILE) + catch_discover_tests_impl( + TEST_EXECUTABLE ${TEST_EXECUTABLE} + TEST_EXECUTOR ${TEST_EXECUTOR} + TEST_WORKING_DIR ${TEST_WORKING_DIR} + TEST_SPEC ${TEST_SPEC} + TEST_EXTRA_ARGS ${TEST_EXTRA_ARGS} + TEST_PROPERTIES ${TEST_PROPERTIES} + TEST_PREFIX ${TEST_PREFIX} + TEST_SUFFIX ${TEST_SUFFIX} + TEST_LIST ${TEST_LIST} + TEST_REPORTER ${TEST_REPORTER} + TEST_OUTPUT_DIR ${TEST_OUTPUT_DIR} + TEST_OUTPUT_PREFIX ${TEST_OUTPUT_PREFIX} + TEST_OUTPUT_SUFFIX ${TEST_OUTPUT_SUFFIX} + TEST_DL_PATHS ${TEST_DL_PATHS} + CTEST_FILE ${CTEST_FILE} + ) +endif() diff --git a/packages/Catch2/extras/CatchShardTests.cmake b/packages/Catch2/extras/CatchShardTests.cmake index d3b5e6fcf876afb12abba2843ece3786313520fe..68228f5a608a1fd95e9014648a9700a386c2c3a9 100644 --- a/packages/Catch2/extras/CatchShardTests.cmake +++ b/packages/Catch2/extras/CatchShardTests.cmake @@ -1,7 +1,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 @@ -46,7 +46,7 @@ function(catch_add_sharded_tests TARGET) APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}" ) - set(shard_impl_script_file "${CMAKE_CURRENT_LIST_DIR}/CatchShardTestsImpl.cmake") + set(shard_impl_script_file "${_CATCH_DISCOVER_SHARD_TESTS_IMPL_SCRIPT}") add_custom_command( TARGET ${TARGET} POST_BUILD @@ -64,3 +64,11 @@ function(catch_add_sharded_tests TARGET) endfunction() + + +############################################################################### + +set(_CATCH_DISCOVER_SHARD_TESTS_IMPL_SCRIPT + ${CMAKE_CURRENT_LIST_DIR}/CatchShardTestsImpl.cmake + CACHE INTERNAL "Catch2 full path to CatchShardTestsImpl.cmake helper file" +) diff --git a/packages/Catch2/extras/CatchShardTestsImpl.cmake b/packages/Catch2/extras/CatchShardTestsImpl.cmake index d18dddef1642e54aba158416bb53202c692a1a1c..bb2fc3ef60dc8d4e64999d38d5bf508c89f53593 100644 --- a/packages/Catch2/extras/CatchShardTestsImpl.cmake +++ b/packages/Catch2/extras/CatchShardTestsImpl.cmake @@ -1,7 +1,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/extras/catch_amalgamated.cpp b/packages/Catch2/extras/catch_amalgamated.cpp index ecda2301b3adc6e555f5a27358c0af698762b882..a81b1b6ae5f852305d8d7cfefee26317e1486357 100644 --- a/packages/Catch2/extras/catch_amalgamated.cpp +++ b/packages/Catch2/extras/catch_amalgamated.cpp @@ -1,12 +1,12 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -// Catch v3.1.0 -// Generated: 2022-07-17 20:14:05.885021 +// Catch v3.3.2 +// Generated: 2023-02-26 10:28:48.270752 // ---------------------------------------------------------- // This file is an amalgamation of multiple different files. // You probably shouldn't edit it directly. @@ -15,6 +15,28 @@ #include "catch_amalgamated.hpp" +#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED +#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED + + +#if defined(CATCH_PLATFORM_WINDOWS) + +// We might end up with the define made globally through the compiler, +// and we don't want to trigger warnings for this +#if !defined(NOMINMAX) +# define NOMINMAX +#endif +#if !defined(WIN32_LEAN_AND_MEAN) +# define WIN32_LEAN_AND_MEAN +#endif + +#include <windows.h> + +#endif // defined(CATCH_PLATFORM_WINDOWS) + +#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED + + namespace Catch { @@ -406,9 +428,9 @@ namespace Catch { return reconstructedExpression; } - AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) + AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData&& data ) : m_info( info ), - m_resultData( data ) + m_resultData( CATCH_MOVE(data) ) {} // Result was a success @@ -447,16 +469,15 @@ namespace Catch { } std::string AssertionResult::getExpressionInMacro() const { - std::string expr; - if( m_info.macroName.empty() ) - expr = static_cast<std::string>(m_info.capturedExpression); - else { - expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); - expr += m_info.macroName; - expr += "( "; - expr += m_info.capturedExpression; - expr += " )"; + if ( m_info.macroName.empty() ) { + return static_cast<std::string>( m_info.capturedExpression ); } + std::string expr; + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + expr += " )"; return expr; } @@ -486,29 +507,73 @@ namespace Catch { -namespace { - bool provideBazelReporterOutput() { -#ifdef CATCH_CONFIG_BAZEL_SUPPORT - return true; +#include <fstream> + +namespace Catch { + + namespace { + static bool enableBazelEnvSupport() { +#if defined( CATCH_CONFIG_BAZEL_SUPPORT ) + return true; #else + return Detail::getEnv( "BAZEL_TEST" ) != nullptr; +#endif + } -# if defined( _MSC_VER ) - // On Windows getenv throws a warning as there is no input validation, - // since the switch is hardcoded, this should not be an issue. -# pragma warning( push ) -# pragma warning( disable : 4996 ) -# endif + struct bazelShardingOptions { + unsigned int shardIndex, shardCount; + std::string shardFilePath; + }; - return std::getenv( "BAZEL_TEST" ) != nullptr; + static Optional<bazelShardingOptions> readBazelShardingOptions() { + const auto bazelShardIndex = Detail::getEnv( "TEST_SHARD_INDEX" ); + const auto bazelShardTotal = Detail::getEnv( "TEST_TOTAL_SHARDS" ); + const auto bazelShardInfoFile = Detail::getEnv( "TEST_SHARD_STATUS_FILE" ); + + + const bool has_all = + bazelShardIndex && bazelShardTotal && bazelShardInfoFile; + if ( !has_all ) { + // We provide nice warning message if the input is + // misconfigured. + auto warn = []( const char* env_var ) { + Catch::cerr() + << "Warning: Bazel shard configuration is missing '" + << env_var << "'. Shard configuration is skipped.\n"; + }; + if ( !bazelShardIndex ) { + warn( "TEST_SHARD_INDEX" ); + } + if ( !bazelShardTotal ) { + warn( "TEST_TOTAL_SHARDS" ); + } + if ( !bazelShardInfoFile ) { + warn( "TEST_SHARD_STATUS_FILE" ); + } + return {}; + } -# if defined( _MSC_VER ) -# pragma warning( pop ) -# endif -#endif - } -} + auto shardIndex = parseUInt( bazelShardIndex ); + if ( !shardIndex ) { + Catch::cerr() + << "Warning: could not parse 'TEST_SHARD_INDEX' ('" << bazelShardIndex + << "') as unsigned int.\n"; + return {}; + } + auto shardTotal = parseUInt( bazelShardTotal ); + if ( !shardTotal ) { + Catch::cerr() + << "Warning: could not parse 'TEST_TOTAL_SHARD' ('" + << bazelShardTotal << "') as unsigned int.\n"; + return {}; + } + + return bazelShardingOptions{ + *shardIndex, *shardTotal, bazelShardInfoFile }; + + } + } // end namespace -namespace Catch { bool operator==( ProcessedReporterSpec const& lhs, ProcessedReporterSpec const& rhs ) { @@ -531,17 +596,6 @@ namespace Catch { elem = trim(elem); } - - TestSpecParser parser(ITagAliasRegistry::get()); - if (!m_data.testsOrTags.empty()) { - m_hasTestFilters = true; - for (auto const& testOrTags : m_data.testsOrTags) { - parser.parse(testOrTags); - } - } - m_testSpec = parser.testSpec(); - - // Insert the default reporter if user hasn't asked for a specfic one if ( m_data.reporterSpecifications.empty() ) { m_data.reporterSpecifications.push_back( { @@ -554,27 +608,20 @@ namespace Catch { } ); } - if(provideBazelReporterOutput()){ - // Register a JUnit reporter for Bazel. Bazel sets an environment - // variable with the path to XML output. If this file is written to - // during test, Bazel will not generate a default XML output. - // This allows the XML output file to contain higher level of detail - // than what is possible otherwise. -# if defined( _MSC_VER ) - // On Windows getenv throws a warning as there is no input validation, - // since the key is hardcoded, this should not be an issue. -# pragma warning( push ) -# pragma warning( disable : 4996 ) -# endif - const auto bazelOutputFilePtr = std::getenv( "XML_OUTPUT_FILE" ); -# if defined( _MSC_VER ) -# pragma warning( pop ) -# endif - if ( bazelOutputFilePtr != nullptr ) { - m_data.reporterSpecifications.push_back( - { "junit", std::string( bazelOutputFilePtr ), {}, {} } ); + if ( enableBazelEnvSupport() ) { + readBazelEnvVars(); + } + + // Bazel support can modify the test specs, so parsing has to happen + // after reading Bazel env vars. + TestSpecParser parser( ITagAliasRegistry::get() ); + if ( !m_data.testsOrTags.empty() ) { + m_hasTestFilters = true; + for ( auto const& testOrTags : m_data.testsOrTags ) { + parser.parse( testOrTags ); } - } + } + m_testSpec = parser.testSpec(); // We now fixup the reporter specs to handle default output spec, @@ -655,10 +702,53 @@ namespace Catch { unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; } std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); } + void Config::readBazelEnvVars() { + // Register a JUnit reporter for Bazel. Bazel sets an environment + // variable with the path to XML output. If this file is written to + // during test, Bazel will not generate a default XML output. + // This allows the XML output file to contain higher level of detail + // than what is possible otherwise. + const auto bazelOutputFile = Detail::getEnv( "XML_OUTPUT_FILE" ); + + if ( bazelOutputFile ) { + m_data.reporterSpecifications.push_back( + { "junit", std::string( bazelOutputFile ), {}, {} } ); + } + + const auto bazelTestSpec = Detail::getEnv( "TESTBRIDGE_TEST_ONLY" ); + if ( bazelTestSpec ) { + // Presumably the test spec from environment should overwrite + // the one we got from CLI (if we got any) + m_data.testsOrTags.clear(); + m_data.testsOrTags.push_back( bazelTestSpec ); + } + + const auto bazelShardOptions = readBazelShardingOptions(); + if ( bazelShardOptions ) { + std::ofstream f( bazelShardOptions->shardFilePath, + std::ios_base::out | std::ios_base::trunc ); + if ( f.is_open() ) { + f << ""; + m_data.shardIndex = bazelShardOptions->shardIndex; + m_data.shardCount = bazelShardOptions->shardCount; + } + } + } + } // end namespace Catch + + +namespace Catch { + std::uint32_t getSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } +} + + + #include <cassert> #include <stack> @@ -667,8 +757,8 @@ namespace Catch { //////////////////////////////////////////////////////////////////////////// - ScopedMessage::ScopedMessage( MessageBuilder const& builder ): - m_info( builder.m_info ) { + ScopedMessage::ScopedMessage( MessageBuilder&& builder ): + m_info( CATCH_MOVE(builder.m_info) ) { m_info.message = builder.m_stream.str(); getResultCapture().pushScopedMessage( m_info ); } @@ -882,7 +972,6 @@ namespace Catch { multi->addListener(listener->create(config)); } - std::size_t reporterIdx = 0; for ( auto const& reporterSpec : config->getProcessedReporterSpecs() ) { multi->addReporter( createReporter( reporterSpec.name, @@ -890,7 +979,6 @@ namespace Catch { makeStream( reporterSpec.outputFilename ), reporterSpec.colourMode, reporterSpec.customOptions ) ) ); - reporterIdx++; } return multi; @@ -1164,6 +1252,12 @@ namespace Catch { return 2; } + if ( totals.testCases.total() > 0 && + totals.testCases.total() == totals.testCases.skipped + && !m_config->zeroTestsCountAsSuccess() ) { + return 4; + } + // Note that on unices only the lower 8 bits are usually used, clamping // the return value to 255 prevents false negative when some multiple // of 256 tests has failed @@ -1438,6 +1532,7 @@ namespace Catch { #include <algorithm> #include <string> #include <vector> +#include <ostream> namespace Catch { @@ -1461,6 +1556,10 @@ namespace Catch { return m_wildcardPattern.matches( testCase.name ); } + void TestSpec::NamePattern::serializeTo( std::ostream& out ) const { + out << '"' << name() << '"'; + } + TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString ) : Pattern( filterString ) @@ -1473,6 +1572,10 @@ namespace Catch { Tag( m_tag ) ) != end( testCase.tags ); } + void TestSpec::TagPattern::serializeTo( std::ostream& out ) const { + out << name(); + } + bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { bool should_use = !testCase.isHidden(); for (auto const& pattern : m_required) { @@ -1489,18 +1592,31 @@ namespace Catch { return should_use; } - std::string TestSpec::Filter::name() const { - std::string name; - for (auto const& p : m_required) { - name += p->name(); + void TestSpec::Filter::serializeTo( std::ostream& out ) const { + bool first = true; + for ( auto const& pattern : m_required ) { + if ( !first ) { + out << ' '; + } + out << *pattern; + first = false; } - for (auto const& p : m_forbidden) { - name += p->name(); + for ( auto const& pattern : m_forbidden ) { + if ( !first ) { + out << ' '; + } + out << *pattern; + first = false; } - return name; } + std::string TestSpec::extractFilterName( Filter const& filter ) { + Catch::ReusableStringStream sstr; + sstr << filter; + return sstr.str(); + } + bool TestSpec::hasFilters() const { return !m_filters.empty(); } @@ -1517,7 +1633,7 @@ namespace Catch { for( auto const& test : testCases ) if( isThrowSafe( test, config ) && filter.matches( test.getTestCaseInfo() ) ) currentMatches.emplace_back( &test ); - return FilterMatch{ filter.name(), currentMatches }; + return FilterMatch{ extractFilterName(filter), currentMatches }; } ); return matches; } @@ -1526,6 +1642,17 @@ namespace Catch { return m_invalidSpecs; } + void TestSpec::serializeTo( std::ostream& out ) const { + bool first = true; + for ( auto const& filter : m_filters ) { + if ( !first ) { + out << ','; + } + out << filter; + first = false; + } + } + } @@ -1813,6 +1940,7 @@ namespace Catch { diff.passed = passed - other.passed; diff.failed = failed - other.failed; diff.failedButOk = failedButOk - other.failedButOk; + diff.skipped = skipped - other.skipped; return diff; } @@ -1820,14 +1948,15 @@ namespace Catch { passed += other.passed; failed += other.failed; failedButOk += other.failedButOk; + skipped += other.skipped; return *this; } std::uint64_t Counts::total() const { - return passed + failed + failedButOk; + return passed + failed + failedButOk + skipped; } bool Counts::allPassed() const { - return failed == 0 && failedButOk == 0; + return failed == 0 && failedButOk == 0 && skipped == 0; } bool Counts::allOk() const { return failed == 0; @@ -1852,6 +1981,8 @@ namespace Catch { ++diff.testCases.failed; else if( diff.assertions.failedButOk > 0 ) ++diff.testCases.failedButOk; + else if ( diff.assertions.skipped > 0 ) + ++ diff.testCases.skipped; else ++diff.testCases.passed; return diff; @@ -1890,7 +2021,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 3, 1, 0, "", 0 ); + static Version version( 3, 3, 2, "", 0 ); return version; } @@ -1926,10 +2057,17 @@ namespace Detail { GeneratorUntypedBase::~GeneratorUntypedBase() = default; - auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + IGeneratorTracker* acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) { return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); } + IGeneratorTracker* createGeneratorTracker( StringRef generatorName, + SourceLineInfo lineInfo, + GeneratorBasePtr&& generator ) { + return getResultCapture().createGeneratorTracker( + generatorName, lineInfo, CATCH_MOVE( generator ) ); + } + } // namespace Generators } // namespace Catch @@ -2040,18 +2178,17 @@ namespace Catch { // Copy message into messages list. // !TBD This should have been done earlier, somewhere MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); - builder << assertionResult.getMessage(); - builder.m_info.message = builder.m_stream.str(); + builder.m_info.message = static_cast<std::string>(assertionResult.getMessage()); - infoMessages.push_back( builder.m_info ); + infoMessages.push_back( CATCH_MOVE(builder.m_info) ); } } - SectionStats::SectionStats( SectionInfo const& _sectionInfo, + SectionStats::SectionStats( SectionInfo&& _sectionInfo, Counts const& _assertions, double _durationInSeconds, bool _missingAssertions ) - : sectionInfo( _sectionInfo ), + : sectionInfo( CATCH_MOVE(_sectionInfo) ), assertions( _assertions ), durationInSeconds( _durationInSeconds ), missingAssertions( _missingAssertions ) @@ -2060,13 +2197,13 @@ namespace Catch { TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, Totals const& _totals, - std::string const& _stdOut, - std::string const& _stdErr, + std::string&& _stdOut, + std::string&& _stdErr, bool _aborting ) : testInfo( &_testInfo ), totals( _totals ), - stdOut( _stdOut ), - stdErr( _stdErr ), + stdOut( CATCH_MOVE(_stdOut) ), + stdErr( CATCH_MOVE(_stdErr) ), aborting( _aborting ) {} @@ -2141,10 +2278,13 @@ namespace Catch { CATCH_BREAK_INTO_DEBUGGER(); } if (m_reaction.shouldThrow) { -#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - throw Catch::TestFailureException(); + throw_test_failure_exception(); + } + if ( m_reaction.shouldSkip ) { +#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS ) + throw Catch::TestSkipException(); #else - CATCH_ERROR( "Test failure requires aborting test!" ); + CATCH_ERROR( "Explicitly skipping tests during runtime requires exceptions" ); #endif } } @@ -2173,8 +2313,8 @@ namespace Catch { // This is the overload that takes a string and infers the Equals matcher from it // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp - void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) { - handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str ) { + handleExceptionMatchExpr( handler, Matchers::Equals( str ) ); } } // namespace Catch @@ -2710,23 +2850,14 @@ namespace Catch { return ParserResult::ok(ParseResultType::Matched); } - CATCH_TRY { - std::size_t parsedTo = 0; - unsigned long parsedSeed = std::stoul(seed, &parsedTo, 0); - if (parsedTo != seed.size()) { - return ParserResult::runtimeError("Could not parse '" + seed + "' as seed"); - } - - // TODO: Ideally we could parse unsigned int directly, - // but the stdlib doesn't provide helper for that - // type. After this is refactored to use fixed size - // type, we should check the parsed value is in range - // of the underlying type. - config.rngSeed = static_cast<unsigned int>(parsedSeed); - return ParserResult::ok(ParseResultType::Matched); - } CATCH_CATCH_ANON(std::exception const&) { - return ParserResult::runtimeError("Could not parse '" + seed + "' as seed"); + // TODO: ideally we should be parsing uint32_t directly + // fix this later when we add new parse overload + auto parsedSeed = parseUInt( seed, 0 ); + if ( !parsedSeed ) { + return ParserResult::runtimeError( "Could not parse '" + seed + "' as seed" ); } + config.rngSeed = *parsedSeed; + return ParserResult::ok( ParseResultType::Matched ); }; auto const setDefaultColourMode = [&]( std::string const& colourMode ) { Optional<ColourMode> maybeMode = Catch::Detail::stringToColourMode(toLower( colourMode )); @@ -2818,42 +2949,29 @@ namespace Catch { return ParserResult::ok( ParseResultType::Matched ); }; auto const setShardCount = [&]( std::string const& shardCount ) { - CATCH_TRY{ - std::size_t parsedTo = 0; - int64_t parsedCount = std::stoll(shardCount, &parsedTo, 0); - if (parsedTo != shardCount.size()) { - return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count"); - } - if (parsedCount <= 0) { - return ParserResult::runtimeError("Shard count must be a positive number"); - } - - config.shardCount = static_cast<unsigned int>(parsedCount); - return ParserResult::ok(ParseResultType::Matched); - } CATCH_CATCH_ANON(std::exception const&) { - return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count"); + auto parsedCount = parseUInt( shardCount ); + if ( !parsedCount ) { + return ParserResult::runtimeError( + "Could not parse '" + shardCount + "' as shard count" ); + } + if ( *parsedCount == 0 ) { + return ParserResult::runtimeError( + "Shard count must be positive" ); } + config.shardCount = *parsedCount; + return ParserResult::ok( ParseResultType::Matched ); }; auto const setShardIndex = [&](std::string const& shardIndex) { - CATCH_TRY{ - std::size_t parsedTo = 0; - int64_t parsedIndex = std::stoll(shardIndex, &parsedTo, 0); - if (parsedTo != shardIndex.size()) { - return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index"); - } - if (parsedIndex < 0) { - return ParserResult::runtimeError("Shard index must be a non-negative number"); - } - - config.shardIndex = static_cast<unsigned int>(parsedIndex); - return ParserResult::ok(ParseResultType::Matched); - } CATCH_CATCH_ANON(std::exception const&) { - return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index"); + auto parsedIndex = parseUInt( shardIndex ); + if ( !parsedIndex ) { + return ParserResult::runtimeError( + "Could not parse '" + shardIndex + "' as shard index" ); } + config.shardIndex = *parsedIndex; + return ParserResult::ok( ParseResultType::Matched ); }; - auto cli = ExeName( config.processName ) | Help( config.showHelp ) @@ -3595,6 +3713,9 @@ namespace Catch { catch( TestFailureException& ) { std::rethrow_exception(std::current_exception()); } + catch( TestSkipException& ) { + std::rethrow_exception(std::current_exception()); + } catch( std::exception const& ex ) { return ex.what(); } @@ -3891,6 +4012,35 @@ namespace Catch { + +#include <cstdlib> + +namespace Catch { + namespace Detail { + +#if !defined (CATCH_CONFIG_GETENV) + char const* getEnv( char const* ) { return nullptr; } +#else + + char const* getEnv( char const* varName ) { +# if defined( _MSC_VER ) +# pragma warning( push ) +# pragma warning( disable : 4996 ) // use getenv_s instead of getenv +# endif + + return std::getenv( varName ); + +# if defined( _MSC_VER ) +# pragma warning( pop ) +# endif + } +#endif +} // namespace Detail +} // namespace Catch + + + + #include <cstdio> #include <fstream> #include <sstream> @@ -3957,6 +4107,7 @@ namespace Detail { FileStream( std::string const& filename ) { m_ofs.open( filename.c_str() ); CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' ); + m_ofs << std::unitbuf; } ~FileStream() override = default; public: // IStream @@ -4383,6 +4534,50 @@ namespace Catch { +#include <limits> +#include <stdexcept> + +namespace Catch { + + Optional<unsigned int> parseUInt(std::string const& input, int base) { + auto trimmed = trim( input ); + // std::stoull is annoying and accepts numbers starting with '-', + // it just negates them into unsigned int + if ( trimmed.empty() || trimmed[0] == '-' ) { + return {}; + } + + CATCH_TRY { + size_t pos = 0; + const auto ret = std::stoull( trimmed, &pos, base ); + + // We did not consume the whole input, so there is an issue + // This can be bunch of different stuff, like multiple numbers + // in the input, or invalid digits/characters and so on. Either + // way, we do not want to return the partially parsed result. + if ( pos != trimmed.size() ) { + return {}; + } + // Too large + if ( ret > std::numeric_limits<unsigned int>::max() ) { + return {}; + } + return static_cast<unsigned int>(ret); + } + CATCH_CATCH_ANON( std::invalid_argument const& ) { + // no conversion could be performed + } + CATCH_CATCH_ANON( std::out_of_range const& ) { + // the input does not fit into an unsigned long long + } + return {}; + } + +} // namespace Catch + + + + #include <cmath> namespace Catch { @@ -4796,12 +4991,12 @@ namespace Catch { struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { GeneratorBasePtr m_generator; - GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) - : TrackerBase( nameAndLocation, ctx, parent ) + GeneratorTracker( TestCaseTracking::NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( CATCH_MOVE(nameAndLocation), ctx, parent ) {} ~GeneratorTracker() override; - static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { + static GeneratorTracker* acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocationRef const& nameAndLocation ) { GeneratorTracker* tracker; ITracker& currentTracker = ctx.currentTracker(); @@ -4828,18 +5023,14 @@ namespace Catch { assert( childTracker->isGeneratorTracker() ); tracker = static_cast<GeneratorTracker*>( childTracker ); } else { - auto newTracker = - Catch::Detail::make_unique<GeneratorTracker>( - nameAndLocation, ctx, ¤tTracker ); - tracker = newTracker.get(); - currentTracker.addChild( CATCH_MOVE(newTracker) ); + return nullptr; } if( !tracker->isComplete() ) { tracker->open(); } - return *tracker; + return tracker; } // TrackerBase interface @@ -4908,6 +5099,7 @@ namespace Catch { // has a side-effect, where it consumes generator's current // value, but we do not want to invoke the side-effect if // this generator is still waiting for any child to start. + assert( m_generator && "Tracker without generator" ); if ( should_wait_for_child || ( m_runState == CompletedSuccessfully && m_generator->countedNext() ) ) { @@ -4946,13 +5138,8 @@ namespace Catch { Totals RunContext::runTest(TestCaseHandle const& testCase) { const Totals prevTotals = m_totals; - std::string redirectedCout; - std::string redirectedCerr; - auto const& testInfo = testCase.getTestCaseInfo(); - m_reporter->testCaseStarting(testInfo); - m_activeTestCase = &testCase; @@ -4994,9 +5181,11 @@ namespace Catch { seedRng( *m_config ); uint64_t testRuns = 0; + std::string redirectedCout; + std::string redirectedCerr; do { m_trackerContext.startCycle(); - m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); + m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocationRef(testInfo.name, testInfo.lineInfo)); m_reporter->testCasePartialStarting(testInfo, testRuns); @@ -5007,7 +5196,7 @@ namespace Catch { redirectedCerr += oneRunCerr; const auto singleRunTotals = m_totals.delta(beforeRunTotals); - auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, oneRunCout, oneRunCerr, aborting()); + auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, CATCH_MOVE(oneRunCout), CATCH_MOVE(oneRunCerr), aborting()); m_reporter->testCasePartialEnded(statsForOneRun, testRuns); ++testRuns; @@ -5022,8 +5211,8 @@ namespace Catch { m_totals.testCases += deltaTotals.testCases; m_reporter->testCaseEnded(TestCaseStats(testInfo, deltaTotals, - redirectedCout, - redirectedCerr, + CATCH_MOVE(redirectedCout), + CATCH_MOVE(redirectedCerr), aborting())); m_activeTestCase = nullptr; @@ -5037,6 +5226,9 @@ namespace Catch { if (result.getResultType() == ResultWas::Ok) { m_totals.assertions.passed++; m_lastAssertionPassed = true; + } else if (result.getResultType() == ResultWas::ExplicitSkip) { + m_totals.assertions.skipped++; + m_lastAssertionPassed = true; } else if (!result.succeeded()) { m_lastAssertionPassed = false; if (result.isOk()) { @@ -5064,12 +5256,17 @@ namespace Catch { m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; } - bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) { - ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo)); + bool RunContext::sectionStarted(StringRef sectionName, SourceLineInfo const& sectionLineInfo, Counts & assertions) { + ITracker& sectionTracker = + SectionTracker::acquire( m_trackerContext, + TestCaseTracking::NameAndLocationRef( + sectionName, sectionLineInfo ) ); + if (!sectionTracker.isOpen()) return false; m_activeSections.push_back(§ionTracker); + SectionInfo sectionInfo( sectionLineInfo, static_cast<std::string>(sectionName) ); m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; m_reporter->sectionStarting(sectionInfo); @@ -5078,14 +5275,39 @@ namespace Catch { return true; } - auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + IGeneratorTracker* + RunContext::acquireGeneratorTracker( StringRef generatorName, + SourceLineInfo const& lineInfo ) { using namespace Generators; - GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext, - TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) ); + GeneratorTracker* tracker = GeneratorTracker::acquire( + m_trackerContext, + TestCaseTracking::NameAndLocationRef( + generatorName, lineInfo ) ); m_lastAssertionInfo.lineInfo = lineInfo; return tracker; } + IGeneratorTracker* RunContext::createGeneratorTracker( + StringRef generatorName, + SourceLineInfo lineInfo, + Generators::GeneratorBasePtr&& generator ) { + + auto nameAndLoc = TestCaseTracking::NameAndLocation( static_cast<std::string>( generatorName ), lineInfo ); + auto& currentTracker = m_trackerContext.currentTracker(); + assert( + currentTracker.nameAndLocation() != nameAndLoc && + "Trying to create tracker for a genreator that already has one" ); + + auto newTracker = Catch::Detail::make_unique<Generators::GeneratorTracker>( + CATCH_MOVE(nameAndLoc), m_trackerContext, ¤tTracker ); + auto ret = newTracker.get(); + currentTracker.addChild( CATCH_MOVE( newTracker ) ); + + ret->setGenerator( CATCH_MOVE( generator ) ); + ret->open(); + return ret; + } + bool RunContext::testForMissingAssertions(Counts& assertions) { if (assertions.total() != 0) return false; @@ -5098,7 +5320,7 @@ namespace Catch { return true; } - void RunContext::sectionEnded(SectionEndInfo const & endInfo) { + void RunContext::sectionEnded(SectionEndInfo&& endInfo) { Counts assertions = m_totals.assertions - endInfo.prevAssertions; bool missingAssertions = testForMissingAssertions(assertions); @@ -5107,19 +5329,20 @@ namespace Catch { m_activeSections.pop_back(); } - m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions)); + m_reporter->sectionEnded(SectionStats(CATCH_MOVE(endInfo.sectionInfo), assertions, endInfo.durationInSeconds, missingAssertions)); m_messages.clear(); m_messageScopes.clear(); } - void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) { - if (m_unfinishedSections.empty()) + void RunContext::sectionEndedEarly(SectionEndInfo&& endInfo) { + if ( m_unfinishedSections.empty() ) { m_activeSections.back()->fail(); - else + } else { m_activeSections.back()->close(); + } m_activeSections.pop_back(); - m_unfinishedSections.push_back(endInfo); + m_unfinishedSections.push_back(CATCH_MOVE(endInfo)); } void RunContext::benchmarkPreparing( StringRef name ) { @@ -5143,8 +5366,8 @@ namespace Catch { m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end()); } - void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) { - m_messageScopes.emplace_back( builder ); + void RunContext::emplaceUnscopedMessage( MessageBuilder&& builder ) { + m_messageScopes.emplace_back( CATCH_MOVE(builder) ); } std::string RunContext::getCurrentTestName() const { @@ -5169,7 +5392,7 @@ namespace Catch { // Instead, fake a result data. AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); tempResult.message = static_cast<std::string>(message); - AssertionResult result(m_lastAssertionInfo, tempResult); + AssertionResult result(m_lastAssertionInfo, CATCH_MOVE(tempResult)); assertionEnded(result); @@ -5181,7 +5404,7 @@ namespace Catch { Counts assertions; assertions.failed = 1; - SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); + SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, 0, false); m_reporter->sectionEnded(testCaseSectionStats); auto const& testInfo = m_activeTestCase->getTestCaseInfo(); @@ -5242,6 +5465,8 @@ namespace Catch { duration = timer.getElapsedSeconds(); } CATCH_CATCH_ANON (TestFailureException&) { // This just means the test was aborted due to failure + } CATCH_CATCH_ANON (TestSkipException&) { + // This just means the test was explicitly skipped } CATCH_CATCH_ALL { // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions // are reported without translation at the point of origin. @@ -5258,7 +5483,7 @@ namespace Catch { m_messages.clear(); m_messageScopes.clear(); - SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); + SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, duration, missingAssertions); m_reporter->sectionEnded(testCaseSectionStats); } @@ -5282,7 +5507,7 @@ namespace Catch { itEnd = m_unfinishedSections.rend(); it != itEnd; ++it) - sectionEnded(*it); + sectionEnded(CATCH_MOVE(*it)); m_unfinishedSections.clear(); } @@ -5318,7 +5543,7 @@ namespace Catch { m_lastAssertionInfo = info; AssertionResultData data( resultType, LazyExpression( negated ) ); - AssertionResult assertionResult{ info, data }; + AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; assertionEnded( assertionResult ); @@ -5336,10 +5561,16 @@ namespace Catch { AssertionResultData data( resultType, LazyExpression( false ) ); data.message = static_cast<std::string>(message); - AssertionResult assertionResult{ m_lastAssertionInfo, data }; + AssertionResult assertionResult{ m_lastAssertionInfo, + CATCH_MOVE( data ) }; assertionEnded( assertionResult ); - if( !assertionResult.isOk() ) + if ( !assertionResult.isOk() ) { populateReaction( reaction ); + } else if ( resultType == ResultWas::ExplicitSkip ) { + // TODO: Need to handle this explicitly, as ExplicitSkip is + // considered "OK" + reaction.shouldSkip = true; + } } void RunContext::handleUnexpectedExceptionNotThrown( AssertionInfo const& info, @@ -5357,7 +5588,7 @@ namespace Catch { AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); data.message = message; - AssertionResult assertionResult{ info, data }; + AssertionResult assertionResult{ info, CATCH_MOVE(data) }; assertionEnded( assertionResult ); populateReaction( reaction ); } @@ -5370,11 +5601,12 @@ namespace Catch { void RunContext::handleIncomplete( AssertionInfo const& info ) { + using namespace std::string_literals; m_lastAssertionInfo = info; AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); - data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; - AssertionResult assertionResult{ info, data }; + data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"s; + AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; assertionEnded( assertionResult ); } void RunContext::handleNonExpr( @@ -5385,7 +5617,7 @@ namespace Catch { m_lastAssertionInfo = info; AssertionResultData data( resultType, LazyExpression( false ) ); - AssertionResult assertionResult{ info, data }; + AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; assertionEnded( assertionResult ); if( !assertionResult.isOk() ) @@ -5417,7 +5649,7 @@ namespace Catch { Section::Section( SectionInfo&& info ): m_info( CATCH_MOVE( info ) ), m_sectionIncluded( - getResultCapture().sectionStarted( m_info, m_assertions ) ) { + getResultCapture().sectionStarted( m_info.name, m_info.lineInfo, m_assertions ) ) { // Non-"included" sections will not use the timing information // anyway, so don't bother with the potential syscall. if (m_sectionIncluded) { @@ -5425,13 +5657,31 @@ namespace Catch { } } + Section::Section( SourceLineInfo const& _lineInfo, + StringRef _name, + const char* const ): + m_info( { "invalid", static_cast<std::size_t>( -1 ) }, std::string{} ), + m_sectionIncluded( + getResultCapture().sectionStarted( _name, _lineInfo, m_assertions ) ) { + // We delay initialization the SectionInfo member until we know + // this section needs it, so we avoid allocating std::string for name. + // We also delay timer start to avoid the potential syscall unless we + // will actually use the result. + if ( m_sectionIncluded ) { + m_info.name = static_cast<std::string>( _name ); + m_info.lineInfo = _lineInfo; + m_timer.start(); + } + } + Section::~Section() { if( m_sectionIncluded ) { - SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; - if( uncaught_exceptions() ) - getResultCapture().sectionEndedEarly( endInfo ); - else - getResultCapture().sectionEnded( endInfo ); + SectionEndInfo endInfo{ CATCH_MOVE(m_info), m_assertions, m_timer.getElapsedSeconds() }; + if ( uncaught_exceptions() ) { + getResultCapture().sectionEndedEarly( CATCH_MOVE(endInfo) ); + } else { + getResultCapture().sectionEnded( CATCH_MOVE( endInfo ) ); + } } } @@ -5647,10 +5897,6 @@ namespace Catch { : StringRef( rawChars, std::strlen(rawChars) ) {} - auto StringRef::operator == ( StringRef other ) const noexcept -> bool { - return m_size == other.m_size - && (std::memcmp( m_start, other.m_start, m_size ) == 0); - } bool StringRef::operator<(StringRef rhs) const noexcept { if (m_size < rhs.m_size) { @@ -5850,7 +6096,7 @@ namespace Catch { TestCaseInfo const* rhs ) { return *lhs < *rhs; }; - std::set<TestCaseInfo const*, decltype(testInfoCmp)> seenTests(testInfoCmp); + std::set<TestCaseInfo const*, decltype(testInfoCmp) &> seenTests(testInfoCmp); for ( auto const& test : tests ) { const auto infoPtr = &test.getTestCaseInfo(); const auto prev = seenTests.insert( infoPtr ); @@ -5926,8 +6172,8 @@ namespace Catch { namespace Catch { namespace TestCaseTracking { - NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) - : name( _name ), + NameAndLocation::NameAndLocation( std::string&& _name, SourceLineInfo const& _location ) + : name( CATCH_MOVE(_name) ), location( _location ) {} @@ -5942,14 +6188,17 @@ namespace TestCaseTracking { m_children.push_back( CATCH_MOVE(child) ); } - ITracker* ITracker::findChild( NameAndLocation const& nameAndLocation ) { + ITracker* ITracker::findChild( NameAndLocationRef const& nameAndLocation ) { auto it = std::find_if( m_children.begin(), m_children.end(), [&nameAndLocation]( ITrackerPtr const& tracker ) { - return tracker->nameAndLocation().location == - nameAndLocation.location && - tracker->nameAndLocation().name == nameAndLocation.name; + auto const& tnameAndLoc = tracker->nameAndLocation(); + if ( tnameAndLoc.location.line != + nameAndLocation.location.line ) { + return false; + } + return tnameAndLoc == nameAndLocation; } ); return ( it != m_children.end() ) ? it->get() : nullptr; } @@ -5957,10 +6206,6 @@ namespace TestCaseTracking { bool ITracker::isSectionTracker() const { return false; } bool ITracker::isGeneratorTracker() const { return false; } - bool ITracker::isSuccessfullyCompleted() const { - return m_runState == CompletedSuccessfully; - } - bool ITracker::isOpen() const { return m_runState != NotStarted && !isComplete(); } @@ -5987,16 +6232,6 @@ namespace TestCaseTracking { return *m_rootTracker; } - void TrackerContext::endRun() { - m_rootTracker.reset(); - m_currentTracker = nullptr; - m_runState = NotStarted; - } - - void TrackerContext::startCycle() { - m_currentTracker = m_rootTracker.get(); - m_runState = Executing; - } void TrackerContext::completeCycle() { m_runState = CompletedCycle; } @@ -6004,16 +6239,13 @@ namespace TestCaseTracking { bool TrackerContext::completedCycle() const { return m_runState == CompletedCycle; } - ITracker& TrackerContext::currentTracker() { - return *m_currentTracker; - } void TrackerContext::setCurrentTracker( ITracker* tracker ) { m_currentTracker = tracker; } - TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ): - ITracker(nameAndLocation, parent), + TrackerBase::TrackerBase( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ): + ITracker(CATCH_MOVE(nameAndLocation), parent), m_ctx( ctx ) {} @@ -6073,13 +6305,14 @@ namespace TestCaseTracking { m_ctx.setCurrentTracker( this ); } - SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) - : TrackerBase( nameAndLocation, ctx, parent ), - m_trimmed_name(trim(nameAndLocation.name)) + SectionTracker::SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( CATCH_MOVE(nameAndLocation), ctx, parent ), + m_trimmed_name(trim(StringRef(ITracker::nameAndLocation().name))) { if( parent ) { - while( !parent->isSectionTracker() ) + while ( !parent->isSectionTracker() ) { parent = parent->parent(); + } SectionTracker& parentSection = static_cast<SectionTracker&>( *parent ); addNextFilters( parentSection.m_filters ); @@ -6099,24 +6332,30 @@ namespace TestCaseTracking { bool SectionTracker::isSectionTracker() const { return true; } - SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { - SectionTracker* section; + SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation ) { + SectionTracker* tracker; ITracker& currentTracker = ctx.currentTracker(); if ( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { assert( childTracker ); assert( childTracker->isSectionTracker() ); - section = static_cast<SectionTracker*>( childTracker ); + tracker = static_cast<SectionTracker*>( childTracker ); } else { - auto newSection = Catch::Detail::make_unique<SectionTracker>( - nameAndLocation, ctx, ¤tTracker ); - section = newSection.get(); - currentTracker.addChild( CATCH_MOVE( newSection ) ); + auto newTracker = Catch::Detail::make_unique<SectionTracker>( + NameAndLocation{ static_cast<std::string>(nameAndLocation.name), + nameAndLocation.location }, + ctx, + ¤tTracker ); + tracker = newTracker.get(); + currentTracker.addChild( CATCH_MOVE( newTracker ) ); + } + + if ( !ctx.completedCycle() ) { + tracker->tryOpen(); } - if( !ctx.completedCycle() ) - section->tryOpen(); - return *section; + + return *tracker; } void SectionTracker::tryOpen() { @@ -6137,10 +6376,6 @@ namespace TestCaseTracking { m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() ); } - std::vector<StringRef> const& SectionTracker::getFilters() const { - return m_filters; - } - StringRef SectionTracker::trimmedName() const { return m_trimmed_name; } @@ -6155,6 +6390,21 @@ namespace TestCaseTracking { + +namespace Catch { + + void throw_test_failure_exception() { +#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS ) + throw TestFailureException{}; +#else + CATCH_ERROR( "Test failure requires aborting test!" ); +#endif + } + +} // namespace Catch + + + #include <algorithm> #include <iterator> @@ -6424,10 +6674,8 @@ namespace Catch { token.erase(token.begin()); if (m_exclusion) { m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring)); - m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); } else { m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring)); - m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); } } if (m_exclusion) { @@ -6441,10 +6689,6 @@ namespace Catch { m_mode = None; } - TestSpec parseTestSpec( std::string const& arg ) { - return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); - } - } // namespace Catch @@ -6757,6 +7001,7 @@ namespace Catch { // while in /permissive- mode. No, I don't know why. // Tested on VS 2019, 18.{3, 4}.x +#include <cstdint> #include <iomanip> #include <type_traits> @@ -7373,7 +7618,19 @@ WithinRelMatcher WithinRel(float target) { } -} // namespace Matchers + +bool IsNaNMatcher::match( double const& matchee ) const { + return std::isnan( matchee ); +} + +std::string IsNaNMatcher::describe() const { + using namespace std::string_literals; + return "is NaN"s; +} + +IsNaNMatcher IsNaN() { return IsNaNMatcher(); } + + } // namespace Matchers } // namespace Catch @@ -7553,9 +7810,9 @@ namespace Catch { // This is the general overload that takes a any string matcher // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers // the Equals matcher (so the header does not mention matchers) - void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) { + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher ) { std::string exceptionMessage = Catch::translateActiveException(); - MatchExpr<std::string, StringMatcher const&> expr( CATCH_MOVE(exceptionMessage), matcher, matcherString ); + MatchExpr<std::string, StringMatcher const&> expr( CATCH_MOVE(exceptionMessage), matcher ); handler.handleExpr( expr ); } @@ -7572,7 +7829,9 @@ namespace Catch { void AutomakeReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR. m_stream << ":test-result: "; - if (_testCaseStats.totals.assertions.allPassed()) { + if ( _testCaseStats.totals.testCases.skipped > 0 ) { + m_stream << "SKIP"; + } else if (_testCaseStats.totals.assertions.allPassed()) { m_stream << "PASS"; } else if (_testCaseStats.totals.assertions.allOk()) { m_stream << "XFAIL"; @@ -7634,22 +7893,6 @@ namespace Catch { #include <ostream> -namespace { - - constexpr Catch::StringRef bothOrAll( std::uint64_t count ) { - switch (count) { - case 1: - return Catch::StringRef{}; - case 2: - return "both "_catch_sr; - default: - return "all "_catch_sr; - } - } - -} // anon namespace - - namespace Catch { namespace { @@ -7664,42 +7907,6 @@ namespace { static constexpr Catch::StringRef compactPassedString = "passed"_sr; #endif -// Colour, message variants: -// - white: No tests ran. -// - red: Failed [both/all] N test cases, failed [both/all] M assertions. -// - white: Passed [both/all] N test cases (no assertions). -// - red: Failed N tests cases, failed M assertions. -// - green: Passed [both/all] N tests cases with M assertions. -void printTotals(std::ostream& out, const Totals& totals, ColourImpl* colourImpl) { - if (totals.testCases.total() == 0) { - out << "No tests ran."; - } else if (totals.testCases.failed == totals.testCases.total()) { - auto guard = colourImpl->guardColour( Colour::ResultError ).engage( out ); - const StringRef qualify_assertions_failed = - totals.assertions.failed == totals.assertions.total() ? - bothOrAll(totals.assertions.failed) : StringRef{}; - out << - "Failed " << bothOrAll(totals.testCases.failed) - << pluralise(totals.testCases.failed, "test case"_sr) << ", " - "failed " << qualify_assertions_failed << - pluralise(totals.assertions.failed, "assertion"_sr) << '.'; - } else if (totals.assertions.total() == 0) { - out << - "Passed " << bothOrAll(totals.testCases.total()) - << pluralise(totals.testCases.total(), "test case"_sr) - << " (no assertions)."; - } else if (totals.assertions.failed) { - out << colourImpl->guardColour( Colour::ResultError ) << - "Failed " << pluralise(totals.testCases.failed, "test case"_sr) << ", " - "failed " << pluralise(totals.assertions.failed, "assertion"_sr) << '.'; - } else { - out << colourImpl->guardColour( Colour::ResultSuccess ) << - "Passed " << bothOrAll(totals.testCases.passed) - << pluralise(totals.testCases.passed, "test case"_sr) << - " with " << pluralise(totals.assertions.passed, "assertion"_sr) << '.'; - } -} - // Implementation of CompactReporter formatting class AssertionPrinter { public: @@ -7773,6 +7980,11 @@ public: printIssue("explicitly"); printRemainingMessages(Colour::None); break; + case ResultWas::ExplicitSkip: + printResultType(Colour::Skip, "skipped"_sr); + printMessage(); + printRemainingMessages(); + break; // These cases are here to prevent compiler warnings case ResultWas::Unknown: case ResultWas::FailureBit: @@ -7855,7 +8067,7 @@ private: private: std::ostream& stream; AssertionResult const& result; - std::vector<MessageInfo> messages; + std::vector<MessageInfo> const& messages; std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; ColourImpl* colourImpl; @@ -7875,10 +8087,10 @@ private: if ( m_config->testSpec().hasFilters() ) { m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: " - << serializeFilters( m_config->getTestsOrTags() ) + << m_config->testSpec() << '\n'; } - m_stream << "RNG seed: " << m_config->rngSeed() << '\n'; + m_stream << "RNG seed: " << getSeed() << '\n'; } void CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { @@ -7888,7 +8100,7 @@ private: // Drop out if result was successful and we're not printing those if( !m_config->includeSuccessfulResults() && result.isOk() ) { - if( result.getResultType() != ResultWas::Warning ) + if( result.getResultType() != ResultWas::Warning && result.getResultType() != ResultWas::ExplicitSkip ) return; printInfoMessages = false; } @@ -7907,7 +8119,7 @@ private: } void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { - printTotals( m_stream, _testRunStats.totals, m_colour.get() ); + printTestRunTotals( m_stream, *m_colour, _testRunStats.totals ); m_stream << "\n\n" << std::flush; StreamingReporterBase::testRunEnded( _testRunStats ); } @@ -7949,7 +8161,6 @@ public: stats(_stats), result(_stats.assertionResult), colour(Colour::None), - message(result.getMessage()), messages(_stats.infoMessages), colourImpl(colourImpl_), printInfoMessages(_printInfoMessages) { @@ -7958,10 +8169,10 @@ public: colour = Colour::Success; passOrFail = "PASSED"_sr; //if( result.hasMessage() ) - if (_stats.infoMessages.size() == 1) - messageLabel = "with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "with messages"; + if (messages.size() == 1) + messageLabel = "with message"_sr; + if (messages.size() > 1) + messageLabel = "with messages"_sr; break; case ResultWas::ExpressionFailed: if (result.isOk()) { @@ -7971,43 +8182,57 @@ public: colour = Colour::Error; passOrFail = "FAILED"_sr; } - if (_stats.infoMessages.size() == 1) - messageLabel = "with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "with messages"; + if (messages.size() == 1) + messageLabel = "with message"_sr; + if (messages.size() > 1) + messageLabel = "with messages"_sr; break; case ResultWas::ThrewException: colour = Colour::Error; passOrFail = "FAILED"_sr; - messageLabel = "due to unexpected exception with "; - if (_stats.infoMessages.size() == 1) - messageLabel += "message"; - if (_stats.infoMessages.size() > 1) - messageLabel += "messages"; + // todo switch + switch (messages.size()) { case 0: + messageLabel = "due to unexpected exception with "_sr; + break; + case 1: + messageLabel = "due to unexpected exception with message"_sr; + break; + default: + messageLabel = "due to unexpected exception with messages"_sr; + break; + } break; case ResultWas::FatalErrorCondition: colour = Colour::Error; passOrFail = "FAILED"_sr; - messageLabel = "due to a fatal error condition"; + messageLabel = "due to a fatal error condition"_sr; break; case ResultWas::DidntThrowException: colour = Colour::Error; passOrFail = "FAILED"_sr; - messageLabel = "because no exception was thrown where one was expected"; + messageLabel = "because no exception was thrown where one was expected"_sr; break; case ResultWas::Info: - messageLabel = "info"; + messageLabel = "info"_sr; break; case ResultWas::Warning: - messageLabel = "warning"; + messageLabel = "warning"_sr; break; case ResultWas::ExplicitFailure: passOrFail = "FAILED"_sr; colour = Colour::Error; - if (_stats.infoMessages.size() == 1) - messageLabel = "explicitly with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "explicitly with messages"; + if (messages.size() == 1) + messageLabel = "explicitly with message"_sr; + if (messages.size() > 1) + messageLabel = "explicitly with messages"_sr; + break; + case ResultWas::ExplicitSkip: + colour = Colour::Skip; + passOrFail = "SKIPPED"_sr; + if (messages.size() == 1) + messageLabel = "explicitly with message"_sr; + if (messages.size() > 1) + messageLabel = "explicitly with messages"_sr; break; // These cases are here to prevent compiler warnings case ResultWas::Unknown: @@ -8071,9 +8296,8 @@ private: AssertionResult const& result; Colour::Code colour; StringRef passOrFail; - std::string messageLabel; - std::string message; - std::vector<MessageInfo> messages; + StringRef messageLabel; + std::vector<MessageInfo> const& messages; ColourImpl* colourImpl; bool printInfoMessages; }; @@ -8083,13 +8307,16 @@ std::size_t makeRatio( std::uint64_t number, std::uint64_t total ) { return (ratio == 0 && number > 0) ? 1 : static_cast<std::size_t>(ratio); } -std::size_t& findMax( std::size_t& i, std::size_t& j, std::size_t& k ) { - if (i > j && i > k) +std::size_t& +findMax( std::size_t& i, std::size_t& j, std::size_t& k, std::size_t& l ) { + if (i > j && i > k && i > l) return i; - else if (j > k) + else if (j > k && j > l) return j; - else + else if (k > l) return k; + else + return l; } enum class Justification { Left, Right }; @@ -8298,7 +8525,8 @@ void ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) { bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); // Drop out if result was successful but we're not printing them. - if (!includeResults && result.getResultType() != ResultWas::Warning) + // TODO: Make configurable whether skips should be printed + if (!includeResults && result.getResultType() != ResultWas::Warning && result.getResultType() != ResultWas::ExplicitSkip) return; lazyPrint(); @@ -8389,7 +8617,7 @@ void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { } void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) { printTotalsDivider(_testRunStats.totals); - printTotals(_testRunStats.totals); + printTestRunTotals( m_stream, *m_colour, _testRunStats.totals ); m_stream << '\n' << std::flush; StreamingReporterBase::testRunEnded(_testRunStats); } @@ -8397,9 +8625,9 @@ void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) { StreamingReporterBase::testRunStarting(_testInfo); if ( m_config->testSpec().hasFilters() ) { m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: " - << serializeFilters( m_config->getTestsOrTags() ) << '\n'; + << m_config->testSpec() << '\n'; } - m_stream << "Randomness seeded to: " << m_config->rngSeed() << '\n'; + m_stream << "Randomness seeded to: " << getSeed() << '\n'; } void ConsoleReporter::lazyPrint() { @@ -8496,91 +8724,16 @@ void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t << '\n'; } -struct SummaryColumn { - - SummaryColumn( std::string _label, Colour::Code _colour ) - : label( CATCH_MOVE( _label ) ), - colour( _colour ) {} - SummaryColumn addRow( std::uint64_t count ) { - ReusableStringStream rss; - rss << count; - std::string row = rss.str(); - for (auto& oldRow : rows) { - while (oldRow.size() < row.size()) - oldRow = ' ' + oldRow; - while (oldRow.size() > row.size()) - row = ' ' + row; - } - rows.push_back(row); - return *this; - } - - std::string label; - Colour::Code colour; - std::vector<std::string> rows; - -}; - -void ConsoleReporter::printTotals( Totals const& totals ) { - if (totals.testCases.total() == 0) { - m_stream << m_colour->guardColour( Colour::Warning ) - << "No tests ran\n"; - } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { - m_stream << m_colour->guardColour( Colour::ResultSuccess ) - << "All tests passed"; - m_stream << " (" - << pluralise(totals.assertions.passed, "assertion"_sr) << " in " - << pluralise(totals.testCases.passed, "test case"_sr) << ')' - << '\n'; - } else { - - std::vector<SummaryColumn> columns; - columns.push_back(SummaryColumn("", Colour::None) - .addRow(totals.testCases.total()) - .addRow(totals.assertions.total())); - columns.push_back(SummaryColumn("passed", Colour::Success) - .addRow(totals.testCases.passed) - .addRow(totals.assertions.passed)); - columns.push_back(SummaryColumn("failed", Colour::ResultError) - .addRow(totals.testCases.failed) - .addRow(totals.assertions.failed)); - columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) - .addRow(totals.testCases.failedButOk) - .addRow(totals.assertions.failedButOk)); - - printSummaryRow("test cases"_sr, columns, 0); - printSummaryRow("assertions"_sr, columns, 1); - } -} -void ConsoleReporter::printSummaryRow(StringRef label, std::vector<SummaryColumn> const& cols, std::size_t row) { - for (auto col : cols) { - std::string const& value = col.rows[row]; - if (col.label.empty()) { - m_stream << label << ": "; - if ( value != "0" ) { - m_stream << value; - } else { - m_stream << m_colour->guardColour( Colour::Warning ) - << "- none -"; - } - } else if (value != "0") { - m_stream << m_colour->guardColour( Colour::LightGrey ) << " | " - << m_colour->guardColour( col.colour ) << value << ' ' - << col.label; - } - } - m_stream << '\n'; -} - void ConsoleReporter::printTotalsDivider(Totals const& totals) { if (totals.testCases.total() > 0) { std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total()); std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total()); std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total()); - while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1) - findMax(failedRatio, failedButOkRatio, passedRatio)++; + std::size_t skippedRatio = makeRatio(totals.testCases.skipped, totals.testCases.total()); + while (failedRatio + failedButOkRatio + passedRatio + skippedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1) + findMax(failedRatio, failedButOkRatio, passedRatio, skippedRatio)++; while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1) - findMax(failedRatio, failedButOkRatio, passedRatio)--; + findMax(failedRatio, failedButOkRatio, passedRatio, skippedRatio)--; m_stream << m_colour->guardColour( Colour::Error ) << std::string( failedRatio, '=' ) @@ -8593,15 +8746,14 @@ void ConsoleReporter::printTotalsDivider(Totals const& totals) { m_stream << m_colour->guardColour( Colour::Success ) << std::string( passedRatio, '=' ); } + m_stream << m_colour->guardColour( Colour::Skip ) + << std::string( skippedRatio, '=' ); } else { m_stream << m_colour->guardColour( Colour::Warning ) << std::string( CATCH_CONFIG_CONSOLE_WIDTH - 1, '=' ); } m_stream << '\n'; } -void ConsoleReporter::printSummaryDivider() { - m_stream << lineOfChars('-') << '\n'; -} } // end namespace Catch @@ -8677,7 +8829,8 @@ namespace Catch { void CumulativeReporterBase::sectionStarting( SectionInfo const& sectionInfo ) { - SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); + // We need a copy, because SectionStats expect to take ownership + SectionStats incompleteStats( SectionInfo(sectionInfo), Counts(), 0, false ); SectionNode* node; if ( m_sectionStack.empty() ) { if ( !m_rootSection ) { @@ -9019,6 +9172,111 @@ namespace Catch { out << "\n\n" << std::flush; } + namespace { + class SummaryColumn { + public: + SummaryColumn( std::string suffix, Colour::Code colour ): + m_suffix( CATCH_MOVE( suffix ) ), m_colour( colour ) {} + + SummaryColumn&& addRow( std::uint64_t count ) && { + std::string row = std::to_string(count); + auto const new_width = std::max( m_width, row.size() ); + if ( new_width > m_width ) { + for ( auto& oldRow : m_rows ) { + oldRow.insert( 0, new_width - m_width, ' ' ); + } + } else { + row.insert( 0, m_width - row.size(), ' ' ); + } + m_width = new_width; + m_rows.push_back( row ); + return std::move( *this ); + } + + std::string const& getSuffix() const { return m_suffix; } + Colour::Code getColour() const { return m_colour; } + std::string const& getRow( std::size_t index ) const { + return m_rows[index]; + } + + private: + std::string m_suffix; + Colour::Code m_colour; + std::size_t m_width = 0; + std::vector<std::string> m_rows; + }; + + void printSummaryRow( std::ostream& stream, + ColourImpl& colour, + StringRef label, + std::vector<SummaryColumn> const& cols, + std::size_t row ) { + for ( auto const& col : cols ) { + auto const& value = col.getRow( row ); + auto const& suffix = col.getSuffix(); + if ( suffix.empty() ) { + stream << label << ": "; + if ( value != "0" ) { + stream << value; + } else { + stream << colour.guardColour( Colour::Warning ) + << "- none -"; + } + } else if ( value != "0" ) { + stream << colour.guardColour( Colour::LightGrey ) << " | " + << colour.guardColour( col.getColour() ) << value + << ' ' << suffix; + } + } + stream << '\n'; + } + } // namespace + + void printTestRunTotals( std::ostream& stream, + ColourImpl& streamColour, + Totals const& totals ) { + if ( totals.testCases.total() == 0 ) { + stream << streamColour.guardColour( Colour::Warning ) + << "No tests ran\n"; + return; + } + + if ( totals.assertions.total() > 0 && totals.testCases.allPassed() ) { + stream << streamColour.guardColour( Colour::ResultSuccess ) + << "All tests passed"; + stream << " (" + << pluralise( totals.assertions.passed, "assertion"_sr ) + << " in " + << pluralise( totals.testCases.passed, "test case"_sr ) + << ')' << '\n'; + return; + } + + std::vector<SummaryColumn> columns; + // Don't include "skipped assertions" in total count + const auto totalAssertionCount = + totals.assertions.total() - totals.assertions.skipped; + columns.push_back( SummaryColumn( "", Colour::None ) + .addRow( totals.testCases.total() ) + .addRow( totalAssertionCount ) ); + columns.push_back( SummaryColumn( "passed", Colour::Success ) + .addRow( totals.testCases.passed ) + .addRow( totals.assertions.passed ) ); + columns.push_back( SummaryColumn( "failed", Colour::ResultError ) + .addRow( totals.testCases.failed ) + .addRow( totals.assertions.failed ) ); + columns.push_back( SummaryColumn( "skipped", Colour::Skip ) + .addRow( totals.testCases.skipped ) + // Don't print "skipped assertions" + .addRow( 0 ) ); + columns.push_back( + SummaryColumn( "failed as expected", Colour::ResultExpectedFailure ) + .addRow( totals.testCases.failedButOk ) + .addRow( totals.assertions.failedButOk ) ); + printSummaryRow( stream, streamColour, "test cases"_sr, columns, 0 ); + printSummaryRow( stream, streamColour, "assertions"_sr, columns, 1 ); + } + } // namespace Catch @@ -9039,6 +9297,8 @@ namespace Catch { std::tm timeInfo = {}; #if defined (_MSC_VER) || defined (__MINGW32__) gmtime_s(&timeInfo, &rawtime); +#elif defined (CATCH_PLATFORM_PLAYSTATION) + gmtime_s(&rawtime, &timeInfo); #else gmtime_r(&rawtime, &timeInfo); #endif @@ -9138,6 +9398,7 @@ namespace Catch { xml.writeAttribute( "name"_sr, stats.runInfo.name ); xml.writeAttribute( "errors"_sr, unexpectedExceptions ); xml.writeAttribute( "failures"_sr, stats.totals.assertions.failed-unexpectedExceptions ); + xml.writeAttribute( "skipped"_sr, stats.totals.assertions.skipped ); xml.writeAttribute( "tests"_sr, stats.totals.assertions.total() ); xml.writeAttribute( "hostname"_sr, "tbd"_sr ); // !TBD if( m_config->showDurations() == ShowDurations::Never ) @@ -9152,10 +9413,10 @@ namespace Catch { xml.scopedElement("property") .writeAttribute("name"_sr, "random-seed"_sr) .writeAttribute("value"_sr, m_config->rngSeed()); - if (m_config->hasTestFilters()) { + if (m_config->testSpec().hasFilters()) { xml.scopedElement("property") .writeAttribute("name"_sr, "filters"_sr) - .writeAttribute("value"_sr, serializeFilters(m_config->getTestsOrTags())); + .writeAttribute("value"_sr, m_config->testSpec()); } } @@ -9250,7 +9511,8 @@ namespace Catch { void JunitReporter::writeAssertion( AssertionStats const& stats ) { AssertionResult const& result = stats.assertionResult; - if( !result.isOk() ) { + if ( !result.isOk() || + result.getResultType() == ResultWas::ExplicitSkip ) { std::string elementName; switch( result.getResultType() ) { case ResultWas::ThrewException: @@ -9262,7 +9524,9 @@ namespace Catch { case ResultWas::DidntThrowException: elementName = "failure"; break; - + case ResultWas::ExplicitSkip: + elementName = "skipped"; + break; // We should never see these here: case ResultWas::Info: case ResultWas::Warning: @@ -9280,7 +9544,9 @@ namespace Catch { xml.writeAttribute( "type"_sr, result.getTestMacroName() ); ReusableStringStream rss; - if (stats.totals.assertions.total() > 0) { + if ( result.getResultType() == ResultWas::ExplicitSkip ) { + rss << "SKIPPED\n"; + } else { rss << "FAILED" << ":\n"; if (result.hasExpression()) { rss << " "; @@ -9291,8 +9557,6 @@ namespace Catch { rss << "with expansion:\n"; rss << TextFlow::Column(result.getExpandedExpression()).indent(2) << '\n'; } - } else { - rss << '\n'; } if( !result.getMessage().empty() ) @@ -9528,9 +9792,14 @@ namespace Catch { namespace Catch { namespace { - std::string createRngSeedString(uint32_t seed) { + std::string createMetadataString(IConfig const& config) { ReusableStringStream sstr; - sstr << "rng-seed=" << seed; + if ( config.testSpec().hasFilters() ) { + sstr << "filters='" + << config.testSpec() + << "' "; + } + sstr << "rng-seed=" << config.rngSeed(); return sstr.str(); } } @@ -9538,13 +9807,13 @@ namespace Catch { void SonarQubeReporter::testRunStarting(TestRunInfo const& testRunInfo) { CumulativeReporterBase::testRunStarting(testRunInfo); - xml.writeComment( createRngSeedString( m_config->rngSeed() ) ); + xml.writeComment( createMetadataString( *m_config ) ); xml.startElement("testExecutions"); xml.writeAttribute("version"_sr, '1'); } void SonarQubeReporter::writeRun( TestRunNode const& runNode ) { - std::map<std::string, std::vector<TestCaseNode const*>> testsPerFile; + std::map<StringRef, std::vector<TestCaseNode const*>> testsPerFile; for ( auto const& child : runNode.children ) { testsPerFile[child->value.testInfo->lineInfo.file].push_back( @@ -9556,7 +9825,7 @@ namespace Catch { } } - void SonarQubeReporter::writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes) { + void SonarQubeReporter::writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes) { XmlWriter::ScopedElement e = xml.scopedElement("file"); xml.writeAttribute("path"_sr, filename); @@ -9601,7 +9870,8 @@ namespace Catch { void SonarQubeReporter::writeAssertion(AssertionStats const& stats, bool okToFail) { AssertionResult const& result = stats.assertionResult; - if (!result.isOk()) { + if ( !result.isOk() || + result.getResultType() == ResultWas::ExplicitSkip ) { std::string elementName; if (okToFail) { elementName = "skipped"; @@ -9612,15 +9882,13 @@ namespace Catch { elementName = "error"; break; case ResultWas::ExplicitFailure: - elementName = "failure"; - break; case ResultWas::ExpressionFailed: - elementName = "failure"; - break; case ResultWas::DidntThrowException: elementName = "failure"; break; - + case ResultWas::ExplicitSkip: + elementName = "skipped"; + break; // We should never see these here: case ResultWas::Info: case ResultWas::Warning: @@ -9640,7 +9908,9 @@ namespace Catch { xml.writeAttribute("message"_sr, messageRss.str()); ReusableStringStream textRss; - if (stats.totals.assertions.total() > 0) { + if ( result.getResultType() == ResultWas::ExplicitSkip ) { + textRss << "SKIPPED\n"; + } else { textRss << "FAILED:\n"; if (result.hasExpression()) { textRss << '\t' << result.getExpressionInMacro() << '\n'; @@ -9770,6 +10040,12 @@ namespace Catch { printIssue("explicitly"_sr); printRemainingMessages(Colour::None); break; + case ResultWas::ExplicitSkip: + printResultType(tapPassedString); + printIssue(" # SKIP"_sr); + printMessage(); + printRemainingMessages(); + break; // These cases are here to prevent compiler warnings case ResultWas::Unknown: case ResultWas::FailureBit: @@ -9848,7 +10124,7 @@ namespace Catch { private: std::ostream& stream; AssertionResult const& result; - std::vector<MessageInfo> messages; + std::vector<MessageInfo> const& messages; std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; std::size_t counter; @@ -9858,6 +10134,9 @@ namespace Catch { } // End anonymous namespace void TAPReporter::testRunStarting( TestRunInfo const& ) { + if ( m_config->testSpec().hasFilters() ) { + m_stream << "# filters: " << m_config->testSpec() << '\n'; + } m_stream << "# rng-seed: " << m_config->rngSeed() << '\n'; } @@ -9938,7 +10217,8 @@ namespace Catch { void TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) { AssertionResult const& result = assertionStats.assertionResult; - if (!result.isOk()) { + if ( !result.isOk() || + result.getResultType() == ResultWas::ExplicitSkip ) { ReusableStringStream msg; if (!m_headerPrintedForThisSection) @@ -9963,6 +10243,9 @@ namespace Catch { case ResultWas::ExplicitFailure: msg << "explicit failure"; break; + case ResultWas::ExplicitSkip: + msg << "explicit skip"; + break; // We shouldn't get here because of the isOk() test case ResultWas::Ok: @@ -9990,18 +10273,16 @@ namespace Catch { " " << result.getExpandedExpression() << '\n'; } - if (currentTestCaseInfo->okToFail()) { + if ( result.getResultType() == ResultWas::ExplicitSkip ) { + m_stream << "##teamcity[testIgnored"; + } else if ( currentTestCaseInfo->okToFail() ) { msg << "- failure ignore as test marked as 'ok to fail'\n"; - m_stream << "##teamcity[testIgnored" - << " name='" << escape(currentTestCaseInfo->name) << '\'' - << " message='" << escape(msg.str()) << '\'' - << "]\n"; + m_stream << "##teamcity[testIgnored"; } else { - m_stream << "##teamcity[testFailed" - << " name='" << escape(currentTestCaseInfo->name) << '\'' - << " message='" << escape(msg.str()) << '\'' - << "]\n"; + m_stream << "##teamcity[testFailed"; } + m_stream << " name='" << escape( currentTestCaseInfo->name ) << '\'' + << " message='" << escape( msg.str() ) << '\'' << "]\n"; } m_stream.flush(); } @@ -10096,15 +10377,17 @@ namespace Catch { m_xml.startElement("Catch2TestRun") .writeAttribute("name"_sr, m_config->name()) .writeAttribute("rng-seed"_sr, m_config->rngSeed()) + .writeAttribute("xml-format-version"_sr, 2) .writeAttribute("catch2-version"_sr, libraryVersion()); - if (m_config->testSpec().hasFilters()) - m_xml.writeAttribute( "filters"_sr, serializeFilters( m_config->getTestsOrTags() ) ); + if ( m_config->testSpec().hasFilters() ) { + m_xml.writeAttribute( "filters"_sr, m_config->testSpec() ); + } } void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { StreamingReporterBase::testCaseStarting(testInfo); m_xml.startElement( "TestCase" ) - .writeAttribute( "name"_sr, trim( testInfo.name ) ) + .writeAttribute( "name"_sr, trim( StringRef(testInfo.name) ) ) .writeAttribute( "tags"_sr, testInfo.tagsAsString() ); writeSourceInfo( testInfo.lineInfo ); @@ -10118,7 +10401,7 @@ namespace Catch { StreamingReporterBase::sectionStarting( sectionInfo ); if( m_sectionDepth++ > 0 ) { m_xml.startElement( "Section" ) - .writeAttribute( "name"_sr, trim( sectionInfo.name ) ); + .writeAttribute( "name"_sr, trim( StringRef(sectionInfo.name) ) ); writeSourceInfo( sectionInfo.lineInfo ); m_xml.ensureTagClosed(); } @@ -10146,9 +10429,10 @@ namespace Catch { } // Drop out if result was successful but we're not printing them. - if( !includeResults && result.getResultType() != ResultWas::Warning ) + if ( !includeResults && result.getResultType() != ResultWas::Warning && + result.getResultType() != ResultWas::ExplicitSkip ) { return; - + } // Print the expression if there is one. if( result.hasExpression() ) { @@ -10191,6 +10475,12 @@ namespace Catch { m_xml.writeText( result.getMessage() ); m_xml.endElement(); break; + case ResultWas::ExplicitSkip: + m_xml.startElement( "Skip" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; default: break; } @@ -10201,15 +10491,18 @@ namespace Catch { void XmlReporter::sectionEnded( SectionStats const& sectionStats ) { StreamingReporterBase::sectionEnded( sectionStats ); - if( --m_sectionDepth > 0 ) { - XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); - e.writeAttribute( "successes"_sr, sectionStats.assertions.passed ); - e.writeAttribute( "failures"_sr, sectionStats.assertions.failed ); - e.writeAttribute( "expectedFailures"_sr, sectionStats.assertions.failedButOk ); - - if ( m_config->showDurations() == ShowDurations::Always ) - e.writeAttribute( "durationInSeconds"_sr, sectionStats.durationInSeconds ); + if ( --m_sectionDepth > 0 ) { + { + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); + e.writeAttribute( "successes"_sr, sectionStats.assertions.passed ); + e.writeAttribute( "failures"_sr, sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures"_sr, sectionStats.assertions.failedButOk ); + e.writeAttribute( "skipped"_sr, sectionStats.assertions.skipped > 0 ); + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds"_sr, sectionStats.durationInSeconds ); + } + // Ends assertion tag m_xml.endElement(); } } @@ -10218,14 +10511,14 @@ namespace Catch { StreamingReporterBase::testCaseEnded( testCaseStats ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); e.writeAttribute( "success"_sr, testCaseStats.totals.assertions.allOk() ); + e.writeAttribute( "skips"_sr, testCaseStats.totals.assertions.skipped ); if ( m_config->showDurations() == ShowDurations::Always ) e.writeAttribute( "durationInSeconds"_sr, m_testCaseTimer.getElapsedSeconds() ); - if( !testCaseStats.stdOut.empty() ) - m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), XmlFormatting::Newline ); + m_xml.scopedElement( "StdOut" ).writeText( trim( StringRef(testCaseStats.stdOut) ), XmlFormatting::Newline ); if( !testCaseStats.stdErr.empty() ) - m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), XmlFormatting::Newline ); + m_xml.scopedElement( "StdErr" ).writeText( trim( StringRef(testCaseStats.stdErr) ), XmlFormatting::Newline ); m_xml.endElement(); } @@ -10235,11 +10528,13 @@ namespace Catch { m_xml.scopedElement( "OverallResults" ) .writeAttribute( "successes"_sr, testRunStats.totals.assertions.passed ) .writeAttribute( "failures"_sr, testRunStats.totals.assertions.failed ) - .writeAttribute( "expectedFailures"_sr, testRunStats.totals.assertions.failedButOk ); + .writeAttribute( "expectedFailures"_sr, testRunStats.totals.assertions.failedButOk ) + .writeAttribute( "skips"_sr, testRunStats.totals.assertions.skipped ); m_xml.scopedElement( "OverallResultsCases") .writeAttribute( "successes"_sr, testRunStats.totals.testCases.passed ) .writeAttribute( "failures"_sr, testRunStats.totals.testCases.failed ) - .writeAttribute( "expectedFailures"_sr, testRunStats.totals.testCases.failedButOk ); + .writeAttribute( "expectedFailures"_sr, testRunStats.totals.testCases.failedButOk ) + .writeAttribute( "skips"_sr, testRunStats.totals.testCases.skipped ); m_xml.endElement(); } diff --git a/packages/Catch2/extras/catch_amalgamated.hpp b/packages/Catch2/extras/catch_amalgamated.hpp index 757e10c5ac5bb9fe164244c809edc189a931c40f..321cec5dac0647cc2065db5983ddd4ad9898438f 100644 --- a/packages/Catch2/extras/catch_amalgamated.hpp +++ b/packages/Catch2/extras/catch_amalgamated.hpp @@ -1,12 +1,12 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -// Catch v3.1.0 -// Generated: 2022-07-17 20:14:04.055157 +// Catch v3.3.2 +// Generated: 2023-02-26 10:28:46.785908 // ---------------------------------------------------------- // This file is an amalgamation of multiple different files. // You probably shouldn't edit it directly. @@ -95,6 +95,8 @@ namespace Catch { #include <iosfwd> #include <cassert> +#include <cstring> + namespace Catch { /// A non-owning string class (similar to the forthcoming std::string_view) @@ -131,7 +133,10 @@ namespace Catch { } public: // operators - auto operator == ( StringRef other ) const noexcept -> bool; + auto operator == ( StringRef other ) const noexcept -> bool { + return m_size == other.m_size + && (std::memcmp( m_start, other.m_start, m_size ) == 0); + } auto operator != (StringRef other) const noexcept -> bool { return !(*this == other); } @@ -326,6 +331,14 @@ namespace Catch { #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) # define CATCH_PLATFORM_WINDOWS + +# if defined( WINAPI_FAMILY ) && ( WINAPI_FAMILY == WINAPI_FAMILY_APP ) +# define CATCH_PLATFORM_WINDOWS_UWP +# endif + +#elif defined(__ORBIS__) || defined(__PROSPERO__) +# define CATCH_PLATFORM_PLAYSTATION + #endif #endif // CATCH_PLATFORM_HPP_INCLUDED @@ -344,7 +357,7 @@ namespace Catch { // Only GCC compiler should be used in this block, so other compilers trying to // mask themselves as GCC should be ignored. -#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) && !defined(__NVCOMPILER) # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) @@ -356,14 +369,28 @@ namespace Catch { # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ _Pragma( "GCC diagnostic ignored \"-Wunused-variable\"" ) +# define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ + _Pragma( "GCC diagnostic ignored \"-Wuseless-cast\"" ) + # define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) #endif +#if defined(__NVCOMPILER) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "diag push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "diag pop" ) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "diag_suppress declared_but_not_referenced" ) +#endif + #if defined(__CUDACC__) && !defined(__clang__) +# ifdef __NVCC_DIAG_PRAGMA_SUPPORT__ +// New pragmas introduced in CUDA 11.5+ # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic push" ) # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic pop" ) # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "nv_diag_suppress 177" ) +# else +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "diag_suppress 177" ) +# endif #endif // clang-cl defines _MSC_VER as well as __clang__, which could cause the @@ -414,23 +441,32 @@ namespace Catch { # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) -#endif // __clang__ +# define CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wcomma\"" ) +#endif // __clang__ -//////////////////////////////////////////////////////////////////////////////// -// Assume that non-Windows platforms support posix signals by default -#if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS -#endif //////////////////////////////////////////////////////////////////////////////// // We know some environments not to support full POSIX signals -#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#if defined( CATCH_PLATFORM_WINDOWS ) || \ + defined( CATCH_PLATFORM_PLAYSTATION ) || \ + defined( __CYGWIN__ ) || \ + defined( __QNX__ ) || \ + defined( __EMSCRIPTEN__ ) || \ + defined( __DJGPP__ ) || \ + defined( __OS400__ ) +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#else +# define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS #endif -#ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +//////////////////////////////////////////////////////////////////////////////// +// Assume that some platforms do not support getenv. +#if defined(CATCH_PLATFORM_WINDOWS_UWP) || defined(CATCH_PLATFORM_PLAYSTATION) +# define CATCH_INTERNAL_CONFIG_NO_GETENV +#else +# define CATCH_INTERNAL_CONFIG_GETENV #endif //////////////////////////////////////////////////////////////////////////////// @@ -472,12 +508,18 @@ namespace Catch { // Visual C++ #if defined(_MSC_VER) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) +// We want to defer to nvcc-specific warning suppression if we are compiled +// with nvcc masquerading for MSVC. +# if !defined( __CUDACC__ ) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + __pragma( warning( push ) ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + __pragma( warning( pop ) ) +# endif // Universal Windows platform does not support SEH // Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +# if defined(CATCH_PLATFORM_WINDOWS_UWP) # define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 # else # define CATCH_INTERNAL_CONFIG_WINDOWS_SEH @@ -573,6 +615,10 @@ namespace Catch { # define CATCH_CONFIG_POSIX_SIGNALS #endif +#if defined(CATCH_INTERNAL_CONFIG_GETENV) && !defined(CATCH_INTERNAL_CONFIG_NO_GETENV) && !defined(CATCH_CONFIG_NO_GETENV) && !defined(CATCH_CONFIG_GETENV) +# define CATCH_CONFIG_GETENV +#endif + #if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) # define CATCH_CONFIG_CPP11_TO_STRING #endif @@ -638,6 +684,9 @@ namespace Catch { #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS #endif +#if !defined(CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS +#endif #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS #endif @@ -658,6 +707,10 @@ namespace Catch { # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif +#if !defined(CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS +#endif + #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) #define CATCH_TRY if ((true)) #define CATCH_CATCH_ALL if ((false)) @@ -679,6 +732,16 @@ namespace Catch { # define CATCH_CONFIG_COLOUR_WIN32 #endif +#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \ + !defined( CATCH_CONFIG_STATIC ) +# ifdef Catch2_EXPORTS +# define CATCH_EXPORT //__declspec( dllexport ) // not needed +# else +# define CATCH_EXPORT __declspec( dllimport ) +# endif +#else +# define CATCH_EXPORT +#endif #endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED @@ -686,6 +749,7 @@ namespace Catch { #ifndef CATCH_CONTEXT_HPP_INCLUDED #define CATCH_CONTEXT_HPP_INCLUDED + namespace Catch { class IResultCapture; @@ -706,7 +770,7 @@ namespace Catch { virtual void setConfig( IConfig const* config ) = 0; private: - static IMutableContext *currentContext; + CATCH_EXPORT static IMutableContext* currentContext; friend IMutableContext& getCurrentMutableContext(); friend void cleanUpContext(); static void createContext(); @@ -808,6 +872,7 @@ namespace Catch { std::uint64_t passed = 0; std::uint64_t failed = 0; std::uint64_t failedButOk = 0; + std::uint64_t skipped = 0; }; struct Totals { @@ -874,6 +939,8 @@ namespace Catch { Ok = 0, Info = 1, Warning = 2, + // TODO: Should explicit skip be considered "not OK" (cf. isOk)? I.e., should it have the failure bit? + ExplicitSkip = 4, FailureBit = 0x10, @@ -983,7 +1050,7 @@ namespace Catch { class AssertionResult { public: AssertionResult() = delete; - AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); + AssertionResult( AssertionInfo const& info, AssertionResultData&& data ); bool isOk() const; bool succeeded() const; @@ -1020,116 +1087,6 @@ namespace Catch { #include <chrono> -namespace Catch { - - class AssertionResult; - struct AssertionInfo; - struct SectionInfo; - struct SectionEndInfo; - struct MessageInfo; - struct MessageBuilder; - struct Counts; - struct AssertionReaction; - struct SourceLineInfo; - - class ITransientExpression; - class IGeneratorTracker; - - struct BenchmarkInfo; - template <typename Duration = std::chrono::duration<double, std::nano>> - struct BenchmarkStats; - - class IResultCapture { - public: - virtual ~IResultCapture(); - - virtual bool sectionStarted( SectionInfo const& sectionInfo, - Counts& assertions ) = 0; - virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; - virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; - - virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; - - virtual void benchmarkPreparing( StringRef name ) = 0; - virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; - virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0; - virtual void benchmarkFailed( StringRef error ) = 0; - - virtual void pushScopedMessage( MessageInfo const& message ) = 0; - virtual void popScopedMessage( MessageInfo const& message ) = 0; - - virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0; - - virtual void handleFatalErrorCondition( StringRef message ) = 0; - - virtual void handleExpr - ( AssertionInfo const& info, - ITransientExpression const& expr, - AssertionReaction& reaction ) = 0; - virtual void handleMessage - ( AssertionInfo const& info, - ResultWas::OfType resultType, - StringRef message, - AssertionReaction& reaction ) = 0; - virtual void handleUnexpectedExceptionNotThrown - ( AssertionInfo const& info, - AssertionReaction& reaction ) = 0; - virtual void handleUnexpectedInflightException - ( AssertionInfo const& info, - std::string const& message, - AssertionReaction& reaction ) = 0; - virtual void handleIncomplete - ( AssertionInfo const& info ) = 0; - virtual void handleNonExpr - ( AssertionInfo const &info, - ResultWas::OfType resultType, - AssertionReaction &reaction ) = 0; - - - - virtual bool lastAssertionPassed() = 0; - virtual void assertionPassed() = 0; - - // Deprecated, do not use: - virtual std::string getCurrentTestName() const = 0; - virtual const AssertionResult* getLastResult() const = 0; - virtual void exceptionEarlyReported() = 0; - }; - - IResultCapture& getResultCapture(); -} - -#endif // CATCH_INTERFACES_CAPTURE_HPP_INCLUDED - -#include <string> - -namespace Catch { - - struct MessageInfo { - MessageInfo( StringRef _macroName, - SourceLineInfo const& _lineInfo, - ResultWas::OfType _type ); - - StringRef macroName; - std::string message; - SourceLineInfo lineInfo; - ResultWas::OfType type; - unsigned int sequence; - - bool operator == (MessageInfo const& other) const { - return sequence == other.sequence; - } - bool operator < (MessageInfo const& other) const { - return sequence < other.sequence; - } - private: - static unsigned int globalCount; - }; - -} // end namespace Catch - -#endif // CATCH_MESSAGE_INFO_HPP_INCLUDED - #ifndef CATCH_UNIQUE_PTR_HPP_INCLUDED #define CATCH_UNIQUE_PTR_HPP_INCLUDED @@ -1242,6 +1199,129 @@ namespace Detail { #endif // CATCH_UNIQUE_PTR_HPP_INCLUDED +namespace Catch { + + class AssertionResult; + struct AssertionInfo; + struct SectionInfo; + struct SectionEndInfo; + struct MessageInfo; + struct MessageBuilder; + struct Counts; + struct AssertionReaction; + struct SourceLineInfo; + + class ITransientExpression; + class IGeneratorTracker; + + struct BenchmarkInfo; + template <typename Duration = std::chrono::duration<double, std::nano>> + struct BenchmarkStats; + + namespace Generators { + class GeneratorUntypedBase; + using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>; + } + + + class IResultCapture { + public: + virtual ~IResultCapture(); + + virtual bool sectionStarted( StringRef sectionName, + SourceLineInfo const& sectionLineInfo, + Counts& assertions ) = 0; + virtual void sectionEnded( SectionEndInfo&& endInfo ) = 0; + virtual void sectionEndedEarly( SectionEndInfo&& endInfo ) = 0; + + virtual IGeneratorTracker* + acquireGeneratorTracker( StringRef generatorName, + SourceLineInfo const& lineInfo ) = 0; + virtual IGeneratorTracker* + createGeneratorTracker( StringRef generatorName, + SourceLineInfo lineInfo, + Generators::GeneratorBasePtr&& generator ) = 0; + + virtual void benchmarkPreparing( StringRef name ) = 0; + virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; + virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0; + virtual void benchmarkFailed( StringRef error ) = 0; + + virtual void pushScopedMessage( MessageInfo const& message ) = 0; + virtual void popScopedMessage( MessageInfo const& message ) = 0; + + virtual void emplaceUnscopedMessage( MessageBuilder&& builder ) = 0; + + virtual void handleFatalErrorCondition( StringRef message ) = 0; + + virtual void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) = 0; + virtual void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef message, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) = 0; + virtual void handleIncomplete + ( AssertionInfo const& info ) = 0; + virtual void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) = 0; + + + + virtual bool lastAssertionPassed() = 0; + virtual void assertionPassed() = 0; + + // Deprecated, do not use: + virtual std::string getCurrentTestName() const = 0; + virtual const AssertionResult* getLastResult() const = 0; + virtual void exceptionEarlyReported() = 0; + }; + + IResultCapture& getResultCapture(); +} + +#endif // CATCH_INTERFACES_CAPTURE_HPP_INCLUDED + +#include <string> + +namespace Catch { + + struct MessageInfo { + MessageInfo( StringRef _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ); + + StringRef macroName; + std::string message; + SourceLineInfo lineInfo; + ResultWas::OfType type; + unsigned int sequence; + + bool operator == (MessageInfo const& other) const { + return sequence == other.sequence; + } + bool operator < (MessageInfo const& other) const { + return sequence < other.sequence; + } + private: + static unsigned int globalCount; + }; + +} // end namespace Catch + +#endif // CATCH_MESSAGE_INFO_HPP_INCLUDED + // Adapted from donated nonius code. @@ -1351,7 +1431,7 @@ namespace Catch { }; struct SectionStats { - SectionStats( SectionInfo const& _sectionInfo, + SectionStats( SectionInfo&& _sectionInfo, Counts const& _assertions, double _durationInSeconds, bool _missingAssertions ); @@ -1365,8 +1445,8 @@ namespace Catch { struct TestCaseStats { TestCaseStats( TestCaseInfo const& _testInfo, Totals const& _totals, - std::string const& _stdOut, - std::string const& _stdErr, + std::string&& _stdOut, + std::string&& _stdErr, bool _aborting ); TestCaseInfo const * testInfo; @@ -1515,7 +1595,12 @@ namespace Catch { */ virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; - //! Called with test cases that are skipped due to the test run aborting + /** + * Called with test cases that are skipped due to the test run aborting. + * NOT called for test cases that are explicitly skipped using the `SKIP` macro. + * + * Deprecated - will be removed in the next major release. + */ virtual void skipTest( TestCaseInfo const& testInfo ) = 0; //! Called if a fatal error (signal/structured exception) occured @@ -1699,6 +1784,16 @@ namespace Catch { //! Used to signal that an assertion macro failed struct TestFailureException{}; + /** + * Outlines throwing of `TestFailureException` into a single TU + * + * Also handles `CATCH_CONFIG_DISABLE_EXCEPTIONS` for callers. + */ + [[noreturn]] void throw_test_failure_exception(); + + //! Used to signal that the remainder of a test should be skipped + struct TestSkipException{}; + } // namespace Catch #endif // CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED @@ -1710,15 +1805,14 @@ namespace Catch { #include <type_traits> namespace Catch { - template<typename T> - struct always_false : std::false_type {}; + template <typename> + struct true_given : std::true_type {}; - template <typename> struct true_given : std::true_type {}; struct is_callable_tester { template <typename Fun, typename... Args> - true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int); + static true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> test(int); template <typename...> - std::false_type static test(...); + static std::false_type test(...); }; template <typename T> @@ -2609,7 +2703,7 @@ namespace Catch { }); BenchmarkInfo info { - name, + CATCH_MOVE(name), plan.estimated_duration.count(), plan.iterations_per_sample, cfg->benchmarkSamples(), @@ -2625,7 +2719,7 @@ namespace Catch { }); auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end()); - BenchmarkStats<FloatDuration<Clock>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; + BenchmarkStats<FloatDuration<Clock>> stats{ CATCH_MOVE(info), CATCH_MOVE(analysis.samples), analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; getResultCapture().benchmarkEnded(stats); } CATCH_CATCH_ANON (TestFailureException) { getResultCapture().benchmarkFailed("Benchmark failed due to failed assertion"_sr); @@ -2737,14 +2831,18 @@ namespace Catch { template <typename U> void destruct_on_exit(std::enable_if_t<!Destruct, U>* = nullptr) { } - T& stored_object() { - return *static_cast<T*>(static_cast<void*>(data)); - } +#if defined( __GNUC__ ) && __GNUC__ <= 6 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif + T& stored_object() { return *reinterpret_cast<T*>( data ); } T const& stored_object() const { - return *static_cast<T const*>(static_cast<void const*>(data)); + return *reinterpret_cast<T const*>( data ); } - +#if defined( __GNUC__ ) && __GNUC__ <= 6 +# pragma GCC diagnostic pop +#endif alignas( T ) unsigned char data[sizeof( T )]{}; }; @@ -2776,7 +2874,6 @@ namespace Catch { #include <cstddef> #include <type_traits> #include <string> -#include <string.h> @@ -2939,6 +3036,13 @@ namespace Catch { namespace Detail { + inline std::size_t catch_strnlen(const char *str, std::size_t n) { + auto ret = std::char_traits<char>::find(str, n, '\0'); + if (ret != nullptr) { + return static_cast<std::size_t>(ret - str); + } + return n; + } constexpr StringRef unprintableString = "{?}"_sr; @@ -3106,28 +3210,24 @@ namespace Catch { template<size_t SZ> struct StringMaker<char[SZ]> { static std::string convert(char const* str) { - // Note that `strnlen` is not actually part of standard C++, - // but both POSIX and Windows cstdlib provide it. return Detail::convertIntoString( - StringRef( str, strnlen( str, SZ ) ) ); + StringRef( str, Detail::catch_strnlen( str, SZ ) ) ); } }; template<size_t SZ> struct StringMaker<signed char[SZ]> { static std::string convert(signed char const* str) { - // See the plain `char const*` overload auto reinterpreted = reinterpret_cast<char const*>(str); return Detail::convertIntoString( - StringRef(reinterpreted, strnlen(reinterpreted, SZ))); + StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ))); } }; template<size_t SZ> struct StringMaker<unsigned char[SZ]> { static std::string convert(unsigned char const* str) { - // See the plain `char const*` overload auto reinterpreted = reinterpret_cast<char const*>(str); return Detail::convertIntoString( - StringRef(reinterpreted, strnlen(reinterpreted, SZ))); + StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ))); } }; @@ -3194,13 +3294,13 @@ namespace Catch { template<> struct StringMaker<float> { static std::string convert(float value); - static int precision; + CATCH_EXPORT static int precision; }; template<> struct StringMaker<double> { static std::string convert(double value); - static int precision; + CATCH_EXPORT static int precision; }; template <typename T> @@ -3739,6 +3839,7 @@ namespace Catch #endif // CATCH_WILDCARD_PATTERN_HPP_INCLUDED +#include <iosfwd> #include <string> #include <vector> @@ -3757,6 +3858,14 @@ namespace Catch { virtual bool matches( TestCaseInfo const& testCase ) const = 0; std::string const& name() const; private: + virtual void serializeTo( std::ostream& out ) const = 0; + // Writes string that would be reparsed into the pattern + friend std::ostream& operator<<(std::ostream& out, + Pattern const& pattern) { + pattern.serializeTo( out ); + return out; + } + std::string const m_name; }; @@ -3765,6 +3874,8 @@ namespace Catch { explicit NamePattern( std::string const& name, std::string const& filterString ); bool matches( TestCaseInfo const& testCase ) const override; private: + void serializeTo( std::ostream& out ) const override; + WildcardPattern m_wildcardPattern; }; @@ -3773,6 +3884,8 @@ namespace Catch { explicit TagPattern( std::string const& tag, std::string const& filterString ); bool matches( TestCaseInfo const& testCase ) const override; private: + void serializeTo( std::ostream& out ) const override; + std::string m_tag; }; @@ -3780,10 +3893,19 @@ namespace Catch { std::vector<Detail::unique_ptr<Pattern>> m_required; std::vector<Detail::unique_ptr<Pattern>> m_forbidden; + //! Serializes this filter into a string that would be parsed into + //! an equivalent filter + void serializeTo( std::ostream& out ) const; + friend std::ostream& operator<<(std::ostream& out, Filter const& f) { + f.serializeTo( out ); + return out; + } + bool matches( TestCaseInfo const& testCase ) const; - std::string name() const; }; + static std::string extractFilterName( Filter const& filter ); + public: struct FilterMatch { std::string name; @@ -3800,7 +3922,16 @@ namespace Catch { private: std::vector<Filter> m_filters; std::vector<std::string> m_invalidSpecs; + friend class TestSpecParser; + //! Serializes this test spec into a string that would be parsed into + //! equivalent test spec + void serializeTo( std::ostream& out ) const; + friend std::ostream& operator<<(std::ostream& out, + TestSpec const& spec) { + spec.serializeTo( out ); + return out; + } }; } @@ -3973,6 +4104,7 @@ namespace Catch { Error = BrightRed, Success = Green, + Skip = LightGrey, OriginalExpression = Cyan, ReconstructedExpression = BrightYellow, @@ -4261,6 +4393,9 @@ namespace Catch { std::chrono::milliseconds benchmarkWarmupTime() const override; private: + // Reads Bazel env vars and applies them to the config + void readBazelEnvVars(); + ConfigData m_data; std::vector<ProcessedReporterSpec> m_processedReporterSpecs; TestSpec m_testSpec; @@ -4271,6 +4406,19 @@ namespace Catch { #endif // CATCH_CONFIG_HPP_INCLUDED +#ifndef CATCH_GET_RANDOM_SEED_HPP_INCLUDED +#define CATCH_GET_RANDOM_SEED_HPP_INCLUDED + +#include <cstdint> + +namespace Catch { + //! Returns Catch2's current RNG seed. + std::uint32_t getSeed(); +} + +#endif // CATCH_GET_RANDOM_SEED_HPP_INCLUDED + + #ifndef CATCH_MESSAGE_HPP_INCLUDED #define CATCH_MESSAGE_HPP_INCLUDED @@ -4323,11 +4471,10 @@ namespace Catch { ResultWas::OfType type ): m_info(macroName, lineInfo, type) {} - template<typename T> - MessageBuilder& operator << ( T const& value ) { + MessageBuilder&& operator << ( T const& value ) && { m_stream << value; - return *this; + return CATCH_MOVE(*this); } MessageInfo m_info; @@ -4335,7 +4482,7 @@ namespace Catch { class ScopedMessage { public: - explicit ScopedMessage( MessageBuilder const& builder ); + explicit ScopedMessage( MessageBuilder&& builder ); ScopedMessage( ScopedMessage& duplicate ) = delete; ScopedMessage( ScopedMessage&& old ) noexcept; ~ScopedMessage(); @@ -4382,12 +4529,15 @@ namespace Catch { /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \ - Catch::Capturer varName( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \ + Catch::Capturer varName( macroName##_catch_sr, \ + CATCH_INTERNAL_LINEINFO, \ + Catch::ResultWas::Info, \ + #__VA_ARGS__##_catch_sr ); \ varName.captureValues( 0, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_INFO( macroName, log ) \ - Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) + const Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \ @@ -5249,25 +5399,134 @@ namespace Catch { -#ifndef CATCH_TEST_MACROS_HPP_INCLUDED -#define CATCH_TEST_MACROS_HPP_INCLUDED +#ifndef CATCH_TEST_MACROS_HPP_INCLUDED +#define CATCH_TEST_MACROS_HPP_INCLUDED + + + +#ifndef CATCH_TEST_MACRO_IMPL_HPP_INCLUDED +#define CATCH_TEST_MACRO_IMPL_HPP_INCLUDED + + + +#ifndef CATCH_ASSERTION_HANDLER_HPP_INCLUDED +#define CATCH_ASSERTION_HANDLER_HPP_INCLUDED + + + +#ifndef CATCH_DECOMPOSER_HPP_INCLUDED +#define CATCH_DECOMPOSER_HPP_INCLUDED + + + +#ifndef CATCH_COMPARE_TRAITS_HPP_INCLUDED +#define CATCH_COMPARE_TRAITS_HPP_INCLUDED + + +#include <type_traits> + +namespace Catch { + namespace Detail { + +#if defined( __GNUC__ ) && !defined( __clang__ ) +# pragma GCC diagnostic push + // GCC likes to complain about comparing bool with 0, in the decltype() + // that defines the comparable traits below. +# pragma GCC diagnostic ignored "-Wbool-compare" + // "ordered comparison of pointer with integer zero" same as above, + // but it does not have a separate warning flag to suppress +# pragma GCC diagnostic ignored "-Wextra" + // Did you know that comparing floats with `0` directly + // is super-duper dangerous in unevaluated context? +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + +#if defined( __clang__ ) +# pragma clang diagnostic push + // Did you know that comparing floats with `0` directly + // is super-duper dangerous in unevaluated context? +# pragma clang diagnostic ignored "-Wfloat-equal" +#endif + +#define CATCH_DEFINE_COMPARABLE_TRAIT( id, op ) \ + template <typename, typename, typename = void> \ + struct is_##id##_comparable : std::false_type {}; \ + template <typename T, typename U> \ + struct is_##id##_comparable< \ + T, \ + U, \ + void_t<decltype( std::declval<T>() op std::declval<U>() )>> \ + : std::true_type {}; \ + template <typename, typename = void> \ + struct is_##id##_0_comparable : std::false_type {}; \ + template <typename T> \ + struct is_##id##_0_comparable<T, \ + void_t<decltype( std::declval<T>() op 0 )>> \ + : std::true_type {}; + + // We need all 6 pre-spaceship comparison ops: <, <=, >, >=, ==, != + CATCH_DEFINE_COMPARABLE_TRAIT( lt, < ) + CATCH_DEFINE_COMPARABLE_TRAIT( le, <= ) + CATCH_DEFINE_COMPARABLE_TRAIT( gt, > ) + CATCH_DEFINE_COMPARABLE_TRAIT( ge, >= ) + CATCH_DEFINE_COMPARABLE_TRAIT( eq, == ) + CATCH_DEFINE_COMPARABLE_TRAIT( ne, != ) + +#undef CATCH_DEFINE_COMPARABLE_TRAIT + +#if defined( __GNUC__ ) && !defined( __clang__ ) +# pragma GCC diagnostic pop +#endif +#if defined( __clang__ ) +# pragma clang diagnostic pop +#endif + + + } // namespace Detail +} // namespace Catch + +#endif // CATCH_COMPARE_TRAITS_HPP_INCLUDED + +#ifndef CATCH_LOGICAL_TRAITS_HPP_INCLUDED +#define CATCH_LOGICAL_TRAITS_HPP_INCLUDED +#include <type_traits> -#ifndef CATCH_TEST_MACRO_IMPL_HPP_INCLUDED -#define CATCH_TEST_MACRO_IMPL_HPP_INCLUDED +namespace Catch { +namespace Detail { +#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510 + using std::conjunction; + using std::disjunction; + using std::negation; -#ifndef CATCH_ASSERTION_HANDLER_HPP_INCLUDED -#define CATCH_ASSERTION_HANDLER_HPP_INCLUDED +#else + template <class...> struct conjunction : std::true_type {}; + template <class B1> struct conjunction<B1> : B1 {}; + template <class B1, class... Bn> + struct conjunction<B1, Bn...> + : std::conditional_t<bool( B1::value ), conjunction<Bn...>, B1> {}; + template <class...> struct disjunction : std::false_type {}; + template <class B1> struct disjunction<B1> : B1 {}; + template <class B1, class... Bn> + struct disjunction<B1, Bn...> + : std::conditional_t<bool( B1::value ), B1, disjunction<Bn...>> {}; -#ifndef CATCH_DECOMPOSER_HPP_INCLUDED -#define CATCH_DECOMPOSER_HPP_INCLUDED + template <class B> + struct negation : std::integral_constant<bool, !bool(B::value)> {}; + +#endif + +} // namespace Detail +} // namespace Catch +#endif // CATCH_LOGICAL_TRAITS_HPP_INCLUDED +#include <type_traits> #include <iosfwd> #ifdef _MSC_VER @@ -5289,6 +5548,9 @@ namespace Catch { namespace Catch { + template <typename T> + struct always_false : std::false_type {}; + class ITransientExpression { bool m_isBinaryExpression; bool m_result; @@ -5411,68 +5673,134 @@ namespace Catch { }; - // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) - template<typename LhsT, typename RhsT> - auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); } - template<typename T> - auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); } - template<typename T> - auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); } - template<typename T> - auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; } - template<typename T> - auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; } - - template<typename LhsT, typename RhsT> - auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); } - template<typename T> - auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); } - template<typename T> - auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); } - template<typename T> - auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; } - template<typename T> - auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; } - - template<typename LhsT> class ExprLhs { LhsT m_lhs; public: explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} - template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> - friend auto operator == ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { - return { compareEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "=="_sr, rhs }; - } - template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> - friend auto operator == ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { - return { compareEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "=="_sr, rhs }; - } +#define CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( id, op ) \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>, \ + Detail::negation<std::is_arithmetic< \ + std::remove_reference_t<RhsT>>>>::value, \ + BinaryExpr<LhsT, RhsT const&>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>, \ + std::is_arithmetic<RhsT>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction< \ + Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>, \ + Detail::is_eq_0_comparable<LhsT>, \ + /* We allow long because we want `ptr op NULL` to be accepted */ \ + Detail::disjunction<std::is_same<RhsT, int>, \ + std::is_same<RhsT, long>>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + if ( rhs != 0 ) { throw_test_failure_exception(); } \ + return { \ + static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction< \ + Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>, \ + Detail::is_eq_0_comparable<RhsT>, \ + /* We allow long because we want `ptr op NULL` to be accepted */ \ + Detail::disjunction<std::is_same<LhsT, int>, \ + std::is_same<LhsT, long>>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \ + return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } - template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> - friend auto operator != ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { - return { compareNotEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "!="_sr, rhs }; - } - template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> - friend auto operator != ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { - return { compareNotEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "!="_sr, rhs }; - } + CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == ) + CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( ne, != ) + + #undef CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR + +#define CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( id, op ) \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>, \ + Detail::negation<std::is_arithmetic< \ + std::remove_reference_t<RhsT>>>>::value, \ + BinaryExpr<LhsT, RhsT const&>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>, \ + std::is_arithmetic<RhsT>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction< \ + Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>, \ + Detail::is_##id##_0_comparable<LhsT>, \ + std::is_same<RhsT, int>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + if ( rhs != 0 ) { throw_test_failure_exception(); } \ + return { \ + static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction< \ + Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>, \ + Detail::is_##id##_0_comparable<RhsT>, \ + std::is_same<LhsT, int>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \ + return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } - #define CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(op) \ - template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> \ - friend auto operator op ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { \ - return { static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs }; \ - } \ - template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> \ - friend auto operator op ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { \ - return { static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs }; \ - } + CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( lt, < ) + CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( le, <= ) + CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( gt, > ) + CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( ge, >= ) + + #undef CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR + + +#define CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR( op ) \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \ + ->std::enable_if_t< \ + !std::is_arithmetic<std::remove_reference_t<RhsT>>::value, \ + BinaryExpr<LhsT, RhsT const&>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t<std::is_arithmetic<RhsT>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } - CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(<) - CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(>) - CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(<=) - CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(>=) CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(|) CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(&) CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(^) @@ -5532,6 +5860,7 @@ namespace Catch { struct AssertionReaction { bool shouldDebugBreak = false; bool shouldThrow = false; + bool shouldSkip = false; }; class AssertionHandler { @@ -5574,7 +5903,7 @@ namespace Catch { auto allowThrows() const -> bool; }; - void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str ); } // namespace Catch @@ -5589,9 +5918,9 @@ namespace Catch { #if !defined(CATCH_CONFIG_DISABLE) #if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) - #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ + #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__##_catch_sr #else - #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" + #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"_catch_sr #endif #if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) @@ -5642,7 +5971,10 @@ namespace Catch { do { \ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ try { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ static_cast<void>(__VA_ARGS__); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ catchAssertionHandler.handleExceptionNotThrownAsExpected(); \ } \ catch( ... ) { \ @@ -5657,7 +5989,10 @@ namespace Catch { Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \ if( catchAssertionHandler.allowThrows() ) \ try { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ static_cast<void>(__VA_ARGS__); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ } \ catch( ... ) { \ @@ -5674,7 +6009,10 @@ namespace Catch { Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \ if( catchAssertionHandler.allowThrows() ) \ try { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ static_cast<void>(expr); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ } \ catch( exceptionType const& ) { \ @@ -5697,11 +6035,14 @@ namespace Catch { Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ if( catchAssertionHandler.allowThrows() ) \ try { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ static_cast<void>(__VA_ARGS__); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ } \ catch( ... ) { \ - Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher##_catch_sr ); \ + Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher ); \ } \ else \ catchAssertionHandler.handleThrowingCallSkipped(); \ @@ -5744,6 +6085,9 @@ namespace Catch { class Section : Detail::NonCopyable { public: Section( SectionInfo&& info ); + Section( SourceLineInfo const& _lineInfo, + StringRef _name, + const char* const = nullptr ); ~Section(); // This indicates whether the section should be executed or not @@ -5762,7 +6106,7 @@ namespace Catch { #define INTERNAL_CATCH_SECTION( ... ) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ - if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION #define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ @@ -5892,7 +6236,7 @@ struct AutoReg : Detail::NonCopyable { CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ - namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + namespace{ const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ static void TestName() #define INTERNAL_CATCH_TESTCASE( ... ) \ @@ -5903,7 +6247,13 @@ struct AutoReg : Detail::NonCopyable { CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ - namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + namespace { \ + const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \ + Catch::makeTestInvoker( &QualifiedMethod ), \ + CATCH_INTERNAL_LINEINFO, \ + "&" #QualifiedMethod##_catch_sr, \ + Catch::NameAndTags{ __VA_ARGS__ } ); \ + } /* NOLINT */ \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION /////////////////////////////////////////////////////////////////////////////// @@ -5915,7 +6265,11 @@ struct AutoReg : Detail::NonCopyable { struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ void test(); \ }; \ - Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \ + Catch::makeTestInvoker( &TestName::test ), \ + CATCH_INTERNAL_LINEINFO, \ + #ClassName##_catch_sr, \ + Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ } \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ void TestName::test() @@ -5969,6 +6323,7 @@ struct AutoReg : Detail::NonCopyable { #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + #define CATCH_SKIP( ... ) INTERNAL_CATCH_MSG( "SKIP", Catch::ResultWas::ExplicitSkip, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) @@ -6022,6 +6377,7 @@ struct AutoReg : Detail::NonCopyable { #define CATCH_FAIL( ... ) (void)(0) #define CATCH_FAIL_CHECK( ... ) (void)(0) #define CATCH_SUCCEED( ... ) (void)(0) + #define CATCH_SKIP( ... ) (void)(0) #define CATCH_STATIC_REQUIRE( ... ) (void)(0) #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) @@ -6066,6 +6422,7 @@ struct AutoReg : Detail::NonCopyable { #define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + #define SKIP( ... ) INTERNAL_CATCH_MSG( "SKIP", Catch::ResultWas::ExplicitSkip, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) @@ -6118,6 +6475,7 @@ struct AutoReg : Detail::NonCopyable { #define FAIL( ... ) (void)(0) #define FAIL_CHECK( ... ) (void)(0) #define SUCCEED( ... ) (void)(0) + #define SKIP( ... ) (void)(0) #define STATIC_REQUIRE( ... ) (void)(0) #define STATIC_REQUIRE_FALSE( ... ) (void)(0) @@ -6437,6 +6795,7 @@ struct AutoReg : Detail::NonCopyable { CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ namespace {\ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ @@ -6447,12 +6806,12 @@ struct AutoReg : Detail::NonCopyable { struct TestName{\ TestName(){\ size_t index = 0; \ - constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ - using expander = size_t[];\ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; /* NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays,hicpp-avoid-c-arrays) */\ + using expander = size_t[]; /* NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays,hicpp-avoid-c-arrays) */\ (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ }\ };\ - static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + static const int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\ return 0;\ }();\ @@ -6483,6 +6842,7 @@ struct AutoReg : Detail::NonCopyable { CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ template<typename TestType> static void TestFuncName(); \ namespace {\ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ @@ -6532,6 +6892,7 @@ struct AutoReg : Detail::NonCopyable { CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ template<typename TestType> static void TestFunc(); \ namespace {\ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ @@ -6541,7 +6902,7 @@ struct AutoReg : Detail::NonCopyable { void reg_tests() { \ size_t index = 0; \ using expander = size_t[]; \ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\ } \ };\ static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ @@ -6663,6 +7024,7 @@ struct AutoReg : Detail::NonCopyable { CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ template<typename TestType> \ struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \ void test();\ @@ -6675,7 +7037,7 @@ struct AutoReg : Detail::NonCopyable { void reg_tests(){\ size_t index = 0;\ using expander = size_t[];\ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \ }\ };\ static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ @@ -6803,6 +7165,7 @@ struct AutoReg : Detail::NonCopyable { +#include <cstdint> #include <string> #include <vector> @@ -7062,8 +7425,8 @@ namespace Catch { #define CATCH_VERSION_MACROS_HPP_INCLUDED #define CATCH_VERSION_MAJOR 3 -#define CATCH_VERSION_MINOR 1 -#define CATCH_VERSION_PATCH 0 +#define CATCH_VERSION_MINOR 3 +#define CATCH_VERSION_PATCH 2 #endif // CATCH_VERSION_MACROS_HPP_INCLUDED @@ -7387,37 +7750,47 @@ namespace Detail { return makeGenerators( value( T( CATCH_FORWARD( val ) ) ), CATCH_FORWARD( moreGenerators )... ); } - auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; + IGeneratorTracker* acquireGeneratorTracker( StringRef generatorName, + SourceLineInfo const& lineInfo ); + IGeneratorTracker* createGeneratorTracker( StringRef generatorName, + SourceLineInfo lineInfo, + GeneratorBasePtr&& generator ); template<typename L> - // Note: The type after -> is weird, because VS2015 cannot parse - // the expression used in the typedef inside, when it is in - // return type. Yeah. - auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) { + auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> typename decltype(generatorExpression())::type { using UnderlyingType = typename decltype(generatorExpression())::type; - IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo ); - if (!tracker.hasGenerator()) { - tracker.setGenerator(Catch::Detail::make_unique<Generators<UnderlyingType>>(generatorExpression())); + IGeneratorTracker* tracker = acquireGeneratorTracker( generatorName, lineInfo ); + // Creation of tracker is delayed after generator creation, so + // that constructing generator can fail without breaking everything. + if (!tracker) { + tracker = createGeneratorTracker( + generatorName, + lineInfo, + Catch::Detail::make_unique<Generators<UnderlyingType>>( + generatorExpression() ) ); } - auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() ); + auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker->getGenerator() ); return generator.get(); } } // namespace Generators } // namespace Catch +#define CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL( ... ) #__VA_ARGS__##_catch_sr +#define CATCH_INTERNAL_GENERATOR_STRINGIZE(...) CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL(__VA_ARGS__) + #define GENERATE( ... ) \ - Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ CATCH_INTERNAL_LINEINFO, \ [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_COPY( ... ) \ - Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ CATCH_INTERNAL_LINEINFO, \ [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_REF( ... ) \ - Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ CATCH_INTERNAL_LINEINFO, \ [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) @@ -8220,7 +8593,10 @@ namespace Catch { #if defined(__i386__) || defined(__x86_64__) #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ #elif defined(__aarch64__) - #define CATCH_TRAP() __asm__(".inst 0xd43e0000") + #define CATCH_TRAP() __asm__(".inst 0xd43e0000") + #elif defined(__POWERPC__) + #define CATCH_TRAP() __asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \ + : : : "memory","r0","r3","r4" ) /* NOLINT */ #endif #elif defined(CATCH_PLATFORM_IPHONE) @@ -8555,6 +8931,154 @@ namespace Catch { #endif // CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED +#ifndef CATCH_GETENV_HPP_INCLUDED +#define CATCH_GETENV_HPP_INCLUDED + +namespace Catch { +namespace Detail { + + //! Wrapper over `std::getenv` that compiles on UWP (and always returns nullptr there) + char const* getEnv(char const* varName); + +} +} + +#endif // CATCH_GETENV_HPP_INCLUDED + + +#ifndef CATCH_IS_PERMUTATION_HPP_INCLUDED +#define CATCH_IS_PERMUTATION_HPP_INCLUDED + +#include <algorithm> +#include <iterator> + +namespace Catch { + namespace Detail { + + template <typename ForwardIter, + typename Sentinel, + typename T, + typename Comparator> + ForwardIter find_sentinel( ForwardIter start, + Sentinel sentinel, + T const& value, + Comparator cmp ) { + while ( start != sentinel ) { + if ( cmp( *start, value ) ) { break; } + ++start; + } + return start; + } + + template <typename ForwardIter, + typename Sentinel, + typename T, + typename Comparator> + std::ptrdiff_t count_sentinel( ForwardIter start, + Sentinel sentinel, + T const& value, + Comparator cmp ) { + std::ptrdiff_t count = 0; + while ( start != sentinel ) { + if ( cmp( *start, value ) ) { ++count; } + ++start; + } + return count; + } + + template <typename ForwardIter, typename Sentinel> + std::enable_if_t<!std::is_same<ForwardIter, Sentinel>::value, + std::ptrdiff_t> + sentinel_distance( ForwardIter iter, const Sentinel sentinel ) { + std::ptrdiff_t dist = 0; + while ( iter != sentinel ) { + ++iter; + ++dist; + } + return dist; + } + + template <typename ForwardIter> + std::ptrdiff_t sentinel_distance( ForwardIter first, + ForwardIter last ) { + return std::distance( first, last ); + } + + template <typename ForwardIter1, + typename Sentinel1, + typename ForwardIter2, + typename Sentinel2, + typename Comparator> + bool check_element_counts( ForwardIter1 first_1, + const Sentinel1 end_1, + ForwardIter2 first_2, + const Sentinel2 end_2, + Comparator cmp ) { + auto cursor = first_1; + while ( cursor != end_1 ) { + if ( find_sentinel( first_1, cursor, *cursor, cmp ) == + cursor ) { + // we haven't checked this element yet + const auto count_in_range_2 = + count_sentinel( first_2, end_2, *cursor, cmp ); + // Not a single instance in 2nd range, so it cannot be a + // permutation of 1st range + if ( count_in_range_2 == 0 ) { return false; } + + const auto count_in_range_1 = + count_sentinel( cursor, end_1, *cursor, cmp ); + if ( count_in_range_1 != count_in_range_2 ) { + return false; + } + } + + ++cursor; + } + + return true; + } + + template <typename ForwardIter1, + typename Sentinel1, + typename ForwardIter2, + typename Sentinel2, + typename Comparator> + bool is_permutation( ForwardIter1 first_1, + const Sentinel1 end_1, + ForwardIter2 first_2, + const Sentinel2 end_2, + Comparator cmp ) { + // TODO: no optimization for stronger iterators, because we would also have to constrain on sentinel vs not sentinel types + // TODO: Comparator has to be "both sides", e.g. a == b => b == a + // This skips shared prefix of the two ranges + while (first_1 != end_1 && first_2 != end_2 && cmp(*first_1, *first_2)) { + ++first_1; + ++first_2; + } + + // We need to handle case where at least one of the ranges has no more elements + if (first_1 == end_1 || first_2 == end_2) { + return first_1 == end_1 && first_2 == end_2; + } + + // pair counting is n**2, so we pay linear walk to compare the sizes first + auto dist_1 = sentinel_distance( first_1, end_1 ); + auto dist_2 = sentinel_distance( first_2, end_2 ); + + if (dist_1 != dist_2) { return false; } + + // Since we do not try to handle stronger iterators pair (e.g. + // bidir) optimally, the only thing left to do is to check counts in + // the remaining ranges. + return check_element_counts( first_1, end_1, first_2, end_2, cmp ); + } + + } // namespace Detail +} // namespace Catch + +#endif // CATCH_IS_PERMUTATION_HPP_INCLUDED + + #ifndef CATCH_ISTREAM_HPP_INCLUDED #define CATCH_ISTREAM_HPP_INCLUDED @@ -8763,6 +9287,26 @@ namespace Catch { #endif // CATCH_OUTPUT_REDIRECT_HPP_INCLUDED +#ifndef CATCH_PARSE_NUMBERS_HPP_INCLUDED +#define CATCH_PARSE_NUMBERS_HPP_INCLUDED + + +#include <string> + +namespace Catch { + + /** + * Parses unsigned int from the input, using provided base + * + * Effectively a wrapper around std::stoul but with better error checking + * e.g. "-1" is rejected, instead of being parsed as UINT_MAX. + */ + Optional<unsigned int> parseUInt(std::string const& input, int base = 10); +} + +#endif // CATCH_PARSE_NUMBERS_HPP_INCLUDED + + #ifndef CATCH_REPORTER_REGISTRY_HPP_INCLUDED #define CATCH_REPORTER_REGISTRY_HPP_INCLUDED @@ -8813,10 +9357,49 @@ namespace TestCaseTracking { std::string name; SourceLineInfo location; - NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); + NameAndLocation( std::string&& _name, SourceLineInfo const& _location ); friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) { - return lhs.name == rhs.name - && lhs.location == rhs.location; + // This is a very cheap check that should have a very high hit rate. + // If we get to SourceLineInfo::operator==, we will redo it, but the + // cost of repeating is trivial at that point (we will be paying + // multiple strcmp/memcmps at that point). + if ( lhs.location.line != rhs.location.line ) { return false; } + return lhs.name == rhs.name && lhs.location == rhs.location; + } + friend bool operator!=(NameAndLocation const& lhs, + NameAndLocation const& rhs) { + return !( lhs == rhs ); + } + }; + + /** + * This is a variant of `NameAndLocation` that does not own the name string + * + * This avoids extra allocations when trying to locate a tracker by its + * name and location, as long as we make sure that trackers only keep + * around the owning variant. + */ + struct NameAndLocationRef { + StringRef name; + SourceLineInfo location; + + constexpr NameAndLocationRef( StringRef name_, + SourceLineInfo location_ ): + name( name_ ), location( location_ ) {} + + friend bool operator==( NameAndLocation const& lhs, + NameAndLocationRef const& rhs ) { + // This is a very cheap check that should have a very high hit rate. + // If we get to SourceLineInfo::operator==, we will redo it, but the + // cost of repeating is trivial at that point (we will be paying + // multiple strcmp/memcmps at that point). + if ( lhs.location.line != rhs.location.line ) { return false; } + return StringRef( lhs.name ) == rhs.name && + lhs.location == rhs.location; + } + friend bool operator==( NameAndLocationRef const& lhs, + NameAndLocation const& rhs ) { + return rhs == lhs; } }; @@ -8844,8 +9427,8 @@ namespace TestCaseTracking { CycleState m_runState = NotStarted; public: - ITracker( NameAndLocation const& nameAndLoc, ITracker* parent ): - m_nameAndLocation( nameAndLoc ), + ITracker( NameAndLocation&& nameAndLoc, ITracker* parent ): + m_nameAndLocation( CATCH_MOVE(nameAndLoc) ), m_parent( parent ) {} @@ -8866,7 +9449,9 @@ namespace TestCaseTracking { //! Returns true if tracker run to completion (successfully or not) virtual bool isComplete() const = 0; //! Returns true if tracker run to completion succesfully - bool isSuccessfullyCompleted() const; + bool isSuccessfullyCompleted() const { + return m_runState == CompletedSuccessfully; + } //! Returns true if tracker has started but hasn't been completed bool isOpen() const; //! Returns true iff tracker has started @@ -8884,7 +9469,7 @@ namespace TestCaseTracking { * * Returns nullptr if not found. */ - ITracker* findChild( NameAndLocation const& nameAndLocation ); + ITracker* findChild( NameAndLocationRef const& nameAndLocation ); //! Have any children been added? bool hasChildren() const { return !m_children.empty(); @@ -8925,13 +9510,15 @@ namespace TestCaseTracking { public: ITracker& startRun(); - void endRun(); - void startCycle(); + void startCycle() { + m_currentTracker = m_rootTracker.get(); + m_runState = Executing; + } void completeCycle(); bool completedCycle() const; - ITracker& currentTracker(); + ITracker& currentTracker() { return *m_currentTracker; } void setCurrentTracker( ITracker* tracker ); }; @@ -8941,7 +9528,7 @@ namespace TestCaseTracking { TrackerContext& m_ctx; public: - TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + TrackerBase( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ); bool isComplete() const override; @@ -8957,22 +9544,26 @@ namespace TestCaseTracking { class SectionTracker : public TrackerBase { std::vector<StringRef> m_filters; - std::string m_trimmed_name; + // Note that lifetime-wise we piggy back off the name stored in the `ITracker` parent`. + // Currently it allocates owns the name, so this is safe. If it is later refactored + // to not own the name, the name still has to outlive the `ITracker` parent, so + // this should still be safe. + StringRef m_trimmed_name; public: - SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ); bool isSectionTracker() const override; bool isComplete() const override; - static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); + static SectionTracker& acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation ); void tryOpen(); void addInitialFilters( std::vector<std::string> const& filters ); void addNextFilters( std::vector<StringRef> const& filters ); //! Returns filters active in this tracker - std::vector<StringRef> const& getFilters() const; + std::vector<StringRef> const& getFilters() const { return m_filters; } //! Returns whitespace-trimmed name of the tracked section StringRef trimmedName() const; }; @@ -9035,12 +9626,21 @@ namespace Catch { ResultWas::OfType resultType, AssertionReaction &reaction ) override; - bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; + bool sectionStarted( StringRef sectionName, + SourceLineInfo const& sectionLineInfo, + Counts& assertions ) override; - void sectionEnded( SectionEndInfo const& endInfo ) override; - void sectionEndedEarly( SectionEndInfo const& endInfo ) override; + void sectionEnded( SectionEndInfo&& endInfo ) override; + void sectionEndedEarly( SectionEndInfo&& endInfo ) override; + + IGeneratorTracker* + acquireGeneratorTracker( StringRef generatorName, + SourceLineInfo const& lineInfo ) override; + IGeneratorTracker* createGeneratorTracker( + StringRef generatorName, + SourceLineInfo lineInfo, + Generators::GeneratorBasePtr&& generator ) override; - auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; void benchmarkPreparing( StringRef name ) override; void benchmarkStarting( BenchmarkInfo const& info ) override; @@ -9050,7 +9650,7 @@ namespace Catch { void pushScopedMessage( MessageInfo const& message ) override; void popScopedMessage( MessageInfo const& message ) override; - void emplaceUnscopedMessage( MessageBuilder const& builder ) override; + void emplaceUnscopedMessage( MessageBuilder&& builder ) override; std::string getCurrentTestName() const override; @@ -9122,6 +9722,7 @@ namespace Catch { #include <cmath> +#include <algorithm> namespace Catch { @@ -9237,6 +9838,7 @@ namespace Catch { #define CATCH_STRING_MANIP_HPP_INCLUDED +#include <cstdint> #include <string> #include <iosfwd> #include <vector> @@ -9467,7 +10069,6 @@ namespace Catch { } }; - TestSpec parseTestSpec( std::string const& arg ); } // namespace Catch @@ -9673,32 +10274,6 @@ namespace Catch { #endif // CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED -#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED -#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED - - -#if defined(CATCH_PLATFORM_WINDOWS) - -// We might end up with the define made globally through the compiler, -// and we don't want to trigger warnings for this -#if !defined(NOMINMAX) -# define NOMINMAX -#endif -#if !defined(WIN32_LEAN_AND_MEAN) -# define WIN32_LEAN_AND_MEAN -#endif - -#ifdef __AFXDLL -#include <AfxWin.h> -#else -#include <windows.h> -#endif - -#endif // defined(CATCH_PLATFORM_WINDOWS) - -#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED - - #ifndef CATCH_XMLWRITER_HPP_INCLUDED #define CATCH_XMLWRITER_HPP_INCLUDED @@ -9876,13 +10451,11 @@ namespace Catch { class MatchExpr : public ITransientExpression { ArgT && m_arg; MatcherT const& m_matcher; - StringRef m_matcherString; public: - MatchExpr( ArgT && arg, MatcherT const& matcher, StringRef matcherString ) + MatchExpr( ArgT && arg, MatcherT const& matcher ) : ITransientExpression{ true, matcher.match( arg ) }, // not forwarding arg here on purpose m_arg( CATCH_FORWARD(arg) ), - m_matcher( matcher ), - m_matcherString( matcherString ) + m_matcher( matcher ) {} void streamReconstructedExpression( std::ostream& os ) const override { @@ -9899,11 +10472,11 @@ namespace Catch { using StringMatcher = Matchers::MatcherBase<std::string>; - void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher ); template<typename ArgT, typename MatcherT> - auto makeMatchExpr( ArgT && arg, MatcherT const& matcher, StringRef matcherString ) -> MatchExpr<ArgT, MatcherT> { - return MatchExpr<ArgT, MatcherT>( CATCH_FORWARD(arg), matcher, matcherString ); + auto makeMatchExpr( ArgT && arg, MatcherT const& matcher ) -> MatchExpr<ArgT, MatcherT> { + return MatchExpr<ArgT, MatcherT>( CATCH_FORWARD(arg), matcher ); } } // namespace Catch @@ -9914,7 +10487,7 @@ namespace Catch { do { \ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ INTERNAL_CATCH_TRY { \ - catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher ) ); \ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ } while( false ) @@ -9930,7 +10503,7 @@ namespace Catch { catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ } \ catch( exceptionType const& ex ) { \ - catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher##_catch_sr ) ); \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher ) ); \ } \ catch( ... ) { \ catchAssertionHandler.handleUnexpectedInflightException(); \ @@ -10190,7 +10763,7 @@ namespace Matchers { MatcherGenericBase() = default; ~MatcherGenericBase() override; // = default; - MatcherGenericBase(MatcherGenericBase&) = default; + MatcherGenericBase(MatcherGenericBase const&) = default; MatcherGenericBase(MatcherGenericBase&&) = default; MatcherGenericBase& operator=(MatcherGenericBase const&) = delete; @@ -10222,20 +10795,6 @@ namespace Matchers { return arr; } -#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510 - - using std::conjunction; - -#else // __cpp_lib_logical_traits - - template<typename... Cond> - struct conjunction : std::true_type {}; - - template<typename Cond, typename... Rest> - struct conjunction<Cond, Rest...> : std::integral_constant<bool, Cond::value && conjunction<Rest...>::value> {}; - -#endif // __cpp_lib_logical_traits - template<typename T> using is_generic_matcher = std::is_base_of< Catch::Matchers::MatcherGenericBase, @@ -10243,7 +10802,7 @@ namespace Matchers { >; template<typename... Ts> - using are_generic_matchers = conjunction<is_generic_matcher<Ts>...>; + using are_generic_matchers = Catch::Detail::conjunction<is_generic_matcher<Ts>...>; template<typename T> using is_matcher = std::is_base_of< @@ -10578,13 +11137,11 @@ namespace Catch { } template <typename RangeLike> - bool match(RangeLike&& rng) const { - using std::begin; using std::end; - - return end(rng) != std::find_if(begin(rng), end(rng), - [&](auto const& elem) { - return m_eq(elem, m_desired); - }); + bool match( RangeLike&& rng ) const { + for ( auto&& elem : rng ) { + if ( m_eq( elem, m_desired ) ) { return true; } + } + return false; } }; @@ -10636,7 +11193,7 @@ namespace Catch { /** * Creates a matcher that checks whether a range contains a specific element. * - * Uses `eq` to do the comparisons + * Uses `eq` to do the comparisons, the element is provided on the rhs */ template <typename T, typename Equality> ContainsElementMatcher<T, Equality> Contains(T&& elem, Equality&& eq) { @@ -10672,6 +11229,32 @@ public: //! Creates a matcher that checks whether a std derived exception has the provided message ExceptionMessageMatcher Message(std::string const& message); +template <typename StringMatcherType> +class ExceptionMessageMatchesMatcher final + : public MatcherBase<std::exception> { + StringMatcherType m_matcher; + +public: + ExceptionMessageMatchesMatcher( StringMatcherType matcher ): + m_matcher( CATCH_MOVE( matcher ) ) {} + + bool match( std::exception const& ex ) const override { + return m_matcher.match( ex.what() ); + } + + std::string describe() const override { + return " matches \"" + m_matcher.describe() + '"'; + } +}; + +//! Creates a matcher that checks whether a message from an std derived +//! exception matches a provided matcher +template <typename StringMatcherType> +ExceptionMessageMatchesMatcher<StringMatcherType> +MessageMatches( StringMatcherType&& matcher ) { + return { CATCH_FORWARD( matcher ) }; +} + } // namespace Matchers } // namespace Catch @@ -10699,6 +11282,11 @@ namespace Matchers { double m_margin; }; + //! Creates a matcher that accepts numbers within certain range of target + WithinAbsMatcher WithinAbs( double target, double margin ); + + + class WithinUlpsMatcher final : public MatcherBase<double> { public: WithinUlpsMatcher( double target, @@ -10712,6 +11300,13 @@ namespace Matchers { Detail::FloatingPointKind m_type; }; + //! Creates a matcher that accepts doubles within certain ULP range of target + WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff); + //! Creates a matcher that accepts floats within certain ULP range of target + WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff); + + + // Given IEEE-754 format for floats and doubles, we can assume // that float -> double promotion is lossless. Given this, we can // assume that if we do the standard relative comparison of @@ -10728,13 +11323,6 @@ namespace Matchers { double m_epsilon; }; - //! Creates a matcher that accepts doubles within certain ULP range of target - WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff); - //! Creates a matcher that accepts floats within certain ULP range of target - WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff); - //! Creates a matcher that accepts numbers within certain range of target - WithinAbsMatcher WithinAbs(double target, double margin); - //! Creates a matcher that accepts doubles within certain relative range of target WithinRelMatcher WithinRel(double target, double eps); //! Creates a matcher that accepts doubles within 100*DBL_EPS relative range of target @@ -10744,6 +11332,17 @@ namespace Matchers { //! Creates a matcher that accepts floats within 100*FLT_EPS relative range of target WithinRelMatcher WithinRel(float target); + + + class IsNaNMatcher final : public MatcherBase<double> { + public: + IsNaNMatcher() = default; + bool match( double const& matchee ) const override; + std::string describe() const override; + }; + + IsNaNMatcher IsNaN(); + } // namespace Matchers } // namespace Catch @@ -10959,6 +11558,143 @@ namespace Catch { #endif // CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED +#ifndef CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED +#define CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED + + +#include <algorithm> +#include <utility> + +namespace Catch { + namespace Matchers { + + /** + * Matcher for checking that an element contains the same + * elements in the same order + */ + template <typename TargetRangeLike, typename Equality> + class RangeEqualsMatcher final : public MatcherGenericBase { + TargetRangeLike m_desired; + Equality m_predicate; + + public: + template <typename TargetRangeLike2, typename Equality2> + RangeEqualsMatcher( TargetRangeLike2&& range, + Equality2&& predicate ): + m_desired( CATCH_FORWARD( range ) ), + m_predicate( CATCH_FORWARD( predicate ) ) {} + + template <typename RangeLike> + bool match( RangeLike&& rng ) const { + auto rng_start = begin( rng ); + const auto rng_end = end( rng ); + auto target_start = begin( m_desired ); + const auto target_end = end( m_desired ); + + while (rng_start != rng_end && target_start != target_end) { + if (!m_predicate(*rng_start, *target_start)) { + return false; + } + ++rng_start; + ++target_start; + } + return rng_start == rng_end && target_start == target_end; + } + + std::string describe() const override { + return "elements are " + Catch::Detail::stringify( m_desired ); + } + }; + + /** + * Matcher for checking that an element contains the same + * elements (but not necessarily in the same order) + */ + template <typename TargetRangeLike, typename Equality> + class UnorderedRangeEqualsMatcher final : public MatcherGenericBase { + TargetRangeLike m_desired; + Equality m_predicate; + + public: + template <typename TargetRangeLike2, typename Equality2> + UnorderedRangeEqualsMatcher( TargetRangeLike2&& range, + Equality2&& predicate ): + m_desired( CATCH_FORWARD( range ) ), + m_predicate( CATCH_FORWARD( predicate ) ) {} + + template <typename RangeLike> + bool match( RangeLike&& rng ) const { + using std::begin; + using std::end; + return Catch::Detail::is_permutation( begin( m_desired ), + end( m_desired ), + begin( rng ), + end( rng ), + m_predicate ); + } + + std::string describe() const override { + return "unordered elements are " + + ::Catch::Detail::stringify( m_desired ); + } + }; + + /** + * Creates a matcher that checks if all elements in a range are equal + * to all elements in another range. + * + * Uses `std::equal_to` to do the comparison + */ + template <typename RangeLike> + std::enable_if_t<!Detail::is_matcher<RangeLike>::value, + RangeEqualsMatcher<RangeLike, std::equal_to<>>> + RangeEquals( RangeLike&& range ) { + return { CATCH_FORWARD( range ), std::equal_to<>{} }; + } + + /** + * Creates a matcher that checks if all elements in a range are equal + * to all elements in another range. + * + * Uses to provided predicate `predicate` to do the comparisons + */ + template <typename RangeLike, typename Equality> + RangeEqualsMatcher<RangeLike, Equality> + RangeEquals( RangeLike&& range, Equality&& predicate ) { + return { CATCH_FORWARD( range ), CATCH_FORWARD( predicate ) }; + } + + /** + * Creates a matcher that checks if all elements in a range are equal + * to all elements in another range, in some permutation + * + * Uses `std::equal_to` to do the comparison + */ + template <typename RangeLike> + std::enable_if_t< + !Detail::is_matcher<RangeLike>::value, + UnorderedRangeEqualsMatcher<RangeLike, std::equal_to<>>> + UnorderedRangeEquals( RangeLike&& range ) { + return { CATCH_FORWARD( range ), std::equal_to<>{} }; + } + + /** + * Creates a matcher that checks if all elements in a range are equal + * to all elements in another range, in some permuation. + * + * Uses to provided predicate `predicate` to do the comparisons + */ + template <typename RangeLike, typename Equality> + UnorderedRangeEqualsMatcher<RangeLike, Equality> + UnorderedRangeEquals( RangeLike&& range, Equality&& predicate ) { + return { CATCH_FORWARD( range ), CATCH_FORWARD( predicate ) }; + } + } // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED + + #ifndef CATCH_MATCHERS_STRING_HPP_INCLUDED #define CATCH_MATCHERS_STRING_HPP_INCLUDED @@ -11453,7 +12189,6 @@ namespace Catch { namespace Catch { // Fwd decls - struct SummaryColumn; class TablePrinter; class ConsoleReporter final : public StreamingReporterBase { @@ -11497,12 +12232,7 @@ namespace Catch { // subsequent lines void printHeaderString(std::string const& _string, std::size_t indent = 0); - - void printTotals(Totals const& totals); - void printSummaryRow(StringRef label, std::vector<SummaryColumn> const& cols, std::size_t row); - void printTotalsDivider(Totals const& totals); - void printSummaryDivider(); bool m_headerPrinted = false; bool m_testRunInfoPrinted = false; @@ -11782,6 +12512,15 @@ namespace Catch { bool isFiltered, Verbosity verbosity ); + /** + * Prints test run totals to the provided stream in user-friendly format + * + * Used by the console and compact reporters. + */ + void printTestRunTotals( std::ostream& stream, + ColourImpl& streamColour, + Totals const& totals ); + } // end namespace Catch #endif // CATCH_REPORTER_HELPERS_HPP_INCLUDED @@ -12008,7 +12747,7 @@ namespace Catch { CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace { \ Catch::ListenerRegistrar<listenerType> INTERNAL_CATCH_UNIQUE_NAME( \ - catch_internal_RegistrarFor )( #listenerType ); \ + catch_internal_RegistrarFor )( #listenerType##_catch_sr ); \ } \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION @@ -12055,7 +12794,7 @@ namespace Catch { void writeRun( TestRunNode const& groupNode ); - void writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes); + void writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes); void writeTestCase(TestCaseNode const& testCaseNode); diff --git a/packages/Catch2/meson.build b/packages/Catch2/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..ed5033acd8820752dd3dde09374a13056704c68f --- /dev/null +++ b/packages/Catch2/meson.build @@ -0,0 +1,19 @@ +# Copyright Catch2 Authors +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + +# SPDX-License-Identifier: BSL-1.0 + +project( + 'catch2', + 'cpp', + version: '3.3.2', # CML version placeholder, don't delete + license: 'BSL-1.0', + meson_version: '>=0.54.1', +) + +subdir('src/catch2') +if get_option('tests') + subdir('tests') +endif diff --git a/packages/Catch2/meson_options.txt b/packages/Catch2/meson_options.txt new file mode 100644 index 0000000000000000000000000000000000000000..76904873585fc3406b32b6d4e8963eb2dd2fa0a2 --- /dev/null +++ b/packages/Catch2/meson_options.txt @@ -0,0 +1 @@ +option('tests', type: 'boolean', value: true, description: 'Build the unit tests') diff --git a/packages/Catch2/src/CMakeLists.txt b/packages/Catch2/src/CMakeLists.txt index c76a96d528c1a48a5049474e17c3fe715ae1d2fc..0fdf931e6ee86de3412c1cf7e5aad6c2deaa1a83 100644 --- a/packages/Catch2/src/CMakeLists.txt +++ b/packages/Catch2/src/CMakeLists.txt @@ -7,293 +7,338 @@ include(CatchMiscFunctions) set(Catch2_GUID_CMAKE "8d538cbe-01bf-4a2e-a98a-6c368fdf13d7" CACHE INTERNAL "Project GUID") set(Catch2WithMain_GUID_CMAKE "8bd3552a-2cfb-4a59-ab15-2031b97ada1e" CACHE INTERNAL "Project GUID") -# Please keep these ordered alphabetically set(BENCHMARK_HEADERS - ${SOURCES_DIR}/benchmark/catch_benchmark.hpp - ${SOURCES_DIR}/benchmark/catch_benchmark_all.hpp - ${SOURCES_DIR}/benchmark/catch_chronometer.hpp - ${SOURCES_DIR}/benchmark/catch_clock.hpp - ${SOURCES_DIR}/benchmark/catch_constructor.hpp - ${SOURCES_DIR}/benchmark/catch_environment.hpp - ${SOURCES_DIR}/benchmark/catch_estimate.hpp - ${SOURCES_DIR}/benchmark/catch_execution_plan.hpp - ${SOURCES_DIR}/benchmark/catch_optimizer.hpp - ${SOURCES_DIR}/benchmark/catch_outlier_classification.hpp - ${SOURCES_DIR}/benchmark/catch_sample_analysis.hpp - ${SOURCES_DIR}/benchmark/detail/catch_analyse.hpp - ${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.hpp - ${SOURCES_DIR}/benchmark/detail/catch_complete_invoke.hpp - ${SOURCES_DIR}/benchmark/detail/catch_estimate_clock.hpp - ${SOURCES_DIR}/benchmark/detail/catch_measure.hpp - ${SOURCES_DIR}/benchmark/detail/catch_repeat.hpp - ${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.hpp - ${SOURCES_DIR}/benchmark/detail/catch_stats.hpp - ${SOURCES_DIR}/benchmark/detail/catch_timing.hpp + ${SOURCES_DIR}/benchmark/catch_benchmark.hpp + ${SOURCES_DIR}/benchmark/catch_benchmark_all.hpp + ${SOURCES_DIR}/benchmark/catch_chronometer.hpp + ${SOURCES_DIR}/benchmark/catch_clock.hpp + ${SOURCES_DIR}/benchmark/catch_constructor.hpp + ${SOURCES_DIR}/benchmark/catch_environment.hpp + ${SOURCES_DIR}/benchmark/catch_estimate.hpp + ${SOURCES_DIR}/benchmark/catch_execution_plan.hpp + ${SOURCES_DIR}/benchmark/catch_optimizer.hpp + ${SOURCES_DIR}/benchmark/catch_outlier_classification.hpp + ${SOURCES_DIR}/benchmark/catch_sample_analysis.hpp + ${SOURCES_DIR}/benchmark/detail/catch_analyse.hpp + ${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.hpp + ${SOURCES_DIR}/benchmark/detail/catch_benchmark_stats.hpp + ${SOURCES_DIR}/benchmark/detail/catch_benchmark_stats_fwd.hpp + ${SOURCES_DIR}/benchmark/detail/catch_complete_invoke.hpp + ${SOURCES_DIR}/benchmark/detail/catch_estimate_clock.hpp + ${SOURCES_DIR}/benchmark/detail/catch_measure.hpp + ${SOURCES_DIR}/benchmark/detail/catch_repeat.hpp + ${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.hpp + ${SOURCES_DIR}/benchmark/detail/catch_stats.hpp + ${SOURCES_DIR}/benchmark/detail/catch_timing.hpp ) set(BENCHMARK_SOURCES - ${SOURCES_DIR}/benchmark/catch_chronometer.cpp - ${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.cpp - ${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.cpp - ${SOURCES_DIR}/benchmark/detail/catch_stats.cpp + ${SOURCES_DIR}/benchmark/catch_chronometer.cpp + ${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.cpp + ${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.cpp + ${SOURCES_DIR}/benchmark/detail/catch_stats.cpp ) +set(BENCHMARK_FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES}) -SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES}) -set(INTERNAL_HEADERS - "${CMAKE_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" - "${SOURCES_DIR}/catch_user_config.hpp.in" - ${SOURCES_DIR}/catch_all.hpp - ${SOURCES_DIR}/matchers/catch_matchers_all.hpp - ${SOURCES_DIR}/generators/catch_generators_all.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_all.hpp - ${SOURCES_DIR}/matchers/internal/catch_matchers_impl.hpp - ${SOURCES_DIR}/internal/catch_case_insensitive_comparisons.hpp - ${SOURCES_DIR}/internal/catch_console_width.hpp - ${SOURCES_DIR}/internal/catch_container_nonmembers.hpp - ${SOURCES_DIR}/internal/catch_noncopyable.hpp - ${SOURCES_DIR}/catch_approx.hpp - ${SOURCES_DIR}/internal/catch_assertion_handler.hpp - ${SOURCES_DIR}/catch_assertion_info.hpp - ${SOURCES_DIR}/catch_assertion_result.hpp - ${SOURCES_DIR}/internal/catch_test_macro_impl.hpp - ${SOURCES_DIR}/internal/catch_test_failure_exception.hpp - ${SOURCES_DIR}/internal/catch_case_sensitive.hpp - ${SOURCES_DIR}/internal/catch_clara.hpp - ${SOURCES_DIR}/internal/catch_commandline.hpp - ${SOURCES_DIR}/internal/catch_source_line_info.hpp - ${SOURCES_DIR}/internal/catch_compiler_capabilities.hpp - ${SOURCES_DIR}/catch_config.hpp - ${SOURCES_DIR}/internal/catch_config_android_logwrite.hpp - ${SOURCES_DIR}/internal/catch_config_counter.hpp - ${SOURCES_DIR}/internal/catch_config_uncaught_exceptions.hpp - ${SOURCES_DIR}/internal/catch_config_wchar.hpp - ${SOURCES_DIR}/internal/catch_console_colour.hpp - ${SOURCES_DIR}/internal/catch_context.hpp - ${SOURCES_DIR}/internal/catch_debug_console.hpp - ${SOURCES_DIR}/internal/catch_debugger.hpp - ${SOURCES_DIR}/internal/catch_decomposer.hpp - ${SOURCES_DIR}/internal/catch_enforce.hpp - ${SOURCES_DIR}/internal/catch_enum_values_registry.hpp - ${SOURCES_DIR}/internal/catch_errno_guard.hpp - ${SOURCES_DIR}/internal/catch_exception_translator_registry.hpp - ${SOURCES_DIR}/internal/catch_fatal_condition_handler.hpp - ${SOURCES_DIR}/internal/catch_floating_point_helpers.hpp - ${SOURCES_DIR}/internal/catch_istream.hpp - ${SOURCES_DIR}/internal/catch_unique_name.hpp - ${SOURCES_DIR}/internal/catch_sharding.hpp - ${SOURCES_DIR}/generators/catch_generator_exception.hpp - ${SOURCES_DIR}/generators/catch_generators.hpp - ${SOURCES_DIR}/generators/catch_generators_adapters.hpp - ${SOURCES_DIR}/generators/catch_generators_random.hpp - ${SOURCES_DIR}/generators/catch_generators_range.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_capture.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_config.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_enum_values_registry.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_exception.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_generatortracker.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_reporter.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_factory.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_registry.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_tag_alias_registry.hpp - ${SOURCES_DIR}/interfaces/catch_interfaces_testcase.hpp - ${SOURCES_DIR}/internal/catch_lazy_expr.hpp - ${SOURCES_DIR}/internal/catch_leak_detector.hpp - ${SOURCES_DIR}/internal/catch_list.hpp - ${SOURCES_DIR}/matchers/catch_matchers.hpp - ${SOURCES_DIR}/matchers/catch_matchers_container_properties.hpp - ${SOURCES_DIR}/matchers/catch_matchers_contains.hpp - ${SOURCES_DIR}/matchers/catch_matchers_exception.hpp - ${SOURCES_DIR}/matchers/catch_matchers_floating_point.hpp - ${SOURCES_DIR}/matchers/catch_matchers_predicate.hpp - ${SOURCES_DIR}/matchers/catch_matchers_quantifiers.hpp - ${SOURCES_DIR}/matchers/catch_matchers_string.hpp - ${SOURCES_DIR}/matchers/catch_matchers_templated.hpp - ${SOURCES_DIR}/matchers/catch_matchers_vector.hpp - ${SOURCES_DIR}/catch_message.hpp - ${SOURCES_DIR}/internal/catch_message_info.hpp - ${SOURCES_DIR}/internal/catch_meta.hpp - ${SOURCES_DIR}/internal/catch_move_and_forward.hpp - ${SOURCES_DIR}/internal/catch_optional.hpp - ${SOURCES_DIR}/internal/catch_output_redirect.hpp - ${SOURCES_DIR}/internal/catch_platform.hpp - ${SOURCES_DIR}/internal/catch_polyfills.hpp - ${SOURCES_DIR}/internal/catch_preprocessor.hpp - ${SOURCES_DIR}/internal/catch_preprocessor_remove_parens.hpp - ${SOURCES_DIR}/internal/catch_random_number_generator.hpp - ${SOURCES_DIR}/internal/catch_random_seed_generation.hpp - ${SOURCES_DIR}/internal/catch_reporter_registry.hpp - ${SOURCES_DIR}/internal/catch_reporter_spec_parser.hpp - ${SOURCES_DIR}/internal/catch_result_type.hpp - ${SOURCES_DIR}/internal/catch_run_context.hpp - ${SOURCES_DIR}/internal/catch_section.hpp - ${SOURCES_DIR}/internal/catch_stdstreams.hpp - ${SOURCES_DIR}/catch_section_info.hpp - ${SOURCES_DIR}/catch_session.hpp - ${SOURCES_DIR}/internal/catch_singletons.hpp - ${SOURCES_DIR}/internal/catch_startup_exception_registry.hpp - ${SOURCES_DIR}/internal/catch_reusable_string_stream.hpp - ${SOURCES_DIR}/internal/catch_stream_end_stop.hpp - ${SOURCES_DIR}/internal/catch_string_manip.hpp - ${SOURCES_DIR}/internal/catch_stringref.hpp - ${SOURCES_DIR}/catch_tag_alias.hpp - ${SOURCES_DIR}/catch_get_random_seed.hpp - ${SOURCES_DIR}/catch_tag_alias_autoregistrar.hpp - ${SOURCES_DIR}/internal/catch_tag_alias_registry.hpp - ${SOURCES_DIR}/catch_test_case_info.hpp - ${SOURCES_DIR}/internal/catch_test_case_registry_impl.hpp - ${SOURCES_DIR}/internal/catch_test_case_tracker.hpp - ${SOURCES_DIR}/catch_template_test_macros.hpp - ${SOURCES_DIR}/catch_test_macros.hpp - ${SOURCES_DIR}/internal/catch_template_test_registry.hpp - ${SOURCES_DIR}/internal/catch_test_registry.hpp - ${SOURCES_DIR}/catch_test_spec.hpp - ${SOURCES_DIR}/internal/catch_test_spec_parser.hpp - ${SOURCES_DIR}/internal/catch_textflow.hpp - ${SOURCES_DIR}/catch_timer.hpp - ${SOURCES_DIR}/internal/catch_to_string.hpp - ${SOURCES_DIR}/catch_tostring.hpp - ${SOURCES_DIR}/catch_totals.hpp - ${SOURCES_DIR}/catch_translate_exception.hpp - ${SOURCES_DIR}/internal/catch_uncaught_exceptions.hpp - ${SOURCES_DIR}/internal/catch_unique_ptr.hpp - ${SOURCES_DIR}/internal/catch_void_type.hpp - ${SOURCES_DIR}/catch_version.hpp - ${SOURCES_DIR}/catch_version_macros.hpp - ${SOURCES_DIR}/internal/catch_wildcard_pattern.hpp - ${SOURCES_DIR}/internal/catch_windows_h_proxy.hpp - ${SOURCES_DIR}/internal/catch_xmlwriter.hpp - ${SOURCES_DIR}/internal/catch_test_case_info_hasher.hpp +set(IMPL_HEADERS + "${PROJECT_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" + ${SOURCES_DIR}/catch_user_config.hpp.in + ${SOURCES_DIR}/catch_all.hpp + ${SOURCES_DIR}/catch_approx.hpp + ${SOURCES_DIR}/catch_assertion_info.hpp + ${SOURCES_DIR}/catch_assertion_result.hpp + ${SOURCES_DIR}/catch_config.hpp + ${SOURCES_DIR}/catch_get_random_seed.hpp + ${SOURCES_DIR}/catch_message.hpp + ${SOURCES_DIR}/catch_section_info.hpp + ${SOURCES_DIR}/catch_session.hpp + ${SOURCES_DIR}/catch_tag_alias.hpp + ${SOURCES_DIR}/catch_tag_alias_autoregistrar.hpp + ${SOURCES_DIR}/catch_template_test_macros.hpp + ${SOURCES_DIR}/catch_test_case_info.hpp + ${SOURCES_DIR}/catch_test_macros.hpp + ${SOURCES_DIR}/catch_test_spec.hpp + ${SOURCES_DIR}/catch_timer.hpp + ${SOURCES_DIR}/catch_tostring.hpp + ${SOURCES_DIR}/catch_totals.hpp + ${SOURCES_DIR}/catch_translate_exception.hpp + ${SOURCES_DIR}/catch_version.hpp + ${SOURCES_DIR}/catch_version_macros.hpp + ${SOURCES_DIR}/internal/catch_assertion_handler.hpp + ${SOURCES_DIR}/internal/catch_case_insensitive_comparisons.hpp + ${SOURCES_DIR}/internal/catch_case_sensitive.hpp + ${SOURCES_DIR}/internal/catch_clara.hpp + ${SOURCES_DIR}/internal/catch_commandline.hpp + ${SOURCES_DIR}/internal/catch_compare_traits.hpp + ${SOURCES_DIR}/internal/catch_compiler_capabilities.hpp + ${SOURCES_DIR}/internal/catch_config_android_logwrite.hpp + ${SOURCES_DIR}/internal/catch_config_counter.hpp + ${SOURCES_DIR}/internal/catch_config_static_analysis_support.hpp + ${SOURCES_DIR}/internal/catch_config_uncaught_exceptions.hpp + ${SOURCES_DIR}/internal/catch_config_wchar.hpp + ${SOURCES_DIR}/internal/catch_console_colour.hpp + ${SOURCES_DIR}/internal/catch_console_width.hpp + ${SOURCES_DIR}/internal/catch_container_nonmembers.hpp + ${SOURCES_DIR}/internal/catch_context.hpp + ${SOURCES_DIR}/internal/catch_debug_console.hpp + ${SOURCES_DIR}/internal/catch_debugger.hpp + ${SOURCES_DIR}/internal/catch_decomposer.hpp + ${SOURCES_DIR}/internal/catch_enforce.hpp + ${SOURCES_DIR}/internal/catch_enum_values_registry.hpp + ${SOURCES_DIR}/internal/catch_errno_guard.hpp + ${SOURCES_DIR}/internal/catch_exception_translator_registry.hpp + ${SOURCES_DIR}/internal/catch_fatal_condition_handler.hpp + ${SOURCES_DIR}/internal/catch_floating_point_helpers.hpp + ${SOURCES_DIR}/internal/catch_getenv.hpp + ${SOURCES_DIR}/internal/catch_istream.hpp + ${SOURCES_DIR}/internal/catch_is_permutation.hpp + ${SOURCES_DIR}/internal/catch_lazy_expr.hpp + ${SOURCES_DIR}/internal/catch_leak_detector.hpp + ${SOURCES_DIR}/internal/catch_list.hpp + ${SOURCES_DIR}/internal/catch_logical_traits.hpp + ${SOURCES_DIR}/internal/catch_message_info.hpp + ${SOURCES_DIR}/internal/catch_meta.hpp + ${SOURCES_DIR}/internal/catch_move_and_forward.hpp + ${SOURCES_DIR}/internal/catch_noncopyable.hpp + ${SOURCES_DIR}/internal/catch_optional.hpp + ${SOURCES_DIR}/internal/catch_output_redirect.hpp + ${SOURCES_DIR}/internal/catch_parse_numbers.hpp + ${SOURCES_DIR}/internal/catch_platform.hpp + ${SOURCES_DIR}/internal/catch_polyfills.hpp + ${SOURCES_DIR}/internal/catch_preprocessor.hpp + ${SOURCES_DIR}/internal/catch_preprocessor_remove_parens.hpp + ${SOURCES_DIR}/internal/catch_random_number_generator.hpp + ${SOURCES_DIR}/internal/catch_random_seed_generation.hpp + ${SOURCES_DIR}/internal/catch_reporter_registry.hpp + ${SOURCES_DIR}/internal/catch_reporter_spec_parser.hpp + ${SOURCES_DIR}/internal/catch_result_type.hpp + ${SOURCES_DIR}/internal/catch_reusable_string_stream.hpp + ${SOURCES_DIR}/internal/catch_run_context.hpp + ${SOURCES_DIR}/internal/catch_section.hpp + ${SOURCES_DIR}/internal/catch_sharding.hpp + ${SOURCES_DIR}/internal/catch_singletons.hpp + ${SOURCES_DIR}/internal/catch_source_line_info.hpp + ${SOURCES_DIR}/internal/catch_startup_exception_registry.hpp + ${SOURCES_DIR}/internal/catch_stdstreams.hpp + ${SOURCES_DIR}/internal/catch_stream_end_stop.hpp + ${SOURCES_DIR}/internal/catch_string_manip.hpp + ${SOURCES_DIR}/internal/catch_stringref.hpp + ${SOURCES_DIR}/internal/catch_tag_alias_registry.hpp + ${SOURCES_DIR}/internal/catch_template_test_registry.hpp + ${SOURCES_DIR}/internal/catch_test_case_info_hasher.hpp + ${SOURCES_DIR}/internal/catch_test_case_registry_impl.hpp + ${SOURCES_DIR}/internal/catch_test_case_tracker.hpp + ${SOURCES_DIR}/internal/catch_test_failure_exception.hpp + ${SOURCES_DIR}/internal/catch_test_macro_impl.hpp + ${SOURCES_DIR}/internal/catch_test_registry.hpp + ${SOURCES_DIR}/internal/catch_test_run_info.hpp + ${SOURCES_DIR}/internal/catch_test_spec_parser.hpp + ${SOURCES_DIR}/internal/catch_textflow.hpp + ${SOURCES_DIR}/internal/catch_to_string.hpp + ${SOURCES_DIR}/internal/catch_uncaught_exceptions.hpp + ${SOURCES_DIR}/internal/catch_unique_name.hpp + ${SOURCES_DIR}/internal/catch_unique_ptr.hpp + ${SOURCES_DIR}/internal/catch_void_type.hpp + ${SOURCES_DIR}/internal/catch_wildcard_pattern.hpp + ${SOURCES_DIR}/internal/catch_windows_h_proxy.hpp + ${SOURCES_DIR}/internal/catch_xmlwriter.hpp ) set(IMPL_SOURCES - ${SOURCES_DIR}/catch_approx.cpp - ${SOURCES_DIR}/internal/catch_assertion_handler.cpp - ${SOURCES_DIR}/catch_assertion_result.cpp - ${SOURCES_DIR}/internal/catch_clara.cpp - ${SOURCES_DIR}/internal/catch_commandline.cpp - ${SOURCES_DIR}/internal/catch_source_line_info.cpp - ${SOURCES_DIR}/catch_config.cpp - ${SOURCES_DIR}/internal/catch_case_insensitive_comparisons.cpp - ${SOURCES_DIR}/internal/catch_console_colour.cpp - ${SOURCES_DIR}/internal/catch_context.cpp - ${SOURCES_DIR}/internal/catch_debug_console.cpp - ${SOURCES_DIR}/internal/catch_debugger.cpp - ${SOURCES_DIR}/internal/catch_enforce.cpp - ${SOURCES_DIR}/internal/catch_enum_values_registry.cpp - ${SOURCES_DIR}/internal/catch_exception_translator_registry.cpp - ${SOURCES_DIR}/internal/catch_fatal_condition_handler.cpp - ${SOURCES_DIR}/internal/catch_floating_point_helpers.cpp - ${SOURCES_DIR}/internal/catch_istream.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_generatortracker.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_reporter.cpp - ${SOURCES_DIR}/internal/catch_list.cpp - ${SOURCES_DIR}/matchers/catch_matchers_floating_point.cpp - ${SOURCES_DIR}/matchers/catch_matchers_quantifiers.cpp - ${SOURCES_DIR}/matchers/catch_matchers_string.cpp - ${SOURCES_DIR}/matchers/catch_matchers_templated.cpp - ${SOURCES_DIR}/catch_message.cpp - ${SOURCES_DIR}/internal/catch_output_redirect.cpp - ${SOURCES_DIR}/catch_registry_hub.cpp - ${SOURCES_DIR}/internal/catch_random_number_generator.cpp - ${SOURCES_DIR}/internal/catch_random_seed_generation.cpp - ${SOURCES_DIR}/internal/catch_reporter_registry.cpp - ${SOURCES_DIR}/internal/catch_reporter_spec_parser.cpp - ${SOURCES_DIR}/internal/catch_result_type.cpp - ${SOURCES_DIR}/internal/catch_run_context.cpp - ${SOURCES_DIR}/internal/catch_section.cpp - ${SOURCES_DIR}/internal/catch_stdstreams.cpp - ${SOURCES_DIR}/catch_session.cpp - ${SOURCES_DIR}/internal/catch_singletons.cpp - ${SOURCES_DIR}/internal/catch_reusable_string_stream.cpp - ${SOURCES_DIR}/internal/catch_stringref.cpp - ${SOURCES_DIR}/internal/catch_string_manip.cpp - ${SOURCES_DIR}/internal/catch_tag_alias_registry.cpp - ${SOURCES_DIR}/catch_test_case_info.cpp - ${SOURCES_DIR}/internal/catch_test_case_registry_impl.cpp - ${SOURCES_DIR}/internal/catch_test_case_tracker.cpp - ${SOURCES_DIR}/internal/catch_test_registry.cpp - ${SOURCES_DIR}/internal/catch_textflow.cpp - ${SOURCES_DIR}/catch_test_spec.cpp - ${SOURCES_DIR}/internal/catch_test_spec_parser.cpp - ${SOURCES_DIR}/catch_timer.cpp - ${SOURCES_DIR}/catch_tostring.cpp - ${SOURCES_DIR}/catch_totals.cpp - ${SOURCES_DIR}/catch_version.cpp - ${SOURCES_DIR}/internal/catch_wildcard_pattern.cpp - ${SOURCES_DIR}/internal/catch_xmlwriter.cpp - ${SOURCES_DIR}/internal/catch_test_case_info_hasher.cpp - ${SOURCES_DIR}/generators/catch_generators_random.cpp - ${SOURCES_DIR}/generators/catch_generator_exception.cpp - ${SOURCES_DIR}/generators/catch_generators.cpp - ${SOURCES_DIR}/matchers/catch_matchers.cpp - ${SOURCES_DIR}/matchers/catch_matchers_container_properties.cpp - ${SOURCES_DIR}/matchers/catch_matchers_exception.cpp - ${SOURCES_DIR}/matchers/catch_matchers_predicate.cpp - ${SOURCES_DIR}/matchers/internal/catch_matchers_impl.cpp - ${SOURCES_DIR}/catch_tag_alias_autoregistrar.cpp - ${SOURCES_DIR}/catch_get_random_seed.cpp - ${SOURCES_DIR}/internal/catch_decomposer.cpp - ${SOURCES_DIR}/internal/catch_errno_guard.cpp - ${SOURCES_DIR}/internal/catch_lazy_expr.cpp - ${SOURCES_DIR}/internal/catch_leak_detector.cpp - ${SOURCES_DIR}/internal/catch_message_info.cpp - ${SOURCES_DIR}/internal/catch_polyfills.cpp - ${SOURCES_DIR}/internal/catch_startup_exception_registry.cpp - ${SOURCES_DIR}/internal/catch_uncaught_exceptions.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_capture.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_config.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_exception.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_factory.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_registry.cpp - ${SOURCES_DIR}/interfaces/catch_interfaces_testcase.cpp + ${SOURCES_DIR}/catch_approx.cpp + ${SOURCES_DIR}/catch_assertion_result.cpp + ${SOURCES_DIR}/catch_config.cpp + ${SOURCES_DIR}/catch_get_random_seed.cpp + ${SOURCES_DIR}/catch_message.cpp + ${SOURCES_DIR}/catch_registry_hub.cpp + ${SOURCES_DIR}/catch_session.cpp + ${SOURCES_DIR}/catch_tag_alias_autoregistrar.cpp + ${SOURCES_DIR}/catch_test_case_info.cpp + ${SOURCES_DIR}/catch_test_spec.cpp + ${SOURCES_DIR}/catch_timer.cpp + ${SOURCES_DIR}/catch_tostring.cpp + ${SOURCES_DIR}/catch_totals.cpp + ${SOURCES_DIR}/catch_translate_exception.cpp + ${SOURCES_DIR}/catch_version.cpp + ${SOURCES_DIR}/internal/catch_assertion_handler.cpp + ${SOURCES_DIR}/internal/catch_case_insensitive_comparisons.cpp + ${SOURCES_DIR}/internal/catch_clara.cpp + ${SOURCES_DIR}/internal/catch_commandline.cpp + ${SOURCES_DIR}/internal/catch_console_colour.cpp + ${SOURCES_DIR}/internal/catch_context.cpp + ${SOURCES_DIR}/internal/catch_debug_console.cpp + ${SOURCES_DIR}/internal/catch_debugger.cpp + ${SOURCES_DIR}/internal/catch_decomposer.cpp + ${SOURCES_DIR}/internal/catch_enforce.cpp + ${SOURCES_DIR}/internal/catch_enum_values_registry.cpp + ${SOURCES_DIR}/internal/catch_errno_guard.cpp + ${SOURCES_DIR}/internal/catch_exception_translator_registry.cpp + ${SOURCES_DIR}/internal/catch_fatal_condition_handler.cpp + ${SOURCES_DIR}/internal/catch_floating_point_helpers.cpp + ${SOURCES_DIR}/internal/catch_getenv.cpp + ${SOURCES_DIR}/internal/catch_istream.cpp + ${SOURCES_DIR}/internal/catch_lazy_expr.cpp + ${SOURCES_DIR}/internal/catch_leak_detector.cpp + ${SOURCES_DIR}/internal/catch_list.cpp + ${SOURCES_DIR}/internal/catch_message_info.cpp + ${SOURCES_DIR}/internal/catch_output_redirect.cpp + ${SOURCES_DIR}/internal/catch_parse_numbers.cpp + ${SOURCES_DIR}/internal/catch_polyfills.cpp + ${SOURCES_DIR}/internal/catch_random_number_generator.cpp + ${SOURCES_DIR}/internal/catch_random_seed_generation.cpp + ${SOURCES_DIR}/internal/catch_reporter_registry.cpp + ${SOURCES_DIR}/internal/catch_reporter_spec_parser.cpp + ${SOURCES_DIR}/internal/catch_result_type.cpp + ${SOURCES_DIR}/internal/catch_reusable_string_stream.cpp + ${SOURCES_DIR}/internal/catch_run_context.cpp + ${SOURCES_DIR}/internal/catch_section.cpp + ${SOURCES_DIR}/internal/catch_singletons.cpp + ${SOURCES_DIR}/internal/catch_source_line_info.cpp + ${SOURCES_DIR}/internal/catch_startup_exception_registry.cpp + ${SOURCES_DIR}/internal/catch_stdstreams.cpp + ${SOURCES_DIR}/internal/catch_string_manip.cpp + ${SOURCES_DIR}/internal/catch_stringref.cpp + ${SOURCES_DIR}/internal/catch_tag_alias_registry.cpp + ${SOURCES_DIR}/internal/catch_test_case_info_hasher.cpp + ${SOURCES_DIR}/internal/catch_test_case_registry_impl.cpp + ${SOURCES_DIR}/internal/catch_test_case_tracker.cpp + ${SOURCES_DIR}/internal/catch_test_failure_exception.cpp + ${SOURCES_DIR}/internal/catch_test_registry.cpp + ${SOURCES_DIR}/internal/catch_test_spec_parser.cpp + ${SOURCES_DIR}/internal/catch_textflow.cpp + ${SOURCES_DIR}/internal/catch_uncaught_exceptions.cpp + ${SOURCES_DIR}/internal/catch_wildcard_pattern.cpp + ${SOURCES_DIR}/internal/catch_xmlwriter.cpp ) -set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS}) +set(INTERNAL_FILES ${IMPL_SOURCES} ${IMPL_HEADERS}) + +set(INTERFACE_HEADERS + ${SOURCES_DIR}/interfaces/catch_interfaces_all.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_capture.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_config.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_enum_values_registry.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_exception.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_generatortracker.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_factory.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_tag_alias_registry.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_test_invoker.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_testcase.hpp +) +set(INTERFACE_SOURCES + ${SOURCES_DIR}/interfaces/catch_interfaces_capture.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_config.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_exception.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_generatortracker.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_factory.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_testcase.cpp +) +set(INTERFACE_FILES ${INTERFACE_HEADERS} ${INTERFACE_SOURCES}) + +set(GENERATOR_HEADERS + ${SOURCES_DIR}/generators/catch_generator_exception.hpp + ${SOURCES_DIR}/generators/catch_generators.hpp + ${SOURCES_DIR}/generators/catch_generators_adapters.hpp + ${SOURCES_DIR}/generators/catch_generators_all.hpp + ${SOURCES_DIR}/generators/catch_generators_random.hpp + ${SOURCES_DIR}/generators/catch_generators_range.hpp +) +set(GENERATOR_SOURCES + ${SOURCES_DIR}/generators/catch_generator_exception.cpp + ${SOURCES_DIR}/generators/catch_generators.cpp + ${SOURCES_DIR}/generators/catch_generators_random.cpp +) +set(GENERATOR_FILES ${GENERATOR_HEADERS} ${GENERATOR_SOURCES}) + +set(MATCHER_HEADERS + ${SOURCES_DIR}/matchers/catch_matchers.hpp + ${SOURCES_DIR}/matchers/catch_matchers_all.hpp + ${SOURCES_DIR}/matchers/catch_matchers_container_properties.hpp + ${SOURCES_DIR}/matchers/catch_matchers_contains.hpp + ${SOURCES_DIR}/matchers/catch_matchers_range_equals.hpp + ${SOURCES_DIR}/matchers/catch_matchers_exception.hpp + ${SOURCES_DIR}/matchers/catch_matchers_floating_point.hpp + ${SOURCES_DIR}/matchers/catch_matchers_predicate.hpp + ${SOURCES_DIR}/matchers/catch_matchers_quantifiers.hpp + ${SOURCES_DIR}/matchers/catch_matchers_string.hpp + ${SOURCES_DIR}/matchers/catch_matchers_templated.hpp + ${SOURCES_DIR}/matchers/catch_matchers_vector.hpp + ${SOURCES_DIR}/matchers/internal/catch_matchers_impl.hpp +) +set(MATCHER_SOURCES + ${SOURCES_DIR}/matchers/catch_matchers.cpp + ${SOURCES_DIR}/matchers/catch_matchers_container_properties.cpp + ${SOURCES_DIR}/matchers/catch_matchers_exception.cpp + ${SOURCES_DIR}/matchers/catch_matchers_floating_point.cpp + ${SOURCES_DIR}/matchers/catch_matchers_predicate.cpp + ${SOURCES_DIR}/matchers/catch_matchers_quantifiers.cpp + ${SOURCES_DIR}/matchers/catch_matchers_string.cpp + ${SOURCES_DIR}/matchers/catch_matchers_templated.cpp + ${SOURCES_DIR}/matchers/internal/catch_matchers_impl.cpp +) +set(MATCHER_FILES ${MATCHER_HEADERS} ${MATCHER_SOURCES}) -# Please keep these ordered alphabetically set(REPORTER_HEADERS - ${SOURCES_DIR}/reporters/catch_reporters_all.hpp - ${SOURCES_DIR}/reporters/catch_reporter_automake.hpp - ${SOURCES_DIR}/reporters/catch_reporter_common_base.hpp - ${SOURCES_DIR}/reporters/catch_reporter_compact.hpp - ${SOURCES_DIR}/reporters/catch_reporter_console.hpp - ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.hpp - ${SOURCES_DIR}/reporters/catch_reporter_event_listener.hpp - ${SOURCES_DIR}/reporters/catch_reporter_helpers.hpp - ${SOURCES_DIR}/reporters/catch_reporter_junit.hpp - ${SOURCES_DIR}/reporters/catch_reporter_multi.hpp - ${SOURCES_DIR}/reporters/catch_reporter_registrars.hpp - ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.hpp - ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.hpp - ${SOURCES_DIR}/reporters/catch_reporter_tap.hpp - ${SOURCES_DIR}/reporters/catch_reporter_teamcity.hpp - ${SOURCES_DIR}/reporters/catch_reporter_xml.hpp + ${SOURCES_DIR}/reporters/catch_reporter_automake.hpp + ${SOURCES_DIR}/reporters/catch_reporter_common_base.hpp + ${SOURCES_DIR}/reporters/catch_reporter_compact.hpp + ${SOURCES_DIR}/reporters/catch_reporter_console.hpp + ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.hpp + ${SOURCES_DIR}/reporters/catch_reporter_event_listener.hpp + ${SOURCES_DIR}/reporters/catch_reporter_helpers.hpp + ${SOURCES_DIR}/reporters/catch_reporter_junit.hpp + ${SOURCES_DIR}/reporters/catch_reporter_multi.hpp + ${SOURCES_DIR}/reporters/catch_reporter_registrars.hpp + ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.hpp + ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.hpp + ${SOURCES_DIR}/reporters/catch_reporter_tap.hpp + ${SOURCES_DIR}/reporters/catch_reporter_teamcity.hpp + ${SOURCES_DIR}/reporters/catch_reporter_xml.hpp + ${SOURCES_DIR}/reporters/catch_reporters_all.hpp ) set(REPORTER_SOURCES - ${SOURCES_DIR}/reporters/catch_reporter_automake.cpp - ${SOURCES_DIR}/reporters/catch_reporter_common_base.cpp - ${SOURCES_DIR}/reporters/catch_reporter_compact.cpp - ${SOURCES_DIR}/reporters/catch_reporter_console.cpp - ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.cpp - ${SOURCES_DIR}/reporters/catch_reporter_event_listener.cpp - ${SOURCES_DIR}/reporters/catch_reporter_helpers.cpp - ${SOURCES_DIR}/reporters/catch_reporter_junit.cpp - ${SOURCES_DIR}/reporters/catch_reporter_multi.cpp - ${SOURCES_DIR}/reporters/catch_reporter_registrars.cpp - ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.cpp - ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.cpp - ${SOURCES_DIR}/reporters/catch_reporter_tap.cpp - ${SOURCES_DIR}/reporters/catch_reporter_teamcity.cpp - ${SOURCES_DIR}/reporters/catch_reporter_xml.cpp + ${SOURCES_DIR}/reporters/catch_reporter_automake.cpp + ${SOURCES_DIR}/reporters/catch_reporter_common_base.cpp + ${SOURCES_DIR}/reporters/catch_reporter_compact.cpp + ${SOURCES_DIR}/reporters/catch_reporter_console.cpp + ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.cpp + ${SOURCES_DIR}/reporters/catch_reporter_event_listener.cpp + ${SOURCES_DIR}/reporters/catch_reporter_helpers.cpp + ${SOURCES_DIR}/reporters/catch_reporter_junit.cpp + ${SOURCES_DIR}/reporters/catch_reporter_multi.cpp + ${SOURCES_DIR}/reporters/catch_reporter_registrars.cpp + ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.cpp + ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.cpp + ${SOURCES_DIR}/reporters/catch_reporter_tap.cpp + ${SOURCES_DIR}/reporters/catch_reporter_teamcity.cpp + ${SOURCES_DIR}/reporters/catch_reporter_xml.cpp ) set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES}) -add_library(Catch2 +set(ALL_FILES + ${BENCHMARK_FILES} + ${GENERATOR_FILES} ${REPORTER_FILES} + ${INTERFACE_FILES} ${INTERNAL_FILES} - ${BENCHMARK_HEADERS} - ${BENCHMARK_SOURCES} + ${MATCHER_FILES} +) + +set(FILTERED_FILES ${ALL_FILES}) +list(REMOVE_ITEM FILTERED_FILES "${PROJECT_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp") +source_group( + TREE ${SOURCES_DIR} + PREFIX sources + FILES ${FILTERED_FILES} +) +source_group("generated headers" + FILES + "${PROJECT_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" ) + +add_library(Catch2 ${ALL_FILES}) add_build_reproducibility_settings(Catch2) add_library(Catch2::Catch2 ALIAS Catch2) @@ -301,7 +346,10 @@ if (ANDROID) target_link_libraries(Catch2 INTERFACE log) endif() -set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "d") +set_target_properties(Catch2 PROPERTIES + DEBUG_POSTFIX "d" + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION}) # depend on bunch of C++11 and C++14 features to have C++14 enabled by default target_compile_features(Catch2 @@ -330,13 +378,13 @@ target_compile_features(Catch2 configure_file( "${SOURCES_DIR}/catch_user_config.hpp.in" - "${CMAKE_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" + "${PROJECT_BINARY_DIR}/generated-includes/catch2/catch_user_config.hpp" ) target_include_directories(Catch2 PUBLIC $<BUILD_INTERFACE:${SOURCES_DIR}/..> - $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated-includes> + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/generated-includes> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) @@ -350,6 +398,8 @@ target_link_libraries(Catch2WithMain PUBLIC Catch2) set_target_properties(Catch2WithMain PROPERTIES OUTPUT_NAME "Catch2Main" + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION} ) set_target_properties(Catch2WithMain PROPERTIES DEBUG_POSTFIX "d") @@ -361,7 +411,7 @@ if (NOT_SUBPROJECT) Catch2WithMain EXPORT Catch2Targets - LIBRARY DESTINATION + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -382,7 +432,7 @@ if (NOT_SUBPROJECT) install( DIRECTORY "${SOURCES_DIR}" - "${CMAKE_BINARY_DIR}/generated-includes/catch2" # Also install the generated header + "${PROJECT_BINARY_DIR}/generated-includes/catch2" # Also install the generated header DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" FILES_MATCHING @@ -396,19 +446,20 @@ endif() if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS) add_library(Catch2_buildall_interface INTERFACE) target_sources(Catch2_buildall_interface INTERFACE - ${REPORTER_FILES} - ${INTERNAL_FILES} - ${BENCHMARK_HEADERS} - ${BENCHMARK_SOURCES} + ${ALL_FILES} # Also include main entry point ${SOURCES_DIR}/internal/catch_main.cpp ) target_include_directories(Catch2_buildall_interface INTERFACE $<BUILD_INTERFACE:${SOURCES_DIR}/..> - $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/generated-includes> + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/generated-includes> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) + target_compile_definitions(Catch2_buildall_interface + INTERFACE + CATCH_CONFIG_STATIC + ) target_compile_features(Catch2_buildall_interface INTERFACE cxx_alignas @@ -442,12 +493,10 @@ set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE) # so we want to check & warn users if they do this. However, we won't abort # the configuration step so that we don't have to also provide an override. if (BUILD_SHARED_LIBS) - if (MSVC) - set_target_properties(Catch2 Catch2WithMain - PROPERTIES - WINDOWS_EXPORT_ALL_SYMBOLS ON - ) - endif() + set_target_properties(Catch2 Catch2WithMain + PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON + ) get_target_property(_VisPreset Catch2 CXX_VISIBILITY_PRESET) if (NOT MSVC AND _VisPreset STREQUAL "hidden") diff --git a/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp b/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp index 66e3670f602aef04e237fcc0e4aa02eedf30107e..99d1c9df895afa1c2563a32c28876290c85cd64a 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,23 +10,27 @@ #ifndef CATCH_BENCHMARK_HPP_INCLUDED #define CATCH_BENCHMARK_HPP_INCLUDED -#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/catch_user_config.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_context.hpp> -#include <catch2/interfaces/catch_interfaces_reporter.hpp> -#include <catch2/internal/catch_unique_name.hpp> #include <catch2/internal/catch_move_and_forward.hpp> -#include <catch2/benchmark/catch_chronometer.hpp> +#include <catch2/internal/catch_test_failure_exception.hpp> +#include <catch2/internal/catch_unique_name.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/benchmark/detail/catch_benchmark_stats.hpp> #include <catch2/benchmark/catch_clock.hpp> #include <catch2/benchmark/catch_environment.hpp> #include <catch2/benchmark/catch_execution_plan.hpp> #include <catch2/benchmark/detail/catch_estimate_clock.hpp> -#include <catch2/benchmark/detail/catch_complete_invoke.hpp> #include <catch2/benchmark/detail/catch_analyse.hpp> #include <catch2/benchmark/detail/catch_benchmark_function.hpp> #include <catch2/benchmark/detail/catch_run_for_at_least.hpp> #include <algorithm> +#include <chrono> +#include <exception> #include <functional> #include <string> #include <vector> @@ -64,7 +68,7 @@ namespace Catch { }); BenchmarkInfo info { - name, + CATCH_MOVE(name), plan.estimated_duration.count(), plan.iterations_per_sample, cfg->benchmarkSamples(), @@ -80,9 +84,9 @@ namespace Catch { }); auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end()); - BenchmarkStats<FloatDuration<Clock>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; + BenchmarkStats<FloatDuration<Clock>> stats{ CATCH_MOVE(info), CATCH_MOVE(analysis.samples), analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; getResultCapture().benchmarkEnded(stats); - } CATCH_CATCH_ANON (TestFailureException) { + } CATCH_CATCH_ANON (TestFailureException const&) { getResultCapture().benchmarkFailed("Benchmark failed due to failed assertion"_sr); } CATCH_CATCH_ALL{ getResultCapture().benchmarkFailed(translateActiveException()); diff --git a/packages/Catch2/src/catch2/benchmark/catch_benchmark_all.hpp b/packages/Catch2/src/catch2/benchmark/catch_benchmark_all.hpp index 913942b395d9becbb7da89d2ac6b1bca81a4895b..56fc7c74cdb0f432519a90c713f06d0504585ae4 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_benchmark_all.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_benchmark_all.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -33,6 +33,8 @@ #include <catch2/benchmark/catch_sample_analysis.hpp> #include <catch2/benchmark/detail/catch_analyse.hpp> #include <catch2/benchmark/detail/catch_benchmark_function.hpp> +#include <catch2/benchmark/detail/catch_benchmark_stats.hpp> +#include <catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp> #include <catch2/benchmark/detail/catch_complete_invoke.hpp> #include <catch2/benchmark/detail/catch_estimate_clock.hpp> #include <catch2/benchmark/detail/catch_measure.hpp> diff --git a/packages/Catch2/src/catch2/benchmark/catch_chronometer.cpp b/packages/Catch2/src/catch2/benchmark/catch_chronometer.cpp index 459a26c7e4fe2b8be52ce0bf6211a9d568448748..92f03c9f65fdd00f5b3a7e1e7bbe008ebad28ed9 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_chronometer.cpp +++ b/packages/Catch2/src/catch2/benchmark/catch_chronometer.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/benchmark/catch_chronometer.hpp b/packages/Catch2/src/catch2/benchmark/catch_chronometer.hpp index 7ef08cef0d5a72b9c8d4508474dd4df7e533263a..c3f813060f989a91e63ee786e5213682e5abee18 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_chronometer.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_chronometer.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -12,7 +12,6 @@ #include <catch2/benchmark/catch_clock.hpp> #include <catch2/benchmark/catch_optimizer.hpp> -#include <catch2/benchmark/detail/catch_complete_invoke.hpp> #include <catch2/internal/catch_meta.hpp> #include <catch2/internal/catch_move_and_forward.hpp> diff --git a/packages/Catch2/src/catch2/benchmark/catch_clock.hpp b/packages/Catch2/src/catch2/benchmark/catch_clock.hpp index e0cf4aaeb4a4f6a89c327df35a028eccb655cf68..cee46097d0b664954a38caeff026a7d81aa4853c 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_clock.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_clock.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp b/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp index 86bbfb00de21dd5f38824533be962a77cf724aad..853bd6c1935d18544ae8025973b5169545092006 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -54,14 +54,18 @@ namespace Catch { template <typename U> void destruct_on_exit(std::enable_if_t<!Destruct, U>* = nullptr) { } - T& stored_object() { - return *static_cast<T*>(static_cast<void*>(data)); - } +#if defined( __GNUC__ ) && __GNUC__ <= 6 +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif + T& stored_object() { return *reinterpret_cast<T*>( data ); } T const& stored_object() const { - return *static_cast<T const*>(static_cast<void const*>(data)); + return *reinterpret_cast<T const*>( data ); } - +#if defined( __GNUC__ ) && __GNUC__ <= 6 +# pragma GCC diagnostic pop +#endif alignas( T ) unsigned char data[sizeof( T )]{}; }; diff --git a/packages/Catch2/src/catch2/benchmark/catch_environment.hpp b/packages/Catch2/src/catch2/benchmark/catch_environment.hpp index cadd7bc392358f2432eafce76ffe11fd3469f591..de4d77df4f0781da089cd824171e0792848ba302 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_environment.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_environment.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/benchmark/catch_estimate.hpp b/packages/Catch2/src/catch2/benchmark/catch_estimate.hpp index 884a4614eaaae43f3f6bfc4fb6ae10aee50214b8..be594a189b482ad7f8c9ed00726647e85292b3ed 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_estimate.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_estimate.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/benchmark/catch_execution_plan.hpp b/packages/Catch2/src/catch2/benchmark/catch_execution_plan.hpp index bcb366ce6ab510f24d0092f94aea1cfc8907fe2d..4f60a64677850d1b5d4891bb70db7d26ec469c01 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_execution_plan.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_execution_plan.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -17,8 +17,7 @@ #include <catch2/benchmark/detail/catch_repeat.hpp> #include <catch2/benchmark/detail/catch_run_for_at_least.hpp> -#include <algorithm> -#include <iterator> +#include <vector> namespace Catch { namespace Benchmark { @@ -41,14 +40,17 @@ namespace Catch { Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_iterations, Detail::repeat(now<Clock>{})); std::vector<FloatDuration<Clock>> times; - times.reserve(cfg.benchmarkSamples()); - std::generate_n(std::back_inserter(times), cfg.benchmarkSamples(), [this, env] { + const auto num_samples = cfg.benchmarkSamples(); + times.reserve( num_samples ); + for ( size_t i = 0; i < num_samples; ++i ) { Detail::ChronometerModel<Clock> model; - this->benchmark(Chronometer(model, iterations_per_sample)); + this->benchmark( Chronometer( model, iterations_per_sample ) ); auto sample_time = model.elapsed() - env.clock_cost.mean; - if (sample_time < FloatDuration<Clock>::zero()) sample_time = FloatDuration<Clock>::zero(); - return sample_time / iterations_per_sample; - }); + if ( sample_time < FloatDuration<Clock>::zero() ) { + sample_time = FloatDuration<Clock>::zero(); + } + times.push_back(sample_time / iterations_per_sample); + } return times; } }; diff --git a/packages/Catch2/src/catch2/benchmark/catch_optimizer.hpp b/packages/Catch2/src/catch2/benchmark/catch_optimizer.hpp index b9af3ea1de55707af0601903441a8f9c5784d68e..02cf2073e40856db0e36c2051f0372209dabe83a 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_optimizer.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_optimizer.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,7 +10,7 @@ #ifndef CATCH_OPTIMIZER_HPP_INCLUDED #define CATCH_OPTIMIZER_HPP_INCLUDED -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__IAR_SYSTEMS_ICC__) # include <atomic> // atomic_thread_fence #endif @@ -32,16 +32,23 @@ namespace Catch { namespace Detail { inline void optimizer_barrier() { keep_memory(); } } // namespace Detail -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) || defined(__IAR_SYSTEMS_ICC__) +#if defined(_MSVC_VER) #pragma optimize("", off) +#elif defined(__IAR_SYSTEMS_ICC__) +// For IAR the pragma only affects the following function +#pragma optimize=disable +#endif template <typename T> inline void keep_memory(T* p) { // thanks @milleniumbug *reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p); } // TODO equivalent keep_memory() +#if defined(_MSVC_VER) #pragma optimize("", on) +#endif namespace Detail { inline void optimizer_barrier() { diff --git a/packages/Catch2/src/catch2/benchmark/catch_outlier_classification.hpp b/packages/Catch2/src/catch2/benchmark/catch_outlier_classification.hpp index 933f045997ae41c2bdafe2dad98825ed0d726613..e31d65d4a24d73c045b9c53f7adff4aaeb4af0c9 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_outlier_classification.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_outlier_classification.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/benchmark/catch_sample_analysis.hpp b/packages/Catch2/src/catch2/benchmark/catch_sample_analysis.hpp index 6204aaf1417454c81e130d8a4dbdeec108d06000..97b8fe5083eeceb9c9e7ac76a74cb8a287c281da 100644 --- a/packages/Catch2/src/catch2/benchmark/catch_sample_analysis.hpp +++ b/packages/Catch2/src/catch2/benchmark/catch_sample_analysis.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,14 +10,11 @@ #ifndef CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED #define CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED -#include <catch2/benchmark/catch_clock.hpp> #include <catch2/benchmark/catch_estimate.hpp> #include <catch2/benchmark/catch_outlier_classification.hpp> #include <catch2/internal/catch_move_and_forward.hpp> -#include <algorithm> #include <vector> -#include <iterator> namespace Catch { namespace Benchmark { @@ -33,7 +30,9 @@ namespace Catch { operator SampleAnalysis<Duration2>() const { std::vector<Duration2> samples2; samples2.reserve(samples.size()); - std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); }); + for (auto const& d : samples) { + samples2.push_back(Duration2(d)); + } return { CATCH_MOVE(samples2), mean, diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp index 6652f5f4d85fdbeb36bebaa3fc8e92584642a14a..c932ff26a4d1bf0ff1c9364015bb426695916bc1 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,15 +10,12 @@ #ifndef CATCH_ANALYSE_HPP_INCLUDED #define CATCH_ANALYSE_HPP_INCLUDED -#include <catch2/benchmark/catch_clock.hpp> #include <catch2/benchmark/catch_environment.hpp> #include <catch2/benchmark/catch_sample_analysis.hpp> #include <catch2/benchmark/detail/catch_stats.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> #include <catch2/internal/catch_move_and_forward.hpp> -#include <algorithm> -#include <iterator> #include <vector> namespace Catch { @@ -29,7 +26,9 @@ namespace Catch { if (!cfg.benchmarkNoAnalysis()) { std::vector<double> samples; samples.reserve(static_cast<size_t>(last - first)); - std::transform(first, last, std::back_inserter(samples), [](Duration d) { return d.count(); }); + for (auto current = first; current != last; ++current) { + samples.push_back( current->count() ); + } auto analysis = Catch::Benchmark::Detail::analyse_samples(cfg.benchmarkConfidenceInterval(), cfg.benchmarkResamples(), samples.begin(), samples.end()); auto outliers = Catch::Benchmark::Detail::classify_outliers(samples.begin(), samples.end()); @@ -44,7 +43,10 @@ namespace Catch { }; std::vector<Duration> samples2; samples2.reserve(samples.size()); - std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](double d) { return Duration(d); }); + for (auto s : samples) { + samples2.push_back( Duration( s ) ); + } + return { CATCH_MOVE(samples2), wrap_estimate(analysis.mean), diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp index 9562d29e7c9bf1509c045c841ae7be98399bb8e0..b437d04929f9e4f3b53b7a453c27f94c600da5d5 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.hpp index 655c863508fcaa911d776f46dff161125d9da05b..144e4b6e4374ff7f0034fe377d9c995865c8b43a 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,7 +11,6 @@ #define CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED #include <catch2/benchmark/catch_chronometer.hpp> -#include <catch2/benchmark/detail/catch_complete_invoke.hpp> #include <catch2/internal/catch_meta.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/internal/catch_move_and_forward.hpp> diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_stats.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_stats.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a8b3494e97b35a5a36d866911a6fd80a1109200b --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_stats.hpp @@ -0,0 +1,64 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_BENCHMARK_STATS_HPP_INCLUDED +#define CATCH_BENCHMARK_STATS_HPP_INCLUDED + +#include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/benchmark/catch_estimate.hpp> +#include <catch2/benchmark/catch_outlier_classification.hpp> +// The fwd decl & default specialization needs to be seen by VS2017 before +// BenchmarkStats itself, or VS2017 will report compilation error. +#include <catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp> + +#include <string> +#include <vector> + +namespace Catch { + + struct BenchmarkInfo { + std::string name; + double estimatedDuration; + int iterations; + unsigned int samples; + unsigned int resamples; + double clockResolution; + double clockCost; + }; + + template <class Duration> + struct BenchmarkStats { + BenchmarkInfo info; + + std::vector<Duration> samples; + Benchmark::Estimate<Duration> mean; + Benchmark::Estimate<Duration> standardDeviation; + Benchmark::OutlierClassification outliers; + double outlierVariance; + + template <typename Duration2> + operator BenchmarkStats<Duration2>() const { + std::vector<Duration2> samples2; + samples2.reserve(samples.size()); + for (auto const& sample : samples) { + samples2.push_back(Duration2(sample)); + } + return { + info, + CATCH_MOVE(samples2), + mean, + standardDeviation, + outliers, + outlierVariance, + }; + } + }; + + +} // end namespace Catch + +#endif // CATCH_BENCHMARK_STATS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..607725613eae5bebacb2115873f63bce97e860f6 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp @@ -0,0 +1,23 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED +#define CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED + +#include <chrono> + +namespace Catch { + + // We cannot forward declare the type with default template argument + // multiple times, so it is split out into a separate header so that + // we can prevent multiple declarations in dependees + template <typename Duration = std::chrono::duration<double, std::nano>> + struct BenchmarkStats; + +} // end namespace Catch + +#endif // CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_complete_invoke.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_complete_invoke.hpp index 747b37a9968b302c8deb0c8127bde314be1db214..4dff4b7eb8b02f360f752e271cff6a5efeab53d3 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_complete_invoke.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_complete_invoke.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,14 +10,9 @@ #ifndef CATCH_COMPLETE_INVOKE_HPP_INCLUDED #define CATCH_COMPLETE_INVOKE_HPP_INCLUDED -#include <catch2/internal/catch_test_failure_exception.hpp> #include <catch2/internal/catch_meta.hpp> -#include <catch2/interfaces/catch_interfaces_capture.hpp> -#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/internal/catch_move_and_forward.hpp> -#include <type_traits> - namespace Catch { namespace Benchmark { namespace Detail { diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp index c392ca4f7e9ea00bbe04cda50f9ff9edb29dcfe0..1e916ae4aca0cb7631f2ff21805a6c3905b0410d 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -19,7 +19,6 @@ #include <catch2/internal/catch_unique_ptr.hpp> #include <algorithm> -#include <iterator> #include <vector> #include <cmath> @@ -30,26 +29,29 @@ namespace Catch { std::vector<double> resolution(int k) { std::vector<TimePoint<Clock>> times; times.reserve(static_cast<size_t>(k + 1)); - std::generate_n(std::back_inserter(times), k + 1, now<Clock>{}); + for ( int i = 0; i < k + 1; ++i ) { + times.push_back( Clock::now() ); + } std::vector<double> deltas; deltas.reserve(static_cast<size_t>(k)); - std::transform(std::next(times.begin()), times.end(), times.begin(), - std::back_inserter(deltas), - [](TimePoint<Clock> a, TimePoint<Clock> b) { return static_cast<double>((a - b).count()); }); + for ( size_t idx = 1; idx < times.size(); ++idx ) { + deltas.push_back( static_cast<double>( + ( times[idx] - times[idx - 1] ).count() ) ); + } return deltas; } - const auto warmup_iterations = 10000; - const auto warmup_time = std::chrono::milliseconds(100); - const auto minimum_ticks = 1000; - const auto warmup_seed = 10000; - const auto clock_resolution_estimation_time = std::chrono::milliseconds(500); - const auto clock_cost_estimation_time_limit = std::chrono::seconds(1); - const auto clock_cost_estimation_tick_limit = 100000; - const auto clock_cost_estimation_time = std::chrono::milliseconds(10); - const auto clock_cost_estimation_iterations = 10000; + constexpr auto warmup_iterations = 10000; + constexpr auto warmup_time = std::chrono::milliseconds(100); + constexpr auto minimum_ticks = 1000; + constexpr auto warmup_seed = 10000; + constexpr auto clock_resolution_estimation_time = std::chrono::milliseconds(500); + constexpr auto clock_cost_estimation_time_limit = std::chrono::seconds(1); + constexpr auto clock_cost_estimation_tick_limit = 100000; + constexpr auto clock_cost_estimation_time = std::chrono::milliseconds(10); + constexpr auto clock_cost_estimation_iterations = 10000; template <typename Clock> int warmup() { @@ -84,9 +86,11 @@ namespace Catch { std::vector<double> times; int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed)); times.reserve(static_cast<size_t>(nsamples)); - std::generate_n(std::back_inserter(times), nsamples, [time_clock, &r] { - return static_cast<double>((time_clock(r.iterations) / r.iterations).count()); - }); + for ( int s = 0; s < nsamples; ++s ) { + times.push_back( static_cast<double>( + ( time_clock( r.iterations ) / r.iterations ) + .count() ) ); + } return { FloatDuration<Clock>(mean(times.begin(), times.end())), classify_outliers(times.begin(), times.end()), diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_measure.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_measure.hpp index 739e91e58947d6445ab7f36ab219bdcee86613b4..1a30efabe04b211d4f8e369d0c9675f6775754ac 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_measure.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_measure.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,7 +10,6 @@ #ifndef CATCH_MEASURE_HPP_INCLUDED #define CATCH_MEASURE_HPP_INCLUDED -#include <catch2/benchmark/catch_clock.hpp> #include <catch2/benchmark/detail/catch_complete_invoke.hpp> #include <catch2/benchmark/detail/catch_timing.hpp> #include <catch2/internal/catch_move_and_forward.hpp> diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_repeat.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_repeat.hpp index 360af09b6fa8bb729e792576600105265ed60f4a..08c03373bd729e6a20b77012fd4fd3ab96cb7442 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_repeat.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_repeat.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp b/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp index 6c246d6a5c537b4110d188fefa158991246b3ee9..3ebdcc05ad20c2be7c8a39a1c5801eb8791e4278 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.cpp @@ -1,15 +1,16 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/benchmark/detail/catch_run_for_at_least.hpp> -#include <exception> #include <catch2/internal/catch_enforce.hpp> +#include <exception> + namespace Catch { namespace Benchmark { namespace Detail { diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.hpp index 6b2f56e77bc055a4abe55bc7f828ee918bda62d3..976a4b2430518735a8f37849968844fb85bb77fb 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp index 023508064ab5d09f64c9076fb1aea5dd919836f2..ea483a3093c6dea4880ca636676228b23f2ae18d 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -13,7 +13,7 @@ #include <cassert> #include <cstddef> -#include <iterator> +#include <numeric> #include <random> @@ -21,117 +21,172 @@ #include <future> #endif -namespace { - -using Catch::Benchmark::Detail::sample; - - template <typename URng, typename Estimator> - sample resample(URng& rng, unsigned int resamples, std::vector<double>::iterator first, std::vector<double>::iterator last, Estimator& estimator) { - auto n = static_cast<size_t>(last - first); - std::uniform_int_distribution<decltype(n)> dist(0, n - 1); - - sample out; - out.reserve(resamples); - std::generate_n(std::back_inserter(out), resamples, [n, first, &estimator, &dist, &rng] { - std::vector<double> resampled; - resampled.reserve(n); - std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[static_cast<std::ptrdiff_t>(dist(rng))]; }); - return estimator(resampled.begin(), resampled.end()); - }); - std::sort(out.begin(), out.end()); - return out; - } - - - double erf_inv(double x) { - // Code accompanying the article "Approximating the erfinv function" in GPU Computing Gems, Volume 2 - double w, p; - - w = -log((1.0 - x) * (1.0 + x)); - - if (w < 6.250000) { - w = w - 3.125000; - p = -3.6444120640178196996e-21; - p = -1.685059138182016589e-19 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -1.333171662854620906e-16 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -4.0545662729752068639e-14 + p * w; - p = -8.1519341976054721522e-14 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -1.2975133253453532498e-11 + p * w; - p = -5.4154120542946279317e-11 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -4.1126339803469836976e-09 + p * w; - p = -2.9070369957882005086e-08 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -1.3654692000834678645e-06 + p * w; - p = -1.3882523362786468719e-05 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.00074070253416626697512 + p * w; - p = -0.0060336708714301490533 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.000000) { - w = sqrt(w) - 3.250000; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -2.7517406297064545428e-07 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -4.013867526981545969e-06 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -4.7318229009055733981e-05 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628474796 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047313 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.0037512085075692412107 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else { - w = sqrt(w) - 5.000000; - p = -2.7109920616438573243e-11; - p = -2.5556418169965252055e-10 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -3.7894654401267369937e-09 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -1.4960026627149240478e-08 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -6.7711997758452339498e-08 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -9.9298272942317002539e-07 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -1.9681778105531670567e-05 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477347 + p * w; - p = -0.00013871931833623122026 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } - return p * x; - } - - double standard_deviation(std::vector<double>::iterator first, std::vector<double>::iterator last) { - auto m = Catch::Benchmark::Detail::mean(first, last); - double variance = std::accumulate( first, - last, - 0., - [m]( double a, double b ) { - double diff = b - m; - return a + diff * diff; - } ) / - ( last - first ); - return std::sqrt( variance ); - } - -} +namespace Catch { + namespace Benchmark { + namespace Detail { + namespace { + + template <typename URng, typename Estimator> + static sample + resample( URng& rng, + unsigned int resamples, + std::vector<double>::const_iterator first, + std::vector<double>::const_iterator last, + Estimator& estimator ) { + auto n = static_cast<size_t>( last - first ); + std::uniform_int_distribution<decltype( n )> dist( 0, + n - 1 ); + + sample out; + out.reserve( resamples ); + // We allocate the vector outside the loop to avoid realloc + // per resample + std::vector<double> resampled; + resampled.reserve( n ); + for ( size_t i = 0; i < resamples; ++i ) { + resampled.clear(); + for ( size_t s = 0; s < n; ++s ) { + resampled.push_back( + first[static_cast<std::ptrdiff_t>( + dist( rng ) )] ); + } + const auto estimate = + estimator( resampled.begin(), resampled.end() ); + out.push_back( estimate ); + } + std::sort( out.begin(), out.end() ); + return out; + } + + static double outlier_variance( Estimate<double> mean, + Estimate<double> stddev, + int n ) { + double sb = stddev.point; + double mn = mean.point / n; + double mg_min = mn / 2.; + double sg = (std::min)( mg_min / 4., sb / std::sqrt( n ) ); + double sg2 = sg * sg; + double sb2 = sb * sb; + + auto c_max = [n, mn, sb2, sg2]( double x ) -> double { + double k = mn - x; + double d = k * k; + double nd = n * d; + double k0 = -n * nd; + double k1 = sb2 - n * sg2 + nd; + double det = k1 * k1 - 4 * sg2 * k0; + return static_cast<int>( -2. * k0 / + ( k1 + std::sqrt( det ) ) ); + }; + + auto var_out = [n, sb2, sg2]( double c ) { + double nc = n - c; + return ( nc / n ) * ( sb2 - nc * sg2 ); + }; + + return (std::min)( var_out( 1 ), + var_out( + (std::min)( c_max( 0. ), + c_max( mg_min ) ) ) ) / + sb2; + } + + static double erf_inv( double x ) { + // Code accompanying the article "Approximating the erfinv + // function" in GPU Computing Gems, Volume 2 + double w, p; + + w = -log( ( 1.0 - x ) * ( 1.0 + x ) ); + + if ( w < 6.250000 ) { + w = w - 3.125000; + p = -3.6444120640178196996e-21; + p = -1.685059138182016589e-19 + p * w; + p = 1.2858480715256400167e-18 + p * w; + p = 1.115787767802518096e-17 + p * w; + p = -1.333171662854620906e-16 + p * w; + p = 2.0972767875968561637e-17 + p * w; + p = 6.6376381343583238325e-15 + p * w; + p = -4.0545662729752068639e-14 + p * w; + p = -8.1519341976054721522e-14 + p * w; + p = 2.6335093153082322977e-12 + p * w; + p = -1.2975133253453532498e-11 + p * w; + p = -5.4154120542946279317e-11 + p * w; + p = 1.051212273321532285e-09 + p * w; + p = -4.1126339803469836976e-09 + p * w; + p = -2.9070369957882005086e-08 + p * w; + p = 4.2347877827932403518e-07 + p * w; + p = -1.3654692000834678645e-06 + p * w; + p = -1.3882523362786468719e-05 + p * w; + p = 0.0001867342080340571352 + p * w; + p = -0.00074070253416626697512 + p * w; + p = -0.0060336708714301490533 + p * w; + p = 0.24015818242558961693 + p * w; + p = 1.6536545626831027356 + p * w; + } else if ( w < 16.000000 ) { + w = sqrt( w ) - 3.250000; + p = 2.2137376921775787049e-09; + p = 9.0756561938885390979e-08 + p * w; + p = -2.7517406297064545428e-07 + p * w; + p = 1.8239629214389227755e-08 + p * w; + p = 1.5027403968909827627e-06 + p * w; + p = -4.013867526981545969e-06 + p * w; + p = 2.9234449089955446044e-06 + p * w; + p = 1.2475304481671778723e-05 + p * w; + p = -4.7318229009055733981e-05 + p * w; + p = 6.8284851459573175448e-05 + p * w; + p = 2.4031110387097893999e-05 + p * w; + p = -0.0003550375203628474796 + p * w; + p = 0.00095328937973738049703 + p * w; + p = -0.0016882755560235047313 + p * w; + p = 0.0024914420961078508066 + p * w; + p = -0.0037512085075692412107 + p * w; + p = 0.005370914553590063617 + p * w; + p = 1.0052589676941592334 + p * w; + p = 3.0838856104922207635 + p * w; + } else { + w = sqrt( w ) - 5.000000; + p = -2.7109920616438573243e-11; + p = -2.5556418169965252055e-10 + p * w; + p = 1.5076572693500548083e-09 + p * w; + p = -3.7894654401267369937e-09 + p * w; + p = 7.6157012080783393804e-09 + p * w; + p = -1.4960026627149240478e-08 + p * w; + p = 2.9147953450901080826e-08 + p * w; + p = -6.7711997758452339498e-08 + p * w; + p = 2.2900482228026654717e-07 + p * w; + p = -9.9298272942317002539e-07 + p * w; + p = 4.5260625972231537039e-06 + p * w; + p = -1.9681778105531670567e-05 + p * w; + p = 7.5995277030017761139e-05 + p * w; + p = -0.00021503011930044477347 + p * w; + p = -0.00013871931833623122026 + p * w; + p = 1.0103004648645343977 + p * w; + p = 4.8499064014085844221 + p * w; + } + return p * x; + } + + static double + standard_deviation( std::vector<double>::const_iterator first, + std::vector<double>::const_iterator last ) { + auto m = Catch::Benchmark::Detail::mean( first, last ); + double variance = + std::accumulate( first, + last, + 0., + [m]( double a, double b ) { + double diff = b - m; + return a + diff * diff; + } ) / + ( last - first ); + return std::sqrt( variance ); + } + + } // namespace + } // namespace Detail + } // namespace Benchmark +} // namespace Catch namespace Catch { namespace Benchmark { @@ -161,6 +216,47 @@ namespace Catch { return xj + g * (xj1 - xj); } + OutlierClassification + classify_outliers( std::vector<double>::const_iterator first, + std::vector<double>::const_iterator last ) { + std::vector<double> copy( first, last ); + + auto q1 = weighted_average_quantile( 1, 4, copy.begin(), copy.end() ); + auto q3 = weighted_average_quantile( 3, 4, copy.begin(), copy.end() ); + auto iqr = q3 - q1; + auto los = q1 - ( iqr * 3. ); + auto lom = q1 - ( iqr * 1.5 ); + auto him = q3 + ( iqr * 1.5 ); + auto his = q3 + ( iqr * 3. ); + + OutlierClassification o; + for ( ; first != last; ++first ) { + const double t = *first; + if ( t < los ) { + ++o.low_severe; + } else if ( t < lom ) { + ++o.low_mild; + } else if ( t > his ) { + ++o.high_severe; + } else if ( t > him ) { + ++o.high_mild; + } + ++o.samples_seen; + } + return o; + } + + double mean( std::vector<double>::const_iterator first, + std::vector<double>::const_iterator last ) { + auto count = last - first; + double sum = 0.; + while (first != last) { + sum += *first; + ++first; + } + return sum / static_cast<double>(count); + } + double erfc_inv(double x) { return erf_inv(1.0 - x); @@ -182,35 +278,10 @@ namespace Catch { return result; } - - double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n) { - double sb = stddev.point; - double mn = mean.point / n; - double mg_min = mn / 2.; - double sg = (std::min)(mg_min / 4., sb / std::sqrt(n)); - double sg2 = sg * sg; - double sb2 = sb * sb; - - auto c_max = [n, mn, sb2, sg2](double x) -> double { - double k = mn - x; - double d = k * k; - double nd = n * d; - double k0 = -n * nd; - double k1 = sb2 - n * sg2 + nd; - double det = k1 * k1 - 4 * sg2 * k0; - return static_cast<int>(-2. * k0 / (k1 + std::sqrt(det))); - }; - - auto var_out = [n, sb2, sg2](double c) { - double nc = n - c; - return (nc / n) * (sb2 - nc * sg2); - }; - - return (std::min)(var_out(1), var_out((std::min)(c_max(0.), c_max(mg_min)))) / sb2; - } - - - bootstrap_analysis analyse_samples(double confidence_level, unsigned int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) { + bootstrap_analysis analyse_samples(double confidence_level, + unsigned int n_resamples, + std::vector<double>::iterator first, + std::vector<double>::iterator last) { CATCH_INTERNAL_START_WARNINGS_SUPPRESSION CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS static std::random_device entropy; @@ -218,11 +289,12 @@ namespace Catch { auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++ - auto mean = &Detail::mean<std::vector<double>::iterator>; + auto mean = &Detail::mean; auto stddev = &standard_deviation; #if defined(CATCH_CONFIG_USE_ASYNC) - auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) { + auto Estimate = [=](double(*f)(std::vector<double>::const_iterator, + std::vector<double>::const_iterator)) { auto seed = entropy(); return std::async(std::launch::async, [=] { std::mt19937 rng(seed); @@ -237,7 +309,8 @@ namespace Catch { auto mean_estimate = mean_future.get(); auto stddev_estimate = stddev_future.get(); #else - auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) { + auto Estimate = [=](double(*f)(std::vector<double>::const_iterator, + std::vector<double>::const_iterator)) { auto seed = entropy(); std::mt19937 rng(seed); auto resampled = resample(rng, n_resamples, first, last, f); diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp index bfeace2c127d8ea220b74aca13eeebc5f80d50e7..c1ce56644271cd79c52d96ebf42a0afe0de787a2 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -15,8 +15,6 @@ #include <algorithm> #include <vector> -#include <numeric> -#include <tuple> #include <cmath> namespace Catch { @@ -30,39 +28,17 @@ namespace Catch { double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last); - template <typename Iterator> - OutlierClassification classify_outliers(Iterator first, Iterator last) { - std::vector<double> copy(first, last); - - auto q1 = weighted_average_quantile(1, 4, copy.begin(), copy.end()); - auto q3 = weighted_average_quantile(3, 4, copy.begin(), copy.end()); - auto iqr = q3 - q1; - auto los = q1 - (iqr * 3.); - auto lom = q1 - (iqr * 1.5); - auto him = q3 + (iqr * 1.5); - auto his = q3 + (iqr * 3.); - - OutlierClassification o; - for (; first != last; ++first) { - auto&& t = *first; - if (t < los) ++o.low_severe; - else if (t < lom) ++o.low_mild; - else if (t > his) ++o.high_severe; - else if (t > him) ++o.high_mild; - ++o.samples_seen; - } - return o; - } + OutlierClassification + classify_outliers( std::vector<double>::const_iterator first, + std::vector<double>::const_iterator last ); - template <typename Iterator> - double mean(Iterator first, Iterator last) { - auto count = last - first; - double sum = std::accumulate(first, last, 0.); - return sum / static_cast<double>(count); - } + double mean( std::vector<double>::const_iterator first, + std::vector<double>::const_iterator last ); - template <typename Estimator, typename Iterator> - sample jackknife(Estimator&& estimator, Iterator first, Iterator last) { + template <typename Estimator> + sample jackknife(Estimator&& estimator, + std::vector<double>::iterator first, + std::vector<double>::iterator last) { auto n = static_cast<size_t>(last - first); auto second = first; ++second; @@ -85,8 +61,12 @@ namespace Catch { double normal_quantile(double p); - template <typename Iterator, typename Estimator> - Estimate<double> bootstrap(double confidence_level, Iterator first, Iterator last, sample const& resample, Estimator&& estimator) { + template <typename Estimator> + Estimate<double> bootstrap( double confidence_level, + std::vector<double>::iterator first, + std::vector<double>::iterator last, + sample const& resample, + Estimator&& estimator ) { auto n_samples = last - first; double point = estimator(first, last); @@ -95,13 +75,13 @@ namespace Catch { sample jack = jackknife(estimator, first, last); double jack_mean = mean(jack.begin(), jack.end()); - double sum_squares, sum_cubes; - std::tie(sum_squares, sum_cubes) = std::accumulate(jack.begin(), jack.end(), std::make_pair(0., 0.), [jack_mean](std::pair<double, double> sqcb, double x) -> std::pair<double, double> { - auto d = jack_mean - x; - auto d2 = d * d; - auto d3 = d2 * d; - return { sqcb.first + d2, sqcb.second + d3 }; - }); + double sum_squares = 0, sum_cubes = 0; + for (double x : jack) { + auto difference = jack_mean - x; + auto square = difference * difference; + auto cube = square * difference; + sum_squares += square; sum_cubes += cube; + } double accel = sum_cubes / (6 * std::pow(sum_squares, 1.5)); long n = static_cast<long>(resample.size()); @@ -128,15 +108,16 @@ namespace Catch { return { point, resample[lo], resample[hi], confidence_level }; } - double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n); - struct bootstrap_analysis { Estimate<double> mean; Estimate<double> standard_deviation; double outlier_variance; }; - bootstrap_analysis analyse_samples(double confidence_level, unsigned int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last); + bootstrap_analysis analyse_samples(double confidence_level, + unsigned int n_resamples, + std::vector<double>::iterator first, + std::vector<double>::iterator last); } // namespace Detail } // namespace Benchmark } // namespace Catch diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_timing.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_timing.hpp index 40a9512b7d54ac6643746c0aad72b653a0a80d91..f5c25571c4779a0cf7ac586c427e3d54ef277a62 100644 --- a/packages/Catch2/src/catch2/benchmark/detail/catch_timing.hpp +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_timing.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_all.hpp b/packages/Catch2/src/catch2/catch_all.hpp index 94f552237afb5245c4588925d57d18bb20cdd024..70ec402d6c223eb99dd8a005f17b1c04760a6743 100644 --- a/packages/Catch2/src/catch2/catch_all.hpp +++ b/packages/Catch2/src/catch2/catch_all.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -50,9 +50,11 @@ #include <catch2/internal/catch_case_sensitive.hpp> #include <catch2/internal/catch_clara.hpp> #include <catch2/internal/catch_commandline.hpp> +#include <catch2/internal/catch_compare_traits.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_config_android_logwrite.hpp> #include <catch2/internal/catch_config_counter.hpp> +#include <catch2/internal/catch_config_static_analysis_support.hpp> #include <catch2/internal/catch_config_uncaught_exceptions.hpp> #include <catch2/internal/catch_config_wchar.hpp> #include <catch2/internal/catch_console_colour.hpp> @@ -68,19 +70,24 @@ #include <catch2/internal/catch_exception_translator_registry.hpp> #include <catch2/internal/catch_fatal_condition_handler.hpp> #include <catch2/internal/catch_floating_point_helpers.hpp> +#include <catch2/internal/catch_getenv.hpp> +#include <catch2/internal/catch_is_permutation.hpp> #include <catch2/internal/catch_istream.hpp> #include <catch2/internal/catch_lazy_expr.hpp> #include <catch2/internal/catch_leak_detector.hpp> #include <catch2/internal/catch_list.hpp> +#include <catch2/internal/catch_logical_traits.hpp> #include <catch2/internal/catch_message_info.hpp> #include <catch2/internal/catch_meta.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/internal/catch_noncopyable.hpp> #include <catch2/internal/catch_optional.hpp> #include <catch2/internal/catch_output_redirect.hpp> +#include <catch2/internal/catch_parse_numbers.hpp> #include <catch2/internal/catch_platform.hpp> #include <catch2/internal/catch_polyfills.hpp> #include <catch2/internal/catch_preprocessor.hpp> +#include <catch2/internal/catch_preprocessor_internal_stringify.hpp> #include <catch2/internal/catch_preprocessor_remove_parens.hpp> #include <catch2/internal/catch_random_number_generator.hpp> #include <catch2/internal/catch_random_seed_generation.hpp> @@ -106,6 +113,7 @@ #include <catch2/internal/catch_test_failure_exception.hpp> #include <catch2/internal/catch_test_macro_impl.hpp> #include <catch2/internal/catch_test_registry.hpp> +#include <catch2/internal/catch_test_run_info.hpp> #include <catch2/internal/catch_test_spec_parser.hpp> #include <catch2/internal/catch_textflow.hpp> #include <catch2/internal/catch_to_string.hpp> @@ -114,7 +122,6 @@ #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/internal/catch_void_type.hpp> #include <catch2/internal/catch_wildcard_pattern.hpp> -#include <catch2/internal/catch_windows_h_proxy.hpp> #include <catch2/internal/catch_xmlwriter.hpp> #include <catch2/matchers/catch_matchers_all.hpp> #include <catch2/reporters/catch_reporters_all.hpp> diff --git a/packages/Catch2/src/catch2/catch_approx.cpp b/packages/Catch2/src/catch2/catch_approx.cpp index b477d6ed985afa4064583d497ed3a550f3f8c555..407586d1d5db4462d5c6bfa5f9b7e49812dcda56 100644 --- a/packages/Catch2/src/catch2/catch_approx.cpp +++ b/packages/Catch2/src/catch2/catch_approx.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_approx.hpp b/packages/Catch2/src/catch2/catch_approx.hpp index a46caeb53b49083cd2998498e6ec7d9d54d76cbb..de4d2ab4ca0a6402f559458f8d8c657607332544 100644 --- a/packages/Catch2/src/catch2/catch_approx.hpp +++ b/packages/Catch2/src/catch2/catch_approx.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_assertion_info.hpp b/packages/Catch2/src/catch2/catch_assertion_info.hpp index 516c324c5c9720edf7c051470ecb2c2fae666e80..9d2f91fad01f552e8d62e7870a98e470701a0ac6 100644 --- a/packages/Catch2/src/catch2/catch_assertion_info.hpp +++ b/packages/Catch2/src/catch2/catch_assertion_info.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_assertion_result.cpp b/packages/Catch2/src/catch2/catch_assertion_result.cpp index 2912c8d305e043aa8f6eae6cc7035a5316cebba3..61d4fd068a92883e9e1edaa454f76d1c24585f00 100644 --- a/packages/Catch2/src/catch2/catch_assertion_result.cpp +++ b/packages/Catch2/src/catch2/catch_assertion_result.cpp @@ -1,12 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/catch_assertion_result.hpp> #include <catch2/internal/catch_reusable_string_stream.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> namespace Catch { @@ -26,9 +27,9 @@ namespace Catch { return reconstructedExpression; } - AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) + AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData&& data ) : m_info( info ), - m_resultData( data ) + m_resultData( CATCH_MOVE(data) ) {} // Result was a success @@ -67,16 +68,15 @@ namespace Catch { } std::string AssertionResult::getExpressionInMacro() const { - std::string expr; - if( m_info.macroName.empty() ) - expr = static_cast<std::string>(m_info.capturedExpression); - else { - expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); - expr += m_info.macroName; - expr += "( "; - expr += m_info.capturedExpression; - expr += " )"; + if ( m_info.macroName.empty() ) { + return static_cast<std::string>( m_info.capturedExpression ); } + std::string expr; + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + expr += " )"; return expr; } diff --git a/packages/Catch2/src/catch2/catch_assertion_result.hpp b/packages/Catch2/src/catch2/catch_assertion_result.hpp index 3008664c212b3e0cec06a8be23041d4ad7b624dc..48882876bca261e5127fe36ea7354ab4985032cc 100644 --- a/packages/Catch2/src/catch2/catch_assertion_result.hpp +++ b/packages/Catch2/src/catch2/catch_assertion_result.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -35,7 +35,7 @@ namespace Catch { class AssertionResult { public: AssertionResult() = delete; - AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); + AssertionResult( AssertionInfo const& info, AssertionResultData&& data ); bool isOk() const; bool succeeded() const; diff --git a/packages/Catch2/src/catch2/catch_config.cpp b/packages/Catch2/src/catch2/catch_config.cpp index 4cb3627db542a2da243b7deb7673a702be3c76ae..34f50f1751634af0c66b0308bf9dfddfe577a2b2 100644 --- a/packages/Catch2/src/catch2/catch_config.cpp +++ b/packages/Catch2/src/catch2/catch_config.cpp @@ -1,45 +1,88 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/catch_config.hpp> #include <catch2/catch_user_config.hpp> #include <catch2/internal/catch_enforce.hpp> -#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_parse_numbers.hpp> +#include <catch2/internal/catch_stdstreams.hpp> #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <catch2/internal/catch_test_spec_parser.hpp> #include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp> +#include <catch2/internal/catch_getenv.hpp> -namespace { - bool provideBazelReporterOutput() { -#if defined(CATCH_CONFIG_BAZEL_SUPPORT) - return true; -#elif defined(CATCH_PLATFORM_WINDOWS_UWP) - // UWP does not support environment variables - return false; +#include <fstream> + +namespace Catch { + + namespace { + static bool enableBazelEnvSupport() { +#if defined( CATCH_CONFIG_BAZEL_SUPPORT ) + return true; #else + return Detail::getEnv( "BAZEL_TEST" ) != nullptr; +#endif + } -# if defined( _MSC_VER ) - // On Windows getenv throws a warning as there is no input validation, - // since the switch is hardcoded, this should not be an issue. -# pragma warning( push ) -# pragma warning( disable : 4996 ) -# endif + struct bazelShardingOptions { + unsigned int shardIndex, shardCount; + std::string shardFilePath; + }; + + static Optional<bazelShardingOptions> readBazelShardingOptions() { + const auto bazelShardIndex = Detail::getEnv( "TEST_SHARD_INDEX" ); + const auto bazelShardTotal = Detail::getEnv( "TEST_TOTAL_SHARDS" ); + const auto bazelShardInfoFile = Detail::getEnv( "TEST_SHARD_STATUS_FILE" ); + + + const bool has_all = + bazelShardIndex && bazelShardTotal && bazelShardInfoFile; + if ( !has_all ) { + // We provide nice warning message if the input is + // misconfigured. + auto warn = []( const char* env_var ) { + Catch::cerr() + << "Warning: Bazel shard configuration is missing '" + << env_var << "'. Shard configuration is skipped.\n"; + }; + if ( !bazelShardIndex ) { + warn( "TEST_SHARD_INDEX" ); + } + if ( !bazelShardTotal ) { + warn( "TEST_TOTAL_SHARDS" ); + } + if ( !bazelShardInfoFile ) { + warn( "TEST_SHARD_STATUS_FILE" ); + } + return {}; + } - return std::getenv( "BAZEL_TEST" ) != nullptr; + auto shardIndex = parseUInt( bazelShardIndex ); + if ( !shardIndex ) { + Catch::cerr() + << "Warning: could not parse 'TEST_SHARD_INDEX' ('" << bazelShardIndex + << "') as unsigned int.\n"; + return {}; + } + auto shardTotal = parseUInt( bazelShardTotal ); + if ( !shardTotal ) { + Catch::cerr() + << "Warning: could not parse 'TEST_TOTAL_SHARD' ('" + << bazelShardTotal << "') as unsigned int.\n"; + return {}; + } -# if defined( _MSC_VER ) -# pragma warning( pop ) -# endif -#endif - } -} + return bazelShardingOptions{ + *shardIndex, *shardTotal, bazelShardInfoFile }; + + } + } // end namespace -namespace Catch { bool operator==( ProcessedReporterSpec const& lhs, ProcessedReporterSpec const& rhs ) { @@ -62,18 +105,7 @@ namespace Catch { elem = trim(elem); } - - TestSpecParser parser(ITagAliasRegistry::get()); - if (!m_data.testsOrTags.empty()) { - m_hasTestFilters = true; - for (auto const& testOrTags : m_data.testsOrTags) { - parser.parse(testOrTags); - } - } - m_testSpec = parser.testSpec(); - - - // Insert the default reporter if user hasn't asked for a specfic one + // Insert the default reporter if user hasn't asked for a specific one if ( m_data.reporterSpecifications.empty() ) { m_data.reporterSpecifications.push_back( { #if defined( CATCH_CONFIG_DEFAULT_REPORTER ) @@ -85,29 +117,21 @@ namespace Catch { } ); } -#if !defined(CATCH_PLATFORM_WINDOWS_UWP) - if(provideBazelReporterOutput()){ - // Register a JUnit reporter for Bazel. Bazel sets an environment - // variable with the path to XML output. If this file is written to - // during test, Bazel will not generate a default XML output. - // This allows the XML output file to contain higher level of detail - // than what is possible otherwise. -# if defined( _MSC_VER ) - // On Windows getenv throws a warning as there is no input validation, - // since the key is hardcoded, this should not be an issue. -# pragma warning( push ) -# pragma warning( disable : 4996 ) -# endif - const auto bazelOutputFilePtr = std::getenv( "XML_OUTPUT_FILE" ); -# if defined( _MSC_VER ) -# pragma warning( pop ) -# endif - if ( bazelOutputFilePtr != nullptr ) { - m_data.reporterSpecifications.push_back( - { "junit", std::string( bazelOutputFilePtr ), {}, {} } ); + if ( enableBazelEnvSupport() ) { + readBazelEnvVars(); + } + + // Bazel support can modify the test specs, so parsing has to happen + // after reading Bazel env vars. + TestSpecParser parser( ITagAliasRegistry::get() ); + if ( !m_data.testsOrTags.empty() ) { + m_hasTestFilters = true; + for ( auto const& testOrTags : m_data.testsOrTags ) { + parser.parse( testOrTags ); } - } -#endif + } + m_testSpec = parser.testSpec(); + // We now fixup the reporter specs to handle default output spec, // default colour spec, etc @@ -187,4 +211,37 @@ namespace Catch { unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; } std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); } + void Config::readBazelEnvVars() { + // Register a JUnit reporter for Bazel. Bazel sets an environment + // variable with the path to XML output. If this file is written to + // during test, Bazel will not generate a default XML output. + // This allows the XML output file to contain higher level of detail + // than what is possible otherwise. + const auto bazelOutputFile = Detail::getEnv( "XML_OUTPUT_FILE" ); + + if ( bazelOutputFile ) { + m_data.reporterSpecifications.push_back( + { "junit", std::string( bazelOutputFile ), {}, {} } ); + } + + const auto bazelTestSpec = Detail::getEnv( "TESTBRIDGE_TEST_ONLY" ); + if ( bazelTestSpec ) { + // Presumably the test spec from environment should overwrite + // the one we got from CLI (if we got any) + m_data.testsOrTags.clear(); + m_data.testsOrTags.push_back( bazelTestSpec ); + } + + const auto bazelShardOptions = readBazelShardingOptions(); + if ( bazelShardOptions ) { + std::ofstream f( bazelShardOptions->shardFilePath, + std::ios_base::out | std::ios_base::trunc ); + if ( f.is_open() ) { + f << ""; + m_data.shardIndex = bazelShardOptions->shardIndex; + m_data.shardCount = bazelShardOptions->shardCount; + } + } + } + } // end namespace Catch diff --git a/packages/Catch2/src/catch2/catch_config.hpp b/packages/Catch2/src/catch2/catch_config.hpp index 10df4d64ad5c313f106860205285b604e89d0aa0..784de4aa5bbc6361503e2637574463055fd44810 100644 --- a/packages/Catch2/src/catch2/catch_config.hpp +++ b/packages/Catch2/src/catch2/catch_config.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -140,6 +140,9 @@ namespace Catch { std::chrono::milliseconds benchmarkWarmupTime() const override; private: + // Reads Bazel env vars and applies them to the config + void readBazelEnvVars(); + ConfigData m_data; std::vector<ProcessedReporterSpec> m_processedReporterSpecs; TestSpec m_testSpec; diff --git a/packages/Catch2/src/catch2/catch_get_random_seed.cpp b/packages/Catch2/src/catch2/catch_get_random_seed.cpp index 12a5b6d8c20cfe884a673933c9797217de76ac78..b12251684095436cb4807239aa269c8c4078970c 100644 --- a/packages/Catch2/src/catch2/catch_get_random_seed.cpp +++ b/packages/Catch2/src/catch2/catch_get_random_seed.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_get_random_seed.hpp b/packages/Catch2/src/catch2/catch_get_random_seed.hpp index 6df3c3a006b578a2fd8fa3be33467554144b17ce..3ab2a4a1c268818f14470e4c4ef1f900049d175a 100644 --- a/packages/Catch2/src/catch2/catch_get_random_seed.hpp +++ b/packages/Catch2/src/catch2/catch_get_random_seed.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_message.cpp b/packages/Catch2/src/catch2/catch_message.cpp index 2ad4aea37ba0ad165c778fb3714306474d63ab59..384f180e55a8a663bcf493d021b63459d3de6165 100644 --- a/packages/Catch2/src/catch2/catch_message.cpp +++ b/packages/Catch2/src/catch2/catch_message.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -19,8 +19,8 @@ namespace Catch { //////////////////////////////////////////////////////////////////////////// - ScopedMessage::ScopedMessage( MessageBuilder const& builder ): - m_info( builder.m_info ) { + ScopedMessage::ScopedMessage( MessageBuilder&& builder ): + m_info( CATCH_MOVE(builder.m_info) ) { m_info.message = builder.m_stream.str(); getResultCapture().pushScopedMessage( m_info ); } @@ -37,7 +37,11 @@ namespace Catch { } - Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { + Capturer::Capturer( StringRef macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType resultType, + StringRef names ): + m_resultCapture( getResultCapture() ) { auto trimmed = [&] (size_t start, size_t end) { while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) { ++start; diff --git a/packages/Catch2/src/catch2/catch_message.hpp b/packages/Catch2/src/catch2/catch_message.hpp index dac7a21d08cf6496fe7f9d4c147328eb1157608f..b348ac87026143447a4b9cd5b02b991949356e0d 100644 --- a/packages/Catch2/src/catch2/catch_message.hpp +++ b/packages/Catch2/src/catch2/catch_message.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -12,7 +12,6 @@ #include <catch2/internal/catch_reusable_string_stream.hpp> #include <catch2/internal/catch_stream_end_stop.hpp> #include <catch2/internal/catch_message_info.hpp> -#include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/catch_tostring.hpp> #include <string> @@ -21,6 +20,7 @@ namespace Catch { struct SourceLineInfo; + class IResultCapture; struct MessageStream { @@ -39,11 +39,10 @@ namespace Catch { ResultWas::OfType type ): m_info(macroName, lineInfo, type) {} - template<typename T> - MessageBuilder& operator << ( T const& value ) { + MessageBuilder&& operator << ( T const& value ) && { m_stream << value; - return *this; + return CATCH_MOVE(*this); } MessageInfo m_info; @@ -51,7 +50,7 @@ namespace Catch { class ScopedMessage { public: - explicit ScopedMessage( MessageBuilder const& builder ); + explicit ScopedMessage( MessageBuilder&& builder ); ScopedMessage( ScopedMessage& duplicate ) = delete; ScopedMessage( ScopedMessage&& old ) noexcept; ~ScopedMessage(); @@ -62,7 +61,7 @@ namespace Catch { class Capturer { std::vector<MessageInfo> m_messages; - IResultCapture& m_resultCapture = getResultCapture(); + IResultCapture& m_resultCapture; size_t m_captured = 0; public: Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ); @@ -98,12 +97,15 @@ namespace Catch { /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \ - Catch::Capturer varName( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \ + Catch::Capturer varName( macroName##_catch_sr, \ + CATCH_INTERNAL_LINEINFO, \ + Catch::ResultWas::Info, \ + #__VA_ARGS__##_catch_sr ); \ varName.captureValues( 0, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_INFO( macroName, log ) \ - Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) + const Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \ diff --git a/packages/Catch2/src/catch2/catch_registry_hub.cpp b/packages/Catch2/src/catch2/catch_registry_hub.cpp index 1fca78fb7fa16729353ce34315f6e932f347506e..8716db3a7d28ae88dde6e55c08e42c78dbbdff36 100644 --- a/packages/Catch2/src/catch2/catch_registry_hub.cpp +++ b/packages/Catch2/src/catch2/catch_registry_hub.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -20,6 +20,9 @@ #include <catch2/internal/catch_noncopyable.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_reporter_registry.hpp> + +#include <exception> namespace Catch { @@ -31,7 +34,7 @@ namespace Catch { public: // IRegistryHub RegistryHub() = default; - IReporterRegistry const& getReporterRegistry() const override { + ReporterRegistry const& getReporterRegistry() const override { return m_reporterRegistry; } ITestCaseRegistry const& getTestCaseRegistry() const override { diff --git a/packages/Catch2/src/catch2/catch_section_info.hpp b/packages/Catch2/src/catch2/catch_section_info.hpp index 1d206891d0d293dc9ec9b7c3de8851d0faa8859b..7de8441c5ff968c70fef59b76912a5efeab170f7 100644 --- a/packages/Catch2/src/catch2/catch_section_info.hpp +++ b/packages/Catch2/src/catch2/catch_section_info.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_session.cpp b/packages/Catch2/src/catch2/catch_session.cpp index df92559b58392c617c974114f8335b0008ae0bad..f1ed5f9cc55a03d0fd6a7afba2b461a60f8d0bf9 100644 --- a/packages/Catch2/src/catch2/catch_session.cpp +++ b/packages/Catch2/src/catch2/catch_session.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -13,13 +13,13 @@ #include <catch2/internal/catch_run_context.hpp> #include <catch2/catch_test_spec.hpp> #include <catch2/catch_version.hpp> -#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/internal/catch_startup_exception_registry.hpp> #include <catch2/internal/catch_sharding.hpp> +#include <catch2/internal/catch_test_case_registry_impl.hpp> #include <catch2/internal/catch_textflow.hpp> #include <catch2/internal/catch_windows_h_proxy.hpp> #include <catch2/reporters/catch_reporter_multi.hpp> -#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +#include <catch2/internal/catch_reporter_registry.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/internal/catch_stdstreams.hpp> @@ -27,6 +27,7 @@ #include <algorithm> #include <cassert> +#include <exception> #include <iomanip> #include <set> @@ -61,7 +62,6 @@ namespace Catch { multi->addListener(listener->create(config)); } - std::size_t reporterIdx = 0; for ( auto const& reporterSpec : config->getProcessedReporterSpecs() ) { multi->addReporter( createReporter( reporterSpec.name, @@ -69,7 +69,6 @@ namespace Catch { makeStream( reporterSpec.outputFilename ), reporterSpec.colourMode, reporterSpec.customOptions ) ) ); - reporterIdx++; } return multi; @@ -343,6 +342,12 @@ namespace Catch { return 2; } + if ( totals.testCases.total() > 0 && + totals.testCases.total() == totals.testCases.skipped + && !m_config->zeroTestsCountAsSuccess() ) { + return 4; + } + // Note that on unices only the lower 8 bits are usually used, clamping // the return value to 255 prevents false negative when some multiple // of 256 tests has failed diff --git a/packages/Catch2/src/catch2/catch_session.hpp b/packages/Catch2/src/catch2/catch_session.hpp index b2d3eb0bce288b7f1857d0a058c76cb27740e0bd..c1de6d5747f2f39322c95d14e89645cc9f962c54 100644 --- a/packages/Catch2/src/catch2/catch_session.hpp +++ b/packages/Catch2/src/catch2/catch_session.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_tag_alias.hpp b/packages/Catch2/src/catch2/catch_tag_alias.hpp index d566d70cb7025c2931a905830635fa57458cd746..dc91f21a7686e7937ecb992ba904128db718baa8 100644 --- a/packages/Catch2/src/catch2/catch_tag_alias.hpp +++ b/packages/Catch2/src/catch2/catch_tag_alias.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.cpp b/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.cpp index d3e10cb06df83ce2cb5219582be67d1ec5e8992a..9b6633a2f9f276f8edeed32f0caf5254b6cc0d0e 100644 --- a/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.cpp +++ b/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.hpp b/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.hpp index c742bcd3bc0f8f3d06b6fc6b60cae446e7403cad..9f80f72fd62827ed1a495d53a631edb7165f004d 100644 --- a/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.hpp +++ b/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_template_test_macros.hpp b/packages/Catch2/src/catch2/catch_template_test_macros.hpp index 66b1bc4de2d51251d52b84c8772256a93c09b50c..3baee517537155a972b8c59235ee1340e1d9a19b 100644 --- a/packages/Catch2/src/catch2/catch_template_test_macros.hpp +++ b/packages/Catch2/src/catch2/catch_template_test_macros.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_test_case_info.cpp b/packages/Catch2/src/catch2/catch_test_case_info.cpp index c1a0a4310aa474e2f2f77c51c6420178fa571ed6..e9dad57787036172a30deb088c8c6a2bea1c6883 100644 --- a/packages/Catch2/src/catch2/catch_test_case_info.cpp +++ b/packages/Catch2/src/catch2/catch_test_case_info.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -139,12 +139,20 @@ namespace Catch { for (size_t idx = 0; idx < originalTags.size(); ++idx) { auto c = originalTags[idx]; if (c == '[') { - assert(!inTag); + CATCH_ENFORCE( + !inTag, + "Found '[' inside a tag while registering test case '" + << _nameAndTags.name << "' at " << _lineInfo ); + inTag = true; tagStart = idx; } if (c == ']') { - assert(inTag); + CATCH_ENFORCE( + inTag, + "Found unmatched ']' while registering test case '" + << _nameAndTags.name << "' at " << _lineInfo ); + inTag = false; tagEnd = idx; assert(tagStart < tagEnd); @@ -153,7 +161,11 @@ namespace Catch { // it over to backing storage and actually reference the // backing storage in the saved tags StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1); - CATCH_ENFORCE(!tagStr.empty(), "Empty tags are not allowed"); + CATCH_ENFORCE( !tagStr.empty(), + "Found an empty tag while registering test case '" + << _nameAndTags.name << "' at " + << _lineInfo ); + enforceNotReservedTag(tagStr, lineInfo); properties |= parseSpecialTag(tagStr); // When copying a tag to the backing storage, we need to @@ -167,8 +179,12 @@ namespace Catch { // the tags. internalAppendTag(tagStr); } - (void)inTag; // Silence "set-but-unused" warning in release mode. } + CATCH_ENFORCE( !inTag, + "Found an unclosed tag while registering test case '" + << _nameAndTags.name << "' at " << _lineInfo ); + + // Add [.] if relevant if (isHidden()) { internalAppendTag("."_sr); diff --git a/packages/Catch2/src/catch2/catch_test_case_info.hpp b/packages/Catch2/src/catch2/catch_test_case_info.hpp index 6cfc2aaf99b8863d8e6e66e4f4f4210e78e9ef76..5ff3e3e7207e3002a69516fddb34f77f889afa99 100644 --- a/packages/Catch2/src/catch2/catch_test_case_info.hpp +++ b/packages/Catch2/src/catch2/catch_test_case_info.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -15,6 +15,7 @@ #include <catch2/internal/catch_unique_ptr.hpp> +#include <cstdint> #include <string> #include <vector> diff --git a/packages/Catch2/src/catch2/catch_test_macros.hpp b/packages/Catch2/src/catch2/catch_test_macros.hpp index e92a45f0fa9dade729354ffb6185ad54a957e1c1..1088afbedd8b2590ccc55469c50db2185ac42ebd 100644 --- a/packages/Catch2/src/catch2/catch_test_macros.hpp +++ b/packages/Catch2/src/catch2/catch_test_macros.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -49,6 +49,7 @@ #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + #define CATCH_SKIP( ... ) INTERNAL_CATCH_MSG( "SKIP", Catch::ResultWas::ExplicitSkip, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) @@ -102,6 +103,7 @@ #define CATCH_FAIL( ... ) (void)(0) #define CATCH_FAIL_CHECK( ... ) (void)(0) #define CATCH_SUCCEED( ... ) (void)(0) + #define CATCH_SKIP( ... ) (void)(0) #define CATCH_STATIC_REQUIRE( ... ) (void)(0) #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) @@ -146,6 +148,7 @@ #define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) #define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + #define SKIP( ... ) INTERNAL_CATCH_MSG( "SKIP", Catch::ResultWas::ExplicitSkip, Catch::ResultDisposition::Normal, __VA_ARGS__ ) #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) @@ -198,6 +201,7 @@ #define FAIL( ... ) (void)(0) #define FAIL_CHECK( ... ) (void)(0) #define SUCCEED( ... ) (void)(0) + #define SKIP( ... ) (void)(0) #define STATIC_REQUIRE( ... ) (void)(0) #define STATIC_REQUIRE_FALSE( ... ) (void)(0) diff --git a/packages/Catch2/src/catch2/catch_test_spec.cpp b/packages/Catch2/src/catch2/catch_test_spec.cpp index a3235d432ff6635a2a3925ee691e06969bd9f8c9..f32f9864c2749c5bc3105384a9096404d4bb103d 100644 --- a/packages/Catch2/src/catch2/catch_test_spec.cpp +++ b/packages/Catch2/src/catch2/catch_test_spec.cpp @@ -1,17 +1,21 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/catch_test_spec.hpp> +#include <catch2/interfaces/catch_interfaces_testcase.hpp> +#include <catch2/internal/catch_test_case_registry_impl.hpp> +#include <catch2/internal/catch_reusable_string_stream.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <catch2/catch_test_case_info.hpp> #include <algorithm> #include <string> #include <vector> +#include <ostream> namespace Catch { @@ -35,6 +39,10 @@ namespace Catch { return m_wildcardPattern.matches( testCase.name ); } + void TestSpec::NamePattern::serializeTo( std::ostream& out ) const { + out << '"' << name() << '"'; + } + TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString ) : Pattern( filterString ) @@ -47,6 +55,10 @@ namespace Catch { Tag( m_tag ) ) != end( testCase.tags ); } + void TestSpec::TagPattern::serializeTo( std::ostream& out ) const { + out << name(); + } + bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { bool should_use = !testCase.isHidden(); for (auto const& pattern : m_required) { @@ -63,18 +75,31 @@ namespace Catch { return should_use; } - std::string TestSpec::Filter::name() const { - std::string name; - for (auto const& p : m_required) { - name += p->name(); + void TestSpec::Filter::serializeTo( std::ostream& out ) const { + bool first = true; + for ( auto const& pattern : m_required ) { + if ( !first ) { + out << ' '; + } + out << *pattern; + first = false; } - for (auto const& p : m_forbidden) { - name += p->name(); + for ( auto const& pattern : m_forbidden ) { + if ( !first ) { + out << ' '; + } + out << *pattern; + first = false; } - return name; } + std::string TestSpec::extractFilterName( Filter const& filter ) { + Catch::ReusableStringStream sstr; + sstr << filter; + return sstr.str(); + } + bool TestSpec::hasFilters() const { return !m_filters.empty(); } @@ -83,16 +108,18 @@ namespace Catch { return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } ); } - TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const - { - Matches matches( m_filters.size() ); - std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){ + TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const { + Matches matches; + matches.reserve( m_filters.size() ); + for ( auto const& filter : m_filters ) { std::vector<TestCaseHandle const*> currentMatches; - for( auto const& test : testCases ) - if( isThrowSafe( test, config ) && filter.matches( test.getTestCaseInfo() ) ) + for ( auto const& test : testCases ) + if ( isThrowSafe( test, config ) && + filter.matches( test.getTestCaseInfo() ) ) currentMatches.emplace_back( &test ); - return FilterMatch{ filter.name(), currentMatches }; - } ); + matches.push_back( + FilterMatch{ extractFilterName( filter ), currentMatches } ); + } return matches; } @@ -100,4 +127,15 @@ namespace Catch { return m_invalidSpecs; } + void TestSpec::serializeTo( std::ostream& out ) const { + bool first = true; + for ( auto const& filter : m_filters ) { + if ( !first ) { + out << ','; + } + out << filter; + first = false; + } + } + } diff --git a/packages/Catch2/src/catch2/catch_test_spec.hpp b/packages/Catch2/src/catch2/catch_test_spec.hpp index 499bfaa56c800b92cfab0b757142417aa7be051b..f12baa636edaa9ae598c4c9db1455f59d7015c6c 100644 --- a/packages/Catch2/src/catch2/catch_test_spec.hpp +++ b/packages/Catch2/src/catch2/catch_test_spec.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -16,6 +16,7 @@ #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/internal/catch_wildcard_pattern.hpp> +#include <iosfwd> #include <string> #include <vector> @@ -34,6 +35,14 @@ namespace Catch { virtual bool matches( TestCaseInfo const& testCase ) const = 0; std::string const& name() const; private: + virtual void serializeTo( std::ostream& out ) const = 0; + // Writes string that would be reparsed into the pattern + friend std::ostream& operator<<(std::ostream& out, + Pattern const& pattern) { + pattern.serializeTo( out ); + return out; + } + std::string const m_name; }; @@ -42,6 +51,8 @@ namespace Catch { explicit NamePattern( std::string const& name, std::string const& filterString ); bool matches( TestCaseInfo const& testCase ) const override; private: + void serializeTo( std::ostream& out ) const override; + WildcardPattern m_wildcardPattern; }; @@ -50,6 +61,8 @@ namespace Catch { explicit TagPattern( std::string const& tag, std::string const& filterString ); bool matches( TestCaseInfo const& testCase ) const override; private: + void serializeTo( std::ostream& out ) const override; + std::string m_tag; }; @@ -57,10 +70,19 @@ namespace Catch { std::vector<Detail::unique_ptr<Pattern>> m_required; std::vector<Detail::unique_ptr<Pattern>> m_forbidden; + //! Serializes this filter into a string that would be parsed into + //! an equivalent filter + void serializeTo( std::ostream& out ) const; + friend std::ostream& operator<<(std::ostream& out, Filter const& f) { + f.serializeTo( out ); + return out; + } + bool matches( TestCaseInfo const& testCase ) const; - std::string name() const; }; + static std::string extractFilterName( Filter const& filter ); + public: struct FilterMatch { std::string name; @@ -77,7 +99,16 @@ namespace Catch { private: std::vector<Filter> m_filters; std::vector<std::string> m_invalidSpecs; + friend class TestSpecParser; + //! Serializes this test spec into a string that would be parsed into + //! equivalent test spec + void serializeTo( std::ostream& out ) const; + friend std::ostream& operator<<(std::ostream& out, + TestSpec const& spec) { + spec.serializeTo( out ); + return out; + } }; } diff --git a/packages/Catch2/src/catch2/catch_timer.cpp b/packages/Catch2/src/catch2/catch_timer.cpp index d67d94ca6800a015e245a8aee78c275f6ed2e638..d75ea70c8b4892cca102c8a063edd3ee3e8f42d7 100644 --- a/packages/Catch2/src/catch2/catch_timer.cpp +++ b/packages/Catch2/src/catch2/catch_timer.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_timer.hpp b/packages/Catch2/src/catch2/catch_timer.hpp index 30e814150335c995238dbda9134736f70150e1b7..f42589ff1b06e8f7f209b63ebd2b598be3272fda 100644 --- a/packages/Catch2/src/catch2/catch_timer.hpp +++ b/packages/Catch2/src/catch2/catch_timer.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_tostring.cpp b/packages/Catch2/src/catch2/catch_tostring.cpp index 4c24234eef9f4222031193457a7722b51c75bc83..b97cf560dc0e7309f99e34090846293c27fc7ae1 100644 --- a/packages/Catch2/src/catch2/catch_tostring.cpp +++ b/packages/Catch2/src/catch2/catch_tostring.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_tostring.hpp b/packages/Catch2/src/catch2/catch_tostring.hpp index 964c8a665e8928d0f8737551d32510b21877f8d4..788d824c899d4f5a7d66081d08a302f8f3b02908 100644 --- a/packages/Catch2/src/catch2/catch_tostring.hpp +++ b/packages/Catch2/src/catch2/catch_tostring.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -13,7 +13,6 @@ #include <cstddef> #include <type_traits> #include <string> -#include <string.h> #include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_config_wchar.hpp> @@ -41,6 +40,13 @@ namespace Catch { namespace Detail { + inline std::size_t catch_strnlen(const char *str, std::size_t n) { + auto ret = std::char_traits<char>::find(str, n, '\0'); + if (ret != nullptr) { + return static_cast<std::size_t>(ret - str); + } + return n; + } constexpr StringRef unprintableString = "{?}"_sr; @@ -110,7 +116,6 @@ namespace Catch { } // namespace Detail - // If we decide for C++14, change these to enable_if_ts template <typename T, typename = void> struct StringMaker { template <typename Fake = T> @@ -208,28 +213,24 @@ namespace Catch { template<size_t SZ> struct StringMaker<char[SZ]> { static std::string convert(char const* str) { - // Note that `strnlen` is not actually part of standard C++, - // but both POSIX and Windows cstdlib provide it. return Detail::convertIntoString( - StringRef( str, strnlen( str, SZ ) ) ); + StringRef( str, Detail::catch_strnlen( str, SZ ) ) ); } }; template<size_t SZ> struct StringMaker<signed char[SZ]> { static std::string convert(signed char const* str) { - // See the plain `char const*` overload auto reinterpreted = reinterpret_cast<char const*>(str); return Detail::convertIntoString( - StringRef(reinterpreted, strnlen(reinterpreted, SZ))); + StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ))); } }; template<size_t SZ> struct StringMaker<unsigned char[SZ]> { static std::string convert(unsigned char const* str) { - // See the plain `char const*` overload auto reinterpreted = reinterpret_cast<char const*>(str); return Detail::convertIntoString( - StringRef(reinterpreted, strnlen(reinterpreted, SZ))); + StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ))); } }; @@ -296,13 +297,13 @@ namespace Catch { template<> struct StringMaker<float> { static std::string convert(float value); - static int precision; + CATCH_EXPORT static int precision; }; template<> struct StringMaker<double> { static std::string convert(double value); - static int precision; + CATCH_EXPORT static int precision; }; template <typename T> diff --git a/packages/Catch2/src/catch2/catch_totals.cpp b/packages/Catch2/src/catch2/catch_totals.cpp index 14a23869dfd1eb1f670850901de5f20ec04b6e02..bd1954fb9e38e6b9f3fd52f882be0ac6520af7a1 100644 --- a/packages/Catch2/src/catch2/catch_totals.cpp +++ b/packages/Catch2/src/catch2/catch_totals.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -14,6 +14,7 @@ namespace Catch { diff.passed = passed - other.passed; diff.failed = failed - other.failed; diff.failedButOk = failedButOk - other.failedButOk; + diff.skipped = skipped - other.skipped; return diff; } @@ -21,14 +22,15 @@ namespace Catch { passed += other.passed; failed += other.failed; failedButOk += other.failedButOk; + skipped += other.skipped; return *this; } std::uint64_t Counts::total() const { - return passed + failed + failedButOk; + return passed + failed + failedButOk + skipped; } bool Counts::allPassed() const { - return failed == 0 && failedButOk == 0; + return failed == 0 && failedButOk == 0 && skipped == 0; } bool Counts::allOk() const { return failed == 0; @@ -53,6 +55,8 @@ namespace Catch { ++diff.testCases.failed; else if( diff.assertions.failedButOk > 0 ) ++diff.testCases.failedButOk; + else if ( diff.assertions.skipped > 0 ) + ++ diff.testCases.skipped; else ++diff.testCases.passed; return diff; diff --git a/packages/Catch2/src/catch2/catch_totals.hpp b/packages/Catch2/src/catch2/catch_totals.hpp index 6bc444fc2f547ee2aa8fd07a0335915e293df9cb..386392c91f0b4d3486f7dfc324cbecddd4733973 100644 --- a/packages/Catch2/src/catch2/catch_totals.hpp +++ b/packages/Catch2/src/catch2/catch_totals.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -23,6 +23,7 @@ namespace Catch { std::uint64_t passed = 0; std::uint64_t failed = 0; std::uint64_t failedButOk = 0; + std::uint64_t skipped = 0; }; struct Totals { diff --git a/packages/Catch2/src/catch2/catch_translate_exception.cpp b/packages/Catch2/src/catch2/catch_translate_exception.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c4b289449c9a5afc4618b1b3e4828f04a19f48e9 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_translate_exception.cpp @@ -0,0 +1,20 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_translate_exception.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + +namespace Catch { + namespace Detail { + void registerTranslatorImpl( + Detail::unique_ptr<IExceptionTranslator>&& translator ) { + getMutableRegistryHub().registerTranslator( + CATCH_MOVE( translator ) ); + } + } // namespace Detail +} // namespace Catch diff --git a/packages/Catch2/src/catch2/catch_translate_exception.hpp b/packages/Catch2/src/catch2/catch_translate_exception.hpp index 4a0be629da9ed63fc8be0124365512ca63ac225d..5a4dc5e376e79451817e03a6a85ddfef3fd66f71 100644 --- a/packages/Catch2/src/catch2/catch_translate_exception.hpp +++ b/packages/Catch2/src/catch2/catch_translate_exception.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -15,6 +15,10 @@ #include <exception> namespace Catch { + namespace Detail { + void registerTranslatorImpl( + Detail::unique_ptr<IExceptionTranslator>&& translator ); + } class ExceptionTranslatorRegistrar { template<typename T> @@ -48,9 +52,9 @@ namespace Catch { public: template<typename T> ExceptionTranslatorRegistrar( std::string(*translateFunction)( T const& ) ) { - getMutableRegistryHub().registerTranslator( - Detail::make_unique<ExceptionTranslator<T>>(translateFunction) - ); + Detail::registerTranslatorImpl( + Detail::make_unique<ExceptionTranslator<T>>( + translateFunction ) ); } }; diff --git a/packages/Catch2/src/catch2/catch_user_config.hpp.in b/packages/Catch2/src/catch2/catch_user_config.hpp.in index 77c94291cd8d2117efadbee7c02d041d22754291..11ab5a6d1aae25ca516859f84c6b46242d28fb39 100644 --- a/packages/Catch2/src/catch2/catch_user_config.hpp.in +++ b/packages/Catch2/src/catch2/catch_user_config.hpp.in @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -130,6 +130,16 @@ +#cmakedefine CATCH_CONFIG_GETENV +#cmakedefine CATCH_CONFIG_NO_GETENV + +#if defined( CATCH_CONFIG_GETENV ) && \ + defined( CATCH_CONFIG_NO_GETENV ) +# error Cannot force GETENV to both ON and OFF +#endif + + + #cmakedefine CATCH_CONFIG_USE_ASYNC #cmakedefine CATCH_CONFIG_NO_USE_ASYNC @@ -159,9 +169,18 @@ #endif +#cmakedefine CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT +#cmakedefine CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT + +#if defined( CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT ) && \ + defined( CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT ) +# error Cannot force STATIC_ANALYSIS_SUPPORT to both ON and OFF +#endif + + // ------ // Simple toggle defines -// their value is never used and they cannot be overriden +// their value is never used and they cannot be overridden // ------ @@ -181,6 +200,8 @@ #cmakedefine CATCH_CONFIG_PREFIX_ALL #cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG +#cmakedefine CATCH_CONFIG_SHARED_LIBRARY + // ------ // "Variable" defines, these have actual values diff --git a/packages/Catch2/src/catch2/catch_version.cpp b/packages/Catch2/src/catch2/catch_version.cpp index a7075f3006e09e2946e75515f0c7a77d4e74fdc2..19cab91b3db63f719726c752c85eab12f1380e38 100644 --- a/packages/Catch2/src/catch2/catch_version.cpp +++ b/packages/Catch2/src/catch2/catch_version.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -36,7 +36,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 3, 1, 0, "", 0 ); + static Version version( 3, 3, 2, "", 0 ); return version; } diff --git a/packages/Catch2/src/catch2/catch_version.hpp b/packages/Catch2/src/catch2/catch_version.hpp index 1f64d163760e4c889d701ea04a197dd03fe2e7cd..af698fad5fe5b3be29f5834183da9fa033ebafb9 100644 --- a/packages/Catch2/src/catch2/catch_version.hpp +++ b/packages/Catch2/src/catch2/catch_version.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/catch_version_macros.hpp b/packages/Catch2/src/catch2/catch_version_macros.hpp index c7212e3a6ad22e86bbaef94ffda018ba1f6b0f19..9ece85051120b099f0f70b1e217243f3cb15c320 100644 --- a/packages/Catch2/src/catch2/catch_version_macros.hpp +++ b/packages/Catch2/src/catch2/catch_version_macros.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -9,7 +9,7 @@ #define CATCH_VERSION_MACROS_HPP_INCLUDED #define CATCH_VERSION_MAJOR 3 -#define CATCH_VERSION_MINOR 1 -#define CATCH_VERSION_PATCH 0 +#define CATCH_VERSION_MINOR 3 +#define CATCH_VERSION_PATCH 2 #endif // CATCH_VERSION_MACROS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/catch_generator_exception.cpp b/packages/Catch2/src/catch2/generators/catch_generator_exception.cpp index 70a991e3c8c43217b72fb9ea38f627441293dee3..64324039267435cea79ace2dee7c439520121590 100644 --- a/packages/Catch2/src/catch2/generators/catch_generator_exception.cpp +++ b/packages/Catch2/src/catch2/generators/catch_generator_exception.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/generators/catch_generator_exception.hpp b/packages/Catch2/src/catch2/generators/catch_generator_exception.hpp index a049452cd2c75ac1759c9faa7340752e48641294..f353042eb562b918a3eb73e7c7cd5ec4be0846c5 100644 --- a/packages/Catch2/src/catch2/generators/catch_generator_exception.hpp +++ b/packages/Catch2/src/catch2/generators/catch_generator_exception.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/generators/catch_generators.cpp b/packages/Catch2/src/catch2/generators/catch_generators.cpp index 3e09bfd9ebe7844c9999e24743e650594d0195bd..3514e9f63218189823b67de89873a2acc917008f 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators.cpp +++ b/packages/Catch2/src/catch2/generators/catch_generators.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -27,9 +27,16 @@ namespace Detail { GeneratorUntypedBase::~GeneratorUntypedBase() = default; - auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + IGeneratorTracker* acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) { return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); } + IGeneratorTracker* createGeneratorTracker( StringRef generatorName, + SourceLineInfo lineInfo, + GeneratorBasePtr&& generator ) { + return getResultCapture().createGeneratorTracker( + generatorName, lineInfo, CATCH_MOVE( generator ) ); + } + } // namespace Generators } // namespace Catch diff --git a/packages/Catch2/src/catch2/generators/catch_generators.hpp b/packages/Catch2/src/catch2/generators/catch_generators.hpp index 1de04e3bddad492c78d8c54c22378b00168f4b92..117f190193ce241e11cf17a3c1ebfd78b3ededb9 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators.hpp +++ b/packages/Catch2/src/catch2/generators/catch_generators.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -14,7 +14,6 @@ #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/internal/catch_unique_name.hpp> -#include <catch2/internal/catch_preprocessor.hpp> #include <vector> #include <tuple> @@ -204,37 +203,47 @@ namespace Detail { return makeGenerators( value( T( CATCH_FORWARD( val ) ) ), CATCH_FORWARD( moreGenerators )... ); } - auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; + IGeneratorTracker* acquireGeneratorTracker( StringRef generatorName, + SourceLineInfo const& lineInfo ); + IGeneratorTracker* createGeneratorTracker( StringRef generatorName, + SourceLineInfo lineInfo, + GeneratorBasePtr&& generator ); template<typename L> - // Note: The type after -> is weird, because VS2015 cannot parse - // the expression used in the typedef inside, when it is in - // return type. Yeah. - auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) { + auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> typename decltype(generatorExpression())::type { using UnderlyingType = typename decltype(generatorExpression())::type; - IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo ); - if (!tracker.hasGenerator()) { - tracker.setGenerator(Catch::Detail::make_unique<Generators<UnderlyingType>>(generatorExpression())); + IGeneratorTracker* tracker = acquireGeneratorTracker( generatorName, lineInfo ); + // Creation of tracker is delayed after generator creation, so + // that constructing generator can fail without breaking everything. + if (!tracker) { + tracker = createGeneratorTracker( + generatorName, + lineInfo, + Catch::Detail::make_unique<Generators<UnderlyingType>>( + generatorExpression() ) ); } - auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() ); + auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker->getGenerator() ); return generator.get(); } } // namespace Generators } // namespace Catch +#define CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL( ... ) #__VA_ARGS__##_catch_sr +#define CATCH_INTERNAL_GENERATOR_STRINGIZE(...) CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL(__VA_ARGS__) + #define GENERATE( ... ) \ - Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ CATCH_INTERNAL_LINEINFO, \ [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_COPY( ... ) \ - Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ CATCH_INTERNAL_LINEINFO, \ [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_REF( ... ) \ - Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ CATCH_INTERNAL_LINEINFO, \ [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) diff --git a/packages/Catch2/src/catch2/generators/catch_generators_adapters.hpp b/packages/Catch2/src/catch2/generators/catch_generators_adapters.hpp index c55a3962538b0335bdd6ce1df8570f8f312e499c..d5fc1e12ad3eeb56d07bd0157760d00abe02262f 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators_adapters.hpp +++ b/packages/Catch2/src/catch2/generators/catch_generators_adapters.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/generators/catch_generators_all.hpp b/packages/Catch2/src/catch2/generators/catch_generators_all.hpp index 845e6516d72859016184be5e71bcae302f7a0d8f..c12d314e83840d386faa3bb23718dff3e9c9fed0 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators_all.hpp +++ b/packages/Catch2/src/catch2/generators/catch_generators_all.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/generators/catch_generators_random.cpp b/packages/Catch2/src/catch2/generators/catch_generators_random.cpp index 57ad174553692589a416d2603422269cf8b34b85..2e3390fdfca69fa312abef527ab2b9662a25f5b1 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators_random.cpp +++ b/packages/Catch2/src/catch2/generators/catch_generators_random.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/generators/catch_generators_random.hpp b/packages/Catch2/src/catch2/generators/catch_generators_random.hpp index e9ff92084d2df15a9fa5f9b665233efa12b73c99..bcd4888dc3d3e6bdb94113309429290f897e8626 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators_random.hpp +++ b/packages/Catch2/src/catch2/generators/catch_generators_random.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/generators/catch_generators_range.hpp b/packages/Catch2/src/catch2/generators/catch_generators_range.hpp index 054af15d546891e03bde83eb0d7b143e5ebab3af..495acb9509b1e616014184da18f447f6073fcfc2 100644 --- a/packages/Catch2/src/catch2/generators/catch_generators_range.hpp +++ b/packages/Catch2/src/catch2/generators/catch_generators_range.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_all.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_all.hpp index 2960bf6763b11f06567a2ff35002fd4233ba0c05..a99fdcdc91493cef73f0230ab7942e85db1b79f5 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_all.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_all.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -30,8 +30,8 @@ #include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> -#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> #include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp> +#include <catch2/interfaces/catch_interfaces_test_invoker.hpp> #include <catch2/interfaces/catch_interfaces_testcase.hpp> #endif // CATCH_INTERFACES_ALL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.cpp index fb98a75d8baec0ed7a3ce8e806310f3387028a81..9b40ee5d696a6e2d6a28612aa682b06fa8bf2ec9 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp index 6981e724bcdf978387acf83f5114a648ecfbf0cb..a1876a4cad8abf6ef5073829ab3de2fa32891f84 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -13,6 +13,8 @@ #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_result_type.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp> namespace Catch { @@ -30,19 +32,31 @@ namespace Catch { class IGeneratorTracker; struct BenchmarkInfo; - template <typename Duration = std::chrono::duration<double, std::nano>> - struct BenchmarkStats; + + namespace Generators { + class GeneratorUntypedBase; + using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>; + } + class IResultCapture { public: virtual ~IResultCapture(); - virtual bool sectionStarted( SectionInfo const& sectionInfo, - Counts& assertions ) = 0; - virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; - virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; - - virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; + virtual void notifyAssertionStarted( AssertionInfo const& info ) = 0; + virtual bool sectionStarted( StringRef sectionName, + SourceLineInfo const& sectionLineInfo, + Counts& assertions ) = 0; + virtual void sectionEnded( SectionEndInfo&& endInfo ) = 0; + virtual void sectionEndedEarly( SectionEndInfo&& endInfo ) = 0; + + virtual IGeneratorTracker* + acquireGeneratorTracker( StringRef generatorName, + SourceLineInfo const& lineInfo ) = 0; + virtual IGeneratorTracker* + createGeneratorTracker( StringRef generatorName, + SourceLineInfo lineInfo, + Generators::GeneratorBasePtr&& generator ) = 0; virtual void benchmarkPreparing( StringRef name ) = 0; virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; @@ -52,7 +66,7 @@ namespace Catch { virtual void pushScopedMessage( MessageInfo const& message ) = 0; virtual void popScopedMessage( MessageInfo const& message ) = 0; - virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0; + virtual void emplaceUnscopedMessage( MessageBuilder&& builder ) = 0; virtual void handleFatalErrorCondition( StringRef message ) = 0; @@ -70,7 +84,7 @@ namespace Catch { AssertionReaction& reaction ) = 0; virtual void handleUnexpectedInflightException ( AssertionInfo const& info, - std::string const& message, + std::string&& message, AssertionReaction& reaction ) = 0; virtual void handleIncomplete ( AssertionInfo const& info ) = 0; diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.cpp index 13d761dfbf54624eade17ca1d00735d368861d66..655bc1b425e355451892d2da9824667969732fe8 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp index 5e358650a4dcdaeefb30f2aa52e46b25b47520b3..eb054805e0c8130cca7277c236e9fc157687ed79 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp index cf25d896eadba2be187f4f87d2f5d57c70184f24..38b052d906da35bc964d0d8fc3e05e1ce38027bd 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.cpp index f0de7450e1eed8fa9d96d8e83f6dbefb4dbe2828..44c272d2c6e6c8c0ca94217d24afc37442726765 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp index b72b49a105f8a1df80d1d6269a4caf8d7f21fbae..fcc2a8f9ce3671e054f542b92f0a46d6dd3110b2 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp @@ -1,14 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED #define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED -#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <string> diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp index e8c67b543a9ede7f9c5fac02695cf6c1d0c57129..e9fa5ddac2562f96d0867b8641781190320d245e 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp index 83e3d783a923fc3a5550fcb7e582de0be70e5ac5..d70cb593beb243cf7f627cc0d2162a19e0f7306d 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp index 557f7303731df86114939d457610d5068ff074bf..cd688a444847e320a49c0abaa36f07e43cb4a6b9 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp index 22e62b7967a4d1da04f33af7ca266cccc58eec9f..113f223e80422b711a5f10212824dea708b76326 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -19,7 +19,7 @@ namespace Catch { class ITestCaseRegistry; class IExceptionTranslatorRegistry; class IExceptionTranslator; - class IReporterRegistry; + class ReporterRegistry; class IReporterFactory; class ITagAliasRegistry; class ITestInvoker; @@ -35,7 +35,7 @@ namespace Catch { public: virtual ~IRegistryHub(); // = default - virtual IReporterRegistry const& getReporterRegistry() const = 0; + virtual ReporterRegistry const& getReporterRegistry() const = 0; virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0; diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp index b1ad584c148023995b7c8a5c50cbe9f15c8f8715..3274bcf50ebd03afd651b2778f90b2a296fe3f91 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -54,24 +54,21 @@ namespace Catch { infoMessages( _infoMessages ), totals( _totals ) { - assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression; - if( assertionResult.hasMessage() ) { // Copy message into messages list. // !TBD This should have been done earlier, somewhere MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); - builder << assertionResult.getMessage(); - builder.m_info.message = builder.m_stream.str(); + builder.m_info.message = static_cast<std::string>(assertionResult.getMessage()); - infoMessages.push_back( builder.m_info ); + infoMessages.push_back( CATCH_MOVE(builder.m_info) ); } } - SectionStats::SectionStats( SectionInfo const& _sectionInfo, + SectionStats::SectionStats( SectionInfo&& _sectionInfo, Counts const& _assertions, double _durationInSeconds, bool _missingAssertions ) - : sectionInfo( _sectionInfo ), + : sectionInfo( CATCH_MOVE(_sectionInfo) ), assertions( _assertions ), durationInSeconds( _durationInSeconds ), missingAssertions( _missingAssertions ) @@ -80,13 +77,13 @@ namespace Catch { TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, Totals const& _totals, - std::string const& _stdOut, - std::string const& _stdErr, + std::string&& _stdOut, + std::string&& _stdErr, bool _aborting ) : testInfo( &_testInfo ), totals( _totals ), - stdOut( _stdOut ), - stdErr( _stdErr ), + stdOut( CATCH_MOVE(_stdOut) ), + stdErr( CATCH_MOVE(_stdErr) ), aborting( _aborting ) {} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp index 421924385046ff1151c950cfd4f5411ca9884998..b40fce3128960bdfaed980d31d7cf1dedeff81d6 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -13,11 +13,10 @@ #include <catch2/catch_assertion_result.hpp> #include <catch2/internal/catch_message_info.hpp> #include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_test_run_info.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/internal/catch_move_and_forward.hpp> -#include <catch2/benchmark/catch_estimate.hpp> -#include <catch2/benchmark/catch_outlier_classification.hpp> - +#include <catch2/benchmark/detail/catch_benchmark_stats.hpp> #include <map> #include <string> @@ -57,11 +56,6 @@ namespace Catch { std::map<std::string, std::string> m_customOptions; }; - struct TestRunInfo { - constexpr TestRunInfo(StringRef _name) : name(_name) {} - StringRef name; - }; - struct AssertionStats { AssertionStats( AssertionResult const& _assertionResult, std::vector<MessageInfo> const& _infoMessages, @@ -78,7 +72,7 @@ namespace Catch { }; struct SectionStats { - SectionStats( SectionInfo const& _sectionInfo, + SectionStats( SectionInfo&& _sectionInfo, Counts const& _assertions, double _durationInSeconds, bool _missingAssertions ); @@ -92,8 +86,8 @@ namespace Catch { struct TestCaseStats { TestCaseStats( TestCaseInfo const& _testInfo, Totals const& _totals, - std::string const& _stdOut, - std::string const& _stdErr, + std::string&& _stdOut, + std::string&& _stdErr, bool _aborting ); TestCaseInfo const * testInfo; @@ -113,45 +107,6 @@ namespace Catch { bool aborting; }; - - struct BenchmarkInfo { - std::string name; - double estimatedDuration; - int iterations; - unsigned int samples; - unsigned int resamples; - double clockResolution; - double clockCost; - }; - - template <class Duration> - struct BenchmarkStats { - BenchmarkInfo info; - - std::vector<Duration> samples; - Benchmark::Estimate<Duration> mean; - Benchmark::Estimate<Duration> standardDeviation; - Benchmark::OutlierClassification outliers; - double outlierVariance; - - template <typename Duration2> - operator BenchmarkStats<Duration2>() const { - std::vector<Duration2> samples2; - samples2.reserve(samples.size()); - for (auto const& sample : samples) { - samples2.push_back(Duration2(sample)); - } - return { - info, - CATCH_MOVE(samples2), - mean, - standardDeviation, - outliers, - outlierVariance, - }; - } - }; - //! By setting up its preferences, a reporter can modify Catch2's behaviour //! in some regards, e.g. it can request Catch2 to capture writes to //! stdout/stderr during test execution, and pass them to the reporter. @@ -242,10 +197,15 @@ namespace Catch { */ virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; - //! Called with test cases that are skipped due to the test run aborting + /** + * Called with test cases that are skipped due to the test run aborting. + * NOT called for test cases that are explicitly skipped using the `SKIP` macro. + * + * Deprecated - will be removed in the next major release. + */ virtual void skipTest( TestCaseInfo const& testInfo ) = 0; - //! Called if a fatal error (signal/structured exception) occured + //! Called if a fatal error (signal/structured exception) occurred virtual void fatalErrorEncountered( StringRef error ) = 0; //! Writes out information about provided reporters using reporter-specific format diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp index 8732ed89a1efdc4c2e8595e446f8884311860d78..4fe992fa86bc5dbb142346866e2d9f0b84c93213 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp index 323edde26cdc79e3a039520934eab396504ed396..83ddd7bc387b141b716b1fe5fef252cc640348f5 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.cpp deleted file mode 100644 index bd38ac2886aa9317e157c4d1512c012af83c8fe7..0000000000000000000000000000000000000000 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// Copyright Catch2 Authors -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// https://www.boost.org/LICENSE_1_0.txt) - -// SPDX-License-Identifier: BSL-1.0 - -#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> - -namespace Catch { - IReporterRegistry::~IReporterRegistry() = default; -} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp deleted file mode 100644 index d2f2a1596bec8f68874184c0663933887458893c..0000000000000000000000000000000000000000 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp +++ /dev/null @@ -1,42 +0,0 @@ - -// Copyright Catch2 Authors -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// https://www.boost.org/LICENSE_1_0.txt) - -// SPDX-License-Identifier: BSL-1.0 -#ifndef CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED -#define CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED - -#include <catch2/internal/catch_case_insensitive_comparisons.hpp> -#include <catch2/internal/catch_unique_ptr.hpp> - -#include <string> -#include <vector> -#include <map> - -namespace Catch { - - class IConfig; - - class IEventListener; - using IEventListenerPtr = Detail::unique_ptr<IEventListener>; - class IReporterFactory; - using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; - struct ReporterConfig; - class EventListenerFactory; - - class IReporterRegistry { - public: - using FactoryMap = std::map<std::string, IReporterFactoryPtr, Detail::CaseInsensitiveLess>; - using Listeners = std::vector<Detail::unique_ptr<EventListenerFactory>>; - - virtual ~IReporterRegistry(); // = default - virtual IEventListenerPtr create( std::string const& name, ReporterConfig&& config ) const = 0; - virtual FactoryMap const& getFactories() const = 0; - virtual Listeners const& getListeners() const = 0; - }; - -} // end namespace Catch - -#endif // CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp index 141560a1fd1c6026ae4fe1e5f078812682d6892d..5da0f8d1e0b6f2728b899b2b8391b9fd2b84a814 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_test_invoker.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_test_invoker.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3caeff9a32ff34bac69aa7e3012e245d87ccaf80 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_test_invoker.hpp @@ -0,0 +1,21 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED +#define CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED + +namespace Catch { + + class ITestInvoker { + public: + virtual void invoke() const = 0; + virtual ~ITestInvoker(); // = default + }; + +} // namespace Catch + +#endif // CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp index ec32d667bf082e9e425604a9ab4946f2ce37a19e..a543116c3f2db804cf3f8626e35a9faa75c8cf97 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -9,6 +9,5 @@ #include <catch2/interfaces/catch_interfaces_testcase.hpp> namespace Catch { - ITestInvoker::~ITestInvoker() = default; ITestCaseRegistry::~ITestCaseRegistry() = default; } diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp index 9701d34218abbc2269f9fbabe591fc4d05090719..daee848295e1b92aa9f2881b99db05de66e5f9b4 100644 --- a/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -12,15 +12,7 @@ namespace Catch { - class TestSpec; struct TestCaseInfo; - - class ITestInvoker { - public: - virtual void invoke () const = 0; - virtual ~ITestInvoker(); // = default - }; - class TestCaseHandle; class IConfig; @@ -33,11 +25,6 @@ namespace Catch { virtual std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const = 0; }; - bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ); - bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ); - std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ); - } #endif // CATCH_INTERFACES_TESTCASE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_assertion_handler.cpp b/packages/Catch2/src/catch2/internal/catch_assertion_handler.cpp index 828aa7cdff567238974b9d20e132377ea2bf0360..e5232f70c9a66c8e6f9b9a9e23633aa7433b3101 100644 --- a/packages/Catch2/src/catch2/internal/catch_assertion_handler.cpp +++ b/packages/Catch2/src/catch2/internal/catch_assertion_handler.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -12,7 +12,6 @@ #include <catch2/internal/catch_debugger.hpp> #include <catch2/internal/catch_test_failure_exception.hpp> #include <catch2/interfaces/catch_interfaces_registry_hub.hpp> -#include <catch2/internal/catch_run_context.hpp> #include <catch2/matchers/catch_matchers_string.hpp> namespace Catch { @@ -24,7 +23,9 @@ namespace Catch { ResultDisposition::Flags resultDisposition ) : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition }, m_resultCapture( getResultCapture() ) - {} + { + m_resultCapture.notifyAssertionStarted( m_assertionInfo ); + } void AssertionHandler::handleExpr( ITransientExpression const& expr ) { m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); @@ -38,7 +39,7 @@ namespace Catch { } void AssertionHandler::complete() { - setCompleted(); + m_completed = true; if( m_reaction.shouldDebugBreak ) { // If you find your debugger stopping you here then go one level up on the @@ -48,15 +49,11 @@ namespace Catch { CATCH_BREAK_INTO_DEBUGGER(); } if (m_reaction.shouldThrow) { -#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - throw Catch::TestFailureException(); -#else - CATCH_ERROR( "Test failure requires aborting test!" ); -#endif + throw_test_failure_exception(); + } + if ( m_reaction.shouldSkip ) { + throw_test_skip_exception(); } - } - void AssertionHandler::setCompleted() { - m_completed = true; } void AssertionHandler::handleUnexpectedInflightException() { @@ -80,8 +77,8 @@ namespace Catch { // This is the overload that takes a string and infers the Equals matcher from it // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp - void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) { - handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str ) { + handleExceptionMatchExpr( handler, Matchers::Equals( str ) ); } } // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp b/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp index 5faa5e4ba6cfa680c8759e1e1ddcb9183f598106..01dd7801d19513cb874dd42c57b6dce32dcd1252 100644 --- a/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp +++ b/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,17 +11,15 @@ #include <catch2/catch_assertion_info.hpp> #include <catch2/internal/catch_decomposer.hpp> #include <catch2/interfaces/catch_interfaces_capture.hpp> -#include <catch2/internal/catch_lazy_expr.hpp> #include <string> namespace Catch { - class IResultCapture; - struct AssertionReaction { bool shouldDebugBreak = false; bool shouldThrow = false; + bool shouldSkip = false; }; class AssertionHandler { @@ -58,13 +56,12 @@ namespace Catch { void handleUnexpectedInflightException(); void complete(); - void setCompleted(); // query auto allowThrows() const -> bool; }; - void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str ); } // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.cpp b/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.cpp index 904c2289b8b891e6bfc5d902845730279a5fca6d..b3e7b53ab030ab7f0ccb5867ecdd779294360a5f 100644 --- a/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.cpp +++ b/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp b/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp index a97b7b4b9a629c8e999364df20837e296eb24283..33b778269e9b1b28289ddcccfeaaf54436fc2871 100644 --- a/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp +++ b/packages/Catch2/src/catch2/internal/catch_case_insensitive_comparisons.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_case_sensitive.hpp b/packages/Catch2/src/catch2/internal/catch_case_sensitive.hpp index f941d1f2f153cd74d1719c7a29f83203537f66d7..cc89110494b261fe8702004f6257ee6f2c119412 100644 --- a/packages/Catch2/src/catch2/internal/catch_case_sensitive.hpp +++ b/packages/Catch2/src/catch2/internal/catch_case_sensitive.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_clara.cpp b/packages/Catch2/src/catch2/internal/catch_clara.cpp index b34ce917679300e9173d91aa2b3798bd2a7586ef..c9bc76959d0b1fb87186020093251055d95fe65d 100644 --- a/packages/Catch2/src/catch2/internal/catch_clara.cpp +++ b/packages/Catch2/src/catch2/internal/catch_clara.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_clara.hpp b/packages/Catch2/src/catch2/internal/catch_clara.hpp index 512b0526c09752c047f2f2a463c4a93ce02de3bc..9117b65e84d51ff0c82d05904107a45afa61fcc9 100644 --- a/packages/Catch2/src/catch2/internal/catch_clara.hpp +++ b/packages/Catch2/src/catch2/internal/catch_clara.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_commandline.cpp b/packages/Catch2/src/catch2/internal/catch_commandline.cpp index fda4b2bd55bbfc221f505993ad4e7238089ec713..4ac1847b20165d6ec0facba40c8bdbe350f7f8df 100644 --- a/packages/Catch2/src/catch2/internal/catch_commandline.cpp +++ b/packages/Catch2/src/catch2/internal/catch_commandline.cpp @@ -1,18 +1,18 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_commandline.hpp> -#include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/catch_config.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <catch2/interfaces/catch_interfaces_registry_hub.hpp> -#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +#include <catch2/internal/catch_reporter_registry.hpp> #include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_parse_numbers.hpp> #include <catch2/internal/catch_reporter_spec_parser.hpp> #include <fstream> @@ -77,23 +77,14 @@ namespace Catch { return ParserResult::ok(ParseResultType::Matched); } - CATCH_TRY { - std::size_t parsedTo = 0; - unsigned long parsedSeed = std::stoul(seed, &parsedTo, 0); - if (parsedTo != seed.size()) { - return ParserResult::runtimeError("Could not parse '" + seed + "' as seed"); - } - - // TODO: Ideally we could parse unsigned int directly, - // but the stdlib doesn't provide helper for that - // type. After this is refactored to use fixed size - // type, we should check the parsed value is in range - // of the underlying type. - config.rngSeed = static_cast<unsigned int>(parsedSeed); - return ParserResult::ok(ParseResultType::Matched); - } CATCH_CATCH_ANON(std::exception const&) { - return ParserResult::runtimeError("Could not parse '" + seed + "' as seed"); + // TODO: ideally we should be parsing uint32_t directly + // fix this later when we add new parse overload + auto parsedSeed = parseUInt( seed, 0 ); + if ( !parsedSeed ) { + return ParserResult::runtimeError( "Could not parse '" + seed + "' as seed" ); } + config.rngSeed = *parsedSeed; + return ParserResult::ok( ParseResultType::Matched ); }; auto const setDefaultColourMode = [&]( std::string const& colourMode ) { Optional<ColourMode> maybeMode = Catch::Detail::stringToColourMode(toLower( colourMode )); @@ -153,7 +144,7 @@ namespace Catch { auto const& reporterSpec = *parsed; - IReporterRegistry::FactoryMap const& factories = + auto const& factories = getRegistryHub().getReporterRegistry().getFactories(); auto result = factories.find( reporterSpec.name() ); @@ -185,42 +176,29 @@ namespace Catch { return ParserResult::ok( ParseResultType::Matched ); }; auto const setShardCount = [&]( std::string const& shardCount ) { - CATCH_TRY{ - std::size_t parsedTo = 0; - int64_t parsedCount = std::stoll(shardCount, &parsedTo, 0); - if (parsedTo != shardCount.size()) { - return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count"); - } - if (parsedCount <= 0) { - return ParserResult::runtimeError("Shard count must be a positive number"); - } - - config.shardCount = static_cast<unsigned int>(parsedCount); - return ParserResult::ok(ParseResultType::Matched); - } CATCH_CATCH_ANON(std::exception const&) { - return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count"); + auto parsedCount = parseUInt( shardCount ); + if ( !parsedCount ) { + return ParserResult::runtimeError( + "Could not parse '" + shardCount + "' as shard count" ); } + if ( *parsedCount == 0 ) { + return ParserResult::runtimeError( + "Shard count must be positive" ); + } + config.shardCount = *parsedCount; + return ParserResult::ok( ParseResultType::Matched ); }; auto const setShardIndex = [&](std::string const& shardIndex) { - CATCH_TRY{ - std::size_t parsedTo = 0; - int64_t parsedIndex = std::stoll(shardIndex, &parsedTo, 0); - if (parsedTo != shardIndex.size()) { - return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index"); - } - if (parsedIndex < 0) { - return ParserResult::runtimeError("Shard index must be a non-negative number"); - } - - config.shardIndex = static_cast<unsigned int>(parsedIndex); - return ParserResult::ok(ParseResultType::Matched); - } CATCH_CATCH_ANON(std::exception const&) { - return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index"); + auto parsedIndex = parseUInt( shardIndex ); + if ( !parsedIndex ) { + return ParserResult::runtimeError( + "Could not parse '" + shardIndex + "' as shard index" ); } + config.shardIndex = *parsedIndex; + return ParserResult::ok( ParseResultType::Matched ); }; - auto cli = ExeName( config.processName ) | Help( config.showHelp ) diff --git a/packages/Catch2/src/catch2/internal/catch_commandline.hpp b/packages/Catch2/src/catch2/internal/catch_commandline.hpp index 1e03085644bae7ac3922b0febb1e39166b8efb6e..8cc2254764f32404b740ac24b32c358e404d64ce 100644 --- a/packages/Catch2/src/catch2/internal/catch_commandline.hpp +++ b/packages/Catch2/src/catch2/internal/catch_commandline.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_compare_traits.hpp b/packages/Catch2/src/catch2/internal/catch_compare_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6304b1ffeee4e909e5abb69ea2cd3412d44ebbfc --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_compare_traits.hpp @@ -0,0 +1,75 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_COMPARE_TRAITS_HPP_INCLUDED +#define CATCH_COMPARE_TRAITS_HPP_INCLUDED + +#include <catch2/internal/catch_void_type.hpp> + +#include <type_traits> + +namespace Catch { + namespace Detail { + +#if defined( __GNUC__ ) && !defined( __clang__ ) +# pragma GCC diagnostic push + // GCC likes to complain about comparing bool with 0, in the decltype() + // that defines the comparable traits below. +# pragma GCC diagnostic ignored "-Wbool-compare" + // "ordered comparison of pointer with integer zero" same as above, + // but it does not have a separate warning flag to suppress +# pragma GCC diagnostic ignored "-Wextra" + // Did you know that comparing floats with `0` directly + // is super-duper dangerous in unevaluated context? +# pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + +#if defined( __clang__ ) +# pragma clang diagnostic push + // Did you know that comparing floats with `0` directly + // is super-duper dangerous in unevaluated context? +# pragma clang diagnostic ignored "-Wfloat-equal" +#endif + +#define CATCH_DEFINE_COMPARABLE_TRAIT( id, op ) \ + template <typename, typename, typename = void> \ + struct is_##id##_comparable : std::false_type {}; \ + template <typename T, typename U> \ + struct is_##id##_comparable< \ + T, \ + U, \ + void_t<decltype( std::declval<T>() op std::declval<U>() )>> \ + : std::true_type {}; \ + template <typename, typename = void> \ + struct is_##id##_0_comparable : std::false_type {}; \ + template <typename T> \ + struct is_##id##_0_comparable<T, \ + void_t<decltype( std::declval<T>() op 0 )>> \ + : std::true_type {}; + + // We need all 6 pre-spaceship comparison ops: <, <=, >, >=, ==, != + CATCH_DEFINE_COMPARABLE_TRAIT( lt, < ) + CATCH_DEFINE_COMPARABLE_TRAIT( le, <= ) + CATCH_DEFINE_COMPARABLE_TRAIT( gt, > ) + CATCH_DEFINE_COMPARABLE_TRAIT( ge, >= ) + CATCH_DEFINE_COMPARABLE_TRAIT( eq, == ) + CATCH_DEFINE_COMPARABLE_TRAIT( ne, != ) + +#undef CATCH_DEFINE_COMPARABLE_TRAIT + +#if defined( __GNUC__ ) && !defined( __clang__ ) +# pragma GCC diagnostic pop +#endif +#if defined( __clang__ ) +# pragma clang diagnostic pop +#endif + + + } // namespace Detail +} // namespace Catch + +#endif // CATCH_COMPARE_TRAITS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp b/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp index 85477ec23d0b5d143a94eb965921a98c3bececda..fc5d4f31506bb67583aa9c9adcc396aa7d793b08 100644 --- a/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp +++ b/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -41,7 +41,7 @@ // Only GCC compiler should be used in this block, so other compilers trying to // mask themselves as GCC should be ignored. -#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) && !defined(__NVCOMPILER) # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) @@ -50,17 +50,37 @@ # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ _Pragma( "GCC diagnostic ignored \"-Wparentheses\"" ) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \ + _Pragma( "GCC diagnostic ignored \"-Wunused-result\"" ) + # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ _Pragma( "GCC diagnostic ignored \"-Wunused-variable\"" ) +# define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ + _Pragma( "GCC diagnostic ignored \"-Wuseless-cast\"" ) + +# define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \ + _Pragma( "GCC diagnostic ignored \"-Wshadow\"" ) + # define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) #endif +#if defined(__NVCOMPILER) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "diag push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "diag pop" ) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "diag_suppress declared_but_not_referenced" ) +#endif + #if defined(__CUDACC__) && !defined(__clang__) +# ifdef __NVCC_DIAG_PRAGMA_SUPPORT__ +// New pragmas introduced in CUDA 11.5+ # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic push" ) # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "nv_diagnostic pop" ) # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "nv_diag_suppress 177" ) +# else +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( "diag_suppress 177" ) +# endif #endif // clang-cl defines _MSC_VER as well as __clang__, which could cause the @@ -111,23 +131,35 @@ # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) -#endif // __clang__ +# define CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wcomma\"" ) +# define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wshadow\"" ) + +#endif // __clang__ -//////////////////////////////////////////////////////////////////////////////// -// Assume that non-Windows platforms support posix signals by default -#if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS -#endif //////////////////////////////////////////////////////////////////////////////// // We know some environments not to support full POSIX signals -#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#if defined( CATCH_PLATFORM_WINDOWS ) || \ + defined( CATCH_PLATFORM_PLAYSTATION ) || \ + defined( __CYGWIN__ ) || \ + defined( __QNX__ ) || \ + defined( __EMSCRIPTEN__ ) || \ + defined( __DJGPP__ ) || \ + defined( __OS400__ ) +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#else +# define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS #endif -#ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +//////////////////////////////////////////////////////////////////////////////// +// Assume that some platforms do not support getenv. +#if defined(CATCH_PLATFORM_WINDOWS_UWP) || defined(CATCH_PLATFORM_PLAYSTATION) +# define CATCH_INTERNAL_CONFIG_NO_GETENV +#else +# define CATCH_INTERNAL_CONFIG_GETENV #endif //////////////////////////////////////////////////////////////////////////////// @@ -169,8 +201,14 @@ // Visual C++ #if defined(_MSC_VER) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) +// We want to defer to nvcc-specific warning suppression if we are compiled +// with nvcc masquerading for MSVC. +# if !defined( __CUDACC__ ) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + __pragma( warning( push ) ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + __pragma( warning( pop ) ) +# endif // Universal Windows platform does not support SEH // Or console colours (or console at all...) @@ -270,6 +308,10 @@ # define CATCH_CONFIG_POSIX_SIGNALS #endif +#if defined(CATCH_INTERNAL_CONFIG_GETENV) && !defined(CATCH_INTERNAL_CONFIG_NO_GETENV) && !defined(CATCH_CONFIG_NO_GETENV) && !defined(CATCH_CONFIG_GETENV) +# define CATCH_CONFIG_GETENV +#endif + #if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) # define CATCH_CONFIG_CPP11_TO_STRING #endif @@ -332,12 +374,28 @@ #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS #endif +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT +#endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS #endif +#if !defined(CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS +#endif #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS #endif +#if !defined( CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS ) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#endif +#if !defined( CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS ) +# define CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS +#endif +#if !defined( CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS ) +# define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS +#endif + // The goal of this macro is to avoid evaluation of the arguments, but // still have the compiler warn on problems inside... @@ -351,9 +409,6 @@ # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#endif #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) #define CATCH_TRY if ((true)) @@ -376,5 +431,15 @@ # define CATCH_CONFIG_COLOUR_WIN32 #endif +#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \ + !defined( CATCH_CONFIG_STATIC ) +# ifdef Catch2_EXPORTS +# define CATCH_EXPORT //__declspec( dllexport ) // not needed +# else +# define CATCH_EXPORT __declspec( dllimport ) +# endif +#else +# define CATCH_EXPORT +#endif #endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp b/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp index 670af2d55c444d16bb01828735f226097eb5703b..490ee372acde6337b9747837223058d119d5e30a 100644 --- a/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp +++ b/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_config_counter.hpp b/packages/Catch2/src/catch2/internal/catch_config_counter.hpp index febb3eeef4ff228361e4f1c0c418d5a0cb962794..a482ce34628fb99cb64ef4b35ff06a829b46ca2d 100644 --- a/packages/Catch2/src/catch2/internal/catch_config_counter.hpp +++ b/packages/Catch2/src/catch2/internal/catch_config_counter.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -18,6 +18,8 @@ #ifndef CATCH_CONFIG_COUNTER_HPP_INCLUDED #define CATCH_CONFIG_COUNTER_HPP_INCLUDED +#include <catch2/catch_user_config.hpp> + #if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) #define CATCH_INTERNAL_CONFIG_COUNTER #endif diff --git a/packages/Catch2/src/catch2/internal/catch_config_static_analysis_support.hpp b/packages/Catch2/src/catch2/internal/catch_config_static_analysis_support.hpp new file mode 100644 index 0000000000000000000000000000000000000000..81bdf39f4d80760a1beb751a7a8bb1c7368e5c4b --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_config_static_analysis_support.hpp @@ -0,0 +1,34 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +/** \file + * Wrapper for the STATIC_ANALYSIS_SUPPORT configuration option + * + * Some of Catch2's macros can be defined differently to work better with + * static analysis tools, like clang-tidy or coverity. + * Currently the main use case is to show that `SECTION`s are executed + * exclusively, and not all in one run of a `TEST_CASE`. + */ + +#ifndef CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED +#define CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED + +#include <catch2/catch_user_config.hpp> + +#if defined(__clang_analyzer__) || defined(__COVERITY__) + #define CATCH_INTERNAL_CONFIG_STATIC_ANALYSIS_SUPPORT +#endif + +#if defined( CATCH_INTERNAL_CONFIG_STATIC_ANALYSIS_SUPPORT ) && \ + !defined( CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT ) && \ + !defined( CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT ) +# define CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT +#endif + + +#endif // CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_config_uncaught_exceptions.hpp b/packages/Catch2/src/catch2/internal/catch_config_uncaught_exceptions.hpp index c853e673c5d34f62d4f639126f99339f63202eda..20b1dfca45db66e377f860a6ecaaec4dc922f3a6 100644 --- a/packages/Catch2/src/catch2/internal/catch_config_uncaught_exceptions.hpp +++ b/packages/Catch2/src/catch2/internal/catch_config_uncaught_exceptions.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -17,6 +17,8 @@ #ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED #define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED +#include <catch2/catch_user_config.hpp> + #if defined(_MSC_VER) # if _MSC_VER >= 1900 // Visual Studio 2015 or newer # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS diff --git a/packages/Catch2/src/catch2/internal/catch_config_wchar.hpp b/packages/Catch2/src/catch2/internal/catch_config_wchar.hpp index fb64daf280b4d09da1eba56850bd1a8f349ce425..90d85d0552f286f8bada1934e17154ccd8aec6fa 100644 --- a/packages/Catch2/src/catch2/internal/catch_config_wchar.hpp +++ b/packages/Catch2/src/catch2/internal/catch_config_wchar.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -17,6 +17,8 @@ #ifndef CATCH_CONFIG_WCHAR_HPP_INCLUDED #define CATCH_CONFIG_WCHAR_HPP_INCLUDED +#include <catch2/catch_user_config.hpp> + // We assume that WCHAR should be enabled by default, and only disabled // for a shortlist (so far only DJGPP) of compilers. diff --git a/packages/Catch2/src/catch2/internal/catch_console_colour.cpp b/packages/Catch2/src/catch2/internal/catch_console_colour.cpp index c77e8295182e1da15f8f89e3457b4521a0e19276..e1238816afdb8a4be6ca4ae350581133ed00fe48 100644 --- a/packages/Catch2/src/catch2/internal/catch_console_colour.cpp +++ b/packages/Catch2/src/catch2/internal/catch_console_colour.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -85,7 +85,7 @@ namespace Catch { namespace { //! A do-nothing implementation of colour, used as fallback for unknown //! platforms, and when the user asks to deactivate all colours. - class NoColourImpl : public ColourImpl { + class NoColourImpl final : public ColourImpl { public: NoColourImpl( IStream* stream ): ColourImpl( stream ) {} @@ -103,7 +103,7 @@ namespace Catch { namespace Catch { namespace { - class Win32ColourImpl : public ColourImpl { + class Win32ColourImpl final : public ColourImpl { public: Win32ColourImpl(IStream* stream): ColourImpl(stream) { @@ -169,7 +169,7 @@ namespace { namespace Catch { namespace { - class ANSIColourImpl : public ColourImpl { + class ANSIColourImpl final : public ColourImpl { public: ANSIColourImpl( IStream* stream ): ColourImpl( stream ) {} diff --git a/packages/Catch2/src/catch2/internal/catch_console_colour.hpp b/packages/Catch2/src/catch2/internal/catch_console_colour.hpp index aa3d83a28e8fe82ec16719b3a69f71357512104d..d914431574b8af571d25a5529d1bf6ad08039e3d 100644 --- a/packages/Catch2/src/catch2/internal/catch_console_colour.hpp +++ b/packages/Catch2/src/catch2/internal/catch_console_colour.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -47,6 +47,7 @@ namespace Catch { Error = BrightRed, Success = Green, + Skip = LightGrey, OriginalExpression = Cyan, ReconstructedExpression = BrightYellow, diff --git a/packages/Catch2/src/catch2/internal/catch_console_width.hpp b/packages/Catch2/src/catch2/internal/catch_console_width.hpp index 7156ec4eea844bf5a93d853daf1aa74bca470e1d..165536174afa9bca42e3680989ca2fb7b950422d 100644 --- a/packages/Catch2/src/catch2/internal/catch_console_width.hpp +++ b/packages/Catch2/src/catch2/internal/catch_console_width.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_container_nonmembers.hpp b/packages/Catch2/src/catch2/internal/catch_container_nonmembers.hpp index d6f10eb5ed0a9e5d07050441f17403dbf9a60377..33b28a9eb83533be96338c437bfc27a13393c204 100644 --- a/packages/Catch2/src/catch2/internal/catch_container_nonmembers.hpp +++ b/packages/Catch2/src/catch2/internal/catch_container_nonmembers.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_context.cpp b/packages/Catch2/src/catch2/internal/catch_context.cpp index 6811b092f172d4d83914bffade7829105a305994..3b1cc277475151c2fd8aa8b7480f9a74d50cce0d 100644 --- a/packages/Catch2/src/catch2/internal/catch_context.cpp +++ b/packages/Catch2/src/catch2/internal/catch_context.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,49 +11,27 @@ namespace Catch { - class Context : public IMutableContext, private Detail::NonCopyable { + Context* Context::currentContext = nullptr; - public: // IContext - IResultCapture* getResultCapture() override { - return m_resultCapture; - } - - IConfig const* getConfig() const override { - return m_config; - } - - ~Context() override; - - public: // IMutableContext - void setResultCapture( IResultCapture* resultCapture ) override { - m_resultCapture = resultCapture; - } - void setConfig( IConfig const* config ) override { - m_config = config; - } - - friend IMutableContext& getCurrentMutableContext(); - - private: - IConfig const* m_config = nullptr; - IResultCapture* m_resultCapture = nullptr; - }; - - IMutableContext *IMutableContext::currentContext = nullptr; - - void IMutableContext::createContext() - { + void cleanUpContext() { + delete Context::currentContext; + Context::currentContext = nullptr; + } + void Context::createContext() { currentContext = new Context(); } - void cleanUpContext() { - delete IMutableContext::currentContext; - IMutableContext::currentContext = nullptr; + Context& getCurrentMutableContext() { + if ( !Context::currentContext ) { Context::createContext(); } + // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) + return *Context::currentContext; + } + + void Context::setResultCapture( IResultCapture* resultCapture ) { + m_resultCapture = resultCapture; } - IContext::~IContext() = default; - IMutableContext::~IMutableContext() = default; - Context::~Context() = default; + void Context::setConfig( IConfig const* config ) { m_config = config; } SimplePcg32& sharedRng() { static SimplePcg32 s_rng; diff --git a/packages/Catch2/src/catch2/internal/catch_context.hpp b/packages/Catch2/src/catch2/internal/catch_context.hpp index fe1297056054e6d846e6affb32c6389aeba64a9b..6ccb3b318945e3d65837f02295c93729a5eb453b 100644 --- a/packages/Catch2/src/catch2/internal/catch_context.hpp +++ b/packages/Catch2/src/catch2/internal/catch_context.hpp @@ -1,50 +1,45 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_CONTEXT_HPP_INCLUDED #define CATCH_CONTEXT_HPP_INCLUDED +#include <catch2/internal/catch_compiler_capabilities.hpp> + namespace Catch { class IResultCapture; class IConfig; - class IContext { - public: - virtual ~IContext(); // = default + class Context { + IConfig const* m_config = nullptr; + IResultCapture* m_resultCapture = nullptr; - virtual IResultCapture* getResultCapture() = 0; - virtual IConfig const* getConfig() const = 0; - }; + CATCH_EXPORT static Context* currentContext; + friend Context& getCurrentMutableContext(); + friend Context const& getCurrentContext(); + static void createContext(); + friend void cleanUpContext(); - class IMutableContext : public IContext { public: - ~IMutableContext() override; // = default - virtual void setResultCapture( IResultCapture* resultCapture ) = 0; - virtual void setConfig( IConfig const* config ) = 0; - - private: - static IMutableContext *currentContext; - friend IMutableContext& getCurrentMutableContext(); - friend void cleanUpContext(); - static void createContext(); + IResultCapture* getResultCapture() const { return m_resultCapture; } + IConfig const* getConfig() const { return m_config; } + void setResultCapture( IResultCapture* resultCapture ); + void setConfig( IConfig const* config ); }; - inline IMutableContext& getCurrentMutableContext() - { - if( !IMutableContext::currentContext ) - IMutableContext::createContext(); - // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) - return *IMutableContext::currentContext; - } + Context& getCurrentMutableContext(); - inline IContext& getCurrentContext() - { - return getCurrentMutableContext(); + inline Context const& getCurrentContext() { + // We duplicate the logic from `getCurrentMutableContext` here, + // to avoid paying the call overhead in debug mode. + if ( !Context::currentContext ) { Context::createContext(); } + // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) + return *Context::currentContext; } void cleanUpContext(); diff --git a/packages/Catch2/src/catch2/internal/catch_debug_console.cpp b/packages/Catch2/src/catch2/internal/catch_debug_console.cpp index 5564c6a8847cd46dd2b4ad493246175de0771d61..40dd0a60480c45aad14b475f30b1f4dde74085c0 100644 --- a/packages/Catch2/src/catch2/internal/catch_debug_console.cpp +++ b/packages/Catch2/src/catch2/internal/catch_debug_console.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_debug_console.hpp b/packages/Catch2/src/catch2/internal/catch_debug_console.hpp index a4b80f09b9e5cb636619f02fea7350b1156c021d..8784f7850ebe4247393b5f239b6e250f53265f18 100644 --- a/packages/Catch2/src/catch2/internal/catch_debug_console.hpp +++ b/packages/Catch2/src/catch2/internal/catch_debug_console.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_debugger.cpp b/packages/Catch2/src/catch2/internal/catch_debugger.cpp index 349cf4ab35412828cf821bbc4eec7e576ad1547c..bd3be17289deea8c8d3cceaf388ed55410243c37 100644 --- a/packages/Catch2/src/catch2/internal/catch_debugger.cpp +++ b/packages/Catch2/src/catch2/internal/catch_debugger.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_debugger.hpp b/packages/Catch2/src/catch2/internal/catch_debugger.hpp index ede291d7fae9c433e7abc7933d84600e3cdbf90e..25c5a2601339b0768f3c10f62201795161ec349d 100644 --- a/packages/Catch2/src/catch2/internal/catch_debugger.hpp +++ b/packages/Catch2/src/catch2/internal/catch_debugger.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -19,7 +19,10 @@ namespace Catch { #if defined(__i386__) || defined(__x86_64__) #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ #elif defined(__aarch64__) - #define CATCH_TRAP() __asm__(".inst 0xd43e0000") + #define CATCH_TRAP() __asm__(".inst 0xd43e0000") + #elif defined(__POWERPC__) + #define CATCH_TRAP() __asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \ + : : : "memory","r0","r3","r4" ) /* NOLINT */ #endif #elif defined(CATCH_PLATFORM_IPHONE) diff --git a/packages/Catch2/src/catch2/internal/catch_decomposer.cpp b/packages/Catch2/src/catch2/internal/catch_decomposer.cpp index a85695389593f908b15f0453fd25004b09dcee93..3f398fcc2bde3cc1e5565d33c8dfd5ab17176c17 100644 --- a/packages/Catch2/src/catch2/internal/catch_decomposer.cpp +++ b/packages/Catch2/src/catch2/internal/catch_decomposer.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_decomposer.hpp b/packages/Catch2/src/catch2/internal/catch_decomposer.hpp index e7dd1e9a4292648672573c0fd47087b80fbda2d9..e0e46c1de80cf86840fa5b4db425673378dbc6d4 100644 --- a/packages/Catch2/src/catch2/internal/catch_decomposer.hpp +++ b/packages/Catch2/src/catch2/internal/catch_decomposer.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,8 +10,11 @@ #include <catch2/catch_tostring.hpp> #include <catch2/internal/catch_stringref.hpp> -#include <catch2/internal/catch_meta.hpp> +#include <catch2/internal/catch_compare_traits.hpp> +#include <catch2/internal/catch_test_failure_exception.hpp> +#include <catch2/internal/catch_logical_traits.hpp> +#include <type_traits> #include <iosfwd> #ifdef _MSC_VER @@ -33,6 +36,9 @@ namespace Catch { + template <typename T> + struct always_false : std::false_type {}; + class ITransientExpression { bool m_isBinaryExpression; bool m_result; @@ -155,68 +161,134 @@ namespace Catch { }; - // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) - template<typename LhsT, typename RhsT> - auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); } - template<typename T> - auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); } - template<typename T> - auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); } - template<typename T> - auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; } - template<typename T> - auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; } - - template<typename LhsT, typename RhsT> - auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); } - template<typename T> - auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); } - template<typename T> - auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); } - template<typename T> - auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; } - template<typename T> - auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; } - - template<typename LhsT> class ExprLhs { LhsT m_lhs; public: explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} - template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> - friend auto operator == ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { - return { compareEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "=="_sr, rhs }; - } - template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> - friend auto operator == ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { - return { compareEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "=="_sr, rhs }; - } - - template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> - friend auto operator != ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { - return { compareNotEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "!="_sr, rhs }; - } - template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> - friend auto operator != ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { - return { compareNotEqual( lhs.m_lhs, rhs ), lhs.m_lhs, "!="_sr, rhs }; - } - - #define CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(op) \ - template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> \ - friend auto operator op ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { \ - return { static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs }; \ - } \ - template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> \ - friend auto operator op ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { \ - return { static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs }; \ - } +#define CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( id, op ) \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>, \ + Detail::negation<std::is_arithmetic< \ + std::remove_reference_t<RhsT>>>>::value, \ + BinaryExpr<LhsT, RhsT const&>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>, \ + std::is_arithmetic<RhsT>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction< \ + Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>, \ + Detail::is_eq_0_comparable<LhsT>, \ + /* We allow long because we want `ptr op NULL` to be accepted */ \ + Detail::disjunction<std::is_same<RhsT, int>, \ + std::is_same<RhsT, long>>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + if ( rhs != 0 ) { throw_test_failure_exception(); } \ + return { \ + static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction< \ + Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>, \ + Detail::is_eq_0_comparable<RhsT>, \ + /* We allow long because we want `ptr op NULL` to be accepted */ \ + Detail::disjunction<std::is_same<LhsT, int>, \ + std::is_same<LhsT, long>>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \ + return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } + + CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == ) + CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( ne, != ) + + #undef CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR + +#define CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( id, op ) \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>, \ + Detail::negation<std::is_arithmetic< \ + std::remove_reference_t<RhsT>>>>::value, \ + BinaryExpr<LhsT, RhsT const&>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>, \ + std::is_arithmetic<RhsT>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction< \ + Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>, \ + Detail::is_##id##_0_comparable<LhsT>, \ + std::is_same<RhsT, int>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + if ( rhs != 0 ) { throw_test_failure_exception(); } \ + return { \ + static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t< \ + Detail::conjunction< \ + Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>, \ + Detail::is_##id##_0_comparable<RhsT>, \ + std::is_same<LhsT, int>>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \ + return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } + + CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( lt, < ) + CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( le, <= ) + CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( gt, > ) + CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( ge, >= ) + + #undef CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR + + +#define CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR( op ) \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT&& rhs ) \ + ->std::enable_if_t< \ + !std::is_arithmetic<std::remove_reference_t<RhsT>>::value, \ + BinaryExpr<LhsT, RhsT const&>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } \ + template <typename RhsT> \ + friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \ + ->std::enable_if_t<std::is_arithmetic<RhsT>::value, \ + BinaryExpr<LhsT, RhsT>> { \ + return { \ + static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \ + } - CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(<) - CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(>) - CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(<=) - CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(>=) CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(|) CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(&) CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(^) diff --git a/packages/Catch2/src/catch2/internal/catch_enforce.cpp b/packages/Catch2/src/catch2/internal/catch_enforce.cpp index 4bc47ce3d3d91ed98a9bbb8d57c706448b358ffb..3f696406772fffedec57a19849ddb5dcd0c30564 100644 --- a/packages/Catch2/src/catch2/internal/catch_enforce.cpp +++ b/packages/Catch2/src/catch2/internal/catch_enforce.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_enforce.hpp b/packages/Catch2/src/catch2/internal/catch_enforce.hpp index db52a0e2d29450ce42f3904a63f231eb5c0cb04a..076cea3c9e0f69d0a6f1b295115288f9f1ab86a6 100644 --- a/packages/Catch2/src/catch2/internal/catch_enforce.hpp +++ b/packages/Catch2/src/catch2/internal/catch_enforce.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp index 32d0a16d96ebe6807fb6da7a8da9e21d1610103c..7e8bf5e5e3eb0841924a6fb6bcdaf2a99887d5cc 100644 --- a/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_enum_values_registry.hpp b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.hpp index 0c16a4c15d59fd52a9ee6eb9333f2063c5699d4b..999059ae8fa81339e77cfa04f6e8e12d65d661c1 100644 --- a/packages/Catch2/src/catch2/internal/catch_enum_values_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_errno_guard.cpp b/packages/Catch2/src/catch2/internal/catch_errno_guard.cpp index 95c192df0120e7ff168149cbd42438761e78f617..3bbf8b4c8303c28ef13f960d0a1b888d5932d138 100644 --- a/packages/Catch2/src/catch2/internal/catch_errno_guard.cpp +++ b/packages/Catch2/src/catch2/internal/catch_errno_guard.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_errno_guard.hpp b/packages/Catch2/src/catch2/internal/catch_errno_guard.hpp index 9082c508559f62e898e7cce7d0a2b7ddf48c0702..df1237d53d3389e3739dc9fdd2f3d0513f00d21f 100644 --- a/packages/Catch2/src/catch2/internal/catch_errno_guard.hpp +++ b/packages/Catch2/src/catch2/internal/catch_errno_guard.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.cpp b/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.cpp index acddea6ec99d796d699c01892bfcf34498f44891..f3d47c0cd6056fd815cf275ac4671d2dcd71261d 100644 --- a/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,8 +11,24 @@ #include <catch2/internal/catch_test_failure_exception.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <exception> + namespace Catch { + namespace { + static std::string tryTranslators( + std::vector< + Detail::unique_ptr<IExceptionTranslator const>> const& translators ) { + if ( translators.empty() ) { + std::rethrow_exception( std::current_exception() ); + } else { + return translators[0]->translate( translators.begin() + 1, + translators.end() ); + } + } + + } + ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { } @@ -37,13 +53,16 @@ namespace Catch { // First we try user-registered translators. If none of them can // handle the exception, it will be rethrown handled by our defaults. try { - return tryTranslators(); + return tryTranslators(m_translators); } // To avoid having to handle TFE explicitly everywhere, we just // rethrow it so that it goes back up the caller. catch( TestFailureException& ) { std::rethrow_exception(std::current_exception()); } + catch( TestSkipException& ) { + std::rethrow_exception(std::current_exception()); + } catch( std::exception const& ex ) { return ex.what(); } @@ -58,23 +77,10 @@ namespace Catch { } } - std::string ExceptionTranslatorRegistry::tryTranslators() const { - if (m_translators.empty()) { - std::rethrow_exception(std::current_exception()); - } else { - return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end()); - } - } - #else // ^^ Exceptions are enabled // Exceptions are disabled vv std::string ExceptionTranslatorRegistry::translateActiveException() const { CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); } - - std::string ExceptionTranslatorRegistry::tryTranslators() const { - CATCH_INTERNAL_ERROR("Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); - } #endif - } diff --git a/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.hpp b/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.hpp index 465796d35b8aecf61908480f561285fa1fc78131..3123e93d77788ec5f6a15337d921a05315342124 100644 --- a/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -21,7 +21,6 @@ namespace Catch { ~ExceptionTranslatorRegistry() override; void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ); std::string translateActiveException() const override; - std::string tryTranslators() const; private: ExceptionTranslators m_translators; diff --git a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp index 3afd46f59fe0a352cf660afbdb0ae6f41b118017..f9702b1847aa0c1d45806e6dcf9f0251dff72c3c 100644 --- a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp +++ b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp index 389dab5d4c13ef9b63a08ff87294e3d347139147..ce07f9b6a7bd813190598a4642789398f990d3f4 100644 --- a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp +++ b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.cpp b/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.cpp index 55a95a2846740c9bd87a479e0b65a6a1ec6adb7c..e30ee43422ab870afe6ff17bfea08a6ad44848b2 100644 --- a/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.cpp +++ b/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.hpp b/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.hpp index f121281390c745440f0303ddb79fefc898b7642c..ca883c613c1b625f8235d263c68c8763719b086f 100644 --- a/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.hpp +++ b/packages/Catch2/src/catch2/internal/catch_floating_point_helpers.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_getenv.cpp b/packages/Catch2/src/catch2/internal/catch_getenv.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a9a592c7d9d1fa1b74a63c68b61c80df32840905 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_getenv.cpp @@ -0,0 +1,37 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/internal/catch_getenv.hpp> + +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> + +#include <cstdlib> + +namespace Catch { + namespace Detail { + +#if !defined (CATCH_CONFIG_GETENV) + char const* getEnv( char const* ) { return nullptr; } +#else + + char const* getEnv( char const* varName ) { +# if defined( _MSC_VER ) +# pragma warning( push ) +# pragma warning( disable : 4996 ) // use getenv_s instead of getenv +# endif + + return std::getenv( varName ); + +# if defined( _MSC_VER ) +# pragma warning( pop ) +# endif + } +#endif +} // namespace Detail +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_getenv.hpp b/packages/Catch2/src/catch2/internal/catch_getenv.hpp new file mode 100644 index 0000000000000000000000000000000000000000..31ef797446eaeb0cbe2056754ac1ad46ebfc205d --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_getenv.hpp @@ -0,0 +1,20 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_GETENV_HPP_INCLUDED +#define CATCH_GETENV_HPP_INCLUDED + +namespace Catch { +namespace Detail { + + //! Wrapper over `std::getenv` that compiles on UWP (and always returns nullptr there) + char const* getEnv(char const* varName); + +} +} + +#endif // CATCH_GETENV_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_is_permutation.hpp b/packages/Catch2/src/catch2/internal/catch_is_permutation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..708053d35c933d64cb3c0c137b3c09d9a1451ac8 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_is_permutation.hpp @@ -0,0 +1,138 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_IS_PERMUTATION_HPP_INCLUDED +#define CATCH_IS_PERMUTATION_HPP_INCLUDED + +#include <algorithm> +#include <iterator> + +namespace Catch { + namespace Detail { + + template <typename ForwardIter, + typename Sentinel, + typename T, + typename Comparator> + ForwardIter find_sentinel( ForwardIter start, + Sentinel sentinel, + T const& value, + Comparator cmp ) { + while ( start != sentinel ) { + if ( cmp( *start, value ) ) { break; } + ++start; + } + return start; + } + + template <typename ForwardIter, + typename Sentinel, + typename T, + typename Comparator> + std::ptrdiff_t count_sentinel( ForwardIter start, + Sentinel sentinel, + T const& value, + Comparator cmp ) { + std::ptrdiff_t count = 0; + while ( start != sentinel ) { + if ( cmp( *start, value ) ) { ++count; } + ++start; + } + return count; + } + + template <typename ForwardIter, typename Sentinel> + std::enable_if_t<!std::is_same<ForwardIter, Sentinel>::value, + std::ptrdiff_t> + sentinel_distance( ForwardIter iter, const Sentinel sentinel ) { + std::ptrdiff_t dist = 0; + while ( iter != sentinel ) { + ++iter; + ++dist; + } + return dist; + } + + template <typename ForwardIter> + std::ptrdiff_t sentinel_distance( ForwardIter first, + ForwardIter last ) { + return std::distance( first, last ); + } + + template <typename ForwardIter1, + typename Sentinel1, + typename ForwardIter2, + typename Sentinel2, + typename Comparator> + bool check_element_counts( ForwardIter1 first_1, + const Sentinel1 end_1, + ForwardIter2 first_2, + const Sentinel2 end_2, + Comparator cmp ) { + auto cursor = first_1; + while ( cursor != end_1 ) { + if ( find_sentinel( first_1, cursor, *cursor, cmp ) == + cursor ) { + // we haven't checked this element yet + const auto count_in_range_2 = + count_sentinel( first_2, end_2, *cursor, cmp ); + // Not a single instance in 2nd range, so it cannot be a + // permutation of 1st range + if ( count_in_range_2 == 0 ) { return false; } + + const auto count_in_range_1 = + count_sentinel( cursor, end_1, *cursor, cmp ); + if ( count_in_range_1 != count_in_range_2 ) { + return false; + } + } + + ++cursor; + } + + return true; + } + + template <typename ForwardIter1, + typename Sentinel1, + typename ForwardIter2, + typename Sentinel2, + typename Comparator> + bool is_permutation( ForwardIter1 first_1, + const Sentinel1 end_1, + ForwardIter2 first_2, + const Sentinel2 end_2, + Comparator cmp ) { + // TODO: no optimization for stronger iterators, because we would also have to constrain on sentinel vs not sentinel types + // TODO: Comparator has to be "both sides", e.g. a == b => b == a + // This skips shared prefix of the two ranges + while (first_1 != end_1 && first_2 != end_2 && cmp(*first_1, *first_2)) { + ++first_1; + ++first_2; + } + + // We need to handle case where at least one of the ranges has no more elements + if (first_1 == end_1 || first_2 == end_2) { + return first_1 == end_1 && first_2 == end_2; + } + + // pair counting is n**2, so we pay linear walk to compare the sizes first + auto dist_1 = sentinel_distance( first_1, end_1 ); + auto dist_2 = sentinel_distance( first_2, end_2 ); + + if (dist_1 != dist_2) { return false; } + + // Since we do not try to handle stronger iterators pair (e.g. + // bidir) optimally, the only thing left to do is to check counts in + // the remaining ranges. + return check_element_counts( first_1, end_1, first_2, end_2, cmp ); + } + + } // namespace Detail +} // namespace Catch + +#endif // CATCH_IS_PERMUTATION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_istream.cpp b/packages/Catch2/src/catch2/internal/catch_istream.cpp index 4cd3505847e4045359eae043df1d06d38e7c90bb..bf0f66e42320d18480531076b19b14774472b318 100644 --- a/packages/Catch2/src/catch2/internal/catch_istream.cpp +++ b/packages/Catch2/src/catch2/internal/catch_istream.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -24,7 +24,7 @@ namespace Catch { namespace Detail { namespace { template<typename WriterF, std::size_t bufferSize=256> - class StreamBufImpl : public std::streambuf { + class StreamBufImpl final : public std::streambuf { char data[bufferSize]; WriterF m_writer; @@ -72,12 +72,13 @@ namespace Detail { /////////////////////////////////////////////////////////////////////////// - class FileStream : public IStream { + class FileStream final : public IStream { std::ofstream m_ofs; public: FileStream( std::string const& filename ) { m_ofs.open( filename.c_str() ); CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' ); + m_ofs << std::unitbuf; } ~FileStream() override = default; public: // IStream @@ -88,7 +89,7 @@ namespace Detail { /////////////////////////////////////////////////////////////////////////// - class CoutStream : public IStream { + class CoutStream final : public IStream { std::ostream m_os; public: // Store the streambuf from cout up-front because @@ -117,7 +118,7 @@ namespace Detail { /////////////////////////////////////////////////////////////////////////// - class DebugOutStream : public IStream { + class DebugOutStream final : public IStream { Detail::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf; std::ostream m_os; public: diff --git a/packages/Catch2/src/catch2/internal/catch_istream.hpp b/packages/Catch2/src/catch2/internal/catch_istream.hpp index 629816c806cbd97654377fe7039f36ea11ac39ce..e6b9a2d3240401c9075bccf9ee7217206f683024 100644 --- a/packages/Catch2/src/catch2/internal/catch_istream.hpp +++ b/packages/Catch2/src/catch2/internal/catch_istream.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_lazy_expr.cpp b/packages/Catch2/src/catch2/internal/catch_lazy_expr.cpp index 96ecf5c333476b32a76236bd50df76a02e30f770..56a5ae5e44519a7d43cea07aa7e846743267e1a9 100644 --- a/packages/Catch2/src/catch2/internal/catch_lazy_expr.cpp +++ b/packages/Catch2/src/catch2/internal/catch_lazy_expr.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp b/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp index d4aa79d7be389e7716951fb190e3506f433f9219..36e0ac5002069b503ceb8dcfa8b07bef2ffe052f 100644 --- a/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp +++ b/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_leak_detector.cpp b/packages/Catch2/src/catch2/internal/catch_leak_detector.cpp index c9abbdfcdd1bc186b9f6bc3a091162f09fbf9678..7389eaf7787dc640f0a6e5817991ba0a548e307b 100644 --- a/packages/Catch2/src/catch2/internal/catch_leak_detector.cpp +++ b/packages/Catch2/src/catch2/internal/catch_leak_detector.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_leak_detector.hpp b/packages/Catch2/src/catch2/internal/catch_leak_detector.hpp index eecdfca70d8d10d1395fefbcf8016f5d72464b75..94c8f32599113ce09724921399b75ff736905551 100644 --- a/packages/Catch2/src/catch2/internal/catch_leak_detector.hpp +++ b/packages/Catch2/src/catch2/internal/catch_leak_detector.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_list.cpp b/packages/Catch2/src/catch2/internal/catch_list.cpp index 2c22745cefbc487d5f9993625569c604f502bc37..97e4c59315b7d74c40fcffa71215d583ab0a7776 100644 --- a/packages/Catch2/src/catch2/internal/catch_list.cpp +++ b/packages/Catch2/src/catch2/internal/catch_list.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -9,9 +9,9 @@ #include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/interfaces/catch_interfaces_reporter.hpp> -#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> -#include <catch2/interfaces/catch_interfaces_testcase.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> +#include <catch2/internal/catch_test_case_registry_impl.hpp> +#include <catch2/internal/catch_reporter_registry.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/internal/catch_case_insensitive_comparisons.hpp> @@ -54,7 +54,7 @@ namespace Catch { void listReporters(IEventListener& reporter) { std::vector<ReporterDescription> descriptions; - IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + auto const& factories = getRegistryHub().getReporterRegistry().getFactories(); descriptions.reserve(factories.size()); for (auto const& fac : factories) { descriptions.push_back({ fac.first, fac.second->getDescription() }); diff --git a/packages/Catch2/src/catch2/internal/catch_list.hpp b/packages/Catch2/src/catch2/internal/catch_list.hpp index 6fd759ea2f847130477f3f6427c7a9dd4265975a..9b4abd8249ac98790d91d8f0953e0b277602b52e 100644 --- a/packages/Catch2/src/catch2/internal/catch_list.hpp +++ b/packages/Catch2/src/catch2/internal/catch_list.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_logical_traits.hpp b/packages/Catch2/src/catch2/internal/catch_logical_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bd8756595db1f9c51d64e51a7994adeca5a5a302 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_logical_traits.hpp @@ -0,0 +1,44 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_LOGICAL_TRAITS_HPP_INCLUDED +#define CATCH_LOGICAL_TRAITS_HPP_INCLUDED + +#include <type_traits> + +namespace Catch { +namespace Detail { + +#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510 + + using std::conjunction; + using std::disjunction; + using std::negation; + +#else + + template <class...> struct conjunction : std::true_type {}; + template <class B1> struct conjunction<B1> : B1 {}; + template <class B1, class... Bn> + struct conjunction<B1, Bn...> + : std::conditional_t<bool( B1::value ), conjunction<Bn...>, B1> {}; + + template <class...> struct disjunction : std::false_type {}; + template <class B1> struct disjunction<B1> : B1 {}; + template <class B1, class... Bn> + struct disjunction<B1, Bn...> + : std::conditional_t<bool( B1::value ), B1, disjunction<Bn...>> {}; + + template <class B> + struct negation : std::integral_constant<bool, !bool(B::value)> {}; + +#endif + +} // namespace Detail +} // namespace Catch + +#endif // CATCH_LOGICAL_TRAITS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_main.cpp b/packages/Catch2/src/catch2/internal/catch_main.cpp index a0126c231a008c51670a333c803085aac1ea051e..503b540f77ed4d46f3739b2f81f868420d40f108 100644 --- a/packages/Catch2/src/catch2/internal/catch_main.cpp +++ b/packages/Catch2/src/catch2/internal/catch_main.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_message_info.cpp b/packages/Catch2/src/catch2/internal/catch_message_info.cpp index 11127e3f690086d3c686720a4fc78174117f02f8..e0e9dc7e5325b65c52223470619f071be3d70b67 100644 --- a/packages/Catch2/src/catch2/internal/catch_message_info.cpp +++ b/packages/Catch2/src/catch2/internal/catch_message_info.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_message_info.hpp b/packages/Catch2/src/catch2/internal/catch_message_info.hpp index ecd78cabf8b9a95780c5fa7a5cee214d34fd6f56..1ef43fdaf00a6e47d2978f2f8837c4feb066ed39 100644 --- a/packages/Catch2/src/catch2/internal/catch_message_info.hpp +++ b/packages/Catch2/src/catch2/internal/catch_message_info.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,7 +10,7 @@ #include <catch2/internal/catch_result_type.hpp> #include <catch2/internal/catch_source_line_info.hpp> -#include <catch2/interfaces/catch_interfaces_capture.hpp> +#include <catch2/internal/catch_stringref.hpp> #include <string> diff --git a/packages/Catch2/src/catch2/internal/catch_meta.hpp b/packages/Catch2/src/catch2/internal/catch_meta.hpp index 7d573585904fab3280c9de11be6a8bfb2a571ee7..6fbc13a5d69749fbbd5439bd3f47fa1286b4a7b6 100644 --- a/packages/Catch2/src/catch2/internal/catch_meta.hpp +++ b/packages/Catch2/src/catch2/internal/catch_meta.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,15 +11,14 @@ #include <type_traits> namespace Catch { - template<typename T> - struct always_false : std::false_type {}; + template <typename> + struct true_given : std::true_type {}; - template <typename> struct true_given : std::true_type {}; struct is_callable_tester { template <typename Fun, typename... Args> - true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int); + static true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> test(int); template <typename...> - std::false_type static test(...); + static std::false_type test(...); }; template <typename T> diff --git a/packages/Catch2/src/catch2/internal/catch_move_and_forward.hpp b/packages/Catch2/src/catch2/internal/catch_move_and_forward.hpp index 01b7adae5decd5a7c80343a653d4067cbebf70ac..383d85cfeeee746dd79dc3fe6bad11f919f0658f 100644 --- a/packages/Catch2/src/catch2/internal/catch_move_and_forward.hpp +++ b/packages/Catch2/src/catch2/internal/catch_move_and_forward.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_noncopyable.hpp b/packages/Catch2/src/catch2/internal/catch_noncopyable.hpp index f08b1578002bb40e5d532ac0f81becfe17c507ca..eb0823e8fe401756a822a12f1c067b9747317631 100644 --- a/packages/Catch2/src/catch2/internal/catch_noncopyable.hpp +++ b/packages/Catch2/src/catch2/internal/catch_noncopyable.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_optional.hpp b/packages/Catch2/src/catch2/internal/catch_optional.hpp index 86eca344ce331840c4b0d5645986eec3b4a59354..d1e953ad994e67bab24dc4f627bc60ab0568a8f2 100644 --- a/packages/Catch2/src/catch2/internal/catch_optional.hpp +++ b/packages/Catch2/src/catch2/internal/catch_optional.hpp @@ -1,13 +1,15 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_OPTIONAL_HPP_INCLUDED #define CATCH_OPTIONAL_HPP_INCLUDED +#include <catch2/internal/catch_move_and_forward.hpp> + #include <cassert> namespace Catch { @@ -16,35 +18,50 @@ namespace Catch { template<typename T> class Optional { public: - Optional() : nullableValue( nullptr ) {} - Optional( T const& _value ) - : nullableValue( new( storage ) T( _value ) ) - {} - Optional( Optional const& _other ) - : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) - {} - - ~Optional() { + Optional(): nullableValue( nullptr ) {} + ~Optional() { reset(); } + + Optional( T const& _value ): + nullableValue( new ( storage ) T( _value ) ) {} + Optional( T&& _value ): + nullableValue( new ( storage ) T( CATCH_MOVE( _value ) ) ) {} + + Optional& operator=( T const& _value ) { reset(); + nullableValue = new ( storage ) T( _value ); + return *this; } + Optional& operator=( T&& _value ) { + reset(); + nullableValue = new ( storage ) T( CATCH_MOVE( _value ) ); + return *this; + } + + Optional( Optional const& _other ): + nullableValue( _other ? new ( storage ) T( *_other ) : nullptr ) {} + Optional( Optional&& _other ): + nullableValue( _other ? new ( storage ) T( CATCH_MOVE( *_other ) ) + : nullptr ) {} - Optional& operator= ( Optional const& _other ) { - if( &_other != this ) { + Optional& operator=( Optional const& _other ) { + if ( &_other != this ) { reset(); - if( _other ) - nullableValue = new( storage ) T( *_other ); + if ( _other ) { nullableValue = new ( storage ) T( *_other ); } } return *this; } - Optional& operator = ( T const& _value ) { - reset(); - nullableValue = new( storage ) T( _value ); + Optional& operator=( Optional&& _other ) { + if ( &_other != this ) { + reset(); + if ( _other ) { + nullableValue = new ( storage ) T( CATCH_MOVE( *_other ) ); + } + } return *this; } void reset() { - if( nullableValue ) - nullableValue->~T(); + if ( nullableValue ) { nullableValue->~T(); } nullableValue = nullptr; } @@ -91,7 +108,7 @@ namespace Catch { } private: - T *nullableValue; + T* nullableValue; alignas(alignof(T)) char storage[sizeof(T)]; }; diff --git a/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp b/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp index ae0601412762d0a59e4829288971db5739dc2a6f..02f7c982689091ac57140e0e9df51ebec470c592 100644 --- a/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp +++ b/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp b/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp index d3463d992c0b957af0b56ad2fae580aed9ecbc8a..dc89223b922899226e304fe8d42ac4ad58e4597d 100644 --- a/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp +++ b/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_parse_numbers.cpp b/packages/Catch2/src/catch2/internal/catch_parse_numbers.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d949ac19ba44d813d9c1cc6b63620f8c754a9e6b --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_parse_numbers.cpp @@ -0,0 +1,52 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_parse_numbers.hpp> +#include <catch2/internal/catch_string_manip.hpp> + +#include <limits> +#include <stdexcept> + +namespace Catch { + + Optional<unsigned int> parseUInt(std::string const& input, int base) { + auto trimmed = trim( input ); + // std::stoull is annoying and accepts numbers starting with '-', + // it just negates them into unsigned int + if ( trimmed.empty() || trimmed[0] == '-' ) { + return {}; + } + + CATCH_TRY { + size_t pos = 0; + const auto ret = std::stoull( trimmed, &pos, base ); + + // We did not consume the whole input, so there is an issue + // This can be bunch of different stuff, like multiple numbers + // in the input, or invalid digits/characters and so on. Either + // way, we do not want to return the partially parsed result. + if ( pos != trimmed.size() ) { + return {}; + } + // Too large + if ( ret > std::numeric_limits<unsigned int>::max() ) { + return {}; + } + return static_cast<unsigned int>(ret); + } + CATCH_CATCH_ANON( std::invalid_argument const& ) { + // no conversion could be performed + } + CATCH_CATCH_ANON( std::out_of_range const& ) { + // the input does not fit into an unsigned long long + } + return {}; + } + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_parse_numbers.hpp b/packages/Catch2/src/catch2/internal/catch_parse_numbers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3dabf95f18a2237de7077c06393e0cb3f400e1df --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_parse_numbers.hpp @@ -0,0 +1,26 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_PARSE_NUMBERS_HPP_INCLUDED +#define CATCH_PARSE_NUMBERS_HPP_INCLUDED + +#include <catch2/internal/catch_optional.hpp> + +#include <string> + +namespace Catch { + + /** + * Parses unsigned int from the input, using provided base + * + * Effectively a wrapper around std::stoul but with better error checking + * e.g. "-1" is rejected, instead of being parsed as UINT_MAX. + */ + Optional<unsigned int> parseUInt(std::string const& input, int base = 10); +} + +#endif // CATCH_PARSE_NUMBERS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_platform.hpp b/packages/Catch2/src/catch2/internal/catch_platform.hpp index 01ee6cd9d39a56e1a7e186edf333aac479638ac2..b11d9ccde75c4ec2cefd815d083dd0741d51fd85 100644 --- a/packages/Catch2/src/catch2/internal/catch_platform.hpp +++ b/packages/Catch2/src/catch2/internal/catch_platform.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -28,6 +28,10 @@ # if defined( WINAPI_FAMILY ) && ( WINAPI_FAMILY == WINAPI_FAMILY_APP ) # define CATCH_PLATFORM_WINDOWS_UWP # endif + +#elif defined(__ORBIS__) || defined(__PROSPERO__) +# define CATCH_PLATFORM_PLAYSTATION + #endif #endif // CATCH_PLATFORM_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_polyfills.cpp b/packages/Catch2/src/catch2/internal/catch_polyfills.cpp index 13e60f4a4d3195021ed2ecafdca53fb48739fcb4..96efad5dded864ba4c7e27c68caa451335fc88a8 100644 --- a/packages/Catch2/src/catch2/internal/catch_polyfills.cpp +++ b/packages/Catch2/src/catch2/internal/catch_polyfills.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_polyfills.hpp b/packages/Catch2/src/catch2/internal/catch_polyfills.hpp index e8444836a72784ae7807bcf67732814cb8edb439..23a9332bc75dbd236efed770ba2aa74461f696db 100644 --- a/packages/Catch2/src/catch2/internal/catch_polyfills.hpp +++ b/packages/Catch2/src/catch2/internal/catch_polyfills.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp b/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp index 4292d0df592a84b821d142151da5717faf78c289..08e844d2053d88393f83271d5d4b4c1163791da4 100644 --- a/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp +++ b/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_preprocessor_internal_stringify.hpp b/packages/Catch2/src/catch2/internal/catch_preprocessor_internal_stringify.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2fd64e1c61576f05562b0c88e885749de8c41a6e --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_preprocessor_internal_stringify.hpp @@ -0,0 +1,19 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED +#define CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED + +#include <catch2/catch_user_config.hpp> + +#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) + #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__##_catch_sr +#else + #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"_catch_sr +#endif + +#endif // CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp b/packages/Catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp index 8033789083416c1ec673a19e4534af837b5644ca..dee11cd6a4177d4d5f5302a29a901d1478fd6038 100644 --- a/packages/Catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp +++ b/packages/Catch2/src/catch2/internal/catch_preprocessor_remove_parens.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_random_number_generator.cpp b/packages/Catch2/src/catch2/internal/catch_random_number_generator.cpp index f71c2323a6e55c807d594160b3af3a328ca70ccd..6a79dff39a0fd380def5da040d6c63d9360a1d8b 100644 --- a/packages/Catch2/src/catch2/internal/catch_random_number_generator.cpp +++ b/packages/Catch2/src/catch2/internal/catch_random_number_generator.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_random_number_generator.hpp b/packages/Catch2/src/catch2/internal/catch_random_number_generator.hpp index 6c4b028b239689bf965d13da82bbdce2b9651f84..e4129becf0596fcc1482cbd0d02c57adeee684ce 100644 --- a/packages/Catch2/src/catch2/internal/catch_random_number_generator.hpp +++ b/packages/Catch2/src/catch2/internal/catch_random_number_generator.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_random_seed_generation.cpp b/packages/Catch2/src/catch2/internal/catch_random_seed_generation.cpp index 7fc1b90d4bfe9bb1cd8c29b230d7783f4efa8123..40c468cb4ba3d1debd3bb1db0f7755fe570cde51 100644 --- a/packages/Catch2/src/catch2/internal/catch_random_seed_generation.cpp +++ b/packages/Catch2/src/catch2/internal/catch_random_seed_generation.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_random_seed_generation.hpp b/packages/Catch2/src/catch2/internal/catch_random_seed_generation.hpp index 42ca93db7d83de2c1e381fdd429b91dca7c97e02..d0d6fb245cb60cc34d2f7060e4708197f4762093 100644 --- a/packages/Catch2/src/catch2/internal/catch_random_seed_generation.hpp +++ b/packages/Catch2/src/catch2/internal/catch_random_seed_generation.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp b/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp index 01b6b3a0ac9c935d20e140e8d0c8ea7d29099820..b2b0cd074da4a09f2c2ecbb7574417d69595e63f 100644 --- a/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp @@ -1,65 +1,88 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -#include <catch2/internal/catch_reporter_registry.hpp> -#include <catch2/reporters/catch_reporter_registrars.hpp> +#include <catch2/internal/catch_reporter_registry.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/reporters/catch_reporter_automake.hpp> #include <catch2/reporters/catch_reporter_compact.hpp> #include <catch2/reporters/catch_reporter_console.hpp> #include <catch2/reporters/catch_reporter_junit.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> #include <catch2/reporters/catch_reporter_sonarqube.hpp> #include <catch2/reporters/catch_reporter_tap.hpp> #include <catch2/reporters/catch_reporter_teamcity.hpp> #include <catch2/reporters/catch_reporter_xml.hpp> -#include <catch2/internal/catch_move_and_forward.hpp> -#include <catch2/internal/catch_enforce.hpp> namespace Catch { + struct ReporterRegistry::ReporterRegistryImpl { + std::vector<Detail::unique_ptr<EventListenerFactory>> listeners; + std::map<std::string, IReporterFactoryPtr, Detail::CaseInsensitiveLess> + factories; + }; - ReporterRegistry::ReporterRegistry() { + ReporterRegistry::ReporterRegistry(): + m_impl( Detail::make_unique<ReporterRegistryImpl>() ) { // Because it is impossible to move out of initializer list, // we have to add the elements manually - m_factories["Automake"] = Detail::make_unique<ReporterFactory<AutomakeReporter>>(); - m_factories["compact"] = Detail::make_unique<ReporterFactory<CompactReporter>>(); - m_factories["console"] = Detail::make_unique<ReporterFactory<ConsoleReporter>>(); - m_factories["JUnit"] = Detail::make_unique<ReporterFactory<JunitReporter>>(); - m_factories["SonarQube"] = Detail::make_unique<ReporterFactory<SonarQubeReporter>>(); - m_factories["TAP"] = Detail::make_unique<ReporterFactory<TAPReporter>>(); - m_factories["TeamCity"] = Detail::make_unique<ReporterFactory<TeamCityReporter>>(); - m_factories["XML"] = Detail::make_unique<ReporterFactory<XmlReporter>>(); + m_impl->factories["Automake"] = + Detail::make_unique<ReporterFactory<AutomakeReporter>>(); + m_impl->factories["compact"] = + Detail::make_unique<ReporterFactory<CompactReporter>>(); + m_impl->factories["console"] = + Detail::make_unique<ReporterFactory<ConsoleReporter>>(); + m_impl->factories["JUnit"] = + Detail::make_unique<ReporterFactory<JunitReporter>>(); + m_impl->factories["SonarQube"] = + Detail::make_unique<ReporterFactory<SonarQubeReporter>>(); + m_impl->factories["TAP"] = + Detail::make_unique<ReporterFactory<TAPReporter>>(); + m_impl->factories["TeamCity"] = + Detail::make_unique<ReporterFactory<TeamCityReporter>>(); + m_impl->factories["XML"] = + Detail::make_unique<ReporterFactory<XmlReporter>>(); } ReporterRegistry::~ReporterRegistry() = default; - - IEventListenerPtr ReporterRegistry::create( std::string const& name, ReporterConfig&& config ) const { - auto it = m_factories.find( name ); - if( it == m_factories.end() ) - return nullptr; - return it->second->create( CATCH_MOVE(config) ); + IEventListenerPtr + ReporterRegistry::create( std::string const& name, + ReporterConfig&& config ) const { + auto it = m_impl->factories.find( name ); + if ( it == m_impl->factories.end() ) return nullptr; + return it->second->create( CATCH_MOVE( config ) ); } - void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr factory ) { + void ReporterRegistry::registerReporter( std::string const& name, + IReporterFactoryPtr factory ) { CATCH_ENFORCE( name.find( "::" ) == name.npos, - "'::' is not allowed in reporter name: '" + name + '\'' ); - auto ret = m_factories.emplace(name, CATCH_MOVE(factory)); - CATCH_ENFORCE( ret.second, "reporter using '" + name + "' as name was already registered" ); + "'::' is not allowed in reporter name: '" + name + + '\'' ); + auto ret = m_impl->factories.emplace( name, CATCH_MOVE( factory ) ); + CATCH_ENFORCE( ret.second, + "reporter using '" + name + + "' as name was already registered" ); } void ReporterRegistry::registerListener( Detail::unique_ptr<EventListenerFactory> factory ) { - m_listeners.push_back( CATCH_MOVE(factory) ); + m_impl->listeners.push_back( CATCH_MOVE( factory ) ); } - IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { - return m_factories; - } - IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { - return m_listeners; + std::map<std::string, + IReporterFactoryPtr, + Detail::CaseInsensitiveLess> const& + ReporterRegistry::getFactories() const { + return m_impl->factories; } -} + std::vector<Detail::unique_ptr<EventListenerFactory>> const& + ReporterRegistry::getListeners() const { + return m_impl->listeners; + } +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp b/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp index b0864265c285199b70694f612a9de51070cd7e02..92a889279346c1a01bc98d3bb989fc844172770f 100644 --- a/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp @@ -1,38 +1,55 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_REPORTER_REGISTRY_HPP_INCLUDED #define CATCH_REPORTER_REGISTRY_HPP_INCLUDED -#include <catch2/interfaces/catch_interfaces_reporter.hpp> -#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +#include <catch2/internal/catch_case_insensitive_comparisons.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> #include <map> +#include <string> +#include <vector> namespace Catch { - class ReporterRegistry : public IReporterRegistry { - public: + class IEventListener; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; + class IReporterFactory; + using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; + struct ReporterConfig; + class EventListenerFactory; + + class ReporterRegistry { + struct ReporterRegistryImpl; + Detail::unique_ptr<ReporterRegistryImpl> m_impl; + public: ReporterRegistry(); - ~ReporterRegistry() override; // = default, out of line to allow fwd decl + ~ReporterRegistry(); // = default; - IEventListenerPtr create( std::string const& name, ReporterConfig&& config ) const override; + IEventListenerPtr create( std::string const& name, + ReporterConfig&& config ) const; - void registerReporter( std::string const& name, IReporterFactoryPtr factory ); - void registerListener( Detail::unique_ptr<EventListenerFactory> factory ); + void registerReporter( std::string const& name, + IReporterFactoryPtr factory ); - FactoryMap const& getFactories() const override; - Listeners const& getListeners() const override; + void + registerListener( Detail::unique_ptr<EventListenerFactory> factory ); - private: - FactoryMap m_factories; - Listeners m_listeners; + std::map<std::string, + IReporterFactoryPtr, + Detail::CaseInsensitiveLess> const& + getFactories() const; + + std::vector<Detail::unique_ptr<EventListenerFactory>> const& + getListeners() const; }; -} + +} // end namespace Catch #endif // CATCH_REPORTER_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.cpp b/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.cpp index 30ee191c59ae1a253c1fa37ff49b5a667d0c2572..8b88b170a556162fbd7898085e4377f99d98ffd5 100644 --- a/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.cpp +++ b/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -21,9 +21,9 @@ namespace Catch { }; kvPair splitKVPair(StringRef kvString) { - auto splitPos = static_cast<size_t>( std::distance( - kvString.begin(), - std::find( kvString.begin(), kvString.end(), '=' ) ) ); + auto splitPos = static_cast<size_t>( + std::find( kvString.begin(), kvString.end(), '=' ) - + kvString.begin() ); return { kvString.substr( 0, splitPos ), kvString.substr( splitPos + 1, kvString.size() ) }; diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.hpp b/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.hpp index 242e10222335c34ec32362b07a7197e2bfa0e54c..d446ce98b4614e0c7c804c141e48d7d680316575 100644 --- a/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.hpp +++ b/packages/Catch2/src/catch2/internal/catch_reporter_spec_parser.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_result_type.cpp b/packages/Catch2/src/catch2/internal/catch_result_type.cpp index 7dea5b4738f4caed1cd601683ac044f32a944867..6cedce7169206353546b631119f06368e459a8bb 100644 --- a/packages/Catch2/src/catch2/internal/catch_result_type.cpp +++ b/packages/Catch2/src/catch2/internal/catch_result_type.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_result_type.hpp b/packages/Catch2/src/catch2/internal/catch_result_type.hpp index f0906fcd303d6dd7547f04780314af30bd2acc71..e66afaff005a43192aee01286b3c14185faa3333 100644 --- a/packages/Catch2/src/catch2/internal/catch_result_type.hpp +++ b/packages/Catch2/src/catch2/internal/catch_result_type.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -16,6 +16,8 @@ namespace Catch { Ok = 0, Info = 1, Warning = 2, + // TODO: Should explicit skip be considered "not OK" (cf. isOk)? I.e., should it have the failure bit? + ExplicitSkip = 4, FailureBit = 0x10, diff --git a/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.cpp b/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.cpp index 9b0824236a0f019e27d32611a8cafad6dc50b2b6..33eafde4ad9665782a2794a89c5593890f1efd9a 100644 --- a/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.cpp +++ b/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.hpp b/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.hpp index 55cff727ecd5273ab19f37eff5832e27d484109b..5b864f35ca4af5f9521e05f79c3de75d2232de47 100644 --- a/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.hpp +++ b/packages/Catch2/src/catch2/internal/catch_reusable_string_stream.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_run_context.cpp b/packages/Catch2/src/catch2/internal/catch_run_context.cpp index c8b0b30e399460dbcbdb4a8bd7c626fdbcd4f470..6f15cfb1a4bbf34767d357c3eb5deccc3d31a11e 100644 --- a/packages/Catch2/src/catch2/internal/catch_run_context.cpp +++ b/packages/Catch2/src/catch2/internal/catch_run_context.cpp @@ -1,15 +1,16 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_run_context.hpp> #include <catch2/catch_user_config.hpp> -#include <catch2/interfaces/catch_interfaces_generatortracker.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/interfaces/catch_interfaces_generatortracker.hpp> +#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_context.hpp> #include <catch2/internal/catch_enforce.hpp> @@ -26,149 +27,152 @@ namespace Catch { namespace Generators { - struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { - GeneratorBasePtr m_generator; - - GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) - : TrackerBase( nameAndLocation, ctx, parent ) - {} - ~GeneratorTracker() override; - - static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { - GeneratorTracker* tracker; - - ITracker& currentTracker = ctx.currentTracker(); - // Under specific circumstances, the generator we want - // to acquire is also the current tracker. If this is - // the case, we have to avoid looking through current - // tracker's children, and instead return the current - // tracker. - // A case where this check is important is e.g. - // for (int i = 0; i < 5; ++i) { - // int n = GENERATE(1, 2); - // } - // - // without it, the code above creates 5 nested generators. - if ( currentTracker.nameAndLocation() == nameAndLocation ) { - auto thisTracker = - currentTracker.parent()->findChild( nameAndLocation ); - assert( thisTracker ); - assert( thisTracker->isGeneratorTracker() ); - tracker = static_cast<GeneratorTracker*>( thisTracker ); - } else if ( ITracker* childTracker = - currentTracker.findChild( nameAndLocation ) ) { - assert( childTracker ); - assert( childTracker->isGeneratorTracker() ); - tracker = static_cast<GeneratorTracker*>( childTracker ); - } else { - auto newTracker = - Catch::Detail::make_unique<GeneratorTracker>( - nameAndLocation, ctx, ¤tTracker ); - tracker = newTracker.get(); - currentTracker.addChild( CATCH_MOVE(newTracker) ); - } - - if( !tracker->isComplete() ) { - tracker->open(); - } + namespace { + struct GeneratorTracker final : TestCaseTracking::TrackerBase, + IGeneratorTracker { + GeneratorBasePtr m_generator; + + GeneratorTracker( + TestCaseTracking::NameAndLocation&& nameAndLocation, + TrackerContext& ctx, + ITracker* parent ): + TrackerBase( CATCH_MOVE( nameAndLocation ), ctx, parent ) {} + ~GeneratorTracker() override = default; + + static GeneratorTracker* + acquire( TrackerContext& ctx, + TestCaseTracking::NameAndLocationRef const& + nameAndLocation ) { + GeneratorTracker* tracker; + + ITracker& currentTracker = ctx.currentTracker(); + // Under specific circumstances, the generator we want + // to acquire is also the current tracker. If this is + // the case, we have to avoid looking through current + // tracker's children, and instead return the current + // tracker. + // A case where this check is important is e.g. + // for (int i = 0; i < 5; ++i) { + // int n = GENERATE(1, 2); + // } + // + // without it, the code above creates 5 nested generators. + if ( currentTracker.nameAndLocation() == nameAndLocation ) { + auto thisTracker = currentTracker.parent()->findChild( + nameAndLocation ); + assert( thisTracker ); + assert( thisTracker->isGeneratorTracker() ); + tracker = static_cast<GeneratorTracker*>( thisTracker ); + } else if ( ITracker* childTracker = + currentTracker.findChild( + nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isGeneratorTracker() ); + tracker = + static_cast<GeneratorTracker*>( childTracker ); + } else { + return nullptr; + } - return *tracker; - } + if ( !tracker->isComplete() ) { tracker->open(); } - // TrackerBase interface - bool isGeneratorTracker() const override { return true; } - auto hasGenerator() const -> bool override { - return !!m_generator; - } - void close() override { - TrackerBase::close(); - // If a generator has a child (it is followed by a section) - // and none of its children have started, then we must wait - // until later to start consuming its values. - // This catches cases where `GENERATE` is placed between two - // `SECTION`s. - // **The check for m_children.empty cannot be removed**. - // doing so would break `GENERATE` _not_ followed by `SECTION`s. - const bool should_wait_for_child = [&]() { - // No children -> nobody to wait for - if ( m_children.empty() ) { - return false; - } - // If at least one child started executing, don't wait - if ( std::find_if( - m_children.begin(), - m_children.end(), - []( TestCaseTracking::ITrackerPtr const& tracker ) { - return tracker->hasStarted(); - } ) != m_children.end() ) { - return false; - } + return tracker; + } - // No children have started. We need to check if they _can_ - // start, and thus we should wait for them, or they cannot - // start (due to filters), and we shouldn't wait for them - ITracker* parent = m_parent; - // This is safe: there is always at least one section - // tracker in a test case tracking tree - while ( !parent->isSectionTracker() ) { - parent = parent->parent(); - } - assert( parent && - "Missing root (test case) level section" ); - - auto const& parentSection = - static_cast<SectionTracker const&>( *parent ); - auto const& filters = parentSection.getFilters(); - // No filters -> no restrictions on running sections - if ( filters.empty() ) { - return true; - } + // TrackerBase interface + bool isGeneratorTracker() const override { return true; } + auto hasGenerator() const -> bool override { + return !!m_generator; + } + void close() override { + TrackerBase::close(); + // If a generator has a child (it is followed by a section) + // and none of its children have started, then we must wait + // until later to start consuming its values. + // This catches cases where `GENERATE` is placed between two + // `SECTION`s. + // **The check for m_children.empty cannot be removed**. + // doing so would break `GENERATE` _not_ followed by + // `SECTION`s. + const bool should_wait_for_child = [&]() { + // No children -> nobody to wait for + if ( m_children.empty() ) { return false; } + // If at least one child started executing, don't wait + if ( std::find_if( + m_children.begin(), + m_children.end(), + []( TestCaseTracking::ITrackerPtr const& + tracker ) { + return tracker->hasStarted(); + } ) != m_children.end() ) { + return false; + } - for ( auto const& child : m_children ) { - if ( child->isSectionTracker() && - std::find( - filters.begin(), - filters.end(), - static_cast<SectionTracker const&>( *child ) - .trimmedName() ) != filters.end() ) { - return true; + // No children have started. We need to check if they + // _can_ start, and thus we should wait for them, or + // they cannot start (due to filters), and we shouldn't + // wait for them + ITracker* parent = m_parent; + // This is safe: there is always at least one section + // tracker in a test case tracking tree + while ( !parent->isSectionTracker() ) { + parent = parent->parent(); } + assert( parent && + "Missing root (test case) level section" ); + + auto const& parentSection = + static_cast<SectionTracker const&>( *parent ); + auto const& filters = parentSection.getFilters(); + // No filters -> no restrictions on running sections + if ( filters.empty() ) { return true; } + + for ( auto const& child : m_children ) { + if ( child->isSectionTracker() && + std::find( filters.begin(), + filters.end(), + static_cast<SectionTracker const&>( + *child ) + .trimmedName() ) != + filters.end() ) { + return true; + } + } + return false; + }(); + + // This check is a bit tricky, because m_generator->next() + // has a side-effect, where it consumes generator's current + // value, but we do not want to invoke the side-effect if + // this generator is still waiting for any child to start. + assert( m_generator && "Tracker without generator" ); + if ( should_wait_for_child || + ( m_runState == CompletedSuccessfully && + m_generator->countedNext() ) ) { + m_children.clear(); + m_runState = Executing; } - return false; - }(); - - // This check is a bit tricky, because m_generator->next() - // has a side-effect, where it consumes generator's current - // value, but we do not want to invoke the side-effect if - // this generator is still waiting for any child to start. - if ( should_wait_for_child || - ( m_runState == CompletedSuccessfully && - m_generator->countedNext() ) ) { - m_children.clear(); - m_runState = Executing; } - } - // IGeneratorTracker interface - auto getGenerator() const -> GeneratorBasePtr const& override { - return m_generator; - } - void setGenerator( GeneratorBasePtr&& generator ) override { - m_generator = CATCH_MOVE( generator ); - } - }; - GeneratorTracker::~GeneratorTracker() = default; + // IGeneratorTracker interface + auto getGenerator() const -> GeneratorBasePtr const& override { + return m_generator; + } + void setGenerator( GeneratorBasePtr&& generator ) override { + m_generator = CATCH_MOVE( generator ); + } + }; + } // namespace } RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter) : m_runInfo(_config->name()), - m_context(getCurrentMutableContext()), m_config(_config), m_reporter(CATCH_MOVE(reporter)), m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) { - m_context.setResultCapture(this); + getCurrentMutableContext().setResultCapture( this ); m_reporter->testRunStarting(m_runInfo); } @@ -179,13 +183,8 @@ namespace Catch { Totals RunContext::runTest(TestCaseHandle const& testCase) { const Totals prevTotals = m_totals; - std::string redirectedCout; - std::string redirectedCerr; - auto const& testInfo = testCase.getTestCaseInfo(); - m_reporter->testCaseStarting(testInfo); - m_activeTestCase = &testCase; @@ -227,9 +226,11 @@ namespace Catch { seedRng( *m_config ); uint64_t testRuns = 0; + std::string redirectedCout; + std::string redirectedCerr; do { m_trackerContext.startCycle(); - m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); + m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocationRef(testInfo.name, testInfo.lineInfo)); m_reporter->testCasePartialStarting(testInfo, testRuns); @@ -240,7 +241,7 @@ namespace Catch { redirectedCerr += oneRunCerr; const auto singleRunTotals = m_totals.delta(beforeRunTotals); - auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, oneRunCout, oneRunCerr, aborting()); + auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, CATCH_MOVE(oneRunCout), CATCH_MOVE(oneRunCerr), aborting()); m_reporter->testCasePartialEnded(statsForOneRun, testRuns); ++testRuns; @@ -255,8 +256,8 @@ namespace Catch { m_totals.testCases += deltaTotals.testCases; m_reporter->testCaseEnded(TestCaseStats(testInfo, deltaTotals, - redirectedCout, - redirectedCerr, + CATCH_MOVE(redirectedCout), + CATCH_MOVE(redirectedCerr), aborting())); m_activeTestCase = nullptr; @@ -266,10 +267,13 @@ namespace Catch { } - void RunContext::assertionEnded(AssertionResult const & result) { + void RunContext::assertionEnded(AssertionResult&& result) { if (result.getResultType() == ResultWas::Ok) { m_totals.assertions.passed++; m_lastAssertionPassed = true; + } else if (result.getResultType() == ResultWas::ExplicitSkip) { + m_totals.assertions.skipped++; + m_lastAssertionPassed = true; } else if (!result.succeeded()) { m_lastAssertionPassed = false; if (result.isOk()) { @@ -285,24 +289,36 @@ namespace Catch { m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)); - if (result.getResultType() != ResultWas::Warning) + if ( result.getResultType() != ResultWas::Warning ) { m_messageScopes.clear(); + } // Reset working state resetAssertionInfo(); - m_lastResult = result; + m_lastResult = CATCH_MOVE( result ); } void RunContext::resetAssertionInfo() { m_lastAssertionInfo.macroName = StringRef(); m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; } - bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) { - ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo)); + void RunContext::notifyAssertionStarted( AssertionInfo const& info ) { + m_reporter->assertionStarting( info ); + } + + bool RunContext::sectionStarted( StringRef sectionName, + SourceLineInfo const& sectionLineInfo, + Counts& assertions ) { + ITracker& sectionTracker = + SectionTracker::acquire( m_trackerContext, + TestCaseTracking::NameAndLocationRef( + sectionName, sectionLineInfo ) ); + if (!sectionTracker.isOpen()) return false; m_activeSections.push_back(§ionTracker); + SectionInfo sectionInfo( sectionLineInfo, static_cast<std::string>(sectionName) ); m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; m_reporter->sectionStarting(sectionInfo); @@ -311,14 +327,39 @@ namespace Catch { return true; } - auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + IGeneratorTracker* + RunContext::acquireGeneratorTracker( StringRef generatorName, + SourceLineInfo const& lineInfo ) { using namespace Generators; - GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext, - TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) ); + GeneratorTracker* tracker = GeneratorTracker::acquire( + m_trackerContext, + TestCaseTracking::NameAndLocationRef( + generatorName, lineInfo ) ); m_lastAssertionInfo.lineInfo = lineInfo; return tracker; } + IGeneratorTracker* RunContext::createGeneratorTracker( + StringRef generatorName, + SourceLineInfo lineInfo, + Generators::GeneratorBasePtr&& generator ) { + + auto nameAndLoc = TestCaseTracking::NameAndLocation( static_cast<std::string>( generatorName ), lineInfo ); + auto& currentTracker = m_trackerContext.currentTracker(); + assert( + currentTracker.nameAndLocation() != nameAndLoc && + "Trying to create tracker for a genreator that already has one" ); + + auto newTracker = Catch::Detail::make_unique<Generators::GeneratorTracker>( + CATCH_MOVE(nameAndLoc), m_trackerContext, ¤tTracker ); + auto ret = newTracker.get(); + currentTracker.addChild( CATCH_MOVE( newTracker ) ); + + ret->setGenerator( CATCH_MOVE( generator ) ); + ret->open(); + return ret; + } + bool RunContext::testForMissingAssertions(Counts& assertions) { if (assertions.total() != 0) return false; @@ -331,7 +372,7 @@ namespace Catch { return true; } - void RunContext::sectionEnded(SectionEndInfo const & endInfo) { + void RunContext::sectionEnded(SectionEndInfo&& endInfo) { Counts assertions = m_totals.assertions - endInfo.prevAssertions; bool missingAssertions = testForMissingAssertions(assertions); @@ -340,19 +381,20 @@ namespace Catch { m_activeSections.pop_back(); } - m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions)); + m_reporter->sectionEnded(SectionStats(CATCH_MOVE(endInfo.sectionInfo), assertions, endInfo.durationInSeconds, missingAssertions)); m_messages.clear(); m_messageScopes.clear(); } - void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) { - if (m_unfinishedSections.empty()) + void RunContext::sectionEndedEarly(SectionEndInfo&& endInfo) { + if ( m_unfinishedSections.empty() ) { m_activeSections.back()->fail(); - else + } else { m_activeSections.back()->close(); + } m_activeSections.pop_back(); - m_unfinishedSections.push_back(endInfo); + m_unfinishedSections.push_back(CATCH_MOVE(endInfo)); } void RunContext::benchmarkPreparing( StringRef name ) { @@ -376,8 +418,8 @@ namespace Catch { m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end()); } - void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) { - m_messageScopes.emplace_back( builder ); + void RunContext::emplaceUnscopedMessage( MessageBuilder&& builder ) { + m_messageScopes.emplace_back( CATCH_MOVE(builder) ); } std::string RunContext::getCurrentTestName() const { @@ -402,9 +444,9 @@ namespace Catch { // Instead, fake a result data. AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); tempResult.message = static_cast<std::string>(message); - AssertionResult result(m_lastAssertionInfo, tempResult); + AssertionResult result(m_lastAssertionInfo, CATCH_MOVE(tempResult)); - assertionEnded(result); + assertionEnded(CATCH_MOVE(result) ); handleUnfinishedSections(); @@ -414,7 +456,7 @@ namespace Catch { Counts assertions; assertions.failed = 1; - SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); + SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, 0, false); m_reporter->sectionEnded(testCaseSectionStats); auto const& testInfo = m_activeTestCase->getTestCaseInfo(); @@ -475,6 +517,8 @@ namespace Catch { duration = timer.getElapsedSeconds(); } CATCH_CATCH_ANON (TestFailureException&) { // This just means the test was aborted due to failure + } CATCH_CATCH_ANON (TestSkipException&) { + // This just means the test was explicitly skipped } CATCH_CATCH_ALL { // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions // are reported without translation at the point of origin. @@ -491,7 +535,7 @@ namespace Catch { m_messages.clear(); m_messageScopes.clear(); - SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); + SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, duration, missingAssertions); m_reporter->sectionEnded(testCaseSectionStats); } @@ -515,7 +559,7 @@ namespace Catch { itEnd = m_unfinishedSections.rend(); it != itEnd; ++it) - sectionEnded(*it); + sectionEnded(CATCH_MOVE(*it)); m_unfinishedSections.clear(); } @@ -524,8 +568,6 @@ namespace Catch { ITransientExpression const& expr, AssertionReaction& reaction ) { - m_reporter->assertionStarting( info ); - bool negated = isFalseTest( info.resultDisposition ); bool result = expr.getResult() != negated; @@ -551,10 +593,10 @@ namespace Catch { m_lastAssertionInfo = info; AssertionResultData data( resultType, LazyExpression( negated ) ); - AssertionResult assertionResult{ info, data }; + AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; - assertionEnded( assertionResult ); + assertionEnded( CATCH_MOVE(assertionResult) ); } void RunContext::handleMessage( @@ -563,16 +605,22 @@ namespace Catch { StringRef message, AssertionReaction& reaction ) { - m_reporter->assertionStarting( info ); - m_lastAssertionInfo = info; AssertionResultData data( resultType, LazyExpression( false ) ); data.message = static_cast<std::string>(message); - AssertionResult assertionResult{ m_lastAssertionInfo, data }; - assertionEnded( assertionResult ); - if( !assertionResult.isOk() ) + AssertionResult assertionResult{ m_lastAssertionInfo, + CATCH_MOVE( data ) }; + + const auto isOk = assertionResult.isOk(); + assertionEnded( CATCH_MOVE(assertionResult) ); + if ( !isOk ) { populateReaction( reaction ); + } else if ( resultType == ResultWas::ExplicitSkip ) { + // TODO: Need to handle this explicitly, as ExplicitSkip is + // considered "OK" + reaction.shouldSkip = true; + } } void RunContext::handleUnexpectedExceptionNotThrown( AssertionInfo const& info, @@ -583,15 +631,15 @@ namespace Catch { void RunContext::handleUnexpectedInflightException( AssertionInfo const& info, - std::string const& message, + std::string&& message, AssertionReaction& reaction ) { m_lastAssertionInfo = info; AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); - data.message = message; - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); + data.message = CATCH_MOVE(message); + AssertionResult assertionResult{ info, CATCH_MOVE(data) }; + assertionEnded( CATCH_MOVE(assertionResult) ); populateReaction( reaction ); } @@ -603,12 +651,13 @@ namespace Catch { void RunContext::handleIncomplete( AssertionInfo const& info ) { + using namespace std::string_literals; m_lastAssertionInfo = info; AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); - data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); + data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"s; + AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; + assertionEnded( CATCH_MOVE(assertionResult) ); } void RunContext::handleNonExpr( AssertionInfo const &info, @@ -618,11 +667,11 @@ namespace Catch { m_lastAssertionInfo = info; AssertionResultData data( resultType, LazyExpression( false ) ); - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); + AssertionResult assertionResult{ info, CATCH_MOVE( data ) }; - if( !assertionResult.isOk() ) - populateReaction( reaction ); + const auto isOk = assertionResult.isOk(); + assertionEnded( CATCH_MOVE(assertionResult) ); + if ( !isOk ) { populateReaction( reaction ); } } diff --git a/packages/Catch2/src/catch2/internal/catch_run_context.hpp b/packages/Catch2/src/catch2/internal/catch_run_context.hpp index cf8941766a0469b21772b917d735b08c06494a76..c749304d3b5b4fe0fd95900680fdd24c2118e9d9 100644 --- a/packages/Catch2/src/catch2/internal/catch_run_context.hpp +++ b/packages/Catch2/src/catch2/internal/catch_run_context.hpp @@ -1,15 +1,16 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_RUN_CONTEXT_HPP_INCLUDED #define CATCH_RUN_CONTEXT_HPP_INCLUDED -#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/internal/catch_test_registry.hpp> +#include <catch2/internal/catch_test_run_info.hpp> #include <catch2/internal/catch_fatal_condition_handler.hpp> #include <catch2/catch_test_case_info.hpp> #include <catch2/catch_message.hpp> @@ -24,13 +25,14 @@ namespace Catch { - class IMutableContext; class IGeneratorTracker; class IConfig; + class IEventListener; + using IEventListenerPtr = Detail::unique_ptr<IEventListener>; /////////////////////////////////////////////////////////////////////////// - class RunContext : public IResultCapture { + class RunContext final : public IResultCapture { public: RunContext( RunContext const& ) = delete; @@ -59,7 +61,7 @@ namespace Catch { AssertionReaction& reaction ) override; void handleUnexpectedInflightException ( AssertionInfo const& info, - std::string const& message, + std::string&& message, AssertionReaction& reaction ) override; void handleIncomplete ( AssertionInfo const& info ) override; @@ -68,12 +70,22 @@ namespace Catch { ResultWas::OfType resultType, AssertionReaction &reaction ) override; - bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; + void notifyAssertionStarted( AssertionInfo const& info ) override; + bool sectionStarted( StringRef sectionName, + SourceLineInfo const& sectionLineInfo, + Counts& assertions ) override; - void sectionEnded( SectionEndInfo const& endInfo ) override; - void sectionEndedEarly( SectionEndInfo const& endInfo ) override; + void sectionEnded( SectionEndInfo&& endInfo ) override; + void sectionEndedEarly( SectionEndInfo&& endInfo ) override; + + IGeneratorTracker* + acquireGeneratorTracker( StringRef generatorName, + SourceLineInfo const& lineInfo ) override; + IGeneratorTracker* createGeneratorTracker( + StringRef generatorName, + SourceLineInfo lineInfo, + Generators::GeneratorBasePtr&& generator ) override; - auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; void benchmarkPreparing( StringRef name ) override; void benchmarkStarting( BenchmarkInfo const& info ) override; @@ -83,7 +95,7 @@ namespace Catch { void pushScopedMessage( MessageInfo const& message ) override; void popScopedMessage( MessageInfo const& message ) override; - void emplaceUnscopedMessage( MessageBuilder const& builder ) override; + void emplaceUnscopedMessage( MessageBuilder&& builder ) override; std::string getCurrentTestName() const override; @@ -109,7 +121,7 @@ namespace Catch { void resetAssertionInfo(); bool testForMissingAssertions( Counts& assertions ); - void assertionEnded( AssertionResult const& result ); + void assertionEnded( AssertionResult&& result ); void reportExpr ( AssertionInfo const &info, ResultWas::OfType resultType, @@ -123,7 +135,6 @@ namespace Catch { void handleUnfinishedSections(); TestRunInfo m_runInfo; - IMutableContext& m_context; TestCaseHandle const* m_activeTestCase = nullptr; ITracker* m_testCaseTracker = nullptr; Optional<AssertionResult> m_lastResult; diff --git a/packages/Catch2/src/catch2/internal/catch_section.cpp b/packages/Catch2/src/catch2/internal/catch_section.cpp index 8f37e27491545c00ef7cd5da9aaf1935ec5b765e..061732b1d875c4433eb8c11632b434786a6d6ac6 100644 --- a/packages/Catch2/src/catch2/internal/catch_section.cpp +++ b/packages/Catch2/src/catch2/internal/catch_section.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -15,7 +15,7 @@ namespace Catch { Section::Section( SectionInfo&& info ): m_info( CATCH_MOVE( info ) ), m_sectionIncluded( - getResultCapture().sectionStarted( m_info, m_assertions ) ) { + getResultCapture().sectionStarted( m_info.name, m_info.lineInfo, m_assertions ) ) { // Non-"included" sections will not use the timing information // anyway, so don't bother with the potential syscall. if (m_sectionIncluded) { @@ -23,13 +23,31 @@ namespace Catch { } } + Section::Section( SourceLineInfo const& _lineInfo, + StringRef _name, + const char* const ): + m_info( { "invalid", static_cast<std::size_t>( -1 ) }, std::string{} ), + m_sectionIncluded( + getResultCapture().sectionStarted( _name, _lineInfo, m_assertions ) ) { + // We delay initialization the SectionInfo member until we know + // this section needs it, so we avoid allocating std::string for name. + // We also delay timer start to avoid the potential syscall unless we + // will actually use the result. + if ( m_sectionIncluded ) { + m_info.name = static_cast<std::string>( _name ); + m_info.lineInfo = _lineInfo; + m_timer.start(); + } + } + Section::~Section() { if( m_sectionIncluded ) { - SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; - if( uncaught_exceptions() ) - getResultCapture().sectionEndedEarly( endInfo ); - else - getResultCapture().sectionEnded( endInfo ); + SectionEndInfo endInfo{ CATCH_MOVE(m_info), m_assertions, m_timer.getElapsedSeconds() }; + if ( uncaught_exceptions() ) { + getResultCapture().sectionEndedEarly( CATCH_MOVE(endInfo) ); + } else { + getResultCapture().sectionEnded( CATCH_MOVE( endInfo ) ); + } } } diff --git a/packages/Catch2/src/catch2/internal/catch_section.hpp b/packages/Catch2/src/catch2/internal/catch_section.hpp index 2e72923c3a1a267752a5b4d6f77565d20a2d6863..bd92bdf462b03e37aca9966bb6e6c09ac79b11ba 100644 --- a/packages/Catch2/src/catch2/internal/catch_section.hpp +++ b/packages/Catch2/src/catch2/internal/catch_section.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -9,6 +9,7 @@ #define CATCH_SECTION_HPP_INCLUDED #include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_config_static_analysis_support.hpp> #include <catch2/internal/catch_noncopyable.hpp> #include <catch2/catch_section_info.hpp> #include <catch2/catch_timer.hpp> @@ -20,6 +21,9 @@ namespace Catch { class Section : Detail::NonCopyable { public: Section( SectionInfo&& info ); + Section( SourceLineInfo const& _lineInfo, + StringRef _name, + const char* const = nullptr ); ~Section(); // This indicates whether the section should be executed or not @@ -35,16 +39,62 @@ namespace Catch { } // end namespace Catch -#define INTERNAL_CATCH_SECTION( ... ) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ - if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ - CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION - -#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ - if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \ - CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#if !defined(CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT) +# define INTERNAL_CATCH_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + if ( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( \ + catch_internal_Section ) = \ + Catch::Section( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +# define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + if ( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( \ + catch_internal_Section ) = \ + Catch::SectionInfo( \ + CATCH_INTERNAL_LINEINFO, \ + ( Catch::ReusableStringStream() << __VA_ARGS__ ) \ + .str() ) ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#else + +// These section definitions imply that at most one section at one level +// will be intered (because only one section's __LINE__ can be equal to +// the dummy `catchInternalSectionHint` variable from `TEST_CASE`). + +namespace Catch { + namespace Detail { + // Intentionally without linkage, as it should only be used as a dummy + // symbol for static analysis. + int GetNewSectionHint(); + } // namespace Detail +} // namespace Catch + + +# define INTERNAL_CATCH_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \ + if ( [[maybe_unused]] int catchInternalPreviousSectionHint = \ + catchInternalSectionHint, \ + catchInternalSectionHint = Catch::Detail::GetNewSectionHint(); \ + catchInternalPreviousSectionHint == __LINE__ ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +# define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \ + if ( [[maybe_unused]] int catchInternalPreviousSectionHint = \ + catchInternalSectionHint, \ + catchInternalSectionHint = Catch::Detail::GetNewSectionHint(); \ + catchInternalPreviousSectionHint == __LINE__ ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#endif + #endif // CATCH_SECTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_sharding.hpp b/packages/Catch2/src/catch2/internal/catch_sharding.hpp index 17a206f85070e8be43f7faa19b53ddd55e194ccb..d0e4cfa13fa62c98338cf9752732aaa3a8f9d40e 100644 --- a/packages/Catch2/src/catch2/internal/catch_sharding.hpp +++ b/packages/Catch2/src/catch2/internal/catch_sharding.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,6 +11,7 @@ #include <catch2/catch_session.hpp> #include <cmath> +#include <algorithm> namespace Catch { diff --git a/packages/Catch2/src/catch2/internal/catch_singletons.cpp b/packages/Catch2/src/catch2/internal/catch_singletons.cpp index 116fce4698630727876b03af314f71ae1c268c09..4e856def35a7112f158df82a7e80b00735da23de 100644 --- a/packages/Catch2/src/catch2/internal/catch_singletons.cpp +++ b/packages/Catch2/src/catch2/internal/catch_singletons.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_singletons.hpp b/packages/Catch2/src/catch2/internal/catch_singletons.hpp index d06d224487eff160b5d30d8c7385381b3b255ef1..a28a13daa5190113d64c0369d687adcbc1855403 100644 --- a/packages/Catch2/src/catch2/internal/catch_singletons.hpp +++ b/packages/Catch2/src/catch2/internal/catch_singletons.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_source_line_info.cpp b/packages/Catch2/src/catch2/internal/catch_source_line_info.cpp index 9a4fe74e511b3b06f56119bd39246f59659eabaf..f55f1c9f4eb4a7ee74c26d4b039d07e06c2ba213 100644 --- a/packages/Catch2/src/catch2/internal/catch_source_line_info.cpp +++ b/packages/Catch2/src/catch2/internal/catch_source_line_info.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_source_line_info.hpp b/packages/Catch2/src/catch2/internal/catch_source_line_info.hpp index c6b98195e1e4a4bb46ec36da9c6856a832fd2cb6..c59805277a0af4c9ec6d793ced1ca6e92d238265 100644 --- a/packages/Catch2/src/catch2/internal/catch_source_line_info.hpp +++ b/packages/Catch2/src/catch2/internal/catch_source_line_info.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.cpp b/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.cpp index 7681f442acbf3bc51b74b6569827266bc9cbf6b0..1607663739251a0ff3b34e71e4d58c7a8284c3c8 100644 --- a/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.hpp b/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.hpp index 943772b8ddd6eb57b4f56bd19a5787988e445205..aef4667d015b3f2efcf409c9887d50f5e6fc1619 100644 --- a/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_stdstreams.cpp b/packages/Catch2/src/catch2/internal/catch_stdstreams.cpp index 21a0e4e61b3c27fe667592b2d74c3615fa140958..a4502b2b85323760ccbad141ff036733c32ba1d5 100644 --- a/packages/Catch2/src/catch2/internal/catch_stdstreams.cpp +++ b/packages/Catch2/src/catch2/internal/catch_stdstreams.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_stdstreams.hpp b/packages/Catch2/src/catch2/internal/catch_stdstreams.hpp index 39d8bd750bb6da16867642258ed6649ef99aa446..02aec63581461d2f70e074d2414d3ce36bf3c5da 100644 --- a/packages/Catch2/src/catch2/internal/catch_stdstreams.hpp +++ b/packages/Catch2/src/catch2/internal/catch_stdstreams.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_stream_end_stop.hpp b/packages/Catch2/src/catch2/internal/catch_stream_end_stop.hpp index 452ca1e97357f30e26c2d584f4b4b856b1f7084e..66d678cf88bb84b3c2186362d4e6fc47b2e51e24 100644 --- a/packages/Catch2/src/catch2/internal/catch_stream_end_stop.hpp +++ b/packages/Catch2/src/catch2/internal/catch_stream_end_stop.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -17,10 +17,10 @@ namespace Catch { // as well as // << stuff +StreamEndStop struct StreamEndStop { - StringRef operator+() const { return StringRef(); } + constexpr StringRef operator+() const { return StringRef(); } template <typename T> - friend T const& operator+( T const& value, StreamEndStop ) { + constexpr friend T const& operator+( T const& value, StreamEndStop ) { return value; } }; diff --git a/packages/Catch2/src/catch2/internal/catch_string_manip.cpp b/packages/Catch2/src/catch2/internal/catch_string_manip.cpp index e61bfd434628c8f7b99915d399016b517e6dba1e..0c889ca1810c38de0426dbe36b7cc27cace07681 100644 --- a/packages/Catch2/src/catch2/internal/catch_string_manip.cpp +++ b/packages/Catch2/src/catch2/internal/catch_string_manip.cpp @@ -1,14 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_string_manip.hpp> #include <catch2/internal/catch_stringref.hpp> -#include <algorithm> #include <ostream> #include <cstring> #include <cctype> @@ -32,9 +31,9 @@ namespace Catch { return s.find( infix ) != std::string::npos; } void toLowerInPlace( std::string& s ) { - std::transform( s.begin(), s.end(), s.begin(), []( char c ) { - return toLower( c ); - } ); + for ( char& c : s ) { + c = toLower( c ); + } } std::string toLower( std::string const& s ) { std::string lc = s; diff --git a/packages/Catch2/src/catch2/internal/catch_string_manip.hpp b/packages/Catch2/src/catch2/internal/catch_string_manip.hpp index dc58a33601e76504a583b51b38f14ff1c8dd4026..dc0c552c4ac996c7cb537417759a579885176ca9 100644 --- a/packages/Catch2/src/catch2/internal/catch_string_manip.hpp +++ b/packages/Catch2/src/catch2/internal/catch_string_manip.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,6 +10,7 @@ #include <catch2/internal/catch_stringref.hpp> +#include <cstdint> #include <string> #include <iosfwd> #include <vector> diff --git a/packages/Catch2/src/catch2/internal/catch_stringref.cpp b/packages/Catch2/src/catch2/internal/catch_stringref.cpp index 46bbfafdba598bd5945814015232ba32dc114d5c..232498ebe7fbab33d20af8a7452a61eca1bbe49a 100644 --- a/packages/Catch2/src/catch2/internal/catch_stringref.cpp +++ b/packages/Catch2/src/catch2/internal/catch_stringref.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -17,10 +17,6 @@ namespace Catch { : StringRef( rawChars, std::strlen(rawChars) ) {} - auto StringRef::operator == ( StringRef other ) const noexcept -> bool { - return m_size == other.m_size - && (std::memcmp( m_start, other.m_start, m_size ) == 0); - } bool StringRef::operator<(StringRef rhs) const noexcept { if (m_size < rhs.m_size) { diff --git a/packages/Catch2/src/catch2/internal/catch_stringref.hpp b/packages/Catch2/src/catch2/internal/catch_stringref.hpp index e7f1ab70c14c8add9bdc2bc3f7156dc708d2070c..99bb9a986af71ddb3a0101a05a4e6f7eea6dfe4a 100644 --- a/packages/Catch2/src/catch2/internal/catch_stringref.hpp +++ b/packages/Catch2/src/catch2/internal/catch_stringref.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -13,6 +13,8 @@ #include <iosfwd> #include <cassert> +#include <cstring> + namespace Catch { /// A non-owning string class (similar to the forthcoming std::string_view) @@ -49,7 +51,10 @@ namespace Catch { } public: // operators - auto operator == ( StringRef other ) const noexcept -> bool; + auto operator == ( StringRef other ) const noexcept -> bool { + return m_size == other.m_size + && (std::memcmp( m_start, other.m_start, m_size ) == 0); + } auto operator != (StringRef other) const noexcept -> bool { return !(*this == other); } diff --git a/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.cpp b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.cpp index 8c3e339f6761894e0d272c1f18512f534ab78457..b7c6b9ec74312ba3e71bd121143796f533cc0c70 100644 --- a/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp index 3dbe05281c1bdcc1c02c5409d251d90d0065fc52..64c0f8f3cdd5480930ce80fdc7e60a9bdf647b83 100644 --- a/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp b/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp index bfac3bc81d44ecbb24425aef0d23e33e11813ea5..0ea354bc6049b3e88b9d6f1b9a36f366cf749035 100644 --- a/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -74,6 +74,7 @@ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ namespace {\ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ @@ -84,12 +85,12 @@ struct TestName{\ TestName(){\ size_t index = 0; \ - constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ - using expander = size_t[];\ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; /* NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays,hicpp-avoid-c-arrays) */\ + using expander = size_t[]; /* NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays,hicpp-avoid-c-arrays) */\ (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ }\ };\ - static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + static const int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\ return 0;\ }();\ @@ -120,6 +121,7 @@ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ template<typename TestType> static void TestFuncName(); \ namespace {\ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ @@ -169,6 +171,7 @@ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ template<typename TestType> static void TestFunc(); \ namespace {\ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ @@ -178,7 +181,7 @@ void reg_tests() { \ size_t index = 0; \ using expander = size_t[]; \ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\ } \ };\ static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ @@ -300,6 +303,7 @@ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \ template<typename TestType> \ struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \ void test();\ @@ -312,7 +316,7 @@ void reg_tests(){\ size_t index = 0;\ using expander = size_t[];\ - (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \ }\ };\ static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.cpp b/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.cpp index 692d066c4352011a015b8f578370e41c6323a41c..e1731ebe8bf997c6f350e3b20adc617db57cdcdb 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.cpp +++ b/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.hpp b/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.hpp index afe233553171e085e88d9c75cf74c40b399ceda4..b0422dccd712fc764cc87e3eda63e2063290f86e 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_case_info_hasher.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp index 6c491a959f27fa42e1a3b23103b609cf479081ed..f1702979e7c79b8fa78410778dc4d2ccd5df5811 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp +++ b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -9,6 +9,7 @@ #include <catch2/internal/catch_context.hpp> #include <catch2/internal/catch_enforce.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> #include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/internal/catch_random_number_generator.hpp> #include <catch2/internal/catch_run_context.hpp> @@ -23,6 +24,38 @@ namespace Catch { + namespace { + static void enforceNoDuplicateTestCases( + std::vector<TestCaseHandle> const& tests ) { + auto testInfoCmp = []( TestCaseInfo const* lhs, + TestCaseInfo const* rhs ) { + return *lhs < *rhs; + }; + std::set<TestCaseInfo const*, decltype( testInfoCmp )&> seenTests( + testInfoCmp ); + for ( auto const& test : tests ) { + const auto infoPtr = &test.getTestCaseInfo(); + const auto prev = seenTests.insert( infoPtr ); + CATCH_ENFORCE( prev.second, + "error: test case \"" + << infoPtr->name << "\", with tags \"" + << infoPtr->tagsAsString() + << "\" already defined.\n" + << "\tFirst seen at " + << ( *prev.first )->lineInfo << "\n" + << "\tRedefined at " << infoPtr->lineInfo ); + } + } + + static bool matchTest( TestCaseHandle const& testCase, + TestSpec const& testSpec, + IConfig const& config ) { + return testSpec.matches( testCase.getTestCaseInfo() ) && + isThrowSafe( testCase, config ); + } + + } // end unnamed namespace + std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) { switch (config.runOrder()) { case TestRunOrder::Declared: @@ -79,29 +112,6 @@ namespace Catch { return !testCase.getTestCaseInfo().throws() || config.allowThrows(); } - bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ) { - return testSpec.matches( testCase.getTestCaseInfo() ) && isThrowSafe( testCase, config ); - } - - void - enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& tests ) { - auto testInfoCmp = []( TestCaseInfo const* lhs, - TestCaseInfo const* rhs ) { - return *lhs < *rhs; - }; - std::set<TestCaseInfo const*, decltype(testInfoCmp)> seenTests(testInfoCmp); - for ( auto const& test : tests ) { - const auto infoPtr = &test.getTestCaseInfo(); - const auto prev = seenTests.insert( infoPtr ); - CATCH_ENFORCE( - prev.second, - "error: test case \"" << infoPtr->name << "\", with tags \"" - << infoPtr->tagsAsString() << "\" already defined.\n" - << "\tFirst seen at " << ( *prev.first )->lineInfo << "\n" - << "\tRedefined at " << infoPtr->lineInfo ); - } - } - std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ) { std::vector<TestCaseHandle> filtered; filtered.reserve( testCases.size() ); @@ -142,11 +152,4 @@ namespace Catch { return m_sortedFunctions; } - - - /////////////////////////////////////////////////////////////////////////// - void TestInvokerAsFunction::invoke() const { - m_testAsFunction(); - } - } // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp index b0064cbbdf8ae5487dd0957b03e11236c38f2c6d..a4a27ed122ddbc86c267ef42f902390c96f248b7 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp @@ -1,30 +1,29 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED #define CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED -#include <catch2/internal/catch_test_registry.hpp> +#include <catch2/interfaces/catch_interfaces_testcase.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> #include <vector> namespace Catch { - class TestCaseHandle; class IConfig; + class ITestInvoker; + class TestCaseHandle; class TestSpec; std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ); bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ); - bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ); - - void enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& functions ); std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ); std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ); @@ -53,18 +52,6 @@ namespace Catch { /////////////////////////////////////////////////////////////////////////// - class TestInvokerAsFunction final : public ITestInvoker { - using TestType = void(*)(); - TestType m_testAsFunction; - public: - TestInvokerAsFunction(TestType testAsFunction) noexcept: - m_testAsFunction(testAsFunction) {} - - void invoke() const override; - }; - - /////////////////////////////////////////////////////////////////////////// - } // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_tracker.cpp b/packages/Catch2/src/catch2/internal/catch_test_case_tracker.cpp index ce76dcba89287acaf63e6cc712c00f11c7439baf..1470b91c67434906657cfbed70e9b43e011b776e 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_case_tracker.cpp +++ b/packages/Catch2/src/catch2/internal/catch_test_case_tracker.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -22,8 +22,8 @@ namespace Catch { namespace TestCaseTracking { - NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) - : name( _name ), + NameAndLocation::NameAndLocation( std::string&& _name, SourceLineInfo const& _location ) + : name( CATCH_MOVE(_name) ), location( _location ) {} @@ -38,14 +38,17 @@ namespace TestCaseTracking { m_children.push_back( CATCH_MOVE(child) ); } - ITracker* ITracker::findChild( NameAndLocation const& nameAndLocation ) { + ITracker* ITracker::findChild( NameAndLocationRef const& nameAndLocation ) { auto it = std::find_if( m_children.begin(), m_children.end(), [&nameAndLocation]( ITrackerPtr const& tracker ) { - return tracker->nameAndLocation().location == - nameAndLocation.location && - tracker->nameAndLocation().name == nameAndLocation.name; + auto const& tnameAndLoc = tracker->nameAndLocation(); + if ( tnameAndLoc.location.line != + nameAndLocation.location.line ) { + return false; + } + return tnameAndLoc == nameAndLocation; } ); return ( it != m_children.end() ) ? it->get() : nullptr; } @@ -53,10 +56,6 @@ namespace TestCaseTracking { bool ITracker::isSectionTracker() const { return false; } bool ITracker::isGeneratorTracker() const { return false; } - bool ITracker::isSuccessfullyCompleted() const { - return m_runState == CompletedSuccessfully; - } - bool ITracker::isOpen() const { return m_runState != NotStarted && !isComplete(); } @@ -83,16 +82,6 @@ namespace TestCaseTracking { return *m_rootTracker; } - void TrackerContext::endRun() { - m_rootTracker.reset(); - m_currentTracker = nullptr; - m_runState = NotStarted; - } - - void TrackerContext::startCycle() { - m_currentTracker = m_rootTracker.get(); - m_runState = Executing; - } void TrackerContext::completeCycle() { m_runState = CompletedCycle; } @@ -100,16 +89,13 @@ namespace TestCaseTracking { bool TrackerContext::completedCycle() const { return m_runState == CompletedCycle; } - ITracker& TrackerContext::currentTracker() { - return *m_currentTracker; - } void TrackerContext::setCurrentTracker( ITracker* tracker ) { m_currentTracker = tracker; } - TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ): - ITracker(nameAndLocation, parent), + TrackerBase::TrackerBase( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ): + ITracker(CATCH_MOVE(nameAndLocation), parent), m_ctx( ctx ) {} @@ -169,13 +155,14 @@ namespace TestCaseTracking { m_ctx.setCurrentTracker( this ); } - SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) - : TrackerBase( nameAndLocation, ctx, parent ), - m_trimmed_name(trim(nameAndLocation.name)) + SectionTracker::SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( CATCH_MOVE(nameAndLocation), ctx, parent ), + m_trimmed_name(trim(StringRef(ITracker::nameAndLocation().name))) { if( parent ) { - while( !parent->isSectionTracker() ) + while ( !parent->isSectionTracker() ) { parent = parent->parent(); + } SectionTracker& parentSection = static_cast<SectionTracker&>( *parent ); addNextFilters( parentSection.m_filters ); @@ -195,24 +182,30 @@ namespace TestCaseTracking { bool SectionTracker::isSectionTracker() const { return true; } - SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { - SectionTracker* section; + SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation ) { + SectionTracker* tracker; ITracker& currentTracker = ctx.currentTracker(); if ( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { assert( childTracker ); assert( childTracker->isSectionTracker() ); - section = static_cast<SectionTracker*>( childTracker ); + tracker = static_cast<SectionTracker*>( childTracker ); } else { - auto newSection = Catch::Detail::make_unique<SectionTracker>( - nameAndLocation, ctx, ¤tTracker ); - section = newSection.get(); - currentTracker.addChild( CATCH_MOVE( newSection ) ); + auto newTracker = Catch::Detail::make_unique<SectionTracker>( + NameAndLocation{ static_cast<std::string>(nameAndLocation.name), + nameAndLocation.location }, + ctx, + ¤tTracker ); + tracker = newTracker.get(); + currentTracker.addChild( CATCH_MOVE( newTracker ) ); + } + + if ( !ctx.completedCycle() ) { + tracker->tryOpen(); } - if( !ctx.completedCycle() ) - section->tryOpen(); - return *section; + + return *tracker; } void SectionTracker::tryOpen() { @@ -233,10 +226,6 @@ namespace TestCaseTracking { m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() ); } - std::vector<StringRef> const& SectionTracker::getFilters() const { - return m_filters; - } - StringRef SectionTracker::trimmedName() const { return m_trimmed_name; } diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_tracker.hpp b/packages/Catch2/src/catch2/internal/catch_test_case_tracker.hpp index 0355f195cd006f83fbf712b4c935c87dea2e958e..50278c910fe332f0d3b5b1944db56aa8cbf03e39 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_case_tracker.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_case_tracker.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -22,10 +22,49 @@ namespace TestCaseTracking { std::string name; SourceLineInfo location; - NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); + NameAndLocation( std::string&& _name, SourceLineInfo const& _location ); friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) { - return lhs.name == rhs.name - && lhs.location == rhs.location; + // This is a very cheap check that should have a very high hit rate. + // If we get to SourceLineInfo::operator==, we will redo it, but the + // cost of repeating is trivial at that point (we will be paying + // multiple strcmp/memcmps at that point). + if ( lhs.location.line != rhs.location.line ) { return false; } + return lhs.name == rhs.name && lhs.location == rhs.location; + } + friend bool operator!=(NameAndLocation const& lhs, + NameAndLocation const& rhs) { + return !( lhs == rhs ); + } + }; + + /** + * This is a variant of `NameAndLocation` that does not own the name string + * + * This avoids extra allocations when trying to locate a tracker by its + * name and location, as long as we make sure that trackers only keep + * around the owning variant. + */ + struct NameAndLocationRef { + StringRef name; + SourceLineInfo location; + + constexpr NameAndLocationRef( StringRef name_, + SourceLineInfo location_ ): + name( name_ ), location( location_ ) {} + + friend bool operator==( NameAndLocation const& lhs, + NameAndLocationRef const& rhs ) { + // This is a very cheap check that should have a very high hit rate. + // If we get to SourceLineInfo::operator==, we will redo it, but the + // cost of repeating is trivial at that point (we will be paying + // multiple strcmp/memcmps at that point). + if ( lhs.location.line != rhs.location.line ) { return false; } + return StringRef( lhs.name ) == rhs.name && + lhs.location == rhs.location; + } + friend bool operator==( NameAndLocationRef const& lhs, + NameAndLocation const& rhs ) { + return rhs == lhs; } }; @@ -53,8 +92,8 @@ namespace TestCaseTracking { CycleState m_runState = NotStarted; public: - ITracker( NameAndLocation const& nameAndLoc, ITracker* parent ): - m_nameAndLocation( nameAndLoc ), + ITracker( NameAndLocation&& nameAndLoc, ITracker* parent ): + m_nameAndLocation( CATCH_MOVE(nameAndLoc) ), m_parent( parent ) {} @@ -74,8 +113,10 @@ namespace TestCaseTracking { //! Returns true if tracker run to completion (successfully or not) virtual bool isComplete() const = 0; - //! Returns true if tracker run to completion succesfully - bool isSuccessfullyCompleted() const; + //! Returns true if tracker run to completion successfully + bool isSuccessfullyCompleted() const { + return m_runState == CompletedSuccessfully; + } //! Returns true if tracker has started but hasn't been completed bool isOpen() const; //! Returns true iff tracker has started @@ -93,7 +134,7 @@ namespace TestCaseTracking { * * Returns nullptr if not found. */ - ITracker* findChild( NameAndLocation const& nameAndLocation ); + ITracker* findChild( NameAndLocationRef const& nameAndLocation ); //! Have any children been added? bool hasChildren() const { return !m_children.empty(); @@ -134,13 +175,15 @@ namespace TestCaseTracking { public: ITracker& startRun(); - void endRun(); - void startCycle(); + void startCycle() { + m_currentTracker = m_rootTracker.get(); + m_runState = Executing; + } void completeCycle(); bool completedCycle() const; - ITracker& currentTracker(); + ITracker& currentTracker() { return *m_currentTracker; } void setCurrentTracker( ITracker* tracker ); }; @@ -150,7 +193,7 @@ namespace TestCaseTracking { TrackerContext& m_ctx; public: - TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + TrackerBase( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ); bool isComplete() const override; @@ -166,22 +209,26 @@ namespace TestCaseTracking { class SectionTracker : public TrackerBase { std::vector<StringRef> m_filters; - std::string m_trimmed_name; + // Note that lifetime-wise we piggy back off the name stored in the `ITracker` parent`. + // Currently it allocates owns the name, so this is safe. If it is later refactored + // to not own the name, the name still has to outlive the `ITracker` parent, so + // this should still be safe. + StringRef m_trimmed_name; public: - SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ); bool isSectionTracker() const override; bool isComplete() const override; - static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); + static SectionTracker& acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation ); void tryOpen(); void addInitialFilters( std::vector<std::string> const& filters ); void addNextFilters( std::vector<StringRef> const& filters ); //! Returns filters active in this tracker - std::vector<StringRef> const& getFilters() const; + std::vector<StringRef> const& getFilters() const { return m_filters; } //! Returns whitespace-trimmed name of the tracked section StringRef trimmedName() const; }; diff --git a/packages/Catch2/src/catch2/internal/catch_test_failure_exception.cpp b/packages/Catch2/src/catch2/internal/catch_test_failure_exception.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8ea313131378f1ed531c27e825900b6af209fbc9 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_failure_exception.cpp @@ -0,0 +1,31 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/internal/catch_test_failure_exception.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/catch_user_config.hpp> + +namespace Catch { + + void throw_test_failure_exception() { +#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS ) + throw TestFailureException{}; +#else + CATCH_ERROR( "Test failure requires aborting test!" ); +#endif + } + + void throw_test_skip_exception() { +#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS ) + throw Catch::TestSkipException(); +#else + CATCH_ERROR( "Explicitly skipping tests during runtime requires exceptions" ); +#endif + } + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_test_failure_exception.hpp b/packages/Catch2/src/catch2/internal/catch_test_failure_exception.hpp index bb6803bae3c764167fa73c5ceda017266a7f91c7..1ef883648f28da5603aa4fa0478f744cb4211cc0 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_failure_exception.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_failure_exception.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -12,6 +12,22 @@ namespace Catch { //! Used to signal that an assertion macro failed struct TestFailureException{}; + //! Used to signal that the remainder of a test should be skipped + struct TestSkipException {}; + + /** + * Outlines throwing of `TestFailureException` into a single TU + * + * Also handles `CATCH_CONFIG_DISABLE_EXCEPTIONS` for callers. + */ + [[noreturn]] void throw_test_failure_exception(); + + /** + * Outlines throwing of `TestSkipException` into a single TU + * + * Also handles `CATCH_CONFIG_DISABLE_EXCEPTIONS` for callers. + */ + [[noreturn]] void throw_test_skip_exception(); } // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp b/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp index 95384bc155ab730b64ec02bbb9d089537eb762e4..39366023f426193457241be4d5c4dc079fa07374 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,6 +10,7 @@ #include <catch2/catch_user_config.hpp> #include <catch2/internal/catch_assertion_handler.hpp> +#include <catch2/internal/catch_preprocessor_internal_stringify.hpp> #include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_source_line_info.hpp> @@ -22,12 +23,6 @@ #if !defined(CATCH_CONFIG_DISABLE) -#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) - #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ -#else - #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" -#endif - #if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) /////////////////////////////////////////////////////////////////////////////// @@ -76,7 +71,10 @@ do { \ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ try { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ static_cast<void>(__VA_ARGS__); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ catchAssertionHandler.handleExceptionNotThrownAsExpected(); \ } \ catch( ... ) { \ @@ -91,7 +89,11 @@ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \ if( catchAssertionHandler.allowThrows() ) \ try { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \ + CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ static_cast<void>(__VA_ARGS__); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ } \ catch( ... ) { \ @@ -108,7 +110,11 @@ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \ if( catchAssertionHandler.allowThrows() ) \ try { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \ + CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ static_cast<void>(expr); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ } \ catch( exceptionType const& ) { \ @@ -131,11 +137,15 @@ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ if( catchAssertionHandler.allowThrows() ) \ try { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \ + CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \ static_cast<void>(__VA_ARGS__); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ } \ catch( ... ) { \ - Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher##_catch_sr ); \ + Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher ); \ } \ else \ catchAssertionHandler.handleThrowingCallSkipped(); \ diff --git a/packages/Catch2/src/catch2/internal/catch_test_registry.cpp b/packages/Catch2/src/catch2/internal/catch_test_registry.cpp index faadb101b663132b5571b53a968399763ce27ba5..e9c999fecd73acc94802d739249e61c90a79d9d1 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_registry.cpp +++ b/packages/Catch2/src/catch2/internal/catch_test_registry.cpp @@ -1,14 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/internal/catch_test_registry.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/catch_test_case_info.hpp> -#include <catch2/internal/catch_test_case_registry_impl.hpp> #include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <catch2/internal/catch_move_and_forward.hpp> @@ -17,9 +16,10 @@ #include <iterator> namespace Catch { + ITestInvoker::~ITestInvoker() = default; namespace { - StringRef extractClassName( StringRef classOrMethodName ) { + static StringRef extractClassName( StringRef classOrMethodName ) { if ( !startsWith( classOrMethodName, '&' ) ) { return classOrMethodName; } @@ -46,6 +46,18 @@ namespace Catch { static_cast<std::size_t>( startIdx ), static_cast<std::size_t>( classNameSize ) ); } + + class TestInvokerAsFunction final : public ITestInvoker { + using TestType = void ( * )(); + TestType m_testAsFunction; + + public: + TestInvokerAsFunction( TestType testAsFunction ) noexcept: + m_testAsFunction( testAsFunction ) {} + + void invoke() const override { m_testAsFunction(); } + }; + } // namespace Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) { diff --git a/packages/Catch2/src/catch2/internal/catch_test_registry.hpp b/packages/Catch2/src/catch2/internal/catch_test_registry.hpp index 6e064e0831416446c81ed95b4b8c63a1691bc727..d248d3cf904a6f90fb6813929a501bfcacf8281a 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_registry.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_registry.hpp @@ -1,16 +1,17 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_TEST_REGISTRY_HPP_INCLUDED #define CATCH_TEST_REGISTRY_HPP_INCLUDED +#include <catch2/internal/catch_config_static_analysis_support.hpp> #include <catch2/internal/catch_source_line_info.hpp> #include <catch2/internal/catch_noncopyable.hpp> -#include <catch2/interfaces/catch_interfaces_testcase.hpp> +#include <catch2/interfaces/catch_interfaces_test_invoker.hpp> #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_unique_ptr.hpp> #include <catch2/internal/catch_unique_name.hpp> @@ -72,25 +73,55 @@ struct AutoReg : Detail::NonCopyable { void TestName::test() #endif + +#if !defined(CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT) + /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ static void TestName(); \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ - namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + namespace{ const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ static void TestName() #define INTERNAL_CATCH_TESTCASE( ... ) \ INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__ ) - /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ - namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ - CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#else // ^^ !CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT | vv CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT + + +// Dummy registrator for the dumy test case macros +namespace Catch { + namespace Detail { + struct DummyUse { + DummyUse( void ( * )( int ) ); + }; + } // namespace Detail +} // namespace Catch + +// Note that both the presence of the argument and its exact name are +// necessary for the section support. + +// We provide a shadowed variable so that a `SECTION` inside non-`TEST_CASE` +// tests can compile. The redefined `TEST_CASE` shadows this with param. +static int catchInternalSectionHint = 0; + +# define INTERNAL_CATCH_TESTCASE2( fname ) \ + static void fname( int ); \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + static const Catch::Detail::DummyUse INTERNAL_CATCH_UNIQUE_NAME( \ + dummyUser )( &fname ); \ + CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \ + static void fname( [[maybe_unused]] int catchInternalSectionHint ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +# define INTERNAL_CATCH_TESTCASE( ... ) \ + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( dummyFunction ) ) + + +#endif // CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ @@ -101,13 +132,33 @@ struct AutoReg : Detail::NonCopyable { struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ void test(); \ }; \ - Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \ + Catch::makeTestInvoker( &TestName::test ), \ + CATCH_INTERNAL_LINEINFO, \ + #ClassName##_catch_sr, \ + Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ } \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ void TestName::test() #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + namespace { \ + const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \ + Catch::makeTestInvoker( &QualifiedMethod ), \ + CATCH_INTERNAL_LINEINFO, \ + "&" #QualifiedMethod##_catch_sr, \ + Catch::NameAndTags{ __VA_ARGS__ } ); \ + } /* NOLINT */ \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + + /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ do { \ diff --git a/packages/Catch2/src/catch2/internal/catch_test_run_info.hpp b/packages/Catch2/src/catch2/internal/catch_test_run_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..90357b0af53464289da25929c5452fb36b520a92 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_run_info.hpp @@ -0,0 +1,22 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_RUN_INFO_HPP_INCLUDED +#define CATCH_TEST_RUN_INFO_HPP_INCLUDED + +#include <catch2/internal/catch_stringref.hpp> + +namespace Catch { + + struct TestRunInfo { + constexpr TestRunInfo(StringRef _name) : name(_name) {} + StringRef name; + }; + +} // end namespace Catch + +#endif // CATCH_TEST_RUN_INFO_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp index 4dd1ea2a17d3318657c66d6023b0654a8b3775da..d6e4cb58d1e1765d478c6f04bb35095c65c59ee2 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp +++ b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -221,10 +221,8 @@ namespace Catch { token.erase(token.begin()); if (m_exclusion) { m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring)); - m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); } else { m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring)); - m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); } } if (m_exclusion) { @@ -238,8 +236,4 @@ namespace Catch { m_mode = None; } - TestSpec parseTestSpec( std::string const& arg ) { - return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); - } - } // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp index 75f2fd760c4c5e7d672f511610f71249a5636462..aa2917dbb2e7c677a07849fa737f9c546ef27053 100644 --- a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp +++ b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -71,7 +71,6 @@ namespace Catch { } }; - TestSpec parseTestSpec( std::string const& arg ); } // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_textflow.cpp b/packages/Catch2/src/catch2/internal/catch_textflow.cpp index 993e16229910d1c93f29e75f2407c6188548da25..7eac973258e8adcfc319d0e21b53217ea221a39b 100644 --- a/packages/Catch2/src/catch2/internal/catch_textflow.cpp +++ b/packages/Catch2/src/catch2/internal/catch_textflow.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_textflow.hpp b/packages/Catch2/src/catch2/internal/catch_textflow.hpp index e2cdff58b7f9e0e9be2704cd5f044c0e525c1b28..0776ab9227d01f7ed99c11fcb771b57c3f778c0c 100644 --- a/packages/Catch2/src/catch2/internal/catch_textflow.hpp +++ b/packages/Catch2/src/catch2/internal/catch_textflow.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -59,7 +59,7 @@ namespace Catch { // Calculates the length of the current line void calcLength(); - // Returns current indention width + // Returns current indentation width size_t indentSize() const; // Creates an indented and (optionally) suffixed string from diff --git a/packages/Catch2/src/catch2/internal/catch_to_string.hpp b/packages/Catch2/src/catch2/internal/catch_to_string.hpp index 15b24e19534253ce9c0b52875fc7fed11fdc080b..c74621619c3b19fc64dc8e404ba6b3bddd63f0ea 100644 --- a/packages/Catch2/src/catch2/internal/catch_to_string.hpp +++ b/packages/Catch2/src/catch2/internal/catch_to_string.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.cpp b/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.cpp index c6251a3f7cff4c669bed5ef2365d8892e500f844..704d6e1ca92cd9f70d36bc95224c34d59efe9f1b 100644 --- a/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.cpp +++ b/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.hpp b/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.hpp index a287bacd87eb18527c6bd77431b9e59c8ad57f79..8520864cb1c73b8783b73168734fb50b771bcfe5 100644 --- a/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.hpp +++ b/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_unique_name.hpp b/packages/Catch2/src/catch2/internal/catch_unique_name.hpp index 31ab91268416035c74ec0a1b66ff1a2625ac6f23..c6e1c2caac765cb79760fc04faf18ef563ed36aa 100644 --- a/packages/Catch2/src/catch2/internal/catch_unique_name.hpp +++ b/packages/Catch2/src/catch2/internal/catch_unique_name.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp b/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp index c453cde623e0e846ca9c6c108974c5898fcfd2c0..49cbc7856d04ca1be345da8b38603ca3f7f6c12c 100644 --- a/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp +++ b/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_void_type.hpp b/packages/Catch2/src/catch2/internal/catch_void_type.hpp index 23875c352471cd07346eb70df6aa388749ec1ba0..dacc83dd1e47e547567300efcdc2cf3a48a88ec9 100644 --- a/packages/Catch2/src/catch2/internal/catch_void_type.hpp +++ b/packages/Catch2/src/catch2/internal/catch_void_type.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.cpp b/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.cpp index d71ca37ac69e73b152923f8b9274aae81d41bac4..09c5a40597e66b9d5b19f5af82805669e0f8841c 100644 --- a/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.cpp +++ b/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.hpp b/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.hpp index 6e9f6d57a7556d9f5a19008a5edd09f7c3812e75..72479ba87844ff9172f13a9c2c35dbb515dd98bb 100644 --- a/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.hpp +++ b/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp b/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp index 14fe747d1447fb37fc5fefc6440238190a99ed5e..e3b914955d8f13020801c86f85040384993ade76 100644 --- a/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp +++ b/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -21,11 +21,7 @@ # define WIN32_LEAN_AND_MEAN #endif -#ifdef __AFXDLL -#include <AfxWin.h> -#else #include <windows.h> -#endif #endif // defined(CATCH_PLATFORM_WINDOWS) diff --git a/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp b/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp index 93758cba766ce7fb2d6c050f610e386ea01bb8d5..6c1d45df4891b7f553dd0add9aeff058eac86e3c 100644 --- a/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp +++ b/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,6 +11,7 @@ #include <catch2/internal/catch_enforce.hpp> #include <catch2/internal/catch_xmlwriter.hpp> +#include <cstdint> #include <iomanip> #include <type_traits> diff --git a/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp b/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp index 556339376d17f1d8972bfe63376bf8532aef57c7..ec55f3c46844c9a8f6dc00de1b3058ac9f0ed3cc 100644 --- a/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp +++ b/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers.cpp index 6b604e4a18e38f84320249b7f6853d9f36e8a3d8..123b30413d302e4f74cb3de80eefeedd1e8dff84 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers.hpp index 373e2a6739ef2af4eaa7e29df6f758b089fea4b6..3d996c39f229c5a11b875f2675d9581505515d84 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_all.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_all.hpp index 3c0bb9f51c76d415b70e2f646161dd4e4d9a6dc4..83fe5386f68ff63340f0e4853d3dd444aae18d5e 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_all.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_all.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -27,6 +27,7 @@ #include <catch2/matchers/catch_matchers_floating_point.hpp> #include <catch2/matchers/catch_matchers_predicate.hpp> #include <catch2/matchers/catch_matchers_quantifiers.hpp> +#include <catch2/matchers/catch_matchers_range_equals.hpp> #include <catch2/matchers/catch_matchers_string.hpp> #include <catch2/matchers/catch_matchers_templated.hpp> #include <catch2/matchers/catch_matchers_vector.hpp> diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.cpp index 5344abcd6c6544b1c371a44053ae994ef48f11f8..f0c535bcbf88a6dec8329b2709645a41188f41cb 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp index f0688a57af50105c55c44c7fc4074825e8877677..5f3fc7fbf715380ad8201bb453211141a24df165 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_contains.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_contains.hpp index 239aa80b96f71b855e69177b5950790793a2ce9e..877d6924dedff769511073356d89c2052e011ad1 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_contains.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_contains.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -33,13 +33,11 @@ namespace Catch { } template <typename RangeLike> - bool match(RangeLike&& rng) const { - using std::begin; using std::end; - - return end(rng) != std::find_if(begin(rng), end(rng), - [&](auto const& elem) { - return m_eq(elem, m_desired); - }); + bool match( RangeLike&& rng ) const { + for ( auto&& elem : rng ) { + if ( m_eq( elem, m_desired ) ) { return true; } + } + return false; } }; @@ -91,7 +89,7 @@ namespace Catch { /** * Creates a matcher that checks whether a range contains a specific element. * - * Uses `eq` to do the comparisons + * Uses `eq` to do the comparisons, the element is provided on the rhs */ template <typename T, typename Equality> ContainsElementMatcher<T, Equality> Contains(T&& elem, Equality&& eq) { diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_exception.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_exception.cpp index af3ea15a6dd079905d315fe27941f29916230a7f..8147390bff69006ddfcd7d6e4d3f96854bfec60e 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_exception.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_exception.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_exception.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_exception.hpp index eca9327d3b433a7371e3b339028463bf2358ec02..e7c3a636b1ce201a0841273251be3ba4a8c11782 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_exception.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_exception.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -29,6 +29,32 @@ public: //! Creates a matcher that checks whether a std derived exception has the provided message ExceptionMessageMatcher Message(std::string const& message); +template <typename StringMatcherType> +class ExceptionMessageMatchesMatcher final + : public MatcherBase<std::exception> { + StringMatcherType m_matcher; + +public: + ExceptionMessageMatchesMatcher( StringMatcherType matcher ): + m_matcher( CATCH_MOVE( matcher ) ) {} + + bool match( std::exception const& ex ) const override { + return m_matcher.match( ex.what() ); + } + + std::string describe() const override { + return " matches \"" + m_matcher.describe() + '"'; + } +}; + +//! Creates a matcher that checks whether a message from an std derived +//! exception matches a provided matcher +template <typename StringMatcherType> +ExceptionMessageMatchesMatcher<StringMatcherType> +MessageMatches( StringMatcherType&& matcher ) { + return { CATCH_FORWARD( matcher ) }; +} + } // namespace Matchers } // namespace Catch diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp index 4d40140fea2bdb108e51958730a1c7401c7b95f4..6e596466ecabf20b88881aecd049c0114862d561 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -225,5 +225,17 @@ WithinRelMatcher WithinRel(float target) { } -} // namespace Matchers + +bool IsNaNMatcher::match( double const& matchee ) const { + return std::isnan( matchee ); +} + +std::string IsNaNMatcher::describe() const { + using namespace std::string_literals; + return "is NaN"s; +} + +IsNaNMatcher IsNaN() { return IsNaNMatcher(); } + + } // namespace Matchers } // namespace Catch diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp index 99572e4332cad6c7328156f2de8dc4155cde0a37..76816633c8dcfe21375c7197ffb677436808b6ef 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -27,6 +27,11 @@ namespace Matchers { double m_margin; }; + //! Creates a matcher that accepts numbers within certain range of target + WithinAbsMatcher WithinAbs( double target, double margin ); + + + class WithinUlpsMatcher final : public MatcherBase<double> { public: WithinUlpsMatcher( double target, @@ -40,6 +45,13 @@ namespace Matchers { Detail::FloatingPointKind m_type; }; + //! Creates a matcher that accepts doubles within certain ULP range of target + WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff); + //! Creates a matcher that accepts floats within certain ULP range of target + WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff); + + + // Given IEEE-754 format for floats and doubles, we can assume // that float -> double promotion is lossless. Given this, we can // assume that if we do the standard relative comparison of @@ -56,13 +68,6 @@ namespace Matchers { double m_epsilon; }; - //! Creates a matcher that accepts doubles within certain ULP range of target - WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff); - //! Creates a matcher that accepts floats within certain ULP range of target - WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff); - //! Creates a matcher that accepts numbers within certain range of target - WithinAbsMatcher WithinAbs(double target, double margin); - //! Creates a matcher that accepts doubles within certain relative range of target WithinRelMatcher WithinRel(double target, double eps); //! Creates a matcher that accepts doubles within 100*DBL_EPS relative range of target @@ -72,6 +77,17 @@ namespace Matchers { //! Creates a matcher that accepts floats within 100*FLT_EPS relative range of target WithinRelMatcher WithinRel(float target); + + + class IsNaNMatcher final : public MatcherBase<double> { + public: + IsNaNMatcher() = default; + bool match( double const& matchee ) const override; + std::string describe() const override; + }; + + IsNaNMatcher IsNaN(); + } // namespace Matchers } // namespace Catch diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.cpp index a9ecffc9fb0edd095b89e6644f751b10566724a2..f5445375cd2a9524cd135df9f927d41aaae2af69 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.hpp index 5f5cea590137927288b535c432a6ebe8685980f1..2d1cc33a47d8ed2cd689aacb7fcaaa1fc69d2b52 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp index 1f2e48d8758c16e91460a116baf3186a08be15e7..5a7524672bd0d4fbe4dc474285d753eb2fe824fc 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp index 8833440f28f88a301b22759ace1f1411c51cdb77..977b0c762c7e803b36dd9b86a60f308335bd6e01 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_range_equals.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_range_equals.hpp new file mode 100644 index 0000000000000000000000000000000000000000..95b781a430f13675b027e21af4368922ea58524a --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_range_equals.hpp @@ -0,0 +1,144 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED +#define CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED + +#include <catch2/internal/catch_is_permutation.hpp> +#include <catch2/matchers/catch_matchers_templated.hpp> + +#include <algorithm> +#include <utility> + +namespace Catch { + namespace Matchers { + + /** + * Matcher for checking that an element contains the same + * elements in the same order + */ + template <typename TargetRangeLike, typename Equality> + class RangeEqualsMatcher final : public MatcherGenericBase { + TargetRangeLike m_desired; + Equality m_predicate; + + public: + template <typename TargetRangeLike2, typename Equality2> + RangeEqualsMatcher( TargetRangeLike2&& range, + Equality2&& predicate ): + m_desired( CATCH_FORWARD( range ) ), + m_predicate( CATCH_FORWARD( predicate ) ) {} + + template <typename RangeLike> + bool match( RangeLike&& rng ) const { + auto rng_start = begin( rng ); + const auto rng_end = end( rng ); + auto target_start = begin( m_desired ); + const auto target_end = end( m_desired ); + + while (rng_start != rng_end && target_start != target_end) { + if (!m_predicate(*rng_start, *target_start)) { + return false; + } + ++rng_start; + ++target_start; + } + return rng_start == rng_end && target_start == target_end; + } + + std::string describe() const override { + return "elements are " + Catch::Detail::stringify( m_desired ); + } + }; + + /** + * Matcher for checking that an element contains the same + * elements (but not necessarily in the same order) + */ + template <typename TargetRangeLike, typename Equality> + class UnorderedRangeEqualsMatcher final : public MatcherGenericBase { + TargetRangeLike m_desired; + Equality m_predicate; + + public: + template <typename TargetRangeLike2, typename Equality2> + UnorderedRangeEqualsMatcher( TargetRangeLike2&& range, + Equality2&& predicate ): + m_desired( CATCH_FORWARD( range ) ), + m_predicate( CATCH_FORWARD( predicate ) ) {} + + template <typename RangeLike> + bool match( RangeLike&& rng ) const { + using std::begin; + using std::end; + return Catch::Detail::is_permutation( begin( m_desired ), + end( m_desired ), + begin( rng ), + end( rng ), + m_predicate ); + } + + std::string describe() const override { + return "unordered elements are " + + ::Catch::Detail::stringify( m_desired ); + } + }; + + /** + * Creates a matcher that checks if all elements in a range are equal + * to all elements in another range. + * + * Uses `std::equal_to` to do the comparison + */ + template <typename RangeLike> + std::enable_if_t<!Detail::is_matcher<RangeLike>::value, + RangeEqualsMatcher<RangeLike, std::equal_to<>>> + RangeEquals( RangeLike&& range ) { + return { CATCH_FORWARD( range ), std::equal_to<>{} }; + } + + /** + * Creates a matcher that checks if all elements in a range are equal + * to all elements in another range. + * + * Uses to provided predicate `predicate` to do the comparisons + */ + template <typename RangeLike, typename Equality> + RangeEqualsMatcher<RangeLike, Equality> + RangeEquals( RangeLike&& range, Equality&& predicate ) { + return { CATCH_FORWARD( range ), CATCH_FORWARD( predicate ) }; + } + + /** + * Creates a matcher that checks if all elements in a range are equal + * to all elements in another range, in some permutation + * + * Uses `std::equal_to` to do the comparison + */ + template <typename RangeLike> + std::enable_if_t< + !Detail::is_matcher<RangeLike>::value, + UnorderedRangeEqualsMatcher<RangeLike, std::equal_to<>>> + UnorderedRangeEquals( RangeLike&& range ) { + return { CATCH_FORWARD( range ), std::equal_to<>{} }; + } + + /** + * Creates a matcher that checks if all elements in a range are equal + * to all elements in another range, in some permutation. + * + * Uses to provided predicate `predicate` to do the comparisons + */ + template <typename RangeLike, typename Equality> + UnorderedRangeEqualsMatcher<RangeLike, Equality> + UnorderedRangeEquals( RangeLike&& range, Equality&& predicate ) { + return { CATCH_FORWARD( range ), CATCH_FORWARD( predicate ) }; + } + } // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp index 2fc3a55638299dd7b3fca1c6c6f43bb39868de39..55002848b4cddf6fa64f605ead4372efb1775ef0 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp index 7f961c45ed5082f0fb6b89f80a21acafbbc04b7b..718022e31c831e183ceadb69ec17659e6ef452ed 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp index a336d8989666be29065e47fbfbab09e21fac8d9b..2fc529d2b90e9f52ea6c7432cae46880ea6c7ad8 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp index 8c7804ce91824f058b0cb6271319c2c4def86a1a..ba0661ae5caa9d833ec9cc4288028165301cf446 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,6 +11,7 @@ #include <catch2/matchers/catch_matchers.hpp> #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <catch2/internal/catch_logical_traits.hpp> #include <array> #include <algorithm> @@ -24,7 +25,7 @@ namespace Matchers { MatcherGenericBase() = default; ~MatcherGenericBase() override; // = default; - MatcherGenericBase(MatcherGenericBase&) = default; + MatcherGenericBase(MatcherGenericBase const&) = default; MatcherGenericBase(MatcherGenericBase&&) = default; MatcherGenericBase& operator=(MatcherGenericBase const&) = delete; @@ -56,20 +57,6 @@ namespace Matchers { return arr; } -#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510 - - using std::conjunction; - -#else // __cpp_lib_logical_traits - - template<typename... Cond> - struct conjunction : std::true_type {}; - - template<typename Cond, typename... Rest> - struct conjunction<Cond, Rest...> : std::integral_constant<bool, Cond::value && conjunction<Rest...>::value> {}; - -#endif // __cpp_lib_logical_traits - template<typename T> using is_generic_matcher = std::is_base_of< Catch::Matchers::MatcherGenericBase, @@ -77,7 +64,7 @@ namespace Matchers { >; template<typename... Ts> - using are_generic_matchers = conjunction<is_generic_matcher<Ts>...>; + using are_generic_matchers = Catch::Detail::conjunction<is_generic_matcher<Ts>...>; template<typename T> using is_matcher = std::is_base_of< diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp index b9a02f579cc5efeb334d83952d155d43d33f2a36..fffbfdf63c3bcb67cd25fc268f541a18d1d93a11 100644 --- a/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -85,11 +85,10 @@ namespace Matchers { // - a more general approach would be via a compare template that defaults // to using !=. but could be specialised for, e.g. std::vector<T> etc // - then just call that directly - if (m_comparator.size() != v.size()) - return false; - for (std::size_t i = 0; i < v.size(); ++i) - if (m_comparator[i] != v[i]) - return false; + if ( m_comparator.size() != v.size() ) { return false; } + for ( std::size_t i = 0; i < v.size(); ++i ) { + if ( !( m_comparator[i] == v[i] ) ) { return false; } + } return true; } std::string describe() const override { diff --git a/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp index 2c2a61179a243435b747efdb768e2a06aaf26aaf..41b462e515570ffde0ad55daeba978696b7d805e 100644 --- a/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp +++ b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -16,9 +16,9 @@ namespace Catch { // This is the general overload that takes a any string matcher // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers // the Equals matcher (so the header does not mention matchers) - void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) { + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher ) { std::string exceptionMessage = Catch::translateActiveException(); - MatchExpr<std::string, StringMatcher const&> expr( CATCH_MOVE(exceptionMessage), matcher, matcherString ); + MatchExpr<std::string, StringMatcher const&> expr( CATCH_MOVE(exceptionMessage), matcher ); handler.handleExpr( expr ); } diff --git a/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp index 5d00ad7d54cee4054833408928a13fc4eddf1444..2ee9f0c0947b3bbda089213f68f68bc29efc7017 100644 --- a/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp +++ b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp @@ -1,30 +1,32 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_MATCHERS_IMPL_HPP_INCLUDED #define CATCH_MATCHERS_IMPL_HPP_INCLUDED -#include <catch2/internal/catch_test_macro_impl.hpp> -#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_assertion_handler.hpp> +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_decomposer.hpp> +#include <catch2/internal/catch_preprocessor_internal_stringify.hpp> #include <catch2/internal/catch_move_and_forward.hpp> +#include <string> + namespace Catch { template<typename ArgT, typename MatcherT> class MatchExpr : public ITransientExpression { ArgT && m_arg; MatcherT const& m_matcher; - StringRef m_matcherString; public: - MatchExpr( ArgT && arg, MatcherT const& matcher, StringRef matcherString ) + MatchExpr( ArgT && arg, MatcherT const& matcher ) : ITransientExpression{ true, matcher.match( arg ) }, // not forwarding arg here on purpose m_arg( CATCH_FORWARD(arg) ), - m_matcher( matcher ), - m_matcherString( matcherString ) + m_matcher( matcher ) {} void streamReconstructedExpression( std::ostream& os ) const override { @@ -41,11 +43,11 @@ namespace Catch { using StringMatcher = Matchers::MatcherBase<std::string>; - void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher ); template<typename ArgT, typename MatcherT> - auto makeMatchExpr( ArgT && arg, MatcherT const& matcher, StringRef matcherString ) -> MatchExpr<ArgT, MatcherT> { - return MatchExpr<ArgT, MatcherT>( CATCH_FORWARD(arg), matcher, matcherString ); + auto makeMatchExpr( ArgT && arg, MatcherT const& matcher ) -> MatchExpr<ArgT, MatcherT> { + return MatchExpr<ArgT, MatcherT>( CATCH_FORWARD(arg), matcher ); } } // namespace Catch @@ -56,7 +58,7 @@ namespace Catch { do { \ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ INTERNAL_CATCH_TRY { \ - catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher ) ); \ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ } while( false ) @@ -72,7 +74,7 @@ namespace Catch { catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ } \ catch( exceptionType const& ex ) { \ - catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher##_catch_sr ) ); \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher ) ); \ } \ catch( ... ) { \ catchAssertionHandler.handleUnexpectedInflightException(); \ diff --git a/packages/Catch2/src/catch2/meson.build b/packages/Catch2/src/catch2/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..2e9469d8419ed99e188ab5d4f233080ad5a0c9b1 --- /dev/null +++ b/packages/Catch2/src/catch2/meson.build @@ -0,0 +1,370 @@ +# Copyright Catch2 Authors +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + +# SPDX-License-Identifier: BSL-1.0 +pkg = import('pkgconfig') + +conf_data = configuration_data() +conf_data.set('CATCH_CONFIG_DEFAULT_REPORTER', 'console') +conf_data.set('CATCH_CONFIG_CONSOLE_WIDTH', '80') + +configure_file( + input: 'catch_user_config.hpp.in', + output: 'catch_user_config.hpp', + format: 'cmake@', + install_dir: get_option('includedir') / 'catch2', + configuration: conf_data, +) + +benchmark_headers = [ + 'benchmark/catch_benchmark.hpp', + 'benchmark/catch_benchmark_all.hpp', + 'benchmark/catch_chronometer.hpp', + 'benchmark/catch_clock.hpp', + 'benchmark/catch_constructor.hpp', + 'benchmark/catch_environment.hpp', + 'benchmark/catch_estimate.hpp', + 'benchmark/catch_execution_plan.hpp', + 'benchmark/catch_optimizer.hpp', + 'benchmark/catch_outlier_classification.hpp', + 'benchmark/catch_sample_analysis.hpp', + 'benchmark/detail/catch_analyse.hpp', + 'benchmark/detail/catch_benchmark_function.hpp', + 'benchmark/detail/catch_benchmark_stats.hpp', + 'benchmark/detail/catch_benchmark_stats_fwd.hpp', + 'benchmark/detail/catch_complete_invoke.hpp', + 'benchmark/detail/catch_estimate_clock.hpp', + 'benchmark/detail/catch_measure.hpp', + 'benchmark/detail/catch_repeat.hpp', + 'benchmark/detail/catch_run_for_at_least.hpp', + 'benchmark/detail/catch_stats.hpp', + 'benchmark/detail/catch_timing.hpp', +] + +benchmark_sources = files( + 'benchmark/catch_chronometer.cpp', + 'benchmark/detail/catch_benchmark_function.cpp', + 'benchmark/detail/catch_run_for_at_least.cpp', + 'benchmark/detail/catch_stats.cpp', +) + +internal_headers = [ + 'generators/catch_generator_exception.hpp', + 'generators/catch_generators.hpp', + 'generators/catch_generators_adapters.hpp', + 'generators/catch_generators_all.hpp', + 'generators/catch_generators_random.hpp', + 'generators/catch_generators_range.hpp', + 'interfaces/catch_interfaces_all.hpp', + 'interfaces/catch_interfaces_capture.hpp', + 'interfaces/catch_interfaces_config.hpp', + 'interfaces/catch_interfaces_enum_values_registry.hpp', + 'interfaces/catch_interfaces_exception.hpp', + 'interfaces/catch_interfaces_generatortracker.hpp', + 'interfaces/catch_interfaces_registry_hub.hpp', + 'interfaces/catch_interfaces_reporter.hpp', + 'interfaces/catch_interfaces_reporter_factory.hpp', + 'interfaces/catch_interfaces_tag_alias_registry.hpp', + 'interfaces/catch_interfaces_test_invoker.hpp', + 'interfaces/catch_interfaces_testcase.hpp', + 'internal/catch_assertion_handler.hpp', + 'internal/catch_case_insensitive_comparisons.hpp', + 'internal/catch_case_sensitive.hpp', + 'internal/catch_clara.hpp', + 'internal/catch_commandline.hpp', + 'internal/catch_compare_traits.hpp', + 'internal/catch_compiler_capabilities.hpp', + 'internal/catch_config_android_logwrite.hpp', + 'internal/catch_config_counter.hpp', + 'internal/catch_config_static_analysis_support.hpp', + 'internal/catch_config_uncaught_exceptions.hpp', + 'internal/catch_config_wchar.hpp', + 'internal/catch_console_colour.hpp', + 'internal/catch_console_width.hpp', + 'internal/catch_container_nonmembers.hpp', + 'internal/catch_context.hpp', + 'internal/catch_debug_console.hpp', + 'internal/catch_debugger.hpp', + 'internal/catch_decomposer.hpp', + 'internal/catch_enforce.hpp', + 'internal/catch_enum_values_registry.hpp', + 'internal/catch_errno_guard.hpp', + 'internal/catch_exception_translator_registry.hpp', + 'internal/catch_fatal_condition_handler.hpp', + 'internal/catch_floating_point_helpers.hpp', + 'internal/catch_getenv.hpp', + 'internal/catch_istream.hpp', + 'internal/catch_is_permutation.hpp', + 'internal/catch_lazy_expr.hpp', + 'internal/catch_leak_detector.hpp', + 'internal/catch_list.hpp', + 'internal/catch_logical_traits.hpp', + 'internal/catch_message_info.hpp', + 'internal/catch_meta.hpp', + 'internal/catch_move_and_forward.hpp', + 'internal/catch_noncopyable.hpp', + 'internal/catch_optional.hpp', + 'internal/catch_output_redirect.hpp', + 'internal/catch_parse_numbers.hpp', + 'internal/catch_platform.hpp', + 'internal/catch_polyfills.hpp', + 'internal/catch_preprocessor.hpp', + 'internal/catch_preprocessor_internal_stringify.hpp', + 'internal/catch_preprocessor_remove_parens.hpp', + 'internal/catch_random_number_generator.hpp', + 'internal/catch_random_seed_generation.hpp', + 'internal/catch_reporter_registry.hpp', + 'internal/catch_reporter_spec_parser.hpp', + 'internal/catch_result_type.hpp', + 'internal/catch_reusable_string_stream.hpp', + 'internal/catch_run_context.hpp', + 'internal/catch_section.hpp', + 'internal/catch_sharding.hpp', + 'internal/catch_singletons.hpp', + 'internal/catch_source_line_info.hpp', + 'internal/catch_startup_exception_registry.hpp', + 'internal/catch_stdstreams.hpp', + 'internal/catch_stream_end_stop.hpp', + 'internal/catch_string_manip.hpp', + 'internal/catch_stringref.hpp', + 'internal/catch_tag_alias_registry.hpp', + 'internal/catch_template_test_registry.hpp', + 'internal/catch_test_case_info_hasher.hpp', + 'internal/catch_test_case_registry_impl.hpp', + 'internal/catch_test_case_tracker.hpp', + 'internal/catch_test_failure_exception.hpp', + 'internal/catch_test_macro_impl.hpp', + 'internal/catch_test_registry.hpp', + 'internal/catch_test_run_info.hpp', + 'internal/catch_test_spec_parser.hpp', + 'internal/catch_textflow.hpp', + 'internal/catch_to_string.hpp', + 'internal/catch_uncaught_exceptions.hpp', + 'internal/catch_unique_name.hpp', + 'internal/catch_unique_ptr.hpp', + 'internal/catch_void_type.hpp', + 'internal/catch_wildcard_pattern.hpp', + 'internal/catch_windows_h_proxy.hpp', + 'internal/catch_xmlwriter.hpp', + 'matchers/catch_matchers.hpp', + 'matchers/catch_matchers_all.hpp', + 'matchers/catch_matchers_container_properties.hpp', + 'matchers/catch_matchers_contains.hpp', + 'matchers/catch_matchers_exception.hpp', + 'matchers/catch_matchers_floating_point.hpp', + 'matchers/catch_matchers_predicate.hpp', + 'matchers/catch_matchers_quantifiers.hpp', + 'matchers/catch_matchers_string.hpp', + 'matchers/catch_matchers_templated.hpp', + 'matchers/catch_matchers_vector.hpp', + 'matchers/internal/catch_matchers_impl.hpp', + 'catch_all.hpp', + 'catch_approx.hpp', + 'catch_assertion_info.hpp', + 'catch_assertion_result.hpp', + 'catch_config.hpp', + 'catch_get_random_seed.hpp', + 'catch_message.hpp', + 'catch_section_info.hpp', + 'catch_session.hpp', + 'catch_tag_alias.hpp', + 'catch_tag_alias_autoregistrar.hpp', + 'catch_template_test_macros.hpp', + 'catch_test_case_info.hpp', + 'catch_test_macros.hpp', + 'catch_test_spec.hpp', + 'catch_timer.hpp', + 'catch_tostring.hpp', + 'catch_totals.hpp', + 'catch_translate_exception.hpp', + 'catch_version.hpp', + 'catch_version_macros.hpp', +] + +internal_sources = files( + 'generators/catch_generator_exception.cpp', + 'generators/catch_generators.cpp', + 'generators/catch_generators_random.cpp', + 'interfaces/catch_interfaces_capture.cpp', + 'interfaces/catch_interfaces_config.cpp', + 'interfaces/catch_interfaces_exception.cpp', + 'interfaces/catch_interfaces_generatortracker.cpp', + 'interfaces/catch_interfaces_registry_hub.cpp', + 'interfaces/catch_interfaces_reporter.cpp', + 'interfaces/catch_interfaces_reporter_factory.cpp', + 'interfaces/catch_interfaces_testcase.cpp', + 'internal/catch_assertion_handler.cpp', + 'internal/catch_case_insensitive_comparisons.cpp', + 'internal/catch_clara.cpp', + 'internal/catch_commandline.cpp', + 'internal/catch_console_colour.cpp', + 'internal/catch_context.cpp', + 'internal/catch_debug_console.cpp', + 'internal/catch_debugger.cpp', + 'internal/catch_decomposer.cpp', + 'internal/catch_enforce.cpp', + 'internal/catch_enum_values_registry.cpp', + 'internal/catch_errno_guard.cpp', + 'internal/catch_exception_translator_registry.cpp', + 'internal/catch_fatal_condition_handler.cpp', + 'internal/catch_floating_point_helpers.cpp', + 'internal/catch_getenv.cpp', + 'internal/catch_istream.cpp', + 'internal/catch_lazy_expr.cpp', + 'internal/catch_leak_detector.cpp', + 'internal/catch_list.cpp', + 'internal/catch_message_info.cpp', + 'internal/catch_output_redirect.cpp', + 'internal/catch_parse_numbers.cpp', + 'internal/catch_polyfills.cpp', + 'internal/catch_random_number_generator.cpp', + 'internal/catch_random_seed_generation.cpp', + 'internal/catch_reporter_registry.cpp', + 'internal/catch_reporter_spec_parser.cpp', + 'internal/catch_result_type.cpp', + 'internal/catch_reusable_string_stream.cpp', + 'internal/catch_run_context.cpp', + 'internal/catch_section.cpp', + 'internal/catch_singletons.cpp', + 'internal/catch_source_line_info.cpp', + 'internal/catch_startup_exception_registry.cpp', + 'internal/catch_stdstreams.cpp', + 'internal/catch_string_manip.cpp', + 'internal/catch_stringref.cpp', + 'internal/catch_tag_alias_registry.cpp', + 'internal/catch_test_case_info_hasher.cpp', + 'internal/catch_test_case_registry_impl.cpp', + 'internal/catch_test_case_tracker.cpp', + 'internal/catch_test_failure_exception.cpp', + 'internal/catch_test_registry.cpp', + 'internal/catch_test_spec_parser.cpp', + 'internal/catch_textflow.cpp', + 'internal/catch_uncaught_exceptions.cpp', + 'internal/catch_wildcard_pattern.cpp', + 'internal/catch_xmlwriter.cpp', + 'matchers/catch_matchers.cpp', + 'matchers/catch_matchers_container_properties.cpp', + 'matchers/catch_matchers_exception.cpp', + 'matchers/catch_matchers_floating_point.cpp', + 'matchers/catch_matchers_predicate.cpp', + 'matchers/catch_matchers_quantifiers.cpp', + 'matchers/catch_matchers_string.cpp', + 'matchers/catch_matchers_templated.cpp', + 'matchers/internal/catch_matchers_impl.cpp', + 'catch_approx.cpp', + 'catch_assertion_result.cpp', + 'catch_config.cpp', + 'catch_get_random_seed.cpp', + 'catch_message.cpp', + 'catch_registry_hub.cpp', + 'catch_session.cpp', + 'catch_tag_alias_autoregistrar.cpp', + 'catch_test_case_info.cpp', + 'catch_test_spec.cpp', + 'catch_timer.cpp', + 'catch_tostring.cpp', + 'catch_totals.cpp', + 'catch_translate_exception.cpp', + 'catch_version.cpp', +) + +reporter_headers = [ + 'reporters/catch_reporter_automake.hpp', + 'reporters/catch_reporter_common_base.hpp', + 'reporters/catch_reporter_compact.hpp', + 'reporters/catch_reporter_console.hpp', + 'reporters/catch_reporter_cumulative_base.hpp', + 'reporters/catch_reporter_event_listener.hpp', + 'reporters/catch_reporter_helpers.hpp', + 'reporters/catch_reporter_junit.hpp', + 'reporters/catch_reporter_multi.hpp', + 'reporters/catch_reporter_registrars.hpp', + 'reporters/catch_reporter_sonarqube.hpp', + 'reporters/catch_reporter_streaming_base.hpp', + 'reporters/catch_reporter_tap.hpp', + 'reporters/catch_reporter_teamcity.hpp', + 'reporters/catch_reporter_xml.hpp', + 'reporters/catch_reporters_all.hpp', +] + +reporter_sources = files( + 'reporters/catch_reporter_automake.cpp', + 'reporters/catch_reporter_common_base.cpp', + 'reporters/catch_reporter_compact.cpp', + 'reporters/catch_reporter_console.cpp', + 'reporters/catch_reporter_cumulative_base.cpp', + 'reporters/catch_reporter_event_listener.cpp', + 'reporters/catch_reporter_helpers.cpp', + 'reporters/catch_reporter_junit.cpp', + 'reporters/catch_reporter_multi.cpp', + 'reporters/catch_reporter_registrars.cpp', + 'reporters/catch_reporter_sonarqube.cpp', + 'reporters/catch_reporter_streaming_base.cpp', + 'reporters/catch_reporter_tap.cpp', + 'reporters/catch_reporter_teamcity.cpp', + 'reporters/catch_reporter_xml.cpp', +) + +headers = benchmark_headers + internal_headers + reporter_headers +sources = benchmark_sources + internal_sources + reporter_sources + +# The headers must be installed with their full paths, which meson +# v0.63 supports using `preserve_path` for `install_headers`. We'd +# like to be compatible with Debian 11 (current stable) which has +# meson v0.56.2. Instead, let's use the technique from +# https://github.com/mesonbuild/meson/issues/14 with some tweaks to +# make it compatible with newer meson. +include_subdir = 'catch2' +foreach file : headers + file_path = file.split('/') + + folder = '' + foreach path : file_path + if path != file_path[-1] + folder = folder / path + endif + endforeach + + install_headers(file, subdir: join_paths(include_subdir, folder)) +endforeach + +catch2 = static_library( + 'Catch2', + sources, + include_directories: '..', + install: true, +) + +catch2_dep = declare_dependency( + link_with: catch2, + include_directories: '..', +) + +pkg.generate( + catch2, + filebase: 'catch2', + description: 'A modern, C++-native, test framework for C++14 and above', + url: 'https://github.com/catchorg/Catch2', +) + +catch2_with_main = static_library( + 'Catch2Main', + 'internal/catch_main.cpp', + link_with: catch2, + include_directories: '..', + install: true, +) + +catch2_with_main_dep = declare_dependency( + link_with: [catch2, catch2_with_main], + include_directories: '..', +) + +pkg.generate( + catch2_with_main, + filebase: 'catch2-with-main', + description: 'A modern, C++-native, test framework for C++14 and above (links in default main)', + requires: 'catch2 = ' + meson.project_version(), +) diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp index 90b12928df803ca3a32eab69d36280f8d3b17294..993b594b8566206c998a4c2c471d7218d9662bd3 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -17,7 +17,9 @@ namespace Catch { void AutomakeReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR. m_stream << ":test-result: "; - if (_testCaseStats.totals.assertions.allPassed()) { + if ( _testCaseStats.totals.testCases.skipped > 0 ) { + m_stream << "SKIP"; + } else if (_testCaseStats.totals.assertions.allPassed()) { m_stream << "PASS"; } else if (_testCaseStats.totals.assertions.allOk()) { m_stream << "XFAIL"; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp index bf18fddf7d0b82eb3137b5852827c08fcfe987bd..a639428c336695e8bbc2af69013887e898c70dc8 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp @@ -1,14 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED #define CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED -#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/reporters/catch_reporter_streaming_base.hpp> #include <catch2/internal/catch_move_and_forward.hpp> diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.cpp index 698435d044c4093880034347c100b3ba43cf0f61..a1ca76a0f8aaa0a32c6125009b46b4dc4de766ce 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.hpp index e6888be1664ff83ce2926e9abb2078fe23516465..b4f0a9ff55c444d39ebcb3196772d3416ab6c371 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_common_base.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp index a09f0483d53e690be0b764f7461f45d8fa823b11..88acb6a465ac8864e6691d96d5e384899a0481b7 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -18,22 +18,6 @@ #include <ostream> -namespace { - - constexpr Catch::StringRef bothOrAll( std::uint64_t count ) { - switch (count) { - case 1: - return Catch::StringRef{}; - case 2: - return "both "_catch_sr; - default: - return "all "_catch_sr; - } - } - -} // anon namespace - - namespace Catch { namespace { @@ -48,42 +32,6 @@ namespace { static constexpr Catch::StringRef compactPassedString = "passed"_sr; #endif -// Colour, message variants: -// - white: No tests ran. -// - red: Failed [both/all] N test cases, failed [both/all] M assertions. -// - white: Passed [both/all] N test cases (no assertions). -// - red: Failed N tests cases, failed M assertions. -// - green: Passed [both/all] N tests cases with M assertions. -void printTotals(std::ostream& out, const Totals& totals, ColourImpl* colourImpl) { - if (totals.testCases.total() == 0) { - out << "No tests ran."; - } else if (totals.testCases.failed == totals.testCases.total()) { - auto guard = colourImpl->guardColour( Colour::ResultError ).engage( out ); - const StringRef qualify_assertions_failed = - totals.assertions.failed == totals.assertions.total() ? - bothOrAll(totals.assertions.failed) : StringRef{}; - out << - "Failed " << bothOrAll(totals.testCases.failed) - << pluralise(totals.testCases.failed, "test case"_sr) << ", " - "failed " << qualify_assertions_failed << - pluralise(totals.assertions.failed, "assertion"_sr) << '.'; - } else if (totals.assertions.total() == 0) { - out << - "Passed " << bothOrAll(totals.testCases.total()) - << pluralise(totals.testCases.total(), "test case"_sr) - << " (no assertions)."; - } else if (totals.assertions.failed) { - out << colourImpl->guardColour( Colour::ResultError ) << - "Failed " << pluralise(totals.testCases.failed, "test case"_sr) << ", " - "failed " << pluralise(totals.assertions.failed, "assertion"_sr) << '.'; - } else { - out << colourImpl->guardColour( Colour::ResultSuccess ) << - "Passed " << bothOrAll(totals.testCases.passed) - << pluralise(totals.testCases.passed, "test case"_sr) << - " with " << pluralise(totals.assertions.passed, "assertion"_sr) << '.'; - } -} - // Implementation of CompactReporter formatting class AssertionPrinter { public: @@ -157,6 +105,11 @@ public: printIssue("explicitly"); printRemainingMessages(Colour::None); break; + case ResultWas::ExplicitSkip: + printResultType(Colour::Skip, "skipped"_sr); + printMessage(); + printRemainingMessages(); + break; // These cases are here to prevent compiler warnings case ResultWas::Unknown: case ResultWas::FailureBit: @@ -218,7 +171,7 @@ private: return; const auto itEnd = messages.cend(); - const auto N = static_cast<std::size_t>(std::distance(itMessage, itEnd)); + const auto N = static_cast<std::size_t>(itEnd - itMessage); stream << colourImpl->guardColour( colour ) << " with " << pluralise( N, "message"_sr ) << ':'; @@ -239,7 +192,7 @@ private: private: std::ostream& stream; AssertionResult const& result; - std::vector<MessageInfo> messages; + std::vector<MessageInfo> const& messages; std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; ColourImpl* colourImpl; @@ -259,7 +212,7 @@ private: if ( m_config->testSpec().hasFilters() ) { m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: " - << serializeFilters( m_config->getTestsOrTags() ) + << m_config->testSpec() << '\n'; } m_stream << "RNG seed: " << getSeed() << '\n'; @@ -272,7 +225,7 @@ private: // Drop out if result was successful and we're not printing those if( !m_config->includeSuccessfulResults() && result.isOk() ) { - if( result.getResultType() != ResultWas::Warning ) + if( result.getResultType() != ResultWas::Warning && result.getResultType() != ResultWas::ExplicitSkip ) return; printInfoMessages = false; } @@ -291,7 +244,7 @@ private: } void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { - printTotals( m_stream, _testRunStats.totals, m_colour.get() ); + printTestRunTotals( m_stream, *m_colour, _testRunStats.totals ); m_stream << "\n\n" << std::flush; StreamingReporterBase::testRunEnded( _testRunStats ); } diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp index 6362fc2977ca2f2d3a276c24000afabc3d26232b..d95bbff11978585e26d9f464a015daed9728a505 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp index 88d43b531fd4ca84c10b275780a5159257214127..a46b22cf086c3fad78a002ab72f8232b2156855b 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -51,7 +51,6 @@ public: stats(_stats), result(_stats.assertionResult), colour(Colour::None), - message(result.getMessage()), messages(_stats.infoMessages), colourImpl(colourImpl_), printInfoMessages(_printInfoMessages) { @@ -60,10 +59,10 @@ public: colour = Colour::Success; passOrFail = "PASSED"_sr; //if( result.hasMessage() ) - if (_stats.infoMessages.size() == 1) - messageLabel = "with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "with messages"; + if (messages.size() == 1) + messageLabel = "with message"_sr; + if (messages.size() > 1) + messageLabel = "with messages"_sr; break; case ResultWas::ExpressionFailed: if (result.isOk()) { @@ -73,43 +72,57 @@ public: colour = Colour::Error; passOrFail = "FAILED"_sr; } - if (_stats.infoMessages.size() == 1) - messageLabel = "with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "with messages"; + if (messages.size() == 1) + messageLabel = "with message"_sr; + if (messages.size() > 1) + messageLabel = "with messages"_sr; break; case ResultWas::ThrewException: colour = Colour::Error; passOrFail = "FAILED"_sr; - messageLabel = "due to unexpected exception with "; - if (_stats.infoMessages.size() == 1) - messageLabel += "message"; - if (_stats.infoMessages.size() > 1) - messageLabel += "messages"; + // todo switch + switch (messages.size()) { case 0: + messageLabel = "due to unexpected exception with "_sr; + break; + case 1: + messageLabel = "due to unexpected exception with message"_sr; + break; + default: + messageLabel = "due to unexpected exception with messages"_sr; + break; + } break; case ResultWas::FatalErrorCondition: colour = Colour::Error; passOrFail = "FAILED"_sr; - messageLabel = "due to a fatal error condition"; + messageLabel = "due to a fatal error condition"_sr; break; case ResultWas::DidntThrowException: colour = Colour::Error; passOrFail = "FAILED"_sr; - messageLabel = "because no exception was thrown where one was expected"; + messageLabel = "because no exception was thrown where one was expected"_sr; break; case ResultWas::Info: - messageLabel = "info"; + messageLabel = "info"_sr; break; case ResultWas::Warning: - messageLabel = "warning"; + messageLabel = "warning"_sr; break; case ResultWas::ExplicitFailure: passOrFail = "FAILED"_sr; colour = Colour::Error; - if (_stats.infoMessages.size() == 1) - messageLabel = "explicitly with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "explicitly with messages"; + if (messages.size() == 1) + messageLabel = "explicitly with message"_sr; + if (messages.size() > 1) + messageLabel = "explicitly with messages"_sr; + break; + case ResultWas::ExplicitSkip: + colour = Colour::Skip; + passOrFail = "SKIPPED"_sr; + if (messages.size() == 1) + messageLabel = "explicitly with message"_sr; + if (messages.size() > 1) + messageLabel = "explicitly with messages"_sr; break; // These cases are here to prevent compiler warnings case ResultWas::Unknown: @@ -173,9 +186,8 @@ private: AssertionResult const& result; Colour::Code colour; StringRef passOrFail; - std::string messageLabel; - std::string message; - std::vector<MessageInfo> messages; + StringRef messageLabel; + std::vector<MessageInfo> const& messages; ColourImpl* colourImpl; bool printInfoMessages; }; @@ -185,13 +197,16 @@ std::size_t makeRatio( std::uint64_t number, std::uint64_t total ) { return (ratio == 0 && number > 0) ? 1 : static_cast<std::size_t>(ratio); } -std::size_t& findMax( std::size_t& i, std::size_t& j, std::size_t& k ) { - if (i > j && i > k) +std::size_t& +findMax( std::size_t& i, std::size_t& j, std::size_t& k, std::size_t& l ) { + if (i > j && i > k && i > l) return i; - else if (j > k) + else if (j > k && j > l) return j; - else + else if (k > l) return k; + else + return l; } enum class Justification { Left, Right }; @@ -400,7 +415,8 @@ void ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) { bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); // Drop out if result was successful but we're not printing them. - if (!includeResults && result.getResultType() != ResultWas::Warning) + // TODO: Make configurable whether skips should be printed + if (!includeResults && result.getResultType() != ResultWas::Warning && result.getResultType() != ResultWas::ExplicitSkip) return; lazyPrint(); @@ -491,7 +507,7 @@ void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { } void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) { printTotalsDivider(_testRunStats.totals); - printTotals(_testRunStats.totals); + printTestRunTotals( m_stream, *m_colour, _testRunStats.totals ); m_stream << '\n' << std::flush; StreamingReporterBase::testRunEnded(_testRunStats); } @@ -499,7 +515,7 @@ void ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) { StreamingReporterBase::testRunStarting(_testInfo); if ( m_config->testSpec().hasFilters() ) { m_stream << m_colour->guardColour( Colour::BrightYellow ) << "Filters: " - << serializeFilters( m_config->getTestsOrTags() ) << '\n'; + << m_config->testSpec() << '\n'; } m_stream << "Randomness seeded to: " << getSeed() << '\n'; } @@ -598,91 +614,16 @@ void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t << '\n'; } -struct SummaryColumn { - - SummaryColumn( std::string _label, Colour::Code _colour ) - : label( CATCH_MOVE( _label ) ), - colour( _colour ) {} - SummaryColumn addRow( std::uint64_t count ) { - ReusableStringStream rss; - rss << count; - std::string row = rss.str(); - for (auto& oldRow : rows) { - while (oldRow.size() < row.size()) - oldRow = ' ' + oldRow; - while (oldRow.size() > row.size()) - row = ' ' + row; - } - rows.push_back(row); - return *this; - } - - std::string label; - Colour::Code colour; - std::vector<std::string> rows; - -}; - -void ConsoleReporter::printTotals( Totals const& totals ) { - if (totals.testCases.total() == 0) { - m_stream << m_colour->guardColour( Colour::Warning ) - << "No tests ran\n"; - } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { - m_stream << m_colour->guardColour( Colour::ResultSuccess ) - << "All tests passed"; - m_stream << " (" - << pluralise(totals.assertions.passed, "assertion"_sr) << " in " - << pluralise(totals.testCases.passed, "test case"_sr) << ')' - << '\n'; - } else { - - std::vector<SummaryColumn> columns; - columns.push_back(SummaryColumn("", Colour::None) - .addRow(totals.testCases.total()) - .addRow(totals.assertions.total())); - columns.push_back(SummaryColumn("passed", Colour::Success) - .addRow(totals.testCases.passed) - .addRow(totals.assertions.passed)); - columns.push_back(SummaryColumn("failed", Colour::ResultError) - .addRow(totals.testCases.failed) - .addRow(totals.assertions.failed)); - columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) - .addRow(totals.testCases.failedButOk) - .addRow(totals.assertions.failedButOk)); - - printSummaryRow("test cases"_sr, columns, 0); - printSummaryRow("assertions"_sr, columns, 1); - } -} -void ConsoleReporter::printSummaryRow(StringRef label, std::vector<SummaryColumn> const& cols, std::size_t row) { - for (auto col : cols) { - std::string const& value = col.rows[row]; - if (col.label.empty()) { - m_stream << label << ": "; - if ( value != "0" ) { - m_stream << value; - } else { - m_stream << m_colour->guardColour( Colour::Warning ) - << "- none -"; - } - } else if (value != "0") { - m_stream << m_colour->guardColour( Colour::LightGrey ) << " | " - << m_colour->guardColour( col.colour ) << value << ' ' - << col.label; - } - } - m_stream << '\n'; -} - void ConsoleReporter::printTotalsDivider(Totals const& totals) { if (totals.testCases.total() > 0) { std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total()); std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total()); std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total()); - while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1) - findMax(failedRatio, failedButOkRatio, passedRatio)++; + std::size_t skippedRatio = makeRatio(totals.testCases.skipped, totals.testCases.total()); + while (failedRatio + failedButOkRatio + passedRatio + skippedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1) + findMax(failedRatio, failedButOkRatio, passedRatio, skippedRatio)++; while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1) - findMax(failedRatio, failedButOkRatio, passedRatio)--; + findMax(failedRatio, failedButOkRatio, passedRatio, skippedRatio)--; m_stream << m_colour->guardColour( Colour::Error ) << std::string( failedRatio, '=' ) @@ -695,15 +636,14 @@ void ConsoleReporter::printTotalsDivider(Totals const& totals) { m_stream << m_colour->guardColour( Colour::Success ) << std::string( passedRatio, '=' ); } + m_stream << m_colour->guardColour( Colour::Skip ) + << std::string( skippedRatio, '=' ); } else { m_stream << m_colour->guardColour( Colour::Warning ) << std::string( CATCH_CONFIG_CONSOLE_WIDTH - 1, '=' ); } m_stream << '\n'; } -void ConsoleReporter::printSummaryDivider() { - m_stream << lineOfChars('-') << '\n'; -} } // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp index 719dcc449f73e6aea7d66a9d3928055529509129..243772622bdf3b4a6fc0cc29e4c490353646da76 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -13,7 +13,6 @@ namespace Catch { // Fwd decls - struct SummaryColumn; class TablePrinter; class ConsoleReporter final : public StreamingReporterBase { @@ -57,12 +56,7 @@ namespace Catch { // subsequent lines void printHeaderString(std::string const& _string, std::size_t indent = 0); - - void printTotals(Totals const& totals); - void printSummaryRow(StringRef label, std::vector<SummaryColumn> const& cols, std::size_t row); - void printTotalsDivider(Totals const& totals); - void printSummaryDivider(); bool m_headerPrinted = false; bool m_testRunInfoPrinted = false; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp index 957880d09ddfd548007f2f6fa8d47de469fe3255..5e10632621472fc3b45f00574cef86625144c09c 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -70,7 +70,8 @@ namespace Catch { void CumulativeReporterBase::sectionStarting( SectionInfo const& sectionInfo ) { - SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); + // We need a copy, because SectionStats expect to take ownership + SectionStats incompleteStats( SectionInfo(sectionInfo), Counts(), 0, false ); SectionNode* node; if ( m_sectionStack.empty() ) { if ( !m_rootSection ) { diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp index c4dcdae0365c0b06dfa2205c642c76efee727f17..267b39fdbf171109a72304e7be95ac20b38ec6fc 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp @@ -1,14 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED #define CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED -#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/reporters/catch_reporter_common_base.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <catch2/internal/catch_unique_ptr.hpp> @@ -125,7 +124,7 @@ namespace Catch { void skipTest(TestCaseInfo const&) override {} protected: - //! Should the cumulative base store the assertion expansion for succesful assertions? + //! Should the cumulative base store the assertion expansion for successful assertions? bool m_shouldStoreSuccesfulAssertions = true; //! Should the cumulative base store the assertion expansion for failed assertions? bool m_shouldStoreFailedAssertions = true; diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.cpp index a997a315d667aac202e3f0f124938f153023f318..e94063bafb23b5985be756ac9fced5b0ef57e350 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp index 3a6d822cc3432e2a2f9eaec68b98107fdc7b70ab..346263e21412c5c0fb62fe418a3ea7f1662c42b9 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.cpp index 31df851a834b64ec6916dfebe043057f1bfc3588..ffb32ffb0bb9f65134dda525f23c8fce014c1fe9 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -235,4 +235,109 @@ namespace Catch { out << "\n\n" << std::flush; } + namespace { + class SummaryColumn { + public: + SummaryColumn( std::string suffix, Colour::Code colour ): + m_suffix( CATCH_MOVE( suffix ) ), m_colour( colour ) {} + + SummaryColumn&& addRow( std::uint64_t count ) && { + std::string row = std::to_string(count); + auto const new_width = std::max( m_width, row.size() ); + if ( new_width > m_width ) { + for ( auto& oldRow : m_rows ) { + oldRow.insert( 0, new_width - m_width, ' ' ); + } + } else { + row.insert( 0, m_width - row.size(), ' ' ); + } + m_width = new_width; + m_rows.push_back( row ); + return std::move( *this ); + } + + std::string const& getSuffix() const { return m_suffix; } + Colour::Code getColour() const { return m_colour; } + std::string const& getRow( std::size_t index ) const { + return m_rows[index]; + } + + private: + std::string m_suffix; + Colour::Code m_colour; + std::size_t m_width = 0; + std::vector<std::string> m_rows; + }; + + void printSummaryRow( std::ostream& stream, + ColourImpl& colour, + StringRef label, + std::vector<SummaryColumn> const& cols, + std::size_t row ) { + for ( auto const& col : cols ) { + auto const& value = col.getRow( row ); + auto const& suffix = col.getSuffix(); + if ( suffix.empty() ) { + stream << label << ": "; + if ( value != "0" ) { + stream << value; + } else { + stream << colour.guardColour( Colour::Warning ) + << "- none -"; + } + } else if ( value != "0" ) { + stream << colour.guardColour( Colour::LightGrey ) << " | " + << colour.guardColour( col.getColour() ) << value + << ' ' << suffix; + } + } + stream << '\n'; + } + } // namespace + + void printTestRunTotals( std::ostream& stream, + ColourImpl& streamColour, + Totals const& totals ) { + if ( totals.testCases.total() == 0 ) { + stream << streamColour.guardColour( Colour::Warning ) + << "No tests ran\n"; + return; + } + + if ( totals.assertions.total() > 0 && totals.testCases.allPassed() ) { + stream << streamColour.guardColour( Colour::ResultSuccess ) + << "All tests passed"; + stream << " (" + << pluralise( totals.assertions.passed, "assertion"_sr ) + << " in " + << pluralise( totals.testCases.passed, "test case"_sr ) + << ')' << '\n'; + return; + } + + std::vector<SummaryColumn> columns; + // Don't include "skipped assertions" in total count + const auto totalAssertionCount = + totals.assertions.total() - totals.assertions.skipped; + columns.push_back( SummaryColumn( "", Colour::None ) + .addRow( totals.testCases.total() ) + .addRow( totalAssertionCount ) ); + columns.push_back( SummaryColumn( "passed", Colour::Success ) + .addRow( totals.testCases.passed ) + .addRow( totals.assertions.passed ) ); + columns.push_back( SummaryColumn( "failed", Colour::ResultError ) + .addRow( totals.testCases.failed ) + .addRow( totals.assertions.failed ) ); + columns.push_back( SummaryColumn( "skipped", Colour::Skip ) + .addRow( totals.testCases.skipped ) + // Don't print "skipped assertions" + .addRow( 0 ) ); + columns.push_back( + SummaryColumn( "failed as expected", Colour::ResultExpectedFailure ) + .addRow( totals.testCases.failedButOk ) + .addRow( totals.assertions.failedButOk ) ); + printSummaryRow( stream, streamColour, "test cases"_sr, columns, 0 ); + printSummaryRow( stream, streamColour, "assertions"_sr, columns, 1 ); + } + } // namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp index ef43534cba82150c28ce7f073c9f338f6138f134..316cb4048a16861e8c5e2b7de3375cdffb1d4df8 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -14,6 +14,7 @@ #include <catch2/internal/catch_list.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/catch_totals.hpp> namespace Catch { @@ -80,6 +81,15 @@ namespace Catch { bool isFiltered, Verbosity verbosity ); + /** + * Prints test run totals to the provided stream in user-friendly format + * + * Used by the console and compact reporters. + */ + void printTestRunTotals( std::ostream& stream, + ColourImpl& streamColour, + Totals const& totals ); + } // end namespace Catch #endif // CATCH_REPORTER_HELPERS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp index c24d1efa253d3226fab22393814bd31a36658367..fc5cae34ad3629da116ddcbb71611f0305543520 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -13,6 +13,7 @@ #include <catch2/internal/catch_textflow.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> #include <catch2/catch_test_case_info.hpp> +#include <catch2/catch_test_spec.hpp> #include <catch2/internal/catch_move_and_forward.hpp> #include <cassert> @@ -30,6 +31,10 @@ namespace Catch { std::tm timeInfo = {}; #if defined (_MSC_VER) || defined (__MINGW32__) gmtime_s(&timeInfo, &rawtime); +#elif defined (CATCH_PLATFORM_PLAYSTATION) + gmtime_s(&rawtime, &timeInfo); +#elif defined (__IAR_SYSTEMS_ICC__) + timeInfo = *std::gmtime(&rawtime); #else gmtime_r(&rawtime, &timeInfo); #endif @@ -129,6 +134,7 @@ namespace Catch { xml.writeAttribute( "name"_sr, stats.runInfo.name ); xml.writeAttribute( "errors"_sr, unexpectedExceptions ); xml.writeAttribute( "failures"_sr, stats.totals.assertions.failed-unexpectedExceptions ); + xml.writeAttribute( "skipped"_sr, stats.totals.assertions.skipped ); xml.writeAttribute( "tests"_sr, stats.totals.assertions.total() ); xml.writeAttribute( "hostname"_sr, "tbd"_sr ); // !TBD if( m_config->showDurations() == ShowDurations::Never ) @@ -143,10 +149,10 @@ namespace Catch { xml.scopedElement("property") .writeAttribute("name"_sr, "random-seed"_sr) .writeAttribute("value"_sr, m_config->rngSeed()); - if (m_config->hasTestFilters()) { + if (m_config->testSpec().hasFilters()) { xml.scopedElement("property") .writeAttribute("name"_sr, "filters"_sr) - .writeAttribute("value"_sr, serializeFilters(m_config->getTestsOrTags())); + .writeAttribute("value"_sr, m_config->testSpec()); } } @@ -241,7 +247,8 @@ namespace Catch { void JunitReporter::writeAssertion( AssertionStats const& stats ) { AssertionResult const& result = stats.assertionResult; - if( !result.isOk() ) { + if ( !result.isOk() || + result.getResultType() == ResultWas::ExplicitSkip ) { std::string elementName; switch( result.getResultType() ) { case ResultWas::ThrewException: @@ -253,7 +260,9 @@ namespace Catch { case ResultWas::DidntThrowException: elementName = "failure"; break; - + case ResultWas::ExplicitSkip: + elementName = "skipped"; + break; // We should never see these here: case ResultWas::Info: case ResultWas::Warning: @@ -271,7 +280,9 @@ namespace Catch { xml.writeAttribute( "type"_sr, result.getTestMacroName() ); ReusableStringStream rss; - if (stats.totals.assertions.total() > 0) { + if ( result.getResultType() == ResultWas::ExplicitSkip ) { + rss << "SKIPPED\n"; + } else { rss << "FAILED" << ":\n"; if (result.hasExpression()) { rss << " "; @@ -282,11 +293,9 @@ namespace Catch { rss << "with expansion:\n"; rss << TextFlow::Column(result.getExpandedExpression()).indent(2) << '\n'; } - } else { - rss << '\n'; } - if( !result.getMessage().empty() ) + if( result.hasMessage() ) rss << result.getMessage() << '\n'; for( auto const& msg : stats.infoMessages ) if( msg.type == ResultWas::Info ) diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp index a45344de6f8167a59273b3f207a4c1e50a46a723..87c7c5679e4f2ee1ad5fff5f10b55393572987d7 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_multi.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_multi.cpp index cf18cb81b0373de0c052bc6174d476d82d8a8721..531902beabcab8cbd9691cfdcba500a435004adf 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_multi.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_multi.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -114,7 +114,6 @@ namespace Catch { } } - // The return value indicates if the messages buffer should be cleared: void MultiReporter::assertionEnded( AssertionStats const& assertionStats ) { const bool reportByDefault = assertionStats.assertionResult.getResultType() != ResultWas::Ok || diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_multi.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_multi.hpp index e35ea5041e8fb024ef524c54f6906f6cc6681f6d..c43f511f8d3825b4254c5f2b019ac339ec3bb7a5 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_multi.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_multi.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.cpp index fd1bc76cad823c59c028b208f6b8125a6aa9dd1e..2a3ac957938d69f52b0185cc4ec63dfac43f48d7 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.cpp @@ -1,13 +1,14 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #include <catch2/reporters/catch_reporter_registrars.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> namespace Catch { @@ -26,5 +27,10 @@ namespace Catch { } } + void registerListenerImpl( Detail::unique_ptr<EventListenerFactory> listenerFactory ) { + getMutableRegistryHub().registerListener( CATCH_MOVE(listenerFactory) ); + } + + } // namespace Detail } // namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.hpp index e33ecf8b62dcc5c21191ef8215307f8e92a7cb19..a93963f061a1b1806f17ec45f74ce8c825634d54 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_registrars.hpp @@ -1,15 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_REPORTER_REGISTRARS_HPP_INCLUDED #define CATCH_REPORTER_REGISTRARS_HPP_INCLUDED -#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> -#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> #include <catch2/internal/catch_compiler_capabilities.hpp> #include <catch2/internal/catch_unique_name.hpp> @@ -36,7 +34,8 @@ namespace Catch { //! independent on the reporter's concrete type void registerReporterImpl( std::string const& name, IReporterFactoryPtr reporterPtr ); - + //! Actually registers the factory, independent on listener's concrete type + void registerListenerImpl( Detail::unique_ptr<EventListenerFactory> listenerFactory ); } // namespace Detail class IEventListener; @@ -97,7 +96,7 @@ namespace Catch { public: ListenerRegistrar(StringRef listenerName) { - getMutableRegistryHub().registerListener( Detail::make_unique<TypedListenerFactory>(listenerName) ); + registerListenerImpl( Detail::make_unique<TypedListenerFactory>(listenerName) ); } }; } @@ -118,7 +117,7 @@ namespace Catch { CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace { \ Catch::ListenerRegistrar<listenerType> INTERNAL_CATCH_UNIQUE_NAME( \ - catch_internal_RegistrarFor )( #listenerType ); \ + catch_internal_RegistrarFor )( #listenerType##_catch_sr ); \ } \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp index 8119c3b8f79fa75dfd9ddb14e4985006f0798d6a..9c391b1f4f2576f969d09825012d070d25620946 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,15 +11,22 @@ #include <catch2/catch_test_case_info.hpp> #include <catch2/internal/catch_reusable_string_stream.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> #include <map> namespace Catch { namespace { - std::string createRngSeedString(uint32_t seed) { + std::string createMetadataString(IConfig const& config) { ReusableStringStream sstr; - sstr << "rng-seed=" << seed; + if ( config.testSpec().hasFilters() ) { + sstr << "filters='" + << config.testSpec() + << "' "; + } + sstr << "rng-seed=" << config.rngSeed(); return sstr.str(); } } @@ -27,13 +34,13 @@ namespace Catch { void SonarQubeReporter::testRunStarting(TestRunInfo const& testRunInfo) { CumulativeReporterBase::testRunStarting(testRunInfo); - xml.writeComment( createRngSeedString( m_config->rngSeed() ) ); + xml.writeComment( createMetadataString( *m_config ) ); xml.startElement("testExecutions"); xml.writeAttribute("version"_sr, '1'); } void SonarQubeReporter::writeRun( TestRunNode const& runNode ) { - std::map<std::string, std::vector<TestCaseNode const*>> testsPerFile; + std::map<StringRef, std::vector<TestCaseNode const*>> testsPerFile; for ( auto const& child : runNode.children ) { testsPerFile[child->value.testInfo->lineInfo.file].push_back( @@ -45,7 +52,7 @@ namespace Catch { } } - void SonarQubeReporter::writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes) { + void SonarQubeReporter::writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes) { XmlWriter::ScopedElement e = xml.scopedElement("file"); xml.writeAttribute("path"_sr, filename); @@ -90,7 +97,8 @@ namespace Catch { void SonarQubeReporter::writeAssertion(AssertionStats const& stats, bool okToFail) { AssertionResult const& result = stats.assertionResult; - if (!result.isOk()) { + if ( !result.isOk() || + result.getResultType() == ResultWas::ExplicitSkip ) { std::string elementName; if (okToFail) { elementName = "skipped"; @@ -101,15 +109,13 @@ namespace Catch { elementName = "error"; break; case ResultWas::ExplicitFailure: - elementName = "failure"; - break; case ResultWas::ExpressionFailed: - elementName = "failure"; - break; case ResultWas::DidntThrowException: elementName = "failure"; break; - + case ResultWas::ExplicitSkip: + elementName = "skipped"; + break; // We should never see these here: case ResultWas::Info: case ResultWas::Warning: @@ -129,7 +135,9 @@ namespace Catch { xml.writeAttribute("message"_sr, messageRss.str()); ReusableStringStream textRss; - if (stats.totals.assertions.total() > 0) { + if ( result.getResultType() == ResultWas::ExplicitSkip ) { + textRss << "SKIPPED\n"; + } else { textRss << "FAILED:\n"; if (result.hasExpression()) { textRss << '\t' << result.getExpressionInMacro() << '\n'; @@ -139,7 +147,7 @@ namespace Catch { } } - if (!result.getMessage().empty()) + if (result.hasMessage()) textRss << result.getMessage() << '\n'; for (auto const& msg : stats.infoMessages) diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp index 32756b488f43a67191dfac9bb84ae084da86809e..cad6deec8ca0a0b82377a01c5e84d4ff90b91ba1 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -41,7 +41,7 @@ namespace Catch { void writeRun( TestRunNode const& groupNode ); - void writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes); + void writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes); void writeTestCase(TestCaseNode const& testCaseNode); diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp index a9c898ed8faff456bf79ece61a759b16b8682b45..f1cc425ab49f2583f7b68f9acca7d9bd43781a66 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp index 76788d8d5c6c4c55f3f5d7730cc28311a9c2e1d5..5448000c70e4c259610e84764a7b0ca7897d8f55 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp @@ -1,14 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #ifndef CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED #define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED -#include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/reporters/catch_reporter_common_base.hpp> #include <catch2/internal/catch_move_and_forward.hpp> diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp index 6058f2422ad7216d2fbc7b1ea3d22d0949934b20..67d406fb828335ffe71662ac8590b2e0a06350e2 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -10,9 +10,10 @@ #include <catch2/internal/catch_string_manip.hpp> #include <catch2/catch_test_case_info.hpp> #include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> #include <algorithm> -#include <iterator> #include <ostream> namespace Catch { @@ -98,6 +99,12 @@ namespace Catch { printIssue("explicitly"_sr); printRemainingMessages(Colour::None); break; + case ResultWas::ExplicitSkip: + printResultType(tapPassedString); + printIssue(" # SKIP"_sr); + printMessage(); + printRemainingMessages(); + break; // These cases are here to prevent compiler warnings case ResultWas::Unknown: case ResultWas::FailureBit: @@ -157,7 +164,7 @@ namespace Catch { // using messages.end() directly (or auto) yields compilation error: std::vector<MessageInfo>::const_iterator itEnd = messages.end(); - const std::size_t N = static_cast<std::size_t>(std::distance(itMessage, itEnd)); + const std::size_t N = static_cast<std::size_t>(itEnd - itMessage); stream << colourImpl->guardColour( colour ) << " with " << pluralise( N, "message"_sr ) << ':'; @@ -176,7 +183,7 @@ namespace Catch { private: std::ostream& stream; AssertionResult const& result; - std::vector<MessageInfo> messages; + std::vector<MessageInfo> const& messages; std::vector<MessageInfo>::const_iterator itMessage; bool printInfoMessages; std::size_t counter; @@ -186,6 +193,9 @@ namespace Catch { } // End anonymous namespace void TAPReporter::testRunStarting( TestRunInfo const& ) { + if ( m_config->testSpec().hasFilters() ) { + m_stream << "# filters: " << m_config->testSpec() << '\n'; + } m_stream << "# rng-seed: " << m_config->rngSeed() << '\n'; } diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp index 0c4b14b4777c6f3c40b79e504109502c81679791..fe45df63e8acffd718e0af45be6bc491681a3e92 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp index 142dffbb1d567e26167bd03c754cb79f71f03862..320728007e9fbbab52aec1bd70c3d88a58a0068f 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -59,7 +59,8 @@ namespace Catch { void TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) { AssertionResult const& result = assertionStats.assertionResult; - if (!result.isOk()) { + if ( !result.isOk() || + result.getResultType() == ResultWas::ExplicitSkip ) { ReusableStringStream msg; if (!m_headerPrintedForThisSection) @@ -84,6 +85,9 @@ namespace Catch { case ResultWas::ExplicitFailure: msg << "explicit failure"; break; + case ResultWas::ExplicitSkip: + msg << "explicit skip"; + break; // We shouldn't get here because of the isOk() test case ResultWas::Ok: @@ -111,18 +115,16 @@ namespace Catch { " " << result.getExpandedExpression() << '\n'; } - if (currentTestCaseInfo->okToFail()) { + if ( result.getResultType() == ResultWas::ExplicitSkip ) { + m_stream << "##teamcity[testIgnored"; + } else if ( currentTestCaseInfo->okToFail() ) { msg << "- failure ignore as test marked as 'ok to fail'\n"; - m_stream << "##teamcity[testIgnored" - << " name='" << escape(currentTestCaseInfo->name) << '\'' - << " message='" << escape(msg.str()) << '\'' - << "]\n"; + m_stream << "##teamcity[testIgnored"; } else { - m_stream << "##teamcity[testFailed" - << " name='" << escape(currentTestCaseInfo->name) << '\'' - << " message='" << escape(msg.str()) << '\'' - << "]\n"; + m_stream << "##teamcity[testFailed"; } + m_stream << " name='" << escape( currentTestCaseInfo->name ) << '\'' + << " message='" << escape( msg.str() ) << '\'' << "]\n"; } m_stream.flush(); } diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp index 5007193bbe87da02937ccc620e15b9f6dd7dd8be..04feb2e6dc03abc953b44a6c2650b899e6ddddf9 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp index 1e5def4176cc408f3024c51f743af1664abc8da0..f80cd2470a246ba9ef329c1c9c6451ad04c00ab6 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -56,15 +56,17 @@ namespace Catch { m_xml.startElement("Catch2TestRun") .writeAttribute("name"_sr, m_config->name()) .writeAttribute("rng-seed"_sr, m_config->rngSeed()) + .writeAttribute("xml-format-version"_sr, 3) .writeAttribute("catch2-version"_sr, libraryVersion()); - if (m_config->testSpec().hasFilters()) - m_xml.writeAttribute( "filters"_sr, serializeFilters( m_config->getTestsOrTags() ) ); + if ( m_config->testSpec().hasFilters() ) { + m_xml.writeAttribute( "filters"_sr, m_config->testSpec() ); + } } void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { StreamingReporterBase::testCaseStarting(testInfo); m_xml.startElement( "TestCase" ) - .writeAttribute( "name"_sr, trim( testInfo.name ) ) + .writeAttribute( "name"_sr, trim( StringRef(testInfo.name) ) ) .writeAttribute( "tags"_sr, testInfo.tagsAsString() ); writeSourceInfo( testInfo.lineInfo ); @@ -78,7 +80,7 @@ namespace Catch { StreamingReporterBase::sectionStarting( sectionInfo ); if( m_sectionDepth++ > 0 ) { m_xml.startElement( "Section" ) - .writeAttribute( "name"_sr, trim( sectionInfo.name ) ); + .writeAttribute( "name"_sr, trim( StringRef(sectionInfo.name) ) ); writeSourceInfo( sectionInfo.lineInfo ); m_xml.ensureTagClosed(); } @@ -96,19 +98,22 @@ namespace Catch { // Print any info messages in <Info> tags. for( auto const& msg : assertionStats.infoMessages ) { if( msg.type == ResultWas::Info && includeResults ) { - m_xml.scopedElement( "Info" ) - .writeText( msg.message ); + auto t = m_xml.scopedElement( "Info" ); + writeSourceInfo( msg.lineInfo ); + t.writeText( msg.message ); } else if ( msg.type == ResultWas::Warning ) { - m_xml.scopedElement( "Warning" ) - .writeText( msg.message ); + auto t = m_xml.scopedElement( "Warning" ); + writeSourceInfo( msg.lineInfo ); + t.writeText( msg.message ); } } } // Drop out if result was successful but we're not printing them. - if( !includeResults && result.getResultType() != ResultWas::Warning ) + if ( !includeResults && result.getResultType() != ResultWas::Warning && + result.getResultType() != ResultWas::ExplicitSkip ) { return; - + } // Print the expression if there is one. if( result.hasExpression() ) { @@ -151,6 +156,12 @@ namespace Catch { m_xml.writeText( result.getMessage() ); m_xml.endElement(); break; + case ResultWas::ExplicitSkip: + m_xml.startElement( "Skip" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; default: break; } @@ -161,15 +172,18 @@ namespace Catch { void XmlReporter::sectionEnded( SectionStats const& sectionStats ) { StreamingReporterBase::sectionEnded( sectionStats ); - if( --m_sectionDepth > 0 ) { - XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); - e.writeAttribute( "successes"_sr, sectionStats.assertions.passed ); - e.writeAttribute( "failures"_sr, sectionStats.assertions.failed ); - e.writeAttribute( "expectedFailures"_sr, sectionStats.assertions.failedButOk ); - - if ( m_config->showDurations() == ShowDurations::Always ) - e.writeAttribute( "durationInSeconds"_sr, sectionStats.durationInSeconds ); - + if ( --m_sectionDepth > 0 ) { + { + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); + e.writeAttribute( "successes"_sr, sectionStats.assertions.passed ); + e.writeAttribute( "failures"_sr, sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures"_sr, sectionStats.assertions.failedButOk ); + e.writeAttribute( "skipped"_sr, sectionStats.assertions.skipped > 0 ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds"_sr, sectionStats.durationInSeconds ); + } + // Ends assertion tag m_xml.endElement(); } } @@ -178,14 +192,14 @@ namespace Catch { StreamingReporterBase::testCaseEnded( testCaseStats ); XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); e.writeAttribute( "success"_sr, testCaseStats.totals.assertions.allOk() ); + e.writeAttribute( "skips"_sr, testCaseStats.totals.assertions.skipped ); if ( m_config->showDurations() == ShowDurations::Always ) e.writeAttribute( "durationInSeconds"_sr, m_testCaseTimer.getElapsedSeconds() ); - if( !testCaseStats.stdOut.empty() ) - m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), XmlFormatting::Newline ); + m_xml.scopedElement( "StdOut" ).writeText( trim( StringRef(testCaseStats.stdOut) ), XmlFormatting::Newline ); if( !testCaseStats.stdErr.empty() ) - m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), XmlFormatting::Newline ); + m_xml.scopedElement( "StdErr" ).writeText( trim( StringRef(testCaseStats.stdErr) ), XmlFormatting::Newline ); m_xml.endElement(); } @@ -195,11 +209,13 @@ namespace Catch { m_xml.scopedElement( "OverallResults" ) .writeAttribute( "successes"_sr, testRunStats.totals.assertions.passed ) .writeAttribute( "failures"_sr, testRunStats.totals.assertions.failed ) - .writeAttribute( "expectedFailures"_sr, testRunStats.totals.assertions.failedButOk ); + .writeAttribute( "expectedFailures"_sr, testRunStats.totals.assertions.failedButOk ) + .writeAttribute( "skips"_sr, testRunStats.totals.assertions.skipped ); m_xml.scopedElement( "OverallResultsCases") .writeAttribute( "successes"_sr, testRunStats.totals.testCases.passed ) .writeAttribute( "failures"_sr, testRunStats.totals.testCases.failed ) - .writeAttribute( "expectedFailures"_sr, testRunStats.totals.testCases.failedButOk ); + .writeAttribute( "expectedFailures"_sr, testRunStats.totals.testCases.failedButOk ) + .writeAttribute( "skips"_sr, testRunStats.totals.testCases.skipped ); m_xml.endElement(); } diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp index 573f9321a3daa58f43e9d2c071a81a5706ad96c4..bead7a87161388a3a4c82df363e4ad2839e7b2b6 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp b/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp index d3a59eb7dc293106d3968d507d459bce88cf2b3f..16f7bd70cdcae5f28757ad4cc94d98ca9a913ae0 100644 --- a/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp +++ b/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/CMakeLists.txt b/packages/Catch2/tests/CMakeLists.txt index 7f5af9949a822031de5da7fa4c4f203a70041b02..7be57abec1856d6b2116f012ed641551ae3e48a9 100644 --- a/packages/Catch2/tests/CMakeLists.txt +++ b/packages/Catch2/tests/CMakeLists.txt @@ -77,6 +77,7 @@ endif(MSVC) #Temporary workaround # Please keep these ordered alphabetically set(TEST_SOURCES ${SELF_TEST_DIR}/TestRegistrations.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Algorithms.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/Clara.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/CmdLine.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/CmdLineHelpers.tests.cpp @@ -85,11 +86,13 @@ set(TEST_SOURCES ${SELF_TEST_DIR}/IntrospectiveTests/FloatingPoint.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/GeneratorsImpl.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/InternalBenchmark.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Parse.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/PartTracker.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/RandomNumberGeneration.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/Reporters.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/Tag.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/TestCaseInfoHasher.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/TestSpec.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/TestSpecParser.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/TextFlow.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/Sharding.tests.cpp @@ -97,8 +100,10 @@ set(TEST_SOURCES ${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/StringManip.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Traits.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/ToString.tests.cpp ${SELF_TEST_DIR}/IntrospectiveTests/UniquePtr.tests.cpp + ${SELF_TEST_DIR}/helpers/parse_test_spec.cpp ${SELF_TEST_DIR}/TimingTests/Sleep.tests.cpp ${SELF_TEST_DIR}/UsageTests/Approx.tests.cpp ${SELF_TEST_DIR}/UsageTests/BDD.tests.cpp @@ -112,6 +117,7 @@ set(TEST_SOURCES ${SELF_TEST_DIR}/UsageTests/Generators.tests.cpp ${SELF_TEST_DIR}/UsageTests/Message.tests.cpp ${SELF_TEST_DIR}/UsageTests/Misc.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Skip.tests.cpp ${SELF_TEST_DIR}/UsageTests/ToStringByte.tests.cpp ${SELF_TEST_DIR}/UsageTests/ToStringChrono.tests.cpp ${SELF_TEST_DIR}/UsageTests/ToStringGeneral.tests.cpp @@ -127,6 +133,12 @@ set(TEST_SOURCES ${SELF_TEST_DIR}/UsageTests/Matchers.tests.cpp ) +set(TEST_HEADERS + ${SELF_TEST_DIR}/helpers/parse_test_spec.hpp + ${SELF_TEST_DIR}/helpers/range_test_helpers.hpp + ${SELF_TEST_DIR}/helpers/type_with_lit_0_comparisons.hpp +) + # Specify the headers, too, so CLion recognises them as project files set(HEADERS @@ -144,7 +156,8 @@ set(HEADERS include(CTest) -add_executable(SelfTest ${TEST_SOURCES}) +add_executable(SelfTest ${TEST_SOURCES} ${TEST_HEADERS}) +target_include_directories(SelfTest PRIVATE ${SELF_TEST_DIR}) target_link_libraries(SelfTest PRIVATE Catch2WithMain) if (BUILD_SHARED_LIBS AND WIN32) add_custom_command(TARGET SelfTest PRE_LINK @@ -165,7 +178,7 @@ endif() add_test(NAME RunTests COMMAND $<TARGET_FILE:SelfTest> --order rand --rng-seed time) set_tests_properties(RunTests PROPERTIES FAIL_REGULAR_EXPRESSION "Filters:" - COST 60 + COST 15 ) # Because CTest does not allow us to check both return code _and_ expected @@ -247,7 +260,7 @@ add_test(NAME TestSpecs::CombiningMatchingAndNonMatchingIsOk-1 COMMAND $<TARGET_ add_test(NAME TestSpecs::CombiningMatchingAndNonMatchingIsOk-2 COMMAND $<TARGET_FILE:SelfTest> Tracker, "___nonexistent_test___") set_tests_properties(TestSpecs::CombiningMatchingAndNonMatchingIsOk-2 PROPERTIES - PASS_REGULAR_EXPRESSION "No test cases matched '___nonexistent_test___'" + PASS_REGULAR_EXPRESSION "No test cases matched '\"___nonexistent_test___\"'" FAIL_REGULAR_EXPRESSION "No tests ran" ) @@ -262,6 +275,18 @@ add_test(NAME TestSpecs::OverrideFailureWithNoMatchedTests COMMAND $<TARGET_FILE:SelfTest> "___nonexistent_test___" --allow-running-no-tests ) +add_test(NAME TestSpecs::OverrideAllSkipFailure + COMMAND $<TARGET_FILE:SelfTest> "tests can be skipped dynamically at runtime" --allow-running-no-tests +) + +add_test(NAME TestSpecs::NonMatchingTestSpecIsRoundTrippable + COMMAND $<TARGET_FILE:SelfTest> Tracker, "this test does not exist" "[nor does this tag]" +) +set_tests_properties(TestSpecs::NonMatchingTestSpecIsRoundTrippable + PROPERTIES + PASS_REGULAR_EXPRESSION "No test cases matched '\"this test does not exist\" \\[nor does this tag\\]'" +) + add_test(NAME Warnings::UnmatchedTestSpecIsAccepted COMMAND $<TARGET_FILE:SelfTest> Tracker --warn UnmatchedTestSpec ) @@ -325,17 +350,27 @@ set_tests_properties(FilteredSection::GeneratorsDontCauseInfiniteLoop-2 ) # AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable -add_test(NAME ApprovalTests COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tools/scripts/approvalTests.py $<TARGET_FILE:SelfTest>) +add_test(NAME ApprovalTests + COMMAND + ${PYTHON_EXECUTABLE} + ${CATCH_DIR}/tools/scripts/approvalTests.py + $<TARGET_FILE:SelfTest> + "${CMAKE_CURRENT_BINARY_DIR}" +) + set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed" - COST 120 # We know that this is either the most, or second most, - # expensive test in the test suite, so we give it high estimate for CI runs + + # This is the most expensive test in the basic test suite, so we give + # it high cost estimate so that CI runs it as one of the first ones, + # for better parallelization. + COST 30 LABELS "uses-python" ) add_test(NAME RegressionCheck-1670 COMMAND $<TARGET_FILE:SelfTest> "#1670 regression check" -c A -r compact) -set_tests_properties(RegressionCheck-1670 PROPERTIES PASS_REGULAR_EXPRESSION "Passed 1 test case with 2 assertions.") +set_tests_properties(RegressionCheck-1670 PROPERTIES PASS_REGULAR_EXPRESSION "All tests passed \\(2 assertions in 1 test case\\)") add_test(NAME VersionCheck COMMAND $<TARGET_FILE:SelfTest> -h) set_tests_properties(VersionCheck PROPERTIES PASS_REGULAR_EXPRESSION "Catch2 v${PROJECT_VERSION}") @@ -595,6 +630,23 @@ foreach (reporterName # "Automake" - the simple .trs format does not support any "TAP" # "TeamCity" - does not seem to support test suite-level metadata/comments "XML") + + add_test(NAME "Reporters:Filters:${reporterName}" + COMMAND + $<TARGET_FILE:SelfTest> [comparisons][string-case] "CaseInsensitiveLess is case insensitive" + --reporter ${reporterName} + ) + # Different regex for these two reporters, because the commas end up xml-escaped + if (reporterName MATCHES "JUnit|XML") + set(testCaseNameFormat ""CaseInsensitiveLess is case insensitive"") + else() + set(testCaseNameFormat "\"CaseInsensitiveLess is case insensitive\"") + endif() + set_tests_properties("Reporters:Filters:${reporterName}" + PROPERTIES + PASS_REGULAR_EXPRESSION "[fF]ilters.+\\[comparisons\\] \\[string-case\\] ${testCaseNameFormat}" + ) + add_test(NAME "Reporters:RngSeed:${reporterName}" COMMAND $<TARGET_FILE:SelfTest> "Factorials are computed" diff --git a/packages/Catch2/tests/ExtraTests/CMakeLists.txt b/packages/Catch2/tests/ExtraTests/CMakeLists.txt index f1a02af3f6a1fc607ea8ae65a3c3aa2d876e015e..2a810e2584ca67d2449c2965ea32a3877b595011 100644 --- a/packages/Catch2/tests/ExtraTests/CMakeLists.txt +++ b/packages/Catch2/tests/ExtraTests/CMakeLists.txt @@ -2,7 +2,7 @@ # Build extra tests. # -cmake_minimum_required( VERSION 3.5 ) +cmake_minimum_required( VERSION 3.10 ) project( Catch2ExtraTests LANGUAGES CXX ) @@ -150,6 +150,29 @@ set_tests_properties(NO_CATCH_CONFIG_BAZEL_REPORTER-1 ENVIRONMENT "BAZEL_TEST=1" ) +add_test(NAME BazelEnv::TESTBRIDGE_TEST_ONLY + COMMAND + $<TARGET_FILE:BazelReporterNoCatchConfig> +) +set_tests_properties(BazelEnv::TESTBRIDGE_TEST_ONLY + PROPERTIES + ENVIRONMENT "BAZEL_TEST=1;TESTBRIDGE_TEST_ONLY=Passing test case" + PASS_REGULAR_EXPRESSION "All tests passed \\(1 assertion in 1 test case\\)" +) + + +add_test(NAME BazelEnv::Sharding + COMMAND + "${PYTHON_EXECUTABLE}" "${CATCH_DIR}/tests/TestScripts/testBazelSharding.py" + $<TARGET_FILE:BazelReporterNoCatchConfig> + "${CMAKE_CURRENT_BINARY_DIR}" +) +set_tests_properties(BazelEnv::Sharding + PROPERTIES + LABELS "uses-python" +) + + # The default handler on Windows leads to the just-in-time debugger firing, # which makes this test unsuitable for CI and headless runs, as it opens # up an interactive dialog. @@ -187,7 +210,7 @@ add_test(NAME DeferredStaticChecks COMMAND DeferredStaticChecks -r compact) set_tests_properties( DeferredStaticChecks PROPERTIES - PASS_REGULAR_EXPRESSION "Failed 1 test case, failed all 3 assertions." + PASS_REGULAR_EXPRESSION "test cases: 1 \\| 1 failed\nassertions: 3 \\| 3 failed" ) @@ -219,9 +242,6 @@ set_tests_properties( if (MSVC) # This test fails if it does not compile and succeeds otherwise add_executable(WindowsHeader ${TESTS_DIR}/X90-WindowsHeaderInclusion.cpp) - set_property( TARGET WindowsHeader PROPERTY CXX_STANDARD 14 ) - set_property( TARGET WindowsHeader PROPERTY CXX_STANDARD_REQUIRED ON ) - set_property( TARGET WindowsHeader PROPERTY CXX_EXTENSIONS OFF ) target_link_libraries( WindowsHeader Catch2WithMain ) add_test(NAME WindowsHeader COMMAND WindowsHeader -r compact) list(APPEND CATCH_WARNING_TARGETS ${EXTRA_TEST_BINARIES} WindowsHeader) @@ -249,6 +269,7 @@ set_tests_properties( BenchmarksInCumulativeReporter PROPERTIES PASS_REGULAR_EXPRESSION "1\n2\n3\n4\n5\n" + COST 30 ) @@ -447,6 +468,17 @@ set_tests_properties( ) +add_executable(AssertionStartingEventGoesBeforeAssertionIsEvaluated + X20-AssertionStartingEventGoesBeforeAssertionIsEvaluated.cpp +) +target_link_libraries(AssertionStartingEventGoesBeforeAssertionIsEvaluated + PRIVATE Catch2::Catch2WithMain +) +add_test( + NAME ReporterEvents::AssertionStartingHappensBeforeAssertionIsEvaluated + COMMAND $<TARGET_FILE:AssertionStartingEventGoesBeforeAssertionIsEvaluated> +) + #add_executable(DebugBreakMacros ${TESTS_DIR}/X12-CustomDebugBreakMacro.cpp) #target_link_libraries(DebugBreakMacros Catch2) #add_test(NAME DebugBreakMacros COMMAND DebugBreakMacros --break) @@ -467,15 +499,32 @@ set_tests_properties(TestSpecs::EmptySpecWithNoTestsFails PROPERTIES WILL_FAIL ON ) + add_test( NAME TestSpecs::OverrideFailureWithEmptySpec COMMAND $<TARGET_FILE:NoTests> --allow-running-no-tests ) + add_test( NAME List::Listeners::WorksWithoutRegisteredListeners COMMAND $<TARGET_FILE:NoTests> --list-listeners ) + + +add_executable(AllSkipped ${TESTS_DIR}/X93-AllSkipped.cpp) +target_link_libraries(AllSkipped PRIVATE Catch2::Catch2WithMain) + +add_test( + NAME TestSpecs::SkippingAllTestsFails + COMMAND $<TARGET_FILE:AllSkipped> +) +set_tests_properties(TestSpecs::SkippingAllTestsFails + PROPERTIES + WILL_FAIL ON +) + set( EXTRA_TEST_BINARIES + AllSkipped PrefixedMacros DisabledMacros DisabledExceptions-DefaultHandler @@ -491,13 +540,6 @@ set( EXTRA_TEST_BINARIES # DebugBreakMacros ) -# Shared config -foreach( test ${EXTRA_TEST_BINARIES} ) - set_property( TARGET ${test} PROPERTY CXX_STANDARD 14 ) - set_property( TARGET ${test} PROPERTY CXX_STANDARD_REQUIRED ON ) - set_property( TARGET ${test} PROPERTY CXX_EXTENSIONS OFF ) -endforeach() - # Notice that we are modifying EXTRA_TEST_BINARIES destructively, do not # use it after this point! list(FILTER EXTRA_TEST_BINARIES EXCLUDE REGEX "DisabledExceptions.*") @@ -514,9 +556,6 @@ add_executable(AmalgamatedTestCompilation ${CATCH_DIR}/extras/catch_amalgamated.cpp ) target_include_directories(AmalgamatedTestCompilation PRIVATE ${CATCH_DIR}/extras) -set_property( TARGET AmalgamatedTestCompilation PROPERTY CXX_STANDARD 14 ) -set_property( TARGET AmalgamatedTestCompilation PROPERTY CXX_STANDARD_REQUIRED ON ) -set_property( TARGET AmalgamatedTestCompilation PROPERTY CXX_EXTENSIONS OFF ) add_test(NAME AmalgamatedFileTest COMMAND AmalgamatedTestCompilation) set_tests_properties( diff --git a/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp b/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp index 65235194c3cc4878ba05105212aee0612476a9d2..d1c246ecb48f7adadb255f1d9cbea96fd5a30d8a 100644 --- a/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp +++ b/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp b/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp index 37d35e11cc10c9e83ccb3e4de0e7c846e9efa4fe..68bc2add60289ed3e872932d06f96f5eb41303ce 100644 --- a/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp +++ b/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp b/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp index 74b651c7504a222e083000144ee8ab8dccc3f2cc..5b6d4b126f101c7295e58db3bb578cca5809369d 100644 --- a/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp +++ b/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp b/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp index 725440ec34d707e757c8d21255279e6aad0edca4..e1f1e703a629dd5cac37bd3419a692e5668c526a 100644 --- a/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp +++ b/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp b/packages/Catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp index 62ceb4a770cf53de8e6d1c49217169bbac97e897..8005dbcfa1363b68ab96bee2ccb6391df6a07d04 100644 --- a/packages/Catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp +++ b/packages/Catch2/tests/ExtraTests/X05-DeferredStaticChecks.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp b/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp index 61ad62ea10a701e20e4ae2bb8a8c5cec1fc24ad7..8525a81369c179f86acd934891b17e893551ecb0 100644 --- a/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp +++ b/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp b/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp index 97dcea7b68e71072e62e08724c1905dd51da7ec5..f89962771bb3bbcf13b4b6398f7a2b00ee374299 100644 --- a/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp +++ b/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp b/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp index e52c1c2b6d8dedc6584e99bb7e6b7482b3f345e3..e6d3e38b002392c2d7d1b80a6e19cc259297fddd 100644 --- a/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp +++ b/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X20-AssertionStartingEventGoesBeforeAssertionIsEvaluated.cpp b/packages/Catch2/tests/ExtraTests/X20-AssertionStartingEventGoesBeforeAssertionIsEvaluated.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ef5b46b95de33876b1356240a460e06e219f3d0e --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X20-AssertionStartingEventGoesBeforeAssertionIsEvaluated.cpp @@ -0,0 +1,81 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +/**\file + * TODO: FIXES Registers custom reporter that reports testCase* events + * + * The resulting executable can then be used by an external Python script + * to verify that testCase{Starting,Ended} and testCasePartial{Starting,Ended} + * events are properly nested. + */ + +#include <catch2/catch_test_macros.hpp> +#include <catch2/reporters/catch_reporter_event_listener.hpp> +#include <catch2/reporters/catch_reporter_registrars.hpp> +#include <catch2/matchers/catch_matchers_predicate.hpp> + +namespace { + + static size_t assertion_starting_events_seen = 0; + + // TODO: custom matcher to check that "assertion_starting_events_seen" has + // the right number of checks + + class AssertionStartingListener : public Catch::EventListenerBase { + public: + AssertionStartingListener( Catch::IConfig const* config ): + EventListenerBase( config ) {} + + void assertionStarting( Catch::AssertionInfo const& ) override { + ++assertion_starting_events_seen; + } + }; + + static bool f1() { + return assertion_starting_events_seen == 1; + } + + static void f2() { + if ( assertion_starting_events_seen != 2 ) { throw 1; } + } + + static void f3() { + if ( assertion_starting_events_seen == 3 ) { throw 1; } + } + + static bool f4() { return assertion_starting_events_seen == 4; } + + static void f5() { throw assertion_starting_events_seen; } + +} // anonymous namespace + +CATCH_REGISTER_LISTENER( AssertionStartingListener ) + +TEST_CASE() { + // **IMPORTANT** + // The order of assertions below matters. + REQUIRE( f1() ); + REQUIRE_NOTHROW( f2() ); + REQUIRE_THROWS( f3() ); + REQUIRE_THAT( f4(), + Catch::Matchers::Predicate<bool>( []( bool b ) { return b; } ) ); + REQUIRE_THROWS_MATCHES( + f5(), size_t, Catch::Matchers::Predicate<size_t>( []( size_t i ) { + return i == 5; + } ) ); + + CAPTURE( assertion_starting_events_seen ); // **not** an assertion + INFO( "some info msg" ); // **not** an assertion + WARN( "warning! warning!" ); // assertion-like message + SUCCEED(); // assertion-like message + + // We skip FAIL/SKIP and so on, which fail the test. + + // This require will also increment the count once + REQUIRE( assertion_starting_events_seen == 8 ); +} diff --git a/packages/Catch2/tests/ExtraTests/X21-PartialTestCaseEvents.cpp b/packages/Catch2/tests/ExtraTests/X21-PartialTestCaseEvents.cpp index 686b50b1d68a35b83159b63d7b934350eb850915..aa5204c95c8d952f6422e31bb9635c3f68dd894d 100644 --- a/packages/Catch2/tests/ExtraTests/X21-PartialTestCaseEvents.cpp +++ b/packages/Catch2/tests/ExtraTests/X21-PartialTestCaseEvents.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X22-BenchmarksInCumulativeReporter.cpp b/packages/Catch2/tests/ExtraTests/X22-BenchmarksInCumulativeReporter.cpp index c75d891e5e15de2ef6990c1107ddd264843a4e73..af03ce30ae97ff456cdd6dd84e487e6b26a7f765 100644 --- a/packages/Catch2/tests/ExtraTests/X22-BenchmarksInCumulativeReporter.cpp +++ b/packages/Catch2/tests/ExtraTests/X22-BenchmarksInCumulativeReporter.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X23-CasingInReporterNames.cpp b/packages/Catch2/tests/ExtraTests/X23-CasingInReporterNames.cpp index 0e13f205b22d97b839c1743ffea727c0d54b5b6f..30523739506cfda626ad0307e13efccbf46631c6 100644 --- a/packages/Catch2/tests/ExtraTests/X23-CasingInReporterNames.cpp +++ b/packages/Catch2/tests/ExtraTests/X23-CasingInReporterNames.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X24-ListenerStdoutCaptureInMultireporter.cpp b/packages/Catch2/tests/ExtraTests/X24-ListenerStdoutCaptureInMultireporter.cpp index 605458515604b374aa7988282f3477b54c37f4ca..ffb706e9c19f79f81b3bd5b09d2a0e7dfca919ee 100644 --- a/packages/Catch2/tests/ExtraTests/X24-ListenerStdoutCaptureInMultireporter.cpp +++ b/packages/Catch2/tests/ExtraTests/X24-ListenerStdoutCaptureInMultireporter.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X25-ListenerCanAskForCapturedStdout.cpp b/packages/Catch2/tests/ExtraTests/X25-ListenerCanAskForCapturedStdout.cpp index a4a55ad75dbe919bd3d459f0fd16bb197a0978fa..de75ef4e74e545360e5ee02f39ad884f3860b019 100644 --- a/packages/Catch2/tests/ExtraTests/X25-ListenerCanAskForCapturedStdout.cpp +++ b/packages/Catch2/tests/ExtraTests/X25-ListenerCanAskForCapturedStdout.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp b/packages/Catch2/tests/ExtraTests/X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp index 01aca7c0c8f29262c546183365fe821371fbff3a..90a5885e9229fca67228be098c7ef2c01e48ce14 100644 --- a/packages/Catch2/tests/ExtraTests/X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp +++ b/packages/Catch2/tests/ExtraTests/X26-ReporterPreferencesForPassingAssertionsIsRespected.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X27-CapturedStdoutInTestCaseEvents.cpp b/packages/Catch2/tests/ExtraTests/X27-CapturedStdoutInTestCaseEvents.cpp index cb29be0c1ed265d44763831a6c2ad47659daf998..61aaa02a8ac0501e2e8cd57a7431bd9e2387a491 100644 --- a/packages/Catch2/tests/ExtraTests/X27-CapturedStdoutInTestCaseEvents.cpp +++ b/packages/Catch2/tests/ExtraTests/X27-CapturedStdoutInTestCaseEvents.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X28-ListenersGetEventsBeforeReporters.cpp b/packages/Catch2/tests/ExtraTests/X28-ListenersGetEventsBeforeReporters.cpp index c8102edb23d6c5084564993f13b15b5cc2a4b504..4098c8b89f356286de87a0fad6ef0c3aa73b8839 100644 --- a/packages/Catch2/tests/ExtraTests/X28-ListenersGetEventsBeforeReporters.cpp +++ b/packages/Catch2/tests/ExtraTests/X28-ListenersGetEventsBeforeReporters.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X29-CustomArgumentsForReporters.cpp b/packages/Catch2/tests/ExtraTests/X29-CustomArgumentsForReporters.cpp index d3af7dc75bf3758a45eeaf6dc432ff52323af7eb..9bd816efcbddfae3f48b4f6566993db3ff6030b7 100644 --- a/packages/Catch2/tests/ExtraTests/X29-CustomArgumentsForReporters.cpp +++ b/packages/Catch2/tests/ExtraTests/X29-CustomArgumentsForReporters.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X30-BazelReporter.cpp b/packages/Catch2/tests/ExtraTests/X30-BazelReporter.cpp index 6a6168dbe4c89b990068eb92398bd43040d02218..2a259416a006a94740e7b803eaaafa3c6022f20d 100644 --- a/packages/Catch2/tests/ExtraTests/X30-BazelReporter.cpp +++ b/packages/Catch2/tests/ExtraTests/X30-BazelReporter.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X31-DuplicatedTestCases.cpp b/packages/Catch2/tests/ExtraTests/X31-DuplicatedTestCases.cpp index 2235ca8396d57363625ae5e831fc8bea50489139..0d091752f2eb811c998cffe1a266b9ea6e11d416 100644 --- a/packages/Catch2/tests/ExtraTests/X31-DuplicatedTestCases.cpp +++ b/packages/Catch2/tests/ExtraTests/X31-DuplicatedTestCases.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X32-DuplicatedTestCasesDifferentTags.cpp b/packages/Catch2/tests/ExtraTests/X32-DuplicatedTestCasesDifferentTags.cpp index 6a4246be51be9bc2549c58f71c113693b8485cd4..b0aa4171a82f01b40b856494778bfb5ad8100f9c 100644 --- a/packages/Catch2/tests/ExtraTests/X32-DuplicatedTestCasesDifferentTags.cpp +++ b/packages/Catch2/tests/ExtraTests/X32-DuplicatedTestCasesDifferentTags.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X33-DuplicatedTestCaseMethods.cpp b/packages/Catch2/tests/ExtraTests/X33-DuplicatedTestCaseMethods.cpp index ff6660a8a1c478f279a6611d8ffec2b6a64cac10..d3c3449ac7518cd84a53a17abeff77f20d505d46 100644 --- a/packages/Catch2/tests/ExtraTests/X33-DuplicatedTestCaseMethods.cpp +++ b/packages/Catch2/tests/ExtraTests/X33-DuplicatedTestCaseMethods.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X34-DuplicatedTestCaseMethodsDifferentFixtures.cpp b/packages/Catch2/tests/ExtraTests/X34-DuplicatedTestCaseMethodsDifferentFixtures.cpp index b2021f5fbff85fa564d82d138c8bb298969f456c..397cf15d2f6839a159365e021210ab8c45487922 100644 --- a/packages/Catch2/tests/ExtraTests/X34-DuplicatedTestCaseMethodsDifferentFixtures.cpp +++ b/packages/Catch2/tests/ExtraTests/X34-DuplicatedTestCaseMethodsDifferentFixtures.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp b/packages/Catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp index cc0dd0b97f5d67df726bae8d320274443fb7758d..a978448a39c09b19b6a56ae13d2cebb7499cfc81 100644 --- a/packages/Catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp +++ b/packages/Catch2/tests/ExtraTests/X35-DuplicatedReporterNames.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp b/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp index 739b34d409335694e119ca78fcc35bd954948692..dff542ae1f93e8dbdb83f2542583e2c765247659 100644 --- a/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp +++ b/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp b/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp index d77f55d5ba93013f499b57e6dbce72b79ada8641..c00462be7444adc06b887bf52a853149c5c9960f 100644 --- a/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp +++ b/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X92-NoTests.cpp b/packages/Catch2/tests/ExtraTests/X92-NoTests.cpp index fc6bf597ac5a9aabd7497d690c4df9c6757feff6..9591e540b80786a5209232ed6199c90d707eb43e 100644 --- a/packages/Catch2/tests/ExtraTests/X92-NoTests.cpp +++ b/packages/Catch2/tests/ExtraTests/X92-NoTests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/ExtraTests/X93-AllSkipped.cpp b/packages/Catch2/tests/ExtraTests/X93-AllSkipped.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8e7d0afe66c4c30c0a710c96650a5c84451c74aa --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X93-AllSkipped.cpp @@ -0,0 +1,16 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_test_macros.hpp> + +TEST_CASE( "this test case is being skipped" ) { SKIP(); } + +TEST_CASE( "all sections in this test case are being skipped" ) { + SECTION( "A" ) { SKIP(); } + SECTION( "B" ) { SKIP(); } +} diff --git a/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt index b8b5956601f0348b9da829840b5490bac8cb6242..6b5938a67b2402df688c5aabd08f5aa23e58dbb7 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -25,6 +25,7 @@ Nor would this :test-result: PASS #1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0 :test-result: PASS #2152 - ULP checks between differently signed values were wrong - double :test-result: PASS #2152 - ULP checks between differently signed values were wrong - float +:test-result: XFAIL #2615 - Throwing in constructor generator fails test case but does not abort :test-result: XFAIL #748 - captures with unexpected exceptions :test-result: PASS #809 :test-result: PASS #833 @@ -129,8 +130,8 @@ Nor would this :test-result: FAIL Custom std-exceptions can be custom translated :test-result: PASS Default scale is invisible to comparison :test-result: PASS Directly creating an EnumInfo +:test-result: SKIP Empty generators can SKIP in constructor :test-result: PASS Empty stream name opens cout stream -:test-result: PASS Empty tag is not allowed :test-result: FAIL EndsWith string matcher :test-result: PASS Enums can quickly have stringification enabled using REGISTER_ENUM :test-result: PASS Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM @@ -142,6 +143,7 @@ Nor would this :test-result: PASS Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified :test-result: FAIL Exception matchers that fail :test-result: PASS Exception matchers that succeed +:test-result: PASS Exception message can be matched :test-result: PASS Exception messages can be tested for :test-result: PASS Exceptions matchers :test-result: FAIL Expected exceptions that don't throw or unexpected exceptions fail the test @@ -149,6 +151,7 @@ Nor would this :test-result: FAIL FAIL does not require an argument :test-result: FAIL FAIL_CHECK does not abort the test :test-result: PASS Factorials are computed +:test-result: PASS Filter generator throws exception for empty generator :test-result: PASS Floating point matchers: double :test-result: PASS Floating point matchers: float :test-result: PASS Generators -- adapters @@ -188,7 +191,7 @@ Nor would this :test-result: PASS Our PCG implementation provides expected results for known seeds :test-result: FAIL Output from all sections is reported :test-result: PASS Overloaded comma or address-of operators are not used -:test-result: PASS Parse test names and tags +:test-result: PASS Parse uints :test-result: PASS Parsed tags are matched case insensitive :test-result: PASS Parsing sharding-related cli flags :test-result: PASS Parsing tags with non-alphabetical characters is pass-through @@ -268,6 +271,7 @@ Message from section two :test-result: FAIL Thrown string literals are translated :test-result: PASS Tracker :test-result: PASS Trim strings +:test-result: PASS Type conversions of RangeEquals and similar :test-result: FAIL Unexpected exceptions can be translated :test-result: PASS Upcasting special member functions :test-result: PASS Usage of AllMatch range matcher @@ -276,6 +280,8 @@ Message from section two :test-result: PASS Usage of AnyTrue range matcher :test-result: PASS Usage of NoneMatch range matcher :test-result: PASS Usage of NoneTrue range matcher +:test-result: PASS Usage of RangeEquals range matcher +:test-result: PASS Usage of UnorderedRangeEquals range matcher :test-result: PASS Usage of the SizeIs range matcher :test-result: PASS Use a custom approx :test-result: PASS Variadic macros @@ -296,6 +302,7 @@ Message from section two :test-result: PASS X/level/1/b :test-result: PASS XmlEncode :test-result: PASS XmlWriter writes boolean attributes as true/false +:test-result: SKIP a succeeding test can still be skipped :test-result: PASS analyse no analysis :test-result: PASS array<int, N> -> toString :test-result: PASS benchmark function call @@ -308,10 +315,14 @@ Message from section two :test-result: PASS comparisons between const int variables :test-result: PASS comparisons between int variables :test-result: PASS convertToBits +:test-result: SKIP dynamic skipping works with generators :test-result: PASS empty tags are not allowed :test-result: PASS erfc_inv :test-result: PASS estimate_clock_resolution :test-result: PASS even more nested SECTION tests +:test-result: XFAIL failed assertions before SKIP cause test case to fail +:test-result: XFAIL failing for some generator values causes entire test case to fail +:test-result: XFAIL failing in some unskipped sections causes entire test case to fail :test-result: FAIL first tag loose text artifact :test-result: FAIL has printf @@ -330,6 +341,10 @@ loose text artifact :test-result: FAIL mix info, unscoped info and warning :test-result: FAIL more nested SECTION tests :test-result: PASS nested SECTION tests +a! +b1! +! +:test-result: FAIL nested sections can be skipped dynamically at runtime :test-result: PASS non streamable - with conv. op :test-result: PASS non-copyable objects :test-result: PASS normal_cdf @@ -351,9 +366,11 @@ loose text artifact :test-result: PASS run_for_at_least, chronometer :test-result: PASS run_for_at_least, int :test-result: FAIL second tag +:test-result: SKIP sections can be skipped dynamically at runtime :test-result: FAIL send a single char to INFO :test-result: FAIL sends information to INFO :test-result: PASS shortened hide tags are split apart +:test-result: SKIP skipped tests can optionally provide a reason :test-result: PASS splitString :test-result: FAIL stacks unscoped info in loops :test-result: PASS startsWith @@ -375,6 +392,7 @@ loose text artifact :test-result: PASS strlen3 :test-result: PASS tables :test-result: PASS tags with dots in later positions are not parsed as hidden +:test-result: SKIP tests can be skipped dynamically at runtime :test-result: FAIL thrown std::strings are translated :test-result: PASS toString on const wchar_t const pointer returns the string contents :test-result: PASS toString on const wchar_t pointer returns the string contents diff --git a/packages/Catch2/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index 2afd308bc4a723ce00eff68d06f6284388fc7197..cd56e6487121bd0629b83ca3f3607cfd4df6a860 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -23,6 +23,7 @@ :test-result: PASS #1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0 :test-result: PASS #2152 - ULP checks between differently signed values were wrong - double :test-result: PASS #2152 - ULP checks between differently signed values were wrong - float +:test-result: XFAIL #2615 - Throwing in constructor generator fails test case but does not abort :test-result: XFAIL #748 - captures with unexpected exceptions :test-result: PASS #809 :test-result: PASS #833 @@ -127,8 +128,8 @@ :test-result: FAIL Custom std-exceptions can be custom translated :test-result: PASS Default scale is invisible to comparison :test-result: PASS Directly creating an EnumInfo +:test-result: SKIP Empty generators can SKIP in constructor :test-result: PASS Empty stream name opens cout stream -:test-result: PASS Empty tag is not allowed :test-result: FAIL EndsWith string matcher :test-result: PASS Enums can quickly have stringification enabled using REGISTER_ENUM :test-result: PASS Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM @@ -140,6 +141,7 @@ :test-result: PASS Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified :test-result: FAIL Exception matchers that fail :test-result: PASS Exception matchers that succeed +:test-result: PASS Exception message can be matched :test-result: PASS Exception messages can be tested for :test-result: PASS Exceptions matchers :test-result: FAIL Expected exceptions that don't throw or unexpected exceptions fail the test @@ -147,6 +149,7 @@ :test-result: FAIL FAIL does not require an argument :test-result: FAIL FAIL_CHECK does not abort the test :test-result: PASS Factorials are computed +:test-result: PASS Filter generator throws exception for empty generator :test-result: PASS Floating point matchers: double :test-result: PASS Floating point matchers: float :test-result: PASS Generators -- adapters @@ -186,7 +189,7 @@ :test-result: PASS Our PCG implementation provides expected results for known seeds :test-result: FAIL Output from all sections is reported :test-result: PASS Overloaded comma or address-of operators are not used -:test-result: PASS Parse test names and tags +:test-result: PASS Parse uints :test-result: PASS Parsed tags are matched case insensitive :test-result: PASS Parsing sharding-related cli flags :test-result: PASS Parsing tags with non-alphabetical characters is pass-through @@ -261,6 +264,7 @@ :test-result: FAIL Thrown string literals are translated :test-result: PASS Tracker :test-result: PASS Trim strings +:test-result: PASS Type conversions of RangeEquals and similar :test-result: FAIL Unexpected exceptions can be translated :test-result: PASS Upcasting special member functions :test-result: PASS Usage of AllMatch range matcher @@ -269,6 +273,8 @@ :test-result: PASS Usage of AnyTrue range matcher :test-result: PASS Usage of NoneMatch range matcher :test-result: PASS Usage of NoneTrue range matcher +:test-result: PASS Usage of RangeEquals range matcher +:test-result: PASS Usage of UnorderedRangeEquals range matcher :test-result: PASS Usage of the SizeIs range matcher :test-result: PASS Use a custom approx :test-result: PASS Variadic macros @@ -289,6 +295,7 @@ :test-result: PASS X/level/1/b :test-result: PASS XmlEncode :test-result: PASS XmlWriter writes boolean attributes as true/false +:test-result: SKIP a succeeding test can still be skipped :test-result: PASS analyse no analysis :test-result: PASS array<int, N> -> toString :test-result: PASS benchmark function call @@ -301,10 +308,14 @@ :test-result: PASS comparisons between const int variables :test-result: PASS comparisons between int variables :test-result: PASS convertToBits +:test-result: SKIP dynamic skipping works with generators :test-result: PASS empty tags are not allowed :test-result: PASS erfc_inv :test-result: PASS estimate_clock_resolution :test-result: PASS even more nested SECTION tests +:test-result: XFAIL failed assertions before SKIP cause test case to fail +:test-result: XFAIL failing for some generator values causes entire test case to fail +:test-result: XFAIL failing in some unskipped sections causes entire test case to fail :test-result: FAIL first tag :test-result: FAIL has printf :test-result: PASS is_unary_function @@ -322,6 +333,7 @@ :test-result: FAIL mix info, unscoped info and warning :test-result: FAIL more nested SECTION tests :test-result: PASS nested SECTION tests +:test-result: FAIL nested sections can be skipped dynamically at runtime :test-result: PASS non streamable - with conv. op :test-result: PASS non-copyable objects :test-result: PASS normal_cdf @@ -343,9 +355,11 @@ :test-result: PASS run_for_at_least, chronometer :test-result: PASS run_for_at_least, int :test-result: FAIL second tag +:test-result: SKIP sections can be skipped dynamically at runtime :test-result: FAIL send a single char to INFO :test-result: FAIL sends information to INFO :test-result: PASS shortened hide tags are split apart +:test-result: SKIP skipped tests can optionally provide a reason :test-result: PASS splitString :test-result: FAIL stacks unscoped info in loops :test-result: PASS startsWith @@ -367,6 +381,7 @@ :test-result: PASS strlen3 :test-result: PASS tables :test-result: PASS tags with dots in later positions are not parsed as hidden +:test-result: SKIP tests can be skipped dynamically at runtime :test-result: FAIL thrown std::strings are translated :test-result: PASS toString on const wchar_t const pointer returns the string contents :test-result: PASS toString on const wchar_t pointer returns the string contents diff --git a/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt index 6d23d01de2d5942b83d5fe94205ab9d425db0dd2..be7a4120358629363c6bb134ec364c602de737e4 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -1,4 +1,4 @@ -Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Filters: "*" ~[!nonportable] ~[!benchmark] ~[approvals] RNG seed: 1 Misc.tests.cpp:<line number>: passed: with 1 message: 'yay' Compilation.tests.cpp:<line number>: passed: y.v == 0 for: 0 == 0 @@ -22,13 +22,13 @@ This would not be caught previously Nor would this Tricky.tests.cpp:<line number>: failed: explicitly with 1 message: '1514' Compilation.tests.cpp:<line number>: passed: std::is_same<TypeList<int>, TypeList<int>>::value for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec . char")) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec , char")) for: true -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec {a} char)")) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec [a] char)")) for: true -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec \ char)")) for: true +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec . char")) for: true +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec , char")) for: true +TestSpec.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec {a} char)")) for: true +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec [a] char)")) for: true +TestSpec.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) for: !false +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec \ char)")) for: true Generators.tests.cpp:<line number>: passed: counter < 7 for: 3 < 7 Generators.tests.cpp:<line number>: passed: counter < 7 for: 6 < 7 Generators.tests.cpp:<line number>: passed: i != j for: 1 != 3 @@ -84,6 +84,7 @@ Matchers.tests.cpp:<line number>: passed: smallest_non_zero, WithinULP( -smalles Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) Matchers.tests.cpp:<line number>: passed: smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) +Generators.tests.cpp:<line number>: failed: unexpected exception with message: 'failure to init' Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42' @@ -519,8 +520,8 @@ ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: V ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}" +Skip.tests.cpp:<line number>: skipped: 'This generator is empty' Stream.tests.cpp:<line number>: passed: Catch::makeStream( "" )->isConsole() for: true -Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring" Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) EnumToString.tests.cpp:<line number>: passed: stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1" @@ -572,6 +573,10 @@ Matchers.tests.cpp:<line number>: failed: throwsSpecialException( 3 ), SpecialEx Matchers.tests.cpp:<line number>: failed: throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number>: passed: throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number>: passed: throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } for: SpecialException::what special exception has value of 2 +Matchers.tests.cpp:<line number>: passed: throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) for: DerivedException::what matches "starts with: "Derived"" +Matchers.tests.cpp:<line number>: passed: throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) for: DerivedException::what matches "ends with: "::what"" +Matchers.tests.cpp:<line number>: passed: throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) for: DerivedException::what matches "not starts with: "::what"" +Matchers.tests.cpp:<line number>: passed: throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) for: SpecialException::what matches "starts with: "Special"" Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" Exception.tests.cpp:<line number>: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive) Exception.tests.cpp:<line number>: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected" @@ -594,6 +599,7 @@ Misc.tests.cpp:<line number>: passed: Factorial(1) == 1 for: 1 == 1 Misc.tests.cpp:<line number>: passed: Factorial(2) == 2 for: 2 == 2 Misc.tests.cpp:<line number>: passed: Factorial(3) == 6 for: 6 == 6 Misc.tests.cpp:<line number>: passed: Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) +GeneratorsImpl.tests.cpp:<line number>: passed: filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException Matchers.tests.cpp:<line number>: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other @@ -623,6 +629,7 @@ Matchers.tests.cpp:<line number>: passed: WithinULP( 1., 0 ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 0. ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1., -0.2 ), std::domain_error Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 1. ), std::domain_error +Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other @@ -655,6 +662,7 @@ Matchers.tests.cpp:<line number>: passed: WithinULP( 1.f, static_cast<uint64_t>( Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, 0.f ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, -0.2f ), std::domain_error Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, 1.f ), std::domain_error +Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 @@ -1119,170 +1127,30 @@ Matchers.tests.cpp:<line number>: passed: ( EvilMatcher(), EvilMatcher() ), Evil Matchers.tests.cpp:<line number>: passed: &EvilMatcher(), EvilAddressOfOperatorUsed Matchers.tests.cpp:<line number>: passed: EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) Matchers.tests.cpp:<line number>: passed: ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a" ).matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "a*" ).matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a*" ).matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark" ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark" ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) for: true -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true +Parse.tests.cpp:<line number>: passed: parseUInt( "0" ) == Optional<unsigned int>{ 0 } for: {?} == {?} +Parse.tests.cpp:<line number>: passed: parseUInt( "100" ) == Optional<unsigned int>{ 100 } for: {?} == {?} +Parse.tests.cpp:<line number>: passed: parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } for: {?} == {?} +Parse.tests.cpp:<line number>: passed: parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } for: {?} == {?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "!!KJHF*#" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "-1" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "4294967296" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "42949672964294967296429496729642949672964294967296" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "2 4" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "0x<hex digits>", 10 )) for: !{?} TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true TestSpecParser.tests.cpp:<line number>: passed: spec.getInvalidSpecs().empty() for: true TestSpecParser.tests.cpp:<line number>: passed: spec.matches( testCase ) for: true CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-count=8" }) for: {?} CmdLine.tests.cpp:<line number>: passed: config.shardCount == 8 for: 8 == 8 CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} -CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) for: "Could not parse '-1' as shard count" contains: "Could not parse '-1' as shard count" CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} -CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) for: "Shard count must be positive" contains: "Shard count must be positive" CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=2" }) for: {?} CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 2 for: 2 == 2 CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} -CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) for: "Could not parse '-12' as shard index" contains: "Could not parse '-12' as shard index" CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=0" }) for: {?} CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 0 for: 0 == 0 TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true with 1 message: 'tagString := "[tag with spaces]"' @@ -1995,6 +1863,23 @@ There is no extra whitespace here StringManip.tests.cpp:<line number>: passed: trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, RangeEquals( c_array ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, UnorderedRangeEquals( c_array ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_3, !RangeEquals( array_int_4 ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_3, !UnorderedRangeEquals( array_int_4 ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, RangeEquals( vector_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, UnorderedRangeEquals( vector_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: with 1 message: 'ContainerIsRandomAccess( array_int_a ) != ContainerIsRandomAccess( list_char_a )' +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, RangeEquals( list_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, UnorderedRangeEquals( list_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: vector_int_a, RangeEquals( vector_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: vector_int_a, UnorderedRangeEquals( vector_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: vector_int_a, !RangeEquals( vector_char_b ) for: { 1, 2, 3 } not elements are { 1, 2, 2 } +MatchersRanges.tests.cpp:<line number>: passed: vector_int_a, !UnorderedRangeEquals( vector_char_b ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 2 } +MatchersRanges.tests.cpp:<line number>: passed: a, !RangeEquals( b ) for: { 1, 2, 3 } not elements are { 3, 2, 1 } +MatchersRanges.tests.cpp:<line number>: passed: a, UnorderedRangeEquals( b ) for: { 1, 2, 3 } unordered elements are { 3, 2, 1 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, RangeEquals( array_a_plus_1, close_enough ) for: { 1, 2, 3 } elements are { 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) for: { 1, 2, 3 } unordered elements are { 2, 3, 4 } Exception.tests.cpp:<line number>: failed: unexpected exception with message: '3.14' UniquePtr.tests.cpp:<line number>: passed: bptr->i == 3 for: 3 == 3 UniquePtr.tests.cpp:<line number>: passed: bptr->i == 3 for: 3 == 3 @@ -2100,6 +1985,38 @@ MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: empty_vector, RangeEquals( empty_vector ) for: { } elements are { } +MatchersRanges.tests.cpp:<line number>: passed: empty_vector, !RangeEquals( non_empty_vector ) for: { } not elements are { 1 } +MatchersRanges.tests.cpp:<line number>: passed: non_empty_vector, !RangeEquals( empty_vector ) for: { 1 } not elements are { } +MatchersRanges.tests.cpp:<line number>: passed: non_empty_array, RangeEquals( non_empty_array ) for: { 1 } elements are { 1 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, RangeEquals( array_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, !RangeEquals( array_b ) for: { 1, 2, 3 } not elements are { 2, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, !RangeEquals( array_c ) for: { 1, 2, 3 } not elements are { 1, 2, 2 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, !RangeEquals( vector_b ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, RangeEquals( vector_a_plus_1, close_enough ) for: { 1, 2, 3 } elements are { 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, !RangeEquals( vector_b, close_enough ) for: { 1, 2, 3 } not elements are { 3, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: needs_adl1, RangeEquals( needs_adl2 ) for: { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } +MatchersRanges.tests.cpp:<line number>: passed: needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) for: { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } +MatchersRanges.tests.cpp:<line number>: passed: mocked1, !RangeEquals( arr ) for: { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked1.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: mocked1, RangeEquals( arr ) for: { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: empty_vector, UnorderedRangeEquals( empty_vector ) for: { } unordered elements are { } +MatchersRanges.tests.cpp:<line number>: passed: empty_vector, !UnorderedRangeEquals( non_empty_vector ) for: { } not unordered elements are { 1 } +MatchersRanges.tests.cpp:<line number>: passed: non_empty_vector, !UnorderedRangeEquals( empty_vector ) for: { 1 } not unordered elements are { } +MatchersRanges.tests.cpp:<line number>: passed: non_empty_array, UnorderedRangeEquals( non_empty_array ) for: { 1 } unordered elements are { 1 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, UnorderedRangeEquals( array_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, !UnorderedRangeEquals( array_b ) for: { 1, 2, 3 } not unordered elements are { 2, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, !UnorderedRangeEquals( vector_b ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) for: { 1, 10, 20 } unordered elements are { 11, 21, 2 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, !UnorderedRangeEquals( vector_b, close_enough ) for: { 1, 10, 21 } not unordered elements are { 11, 21, 3 } +MatchersRanges.tests.cpp:<line number>: passed: needs_adl1, UnorderedRangeEquals( needs_adl2 ) for: { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } MatchersRanges.tests.cpp:<line number>: passed: empty_vec, SizeIs(0) for: { } has size == 0 MatchersRanges.tests.cpp:<line number>: passed: empty_vec, !SizeIs(2) for: { } not has size == 2 MatchersRanges.tests.cpp:<line number>: passed: empty_vec, SizeIs(Lt(2)) for: { } size matches is less than 2 @@ -2196,6 +2113,8 @@ Xml.tests.cpp:<line number>: passed: encode( "[\x7F]" ) == "[\\x7F]" for: "[\x7F Xml.tests.cpp:<line number>: passed: stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) +Skip.tests.cpp:<line number>: passed: +Skip.tests.cpp:<line number>: skipped: InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.point.count() == 23 for: 23.0 == 23 InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.lower_bound.count() == 23 for: 23.0 == 23 InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.upper_bound.count() == 23 for: 23.0 == 23 @@ -2285,6 +2204,9 @@ FloatingPoint.tests.cpp:<line number>: passed: convertToBits( -0. ) == ( 1ULL << 9223372036854775808 (0x<hex digits>) FloatingPoint.tests.cpp:<line number>: passed: convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 for: 1 == 1 FloatingPoint.tests.cpp:<line number>: passed: convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 for: 1 == 1 +Skip.tests.cpp:<line number>: skipped: 'skipping because answer = 41' +Skip.tests.cpp:<line number>: passed: +Skip.tests.cpp:<line number>: skipped: 'skipping because answer = 43' Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(1.103560) == Approx(-0.09203687623843015) for: -0.0920368762 == Approx( -0.0920368762 ) InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(1.067400) == Approx(-0.05980291115763361) for: -0.0598029112 == Approx( -0.0598029112 ) @@ -2294,6 +2216,14 @@ InternalBenchmark.tests.cpp:<line number>: passed: res.outliers.total() == 0 for Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: +Skip.tests.cpp:<line number>: failed: 3 == 4 +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: failed: explicitly +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: failed: explicitly +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: failed: explicitly loose text artifact Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value' Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value' @@ -2351,6 +2281,10 @@ Misc.tests.cpp:<line number>: passed: a < b for: 1 < 2 Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2 Misc.tests.cpp:<line number>: passed: b != a for: 2 != 1 Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2 +a! +b1! +Skip.tests.cpp:<line number>: skipped: +! Tricky.tests.cpp:<line number>: passed: s == "7" for: "7" == "7" Tricky.tests.cpp:<line number>: passed: ti == typeid(int) for: {?} == {?} InternalBenchmark.tests.cpp:<line number>: passed: normal_cdf(0.000000) == Approx(0.50000000000000000) for: 0.5 == Approx( 0.5 ) @@ -2435,9 +2369,13 @@ InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 128 >= 64 InternalBenchmark.tests.cpp:<line number>: passed: Timing.elapsed >= time for: 128 ns >= 100 ns InternalBenchmark.tests.cpp:<line number>: passed: Timing.result == Timing.iterations + 17 for: 145 == 145 InternalBenchmark.tests.cpp:<line number>: passed: Timing.iterations >= time.count() for: 128 >= 100 +Skip.tests.cpp:<line number>: passed: +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: failed: false with 1 message: '3' Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7' Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +Skip.tests.cpp:<line number>: skipped: 'skipping because answer = 43' StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { } StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc } StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def } @@ -2503,6 +2441,7 @@ Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_ Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6 Tag.tests.cpp:<line number>: passed: testcase.tags.size() == 1 for: 1 == 1 Tag.tests.cpp:<line number>: passed: testcase.tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag +Skip.tests.cpp:<line number>: skipped: Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'Why would you throw a std::string?' Misc.tests.cpp:<line number>: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load"" Misc.tests.cpp:<line number>: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load"" @@ -2599,5 +2538,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: -Failed 83 test cases, failed 143 assertions. +test cases: 409 | 308 passed | 84 failed | 6 skipped | 11 failed as expected +assertions: 2225 | 2048 passed | 145 failed | 32 failed as expected + diff --git a/packages/Catch2/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index a3500a352d5d15e9548f7c92be723e5b00ffd66b..6c48ab917fb8b1d1aba40105e3d4c58c8bb14cd7 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -1,4 +1,4 @@ -Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Filters: "*" ~[!nonportable] ~[!benchmark] ~[approvals] RNG seed: 1 Misc.tests.cpp:<line number>: passed: with 1 message: 'yay' Compilation.tests.cpp:<line number>: passed: y.v == 0 for: 0 == 0 @@ -20,13 +20,13 @@ This info message starts with a linebreak' with 1 message: ' This warning message starts with a linebreak' Tricky.tests.cpp:<line number>: failed: explicitly with 1 message: '1514' Compilation.tests.cpp:<line number>: passed: std::is_same<TypeList<int>, TypeList<int>>::value for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec . char")) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec , char")) for: true -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec {a} char)")) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec [a] char)")) for: true -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec \ char)")) for: true +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec . char")) for: true +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec , char")) for: true +TestSpec.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec {a} char)")) for: true +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec [a] char)")) for: true +TestSpec.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) for: !false +TestSpec.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec \ char)")) for: true Generators.tests.cpp:<line number>: passed: counter < 7 for: 3 < 7 Generators.tests.cpp:<line number>: passed: counter < 7 for: 6 < 7 Generators.tests.cpp:<line number>: passed: i != j for: 1 != 3 @@ -82,6 +82,7 @@ Matchers.tests.cpp:<line number>: passed: smallest_non_zero, WithinULP( -smalles Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) Matchers.tests.cpp:<line number>: passed: smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) Matchers.tests.cpp:<line number>: passed: smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) +Generators.tests.cpp:<line number>: failed: unexpected exception with message: 'failure to init' Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42' @@ -517,8 +518,8 @@ ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: V ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}" +Skip.tests.cpp:<line number>: skipped: 'This generator is empty' Stream.tests.cpp:<line number>: passed: Catch::makeStream( "" )->isConsole() for: true -Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring" Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) EnumToString.tests.cpp:<line number>: passed: stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1" @@ -570,6 +571,10 @@ Matchers.tests.cpp:<line number>: failed: throwsSpecialException( 3 ), SpecialEx Matchers.tests.cpp:<line number>: failed: throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number>: passed: throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number>: passed: throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } for: SpecialException::what special exception has value of 2 +Matchers.tests.cpp:<line number>: passed: throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) for: DerivedException::what matches "starts with: "Derived"" +Matchers.tests.cpp:<line number>: passed: throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) for: DerivedException::what matches "ends with: "::what"" +Matchers.tests.cpp:<line number>: passed: throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) for: DerivedException::what matches "not starts with: "::what"" +Matchers.tests.cpp:<line number>: passed: throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) for: SpecialException::what matches "starts with: "Special"" Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" Exception.tests.cpp:<line number>: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive) Exception.tests.cpp:<line number>: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected" @@ -592,6 +597,7 @@ Misc.tests.cpp:<line number>: passed: Factorial(1) == 1 for: 1 == 1 Misc.tests.cpp:<line number>: passed: Factorial(2) == 2 for: 2 == 2 Misc.tests.cpp:<line number>: passed: Factorial(3) == 6 for: 6 == 6 Misc.tests.cpp:<line number>: passed: Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) +GeneratorsImpl.tests.cpp:<line number>: passed: filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException Matchers.tests.cpp:<line number>: passed: 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 10., !WithinRel( 11.2, 0.1 ) for: 10.0 not and 11.2 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 1., !WithinRel( 0., 0.99 ) for: 1.0 not and 0 are within 99% of each other @@ -621,6 +627,7 @@ Matchers.tests.cpp:<line number>: passed: WithinULP( 1., 0 ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 0. ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1., -0.2 ), std::domain_error Matchers.tests.cpp:<line number>: passed: WithinRel( 1., 1. ), std::domain_error +Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel( 11.2f, 0.1f ) for: 10.0f not and 11.2 are within 10% of each other Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel( 0.f, 0.99f ) for: 1.0f not and 0 are within 99% of each other @@ -653,6 +660,7 @@ Matchers.tests.cpp:<line number>: passed: WithinULP( 1.f, static_cast<uint64_t>( Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, 0.f ) Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, -0.2f ), std::domain_error Matchers.tests.cpp:<line number>: passed: WithinRel( 1.f, 1.f ), std::domain_error +Matchers.tests.cpp:<line number>: passed: 1., !IsNaN() for: 1.0 not is NaN Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 @@ -1117,170 +1125,30 @@ Matchers.tests.cpp:<line number>: passed: ( EvilMatcher(), EvilMatcher() ), Evil Matchers.tests.cpp:<line number>: passed: &EvilMatcher(), EvilAddressOfOperatorUsed Matchers.tests.cpp:<line number>: passed: EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) Matchers.tests.cpp:<line number>: passed: ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a" ).matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "a*" ).matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a*" ).matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcA ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcB ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcC ) == false for: false == false -CmdLine.tests.cpp:<line number>: passed: spec.matches( *tcD ) == true for: true == true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark" ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark" ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) for: true -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false -CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true +Parse.tests.cpp:<line number>: passed: parseUInt( "0" ) == Optional<unsigned int>{ 0 } for: {?} == {?} +Parse.tests.cpp:<line number>: passed: parseUInt( "100" ) == Optional<unsigned int>{ 100 } for: {?} == {?} +Parse.tests.cpp:<line number>: passed: parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } for: {?} == {?} +Parse.tests.cpp:<line number>: passed: parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } for: {?} == {?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "!!KJHF*#" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "-1" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "4294967296" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "42949672964294967296429496729642949672964294967296" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "2 4" )) for: !{?} +Parse.tests.cpp:<line number>: passed: !(parseUInt( "0x<hex digits>", 10 )) for: !{?} TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true TestSpecParser.tests.cpp:<line number>: passed: spec.getInvalidSpecs().empty() for: true TestSpecParser.tests.cpp:<line number>: passed: spec.matches( testCase ) for: true CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-count=8" }) for: {?} CmdLine.tests.cpp:<line number>: passed: config.shardCount == 8 for: 8 == 8 CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} -CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) for: "Could not parse '-1' as shard count" contains: "Could not parse '-1' as shard count" CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} -CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) for: "Shard count must be positive" contains: "Shard count must be positive" CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=2" }) for: {?} CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 2 for: 2 == 2 CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} -CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) for: "Could not parse '-12' as shard index" contains: "Could not parse '-12' as shard index" CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=0" }) for: {?} CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 0 for: 0 == 0 TestSpecParser.tests.cpp:<line number>: passed: spec.hasFilters() for: true with 1 message: 'tagString := "[tag with spaces]"' @@ -1988,6 +1856,23 @@ There is no extra whitespace here StringManip.tests.cpp:<line number>: passed: trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, RangeEquals( c_array ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, UnorderedRangeEquals( c_array ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_3, !RangeEquals( array_int_4 ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_3, !UnorderedRangeEquals( array_int_4 ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, RangeEquals( vector_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, UnorderedRangeEquals( vector_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: with 1 message: 'ContainerIsRandomAccess( array_int_a ) != ContainerIsRandomAccess( list_char_a )' +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, RangeEquals( list_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_int_a, UnorderedRangeEquals( list_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: vector_int_a, RangeEquals( vector_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: vector_int_a, UnorderedRangeEquals( vector_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: vector_int_a, !RangeEquals( vector_char_b ) for: { 1, 2, 3 } not elements are { 1, 2, 2 } +MatchersRanges.tests.cpp:<line number>: passed: vector_int_a, !UnorderedRangeEquals( vector_char_b ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 2 } +MatchersRanges.tests.cpp:<line number>: passed: a, !RangeEquals( b ) for: { 1, 2, 3 } not elements are { 3, 2, 1 } +MatchersRanges.tests.cpp:<line number>: passed: a, UnorderedRangeEquals( b ) for: { 1, 2, 3 } unordered elements are { 3, 2, 1 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, RangeEquals( array_a_plus_1, close_enough ) for: { 1, 2, 3 } elements are { 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) for: { 1, 2, 3 } unordered elements are { 2, 3, 4 } Exception.tests.cpp:<line number>: failed: unexpected exception with message: '3.14' UniquePtr.tests.cpp:<line number>: passed: bptr->i == 3 for: 3 == 3 UniquePtr.tests.cpp:<line number>: passed: bptr->i == 3 for: 3 == 3 @@ -2093,6 +1978,38 @@ MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[1] for: true MatchersRanges.tests.cpp:<line number>: passed: mocked.m_derefed[2] for: true MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[3]) for: !false MatchersRanges.tests.cpp:<line number>: passed: !(mocked.m_derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: empty_vector, RangeEquals( empty_vector ) for: { } elements are { } +MatchersRanges.tests.cpp:<line number>: passed: empty_vector, !RangeEquals( non_empty_vector ) for: { } not elements are { 1 } +MatchersRanges.tests.cpp:<line number>: passed: non_empty_vector, !RangeEquals( empty_vector ) for: { 1 } not elements are { } +MatchersRanges.tests.cpp:<line number>: passed: non_empty_array, RangeEquals( non_empty_array ) for: { 1 } elements are { 1 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, RangeEquals( array_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, !RangeEquals( array_b ) for: { 1, 2, 3 } not elements are { 2, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, !RangeEquals( array_c ) for: { 1, 2, 3 } not elements are { 1, 2, 2 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, !RangeEquals( vector_b ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, RangeEquals( vector_a_plus_1, close_enough ) for: { 1, 2, 3 } elements are { 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, !RangeEquals( vector_b, close_enough ) for: { 1, 2, 3 } not elements are { 3, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: needs_adl1, RangeEquals( needs_adl2 ) for: { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } +MatchersRanges.tests.cpp:<line number>: passed: needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) for: { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } +MatchersRanges.tests.cpp:<line number>: passed: mocked1, !RangeEquals( arr ) for: { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked1.m_derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: mocked1, RangeEquals( arr ) for: { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked1.m_derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: empty_vector, UnorderedRangeEquals( empty_vector ) for: { } unordered elements are { } +MatchersRanges.tests.cpp:<line number>: passed: empty_vector, !UnorderedRangeEquals( non_empty_vector ) for: { } not unordered elements are { 1 } +MatchersRanges.tests.cpp:<line number>: passed: non_empty_vector, !UnorderedRangeEquals( empty_vector ) for: { 1 } not unordered elements are { } +MatchersRanges.tests.cpp:<line number>: passed: non_empty_array, UnorderedRangeEquals( non_empty_array ) for: { 1 } unordered elements are { 1 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, UnorderedRangeEquals( array_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: array_a, !UnorderedRangeEquals( array_b ) for: { 1, 2, 3 } not unordered elements are { 2, 2, 3 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, !UnorderedRangeEquals( vector_b ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) for: { 1, 10, 20 } unordered elements are { 11, 21, 2 } +MatchersRanges.tests.cpp:<line number>: passed: vector_a, !UnorderedRangeEquals( vector_b, close_enough ) for: { 1, 10, 21 } not unordered elements are { 11, 21, 3 } +MatchersRanges.tests.cpp:<line number>: passed: needs_adl1, UnorderedRangeEquals( needs_adl2 ) for: { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } MatchersRanges.tests.cpp:<line number>: passed: empty_vec, SizeIs(0) for: { } has size == 0 MatchersRanges.tests.cpp:<line number>: passed: empty_vec, !SizeIs(2) for: { } not has size == 2 MatchersRanges.tests.cpp:<line number>: passed: empty_vec, SizeIs(Lt(2)) for: { } size matches is less than 2 @@ -2189,6 +2106,8 @@ Xml.tests.cpp:<line number>: passed: encode( "[\x7F]" ) == "[\\x7F]" for: "[\x7F Xml.tests.cpp:<line number>: passed: stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) +Skip.tests.cpp:<line number>: passed: +Skip.tests.cpp:<line number>: skipped: InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.point.count() == 23 for: 23.0 == 23 InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.lower_bound.count() == 23 for: 23.0 == 23 InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.upper_bound.count() == 23 for: 23.0 == 23 @@ -2278,6 +2197,9 @@ FloatingPoint.tests.cpp:<line number>: passed: convertToBits( -0. ) == ( 1ULL << 9223372036854775808 (0x<hex digits>) FloatingPoint.tests.cpp:<line number>: passed: convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 for: 1 == 1 FloatingPoint.tests.cpp:<line number>: passed: convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 for: 1 == 1 +Skip.tests.cpp:<line number>: skipped: 'skipping because answer = 41' +Skip.tests.cpp:<line number>: passed: +Skip.tests.cpp:<line number>: skipped: 'skipping because answer = 43' Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(1.103560) == Approx(-0.09203687623843015) for: -0.0920368762 == Approx( -0.0920368762 ) InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(1.067400) == Approx(-0.05980291115763361) for: -0.0598029112 == Approx( -0.0598029112 ) @@ -2287,6 +2209,14 @@ InternalBenchmark.tests.cpp:<line number>: passed: res.outliers.total() == 0 for Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: +Skip.tests.cpp:<line number>: failed: 3 == 4 +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: failed: explicitly +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: failed: explicitly +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: failed: explicitly Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value' Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary2)>::value' Clara.tests.cpp:<line number>: passed: with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary3)>::value' @@ -2343,6 +2273,7 @@ Misc.tests.cpp:<line number>: passed: a < b for: 1 < 2 Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2 Misc.tests.cpp:<line number>: passed: b != a for: 2 != 1 Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2 +Skip.tests.cpp:<line number>: skipped: Tricky.tests.cpp:<line number>: passed: s == "7" for: "7" == "7" Tricky.tests.cpp:<line number>: passed: ti == typeid(int) for: {?} == {?} InternalBenchmark.tests.cpp:<line number>: passed: normal_cdf(0.000000) == Approx(0.50000000000000000) for: 0.5 == Approx( 0.5 ) @@ -2427,9 +2358,13 @@ InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 128 >= 64 InternalBenchmark.tests.cpp:<line number>: passed: Timing.elapsed >= time for: 128 ns >= 100 ns InternalBenchmark.tests.cpp:<line number>: passed: Timing.result == Timing.iterations + 17 for: 145 == 145 InternalBenchmark.tests.cpp:<line number>: passed: Timing.iterations >= time.count() for: 128 >= 100 +Skip.tests.cpp:<line number>: passed: +Skip.tests.cpp:<line number>: skipped: +Skip.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: failed: false with 1 message: '3' Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7' Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +Skip.tests.cpp:<line number>: skipped: 'skipping because answer = 43' StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { } StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc } StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def } @@ -2495,6 +2430,7 @@ Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_ Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6 Tag.tests.cpp:<line number>: passed: testcase.tags.size() == 1 for: 1 == 1 Tag.tests.cpp:<line number>: passed: testcase.tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag +Skip.tests.cpp:<line number>: skipped: Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'Why would you throw a std::string?' Misc.tests.cpp:<line number>: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load"" Misc.tests.cpp:<line number>: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load"" @@ -2591,5 +2527,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: -Failed 83 test cases, failed 143 assertions. +test cases: 409 | 308 passed | 84 failed | 6 skipped | 11 failed as expected +assertions: 2225 | 2048 passed | 145 failed | 32 failed as expected + diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt index 6962e50826101c2e9d072f04c20170c8ea9b1a9f..0945f0dfb8c4f4dda4ba9b5dbb46eadc43cdb671 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt @@ -1,4 +1,4 @@ -Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Filters: "*" ~[!nonportable] ~[!benchmark] ~[approvals] Randomness seeded to: 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -27,6 +27,16 @@ Tricky.tests.cpp:<line number>: FAILED: explicitly with message: 1514 +------------------------------------------------------------------------------- +#2615 - Throwing in constructor generator fails test case but does not abort +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + failure to init + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions outside assertions @@ -373,6 +383,16 @@ Exception.tests.cpp:<line number>: FAILED: due to unexpected exception with message: custom std exception +------------------------------------------------------------------------------- +Empty generators can SKIP in constructor +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + This generator is empty + ------------------------------------------------------------------------------- EndsWith string matcher ------------------------------------------------------------------------------- @@ -1164,6 +1184,14 @@ Exception.tests.cpp:<line number>: FAILED: due to unexpected exception with message: unexpected exception +------------------------------------------------------------------------------- +a succeeding test can still be skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + ------------------------------------------------------------------------------- checkedElse, failing ------------------------------------------------------------------------------- @@ -1186,6 +1214,87 @@ Misc.tests.cpp:<line number>: FAILED: with expansion: false +------------------------------------------------------------------------------- +dynamic skipping works with generators +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 41 + +------------------------------------------------------------------------------- +dynamic skipping works with generators +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 43 + +------------------------------------------------------------------------------- +failed assertions before SKIP cause test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + CHECK( 3 == 4 ) + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing in some unskipped sections causes entire test case to fail + skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing in some unskipped sections causes entire test case to fail + not skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + loose text artifact ------------------------------------------------------------------------------- just failure @@ -1304,6 +1413,19 @@ Misc.tests.cpp:<line number>: FAILED: with expansion: 1 == 2 +a! +b1! +------------------------------------------------------------------------------- +nested sections can be skipped dynamically at runtime + B + B2 +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +! ------------------------------------------------------------------------------- not prints unscoped info from previous failures ------------------------------------------------------------------------------- @@ -1338,6 +1460,15 @@ Message.tests.cpp:<line number>: FAILED: with message: this SHOULD be seen only ONCE +------------------------------------------------------------------------------- +sections can be skipped dynamically at runtime + skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + ------------------------------------------------------------------------------- send a single char to INFO ------------------------------------------------------------------------------- @@ -1361,6 +1492,16 @@ with messages: hi i := 7 +------------------------------------------------------------------------------- +skipped tests can optionally provide a reason +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 43 + ------------------------------------------------------------------------------- stacks unscoped info in loops ------------------------------------------------------------------------------- @@ -1383,6 +1524,14 @@ with messages: 5 6 +------------------------------------------------------------------------------- +tests can be skipped dynamically at runtime +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + ------------------------------------------------------------------------------- thrown std::strings are translated ------------------------------------------------------------------------------- @@ -1394,6 +1543,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 394 | 318 passed | 69 failed | 7 failed as expected -assertions: 2284 | 2129 passed | 128 failed | 27 failed as expected +test cases: 409 | 322 passed | 69 failed | 7 skipped | 11 failed as expected +assertions: 2208 | 2048 passed | 128 failed | 32 failed as expected diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt index 63dd231e89388f1ff7507f579243d648913cf245..150980e82ff902f791fec3ee357653d1a67b6c07 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt @@ -1,4 +1,4 @@ -Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Filters: "*" ~[!nonportable] ~[!benchmark] ~[approvals] Randomness seeded to: 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -166,20 +166,20 @@ with expansion: ------------------------------------------------------------------------------- #1905 -- test spec parser properly clears internal state between compound tests ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase("spec . char")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase("spec , char")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( spec.matches(*fakeTestCase(R"(spec \, char)")) ) with expansion: !false @@ -188,20 +188,20 @@ with expansion: #1912 -- test spec parser handles escaping Various parentheses ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec {a} char)")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec [a] char)")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( spec.matches(*fakeTestCase("differs but has similar tag", "[a]")) ) with expansion: !false @@ -210,10 +210,10 @@ with expansion: #1912 -- test spec parser handles escaping backslash in test name ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec \ char)")) ) with expansion: true @@ -761,6 +761,16 @@ with expansion: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0. 00000000e+00]) +------------------------------------------------------------------------------- +#2615 - Throwing in constructor generator fails test case but does not abort +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + failure to init + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions outside assertions @@ -3946,6 +3956,16 @@ with expansion: == "{** unexpected enum value **}" +------------------------------------------------------------------------------- +Empty generators can SKIP in constructor +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + This generator is empty + ------------------------------------------------------------------------------- Empty stream name opens cout stream ------------------------------------------------------------------------------- @@ -3957,15 +3977,6 @@ Stream.tests.cpp:<line number>: PASSED: with expansion: true -------------------------------------------------------------------------------- -Empty tag is not allowed -------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> -............................................................................... - -Tag.tests.cpp:<line number>: PASSED: - REQUIRE_THROWS( Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) ) - ------------------------------------------------------------------------------- EndsWith string matcher ------------------------------------------------------------------------------- @@ -4282,6 +4293,32 @@ Matchers.tests.cpp:<line number>: PASSED: with expansion: SpecialException::what special exception has value of 2 +------------------------------------------------------------------------------- +Exception message can be matched +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) ) +with expansion: + DerivedException::what matches "starts with: "Derived"" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) ) +with expansion: + DerivedException::what matches "ends with: "::what"" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) ) +with expansion: + DerivedException::what matches "not starts with: "::what"" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) ) +with expansion: + SpecialException::what matches "starts with: "Special"" + ------------------------------------------------------------------------------- Exception messages can be tested for exact match @@ -4441,6 +4478,15 @@ Misc.tests.cpp:<line number>: PASSED: with expansion: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) +------------------------------------------------------------------------------- +Filter generator throws exception for empty generator +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException ) + ------------------------------------------------------------------------------- Floating point matchers: double Relative @@ -4626,6 +4672,18 @@ Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error ) +------------------------------------------------------------------------------- +Floating point matchers: double + IsNaN +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !IsNaN() ) +with expansion: + 1.0 not is NaN + ------------------------------------------------------------------------------- Floating point matchers: float Relative @@ -4819,6 +4877,18 @@ Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error ) +------------------------------------------------------------------------------- +Floating point matchers: float + IsNaN +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !IsNaN() ) +with expansion: + 1.0 not is NaN + ------------------------------------------------------------------------------- Generators -- adapters Filtering by predicate @@ -8056,2170 +8126,1238 @@ Matchers.tests.cpp:<line number>: PASSED: REQUIRE_NOTHROW( ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() ) ------------------------------------------------------------------------------- -Parse test names and tags - Empty test spec should have no filters +Parse uints + proper inputs ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Parse.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE( parseUInt( "0" ) == Optional<unsigned int>{ 0 } ) with expansion: - false == false + {?} == {?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE( parseUInt( "100" ) == Optional<unsigned int>{ 100 } ) with expansion: - false == false + {?} == {?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE( parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } ) with expansion: - false == false + {?} == {?} + +Parse.tests.cpp:<line number>: PASSED: + REQUIRE( parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } ) +with expansion: + {?} == {?} ------------------------------------------------------------------------------- -Parse test names and tags - Test spec from empty string should have no filters +Parse uints + Bad inputs ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Parse.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "" ) ) with expansion: - false == false + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "!!KJHF*#" ) ) with expansion: - false == false + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "-1" ) ) with expansion: - false == false + !{?} -------------------------------------------------------------------------------- -Parse test names and tags - Test spec from just a comma should have no filters -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "4294967296" ) ) +with expansion: + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "42949672964294967296429496729642949672964294967296" ) ) with expansion: - false == false + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "2 4" ) ) with expansion: - false == false + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "0x<hex digits>", 10 ) ) with expansion: - false == false + !{?} ------------------------------------------------------------------------------- -Parse test names and tags - Test spec from name should have one filter +Parsed tags are matched case insensitive ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpecParser.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) with expansion: - true == true + true -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) with expansion: - false == false + true -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) with expansion: - true == true + true ------------------------------------------------------------------------------- -Parse test names and tags - Test spec from quoted name should have one filter +Parsing sharding-related cli flags + shard-count ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( cli.parse({ "test", "--shard-count=8" }) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + REQUIRE( config.shardCount == 8 ) with expansion: - true == true + 8 == 8 ------------------------------------------------------------------------------- -Parse test names and tags - Test spec from name should have one filter +Parsing sharding-related cli flags + Negative shard count reports error ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK_FALSE( result ) with expansion: - true == true + !{?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) ) with expansion: - false == false + "Could not parse '-1' as shard count" contains: "Could not parse '-1' as + shard count" + +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + Zero shard count reports error +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK_FALSE( result ) with expansion: - true == true + !{?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) ) with expansion: - false == false + "Shard count must be positive" contains: "Shard count must be positive" ------------------------------------------------------------------------------- -Parse test names and tags - Wildcard at the start +Parsing sharding-related cli flags + shard-index ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( cli.parse({ "test", "--shard-index=2" }) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( config.shardIndex == 2 ) with expansion: - false == false + 2 == 2 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + Negative shard index reports error +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + CHECK_FALSE( result ) with expansion: - false == false + !{?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( parseTestSpec( "*a" ).matches( *tcA ) == true ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) ) with expansion: - true == true + "Could not parse '-12' as shard index" contains: "Could not parse '-12' as + shard index" ------------------------------------------------------------------------------- -Parse test names and tags - Wildcard at the end +Parsing sharding-related cli flags + Shard index 0 is accepted ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cli.parse({ "test", "--shard-index=0" }) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.shardIndex == 0 ) with expansion: - false == false + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Parsing tags with non-alphabetical characters is pass-through +------------------------------------------------------------------------------- +TestSpecParser.tests.cpp:<line number> +............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) with expansion: - true == true + true +with message: + tagString := "[tag with spaces]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) with expansion: - false == false + true +with message: + tagString := "[tag with spaces]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( parseTestSpec( "a*" ).matches( *tcA ) == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) with expansion: - true == true + true +with message: + tagString := "[tag with spaces]" ------------------------------------------------------------------------------- -Parse test names and tags - Wildcard at both ends +Parsing tags with non-alphabetical characters is pass-through ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpecParser.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) with expansion: - true == true + true +with message: + tagString := "[I said "good day" sir!]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) with expansion: - false == false + true +with message: + tagString := "[I said "good day" sir!]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) with expansion: - false == false + true +with message: + tagString := "[I said "good day" sir!]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Parsing warnings + NoAssertions +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + REQUIRE( cli.parse( { "test", "-w", "NoAssertions" } ) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( parseTestSpec( "*a*" ).matches( *tcA ) == true ) + REQUIRE( config.warnings == WarnAbout::NoAssertions ) with expansion: - true == true + 1 == 1 ------------------------------------------------------------------------------- -Parse test names and tags - Redundant wildcard at the start +Parsing warnings + NoTests is no longer supported ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + REQUIRE_FALSE( cli.parse( { "test", "-w", "NoTests" } ) ) with expansion: - true == true + !{?} + +------------------------------------------------------------------------------- +Parsing warnings + Combining multiple warnings +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ) with expansion: - false == false + 3 == 3 ------------------------------------------------------------------------------- -Parse test names and tags - Redundant wildcard at the end +Pointers can be compared to null ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Condition.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( p == 0 ) with expansion: - true == true + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( p == pNULL ) with expansion: - true == true + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( p != 0 ) with expansion: - false == false + 0x<hex digits> != 0 -------------------------------------------------------------------------------- -Parse test names and tags - Redundant wildcard at both ends -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( cp != 0 ) +with expansion: + 0x<hex digits> != 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( cpc != 0 ) with expansion: - true == true + 0x<hex digits> != 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( returnsNull() == 0 ) with expansion: - true == true + {null string} == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( returnsConstNull() == 0 ) with expansion: - false == false + {null string} == 0 + +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( 0 != p ) +with expansion: + 0 != 0x<hex digits> ------------------------------------------------------------------------------- -Parse test names and tags - Wildcard at both ends, redundant at start +Precision of floating point stringification can be set + Floats ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +ToStringGeneral.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +ToStringGeneral.tests.cpp:<line number>: PASSED: + CHECK( str1.size() == 3 + 5 ) with expansion: - true == true + 8 == 8 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( str2.size() == 3 + 10 ) with expansion: - false == false + 13 == 13 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Precision of floating point stringification can be set + Double +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) +ToStringGeneral.tests.cpp:<line number>: PASSED: + CHECK( str1.size() == 2 + 5 ) with expansion: - true == true + 7 == 7 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( str2.size() == 2 + 15 ) with expansion: - true == true + 17 == 17 ------------------------------------------------------------------------------- -Parse test names and tags - Just wildcard +Predicate matcher can accept const char* ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Matchers.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( "foo", Predicate<const char*>( []( const char* const& ) { return true; } ) ) with expansion: - true == true + "foo" matches undescribed predicate -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Process can be configured on command line + empty args don't cause a crash +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK( result ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + CHECK( config.processName == "" ) with expansion: - true == true + "" == "" ------------------------------------------------------------------------------- -Parse test names and tags - Single tag +Process can be configured on command line + default - no arguments ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( result ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK( config.processName == "test" ) with expansion: - true == true + "test" == "test" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( config.shouldDebugBreak == false ) with expansion: false == false -------------------------------------------------------------------------------- -Parse test names and tags - Single tag, two matches -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( config.abortAfter == -1 ) with expansion: - true == true + -1 == -1 CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( config.noThrow == false ) with expansion: false == false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK( config.reporterSpecifications.empty() ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK_FALSE( cfg.hasTestFilters() ) with expansion: - true == true - -------------------------------------------------------------------------------- -Parse test names and tags - Two tags -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... + !false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cfg.getReporterSpecs().size() == 1 ) with expansion: - true == true + 1 == 1 CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } ) with expansion: - false == false + {?} == {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + CHECK( cfg.getProcessedReporterSpecs().size() == 1 ) with expansion: - false == false + 1 == 1 CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK( cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } ) with expansion: - true == true + {?} == {?} ------------------------------------------------------------------------------- -Parse test names and tags - Two tags, spare separated +Process can be configured on command line + test lists + Specify one test case using ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( cfg.hasTestFilters() ) with expansion: - false == false + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false ) with expansion: false == false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) ) with expansion: - true == true + true ------------------------------------------------------------------------------- -Parse test names and tags - Wildcarded name and tag +Process can be configured on command line + test lists + Specify one test case exclusion using exclude: ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( cfg.hasTestFilters() ) with expansion: - false == false + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false ) with expansion: false == false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) ) with expansion: - false == false + true ------------------------------------------------------------------------------- -Parse test names and tags - Single tag exclusion +Process can be configured on command line + test lists + Specify one test case exclusion using ~ ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( cfg.hasTestFilters() ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false ) with expansion: false == false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) ) with expansion: - false == false + true ------------------------------------------------------------------------------- -Parse test names and tags - One tag exclusion and one tag inclusion +Process can be configured on command line + reporter + -r/console ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } ) with expansion: - false == false + { {?} } == { {?} } +with message: + result.errorMessage() := "" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + -r/xml +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK( result ) with expansion: - true == true + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } ) with expansion: - false == false + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- -Parse test names and tags - One tag exclusion and one wldcarded name inclusion +Process can be configured on command line + reporter + --reporter/junit ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } ) with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) -with expansion: - true == true + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- -Parse test names and tags - One tag exclusion, using exclude:, and one wldcarded name inclusion +Process can be configured on command line + reporter + must match one of the available ones ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( !result ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Unrecognized reporter") ) with expansion: - false == false + "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" + contains: "Unrecognized reporter" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + With output file +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( result ) with expansion: - false == false + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } ) with expansion: - true == true + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- -Parse test names and tags - name exclusion +Process can be configured on command line + reporter + With Windows-like absolute path as output file ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } ) with expansion: - true == true + { {?} } == { {?} } +with message: + result.errorMessage() := "" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + All with output files +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } ) with expansion: - true == true + { {?}, {?} } == { {?}, {?} } ------------------------------------------------------------------------------- -Parse test names and tags - wildcarded name exclusion +Process can be configured on command line + reporter + Multiple reporters + Mixed output files and default output ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } ) with expansion: - true == true + { {?}, {?} } == { {?}, {?} } -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + cannot have multiple reporters with default output +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( !result ) with expansion: - false == false + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") ) with expansion: - false == false + "Only one reporter may have unspecified output file." contains: "Only one + reporter may have unspecified output file." ------------------------------------------------------------------------------- -Parse test names and tags - wildcarded name exclusion with tag inclusion +Process can be configured on command line + debugger + -b ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK( cli.parse({"test", "-b"}) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + REQUIRE( config.shouldDebugBreak == true ) with expansion: true == true -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) -with expansion: - false == false - ------------------------------------------------------------------------------- -Parse test names and tags - wildcarded name exclusion, using exclude:, with tag inclusion +Process can be configured on command line + debugger + --break ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cli.parse({"test", "--break"}) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( config.shouldDebugBreak ) with expansion: - true == true + true -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Process can be configured on command line + abort + -a aborts after first failure +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK( cli.parse({"test", "-a"}) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE( config.abortAfter == 1 ) with expansion: - false == false + 1 == 1 ------------------------------------------------------------------------------- -Parse test names and tags - two wildcarded names +Process can be configured on command line + abort + -x 2 aborts after two failures ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cli.parse({"test", "-x", "2"}) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.abortAfter == 2 ) with expansion: - false == false + 2 == 2 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + abort + -x must be numeric +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK( !result ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops") ) with expansion: - false == false + "Unable to convert 'oops' to destination type" ( contains: "convert" and + contains: "oops" ) ------------------------------------------------------------------------------- -Parse test names and tags - empty tag +Process can be configured on command line + abort + wait-for-keypress + Accepted options ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.waitForKeypress == std::get<1>(input) ) with expansion: - false == false + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE( config.waitForKeypress == std::get<1>(input) ) with expansion: - false == false + 1 == 1 ------------------------------------------------------------------------------- -Parse test names and tags - empty quoted name +Process can be configured on command line + abort + wait-for-keypress + Accepted options ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.waitForKeypress == std::get<1>(input) ) with expansion: - false == false + 2 == 2 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE( config.waitForKeypress == std::get<1>(input) ) with expansion: - false == false + 3 == 3 ------------------------------------------------------------------------------- -Parse test names and tags - quoted string followed by tag exclusion +Process can be configured on command line + abort + wait-for-keypress + invalid options are reported ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( !result ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both") ) with expansion: - false == false + "keypress argument must be one of: never, start, exit or both. 'sometimes' + not recognised" ( contains: "never" and contains: "both" ) -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + nothrow + -e +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( cli.parse({"test", "-e"}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + REQUIRE( config.noThrow ) with expansion: - true == true + true ------------------------------------------------------------------------------- -Parse test names and tags - Leading and trailing spaces in test spec +Process can be configured on command line + nothrow + --nothrow ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ) + CHECK( cli.parse({"test", "--nothrow"}) ) with expansion: - true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ) + REQUIRE( config.noThrow ) with expansion: true ------------------------------------------------------------------------------- -Parse test names and tags - Leading and trailing spaces in test name +Process can be configured on command line + output filename + -o filename ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ) + CHECK( cli.parse({"test", "-o", "filename.ext"}) ) with expansion: - true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ) + REQUIRE( config.defaultOutputFilename == "filename.ext" ) with expansion: - true + "filename.ext" == "filename.ext" ------------------------------------------------------------------------------- -Parse test names and tags - Shortened hide tags are split apart when parsing +Process can be configured on command line + output filename + --out ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) ) + CHECK( cli.parse({"test", "--out", "filename.ext"}) ) with expansion: - true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( spec.matches(*fakeTestCase("only foo", "[foo]")) ) + REQUIRE( config.defaultOutputFilename == "filename.ext" ) with expansion: - !false + "filename.ext" == "filename.ext" ------------------------------------------------------------------------------- -Parse test names and tags - Shortened hide tags also properly handle exclusion +Process can be configured on command line + combinations + Single character flags can be combined ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) ) + CHECK( cli.parse({"test", "-abe"}) ) with expansion: - !false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( spec.matches(*fakeTestCase("only foo", "[foo]")) ) + CHECK( config.abortAfter == 1 ) with expansion: - !false + 1 == 1 CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( spec.matches(*fakeTestCase("only hidden", "[.]")) ) + CHECK( config.shouldDebugBreak ) with expansion: - !false + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) ) + CHECK( config.noThrow == true ) with expansion: - true + true == true ------------------------------------------------------------------------------- -Parsed tags are matched case insensitive +Process can be configured on command line + use-colour + without option ------------------------------------------------------------------------------- -TestSpecParser.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.hasFilters() ) -with expansion: - true - -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.getInvalidSpecs().empty() ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test"}) ) with expansion: - true + {?} -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.matches( testCase ) ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) with expansion: - true + 0 == 0 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - shard-count +Process can be configured on command line + use-colour + auto ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--shard-count=8" }) ) + CHECK( cli.parse( { "test", "--colour-mode", "default" } ) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shardCount == 8 ) + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) with expansion: - 8 == 8 + 0 == 0 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - Negative shard count reports error +Process can be configured on command line + use-colour + yes ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( result ) + CHECK( cli.parse({"test", "--colour-mode", "ansi"}) ) with expansion: - !{?} + {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard count must be a positive number") ) + REQUIRE( config.defaultColourMode == ColourMode::ANSI ) with expansion: - "Shard count must be a positive number" contains: "Shard count must be a - positive number" + 1 == 1 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - Zero shard count reports error +Process can be configured on command line + use-colour + no ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( result ) + CHECK( cli.parse({"test", "--colour-mode", "none"}) ) with expansion: - !{?} + {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard count must be a positive number") ) + REQUIRE( config.defaultColourMode == ColourMode::None ) with expansion: - "Shard count must be a positive number" contains: "Shard count must be a - positive number" + 3 == 3 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - shard-index +Process can be configured on command line + use-colour + error ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--shard-index=2" }) ) + CHECK( !result ) with expansion: - {?} + true CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shardIndex == 2 ) + CHECK_THAT( result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) ) with expansion: - 2 == 2 + "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not + recognised" contains: "colour mode must be one of" ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - Negative shard index reports error +Process can be configured on command line + Benchmark options + samples ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( result ) + CHECK( cli.parse({ "test", "--benchmark-samples=200" }) ) with expansion: - !{?} + {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") ) + REQUIRE( config.benchmarkSamples == 200 ) with expansion: - "Shard index must be a non-negative number" contains: "Shard index must be a - non-negative number" + 200 == 200 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - Shard index 0 is accepted +Process can be configured on command line + Benchmark options + resamples ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--shard-index=0" }) ) + CHECK( cli.parse({ "test", "--benchmark-resamples=20000" }) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shardIndex == 0 ) + REQUIRE( config.benchmarkResamples == 20000 ) with expansion: - 0 == 0 + 20000 (0x<hex digits>) == 20000 (0x<hex digits>) ------------------------------------------------------------------------------- -Parsing tags with non-alphabetical characters is pass-through +Process can be configured on command line + Benchmark options + confidence-interval ------------------------------------------------------------------------------- -TestSpecParser.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.hasFilters() ) -with expansion: - true -with message: - tagString := "[tag with spaces]" - -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.getInvalidSpecs().empty() ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) ) with expansion: - true -with message: - tagString := "[tag with spaces]" + {?} -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.matches( testCase ) ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkConfidenceInterval == Catch::Approx(0.99) ) with expansion: - true -with message: - tagString := "[tag with spaces]" + 0.99 == Approx( 0.99 ) ------------------------------------------------------------------------------- -Parsing tags with non-alphabetical characters is pass-through +Process can be configured on command line + Benchmark options + no-analysis ------------------------------------------------------------------------------- -TestSpecParser.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.hasFilters() ) -with expansion: - true -with message: - tagString := "[I said "good day" sir!]" - -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.getInvalidSpecs().empty() ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-no-analysis" }) ) with expansion: - true -with message: - tagString := "[I said "good day" sir!]" + {?} -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.matches( testCase ) ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkNoAnalysis ) with expansion: true -with message: - tagString := "[I said "good day" sir!]" ------------------------------------------------------------------------------- -Parsing warnings - NoAssertions +Process can be configured on command line + Benchmark options + warmup-time ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cli.parse( { "test", "-w", "NoAssertions" } ) ) + CHECK( cli.parse({ "test", "--benchmark-warmup-time=10" }) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.warnings == WarnAbout::NoAssertions ) + REQUIRE( config.benchmarkWarmupTime == 10 ) with expansion: - 1 == 1 + 10 == 10 ------------------------------------------------------------------------------- -Parsing warnings - NoTests is no longer supported +Product with differing arities - std::tuple<int, double, float> ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( cli.parse( { "test", "-w", "NoTests" } ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) with expansion: - !{?} + 3 >= 1 ------------------------------------------------------------------------------- -Parsing warnings - Combining multiple warnings +Product with differing arities - std::tuple<int, double> ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) with expansion: - 3 == 3 + 2 >= 1 ------------------------------------------------------------------------------- -Pointers can be compared to null +Product with differing arities - std::tuple<int> ------------------------------------------------------------------------------- -Condition.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( p == 0 ) -with expansion: - 0 == 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( p == pNULL ) -with expansion: - 0 == 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( p != 0 ) -with expansion: - 0x<hex digits> != 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( cp != 0 ) -with expansion: - 0x<hex digits> != 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( cpc != 0 ) -with expansion: - 0x<hex digits> != 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( returnsNull() == 0 ) -with expansion: - {null string} == 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( returnsConstNull() == 0 ) -with expansion: - {null string} == 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( 0 != p ) -with expansion: - 0 != 0x<hex digits> - -------------------------------------------------------------------------------- -Precision of floating point stringification can be set - Floats -------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> -............................................................................... - -ToStringGeneral.tests.cpp:<line number>: PASSED: - CHECK( str1.size() == 3 + 5 ) -with expansion: - 8 == 8 - -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( str2.size() == 3 + 10 ) -with expansion: - 13 == 13 - -------------------------------------------------------------------------------- -Precision of floating point stringification can be set - Double -------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> -............................................................................... - -ToStringGeneral.tests.cpp:<line number>: PASSED: - CHECK( str1.size() == 2 + 5 ) -with expansion: - 7 == 7 - -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( str2.size() == 2 + 15 ) -with expansion: - 17 == 17 - -------------------------------------------------------------------------------- -Predicate matcher can accept const char* -------------------------------------------------------------------------------- -Matchers.tests.cpp:<line number> -............................................................................... - -Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( "foo", Predicate<const char*>( []( const char* const& ) { return true; } ) ) -with expansion: - "foo" matches undescribed predicate - -------------------------------------------------------------------------------- -Process can be configured on command line - empty args don't cause a crash -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.processName == "" ) -with expansion: - "" == "" - -------------------------------------------------------------------------------- -Process can be configured on command line - default - no arguments -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.processName == "test" ) -with expansion: - "test" == "test" - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.shouldDebugBreak == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.abortAfter == -1 ) -with expansion: - -1 == -1 - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.noThrow == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.reporterSpecifications.empty() ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( cfg.hasTestFilters() ) -with expansion: - !false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cfg.getReporterSpecs().size() == 1 ) -with expansion: - 1 == 1 - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } ) -with expansion: - {?} == {?} - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cfg.getProcessedReporterSpecs().size() == 1 ) -with expansion: - 1 == 1 - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } ) -with expansion: - {?} == {?} - -------------------------------------------------------------------------------- -Process can be configured on command line - test lists - Specify one test case using -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.hasTestFilters() ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - test lists - Specify one test case exclusion using exclude: -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.hasTestFilters() ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - test lists - Specify one test case exclusion using ~ -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.hasTestFilters() ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - -r/console -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - -r/xml -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - --reporter/junit -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - must match one of the available ones -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Unrecognized reporter") ) -with expansion: - "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" - contains: "Unrecognized reporter" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - With output file -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - With Windows-like absolute path as output file -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - Multiple reporters - All with output files -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } ) -with expansion: - { {?}, {?} } == { {?}, {?} } - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - Multiple reporters - Mixed output files and default output -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } ) -with expansion: - { {?}, {?} } == { {?}, {?} } - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - Multiple reporters - cannot have multiple reporters with default output -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") ) -with expansion: - "Only one reporter may have unspecified output file." contains: "Only one - reporter may have unspecified output file." - -------------------------------------------------------------------------------- -Process can be configured on command line - debugger - -b -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-b"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shouldDebugBreak == true ) -with expansion: - true == true - -------------------------------------------------------------------------------- -Process can be configured on command line - debugger - --break -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--break"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shouldDebugBreak ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - -a aborts after first failure -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-a"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.abortAfter == 1 ) -with expansion: - 1 == 1 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - -x 2 aborts after two failures -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-x", "2"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.abortAfter == 2 ) -with expansion: - 2 == 2 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - -x must be numeric -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops") ) -with expansion: - "Unable to convert 'oops' to destination type" ( contains: "convert" and - contains: "oops" ) - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - Accepted options -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.waitForKeypress == std::get<1>(input) ) -with expansion: - 0 == 0 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - Accepted options -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.waitForKeypress == std::get<1>(input) ) -with expansion: - 1 == 1 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - Accepted options -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.waitForKeypress == std::get<1>(input) ) -with expansion: - 2 == 2 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - Accepted options -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.waitForKeypress == std::get<1>(input) ) -with expansion: - 3 == 3 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - invalid options are reported -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both") ) -with expansion: - "keypress argument must be one of: never, start, exit or both. 'sometimes' - not recognised" ( contains: "never" and contains: "both" ) - -------------------------------------------------------------------------------- -Process can be configured on command line - nothrow - -e -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-e"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.noThrow ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - nothrow - --nothrow -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--nothrow"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.noThrow ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - output filename - -o filename -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-o", "filename.ext"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultOutputFilename == "filename.ext" ) -with expansion: - "filename.ext" == "filename.ext" - -------------------------------------------------------------------------------- -Process can be configured on command line - output filename - --out -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--out", "filename.ext"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultOutputFilename == "filename.ext" ) -with expansion: - "filename.ext" == "filename.ext" - -------------------------------------------------------------------------------- -Process can be configured on command line - combinations - Single character flags can be combined -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-abe"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.abortAfter == 1 ) -with expansion: - 1 == 1 - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.shouldDebugBreak ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.noThrow == true ) -with expansion: - true == true - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - without option -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) -with expansion: - 0 == 0 - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - auto -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse( { "test", "--colour-mode", "default" } ) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) -with expansion: - 0 == 0 - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - yes -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--colour-mode", "ansi"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultColourMode == ColourMode::ANSI ) -with expansion: - 1 == 1 - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - no -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--colour-mode", "none"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultColourMode == ColourMode::None ) -with expansion: - 3 == 3 - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - error -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK_THAT( result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) ) -with expansion: - "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not - recognised" contains: "colour mode must be one of" - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - samples -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-samples=200" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkSamples == 200 ) -with expansion: - 200 == 200 - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - resamples -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-resamples=20000" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkResamples == 20000 ) -with expansion: - 20000 (0x<hex digits>) == 20000 (0x<hex digits>) - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - confidence-interval -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkConfidenceInterval == Catch::Approx(0.99) ) -with expansion: - 0.99 == Approx( 0.99 ) - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - no-analysis -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-no-analysis" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkNoAnalysis ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - warmup-time -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-warmup-time=10" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkWarmupTime == 10 ) -with expansion: - 10 == 10 - -------------------------------------------------------------------------------- -Product with differing arities - std::tuple<int, double, float> -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... - -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( std::tuple_size<TestType>::value >= 1 ) -with expansion: - 3 >= 1 - -------------------------------------------------------------------------------- -Product with differing arities - std::tuple<int, double> -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... - -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( std::tuple_size<TestType>::value >= 1 ) -with expansion: - 2 >= 1 - -------------------------------------------------------------------------------- -Product with differing arities - std::tuple<int> -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... - -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( std::tuple_size<TestType>::value >= 1 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) with expansion: 1 >= 1 @@ -11250,893 +10388,1183 @@ Approx.tests.cpp:<line number> Approx.tests.cpp:<line number>: PASSED: REQUIRE( d == Approx( 1.23 ) ) with expansion: - 1.23 == Approx( 1.23 ) + 1.23 == Approx( 1.23 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != Approx( 1.22 ) ) +with expansion: + 1.23 != Approx( 1.22 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != Approx( 1.24 ) ) +with expansion: + 1.23 != Approx( 1.24 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d == 1.23_a ) +with expansion: + 1.23 == Approx( 1.23 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != 1.22_a ) +with expansion: + 1.23 != Approx( 1.22 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( Approx( d ) == 1.23 ) +with expansion: + Approx( 1.23 ) == 1.23 + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( Approx( d ) != 1.22 ) +with expansion: + Approx( 1.23 ) != 1.22 + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( Approx( d ) != 1.24 ) +with expansion: + Approx( 1.23 ) != 1.24 + +Message from section one +------------------------------------------------------------------------------- +Standard output from all sections is reported + one +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'one' + +Message from section two +------------------------------------------------------------------------------- +Standard output from all sections is reported + two +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'two' + +------------------------------------------------------------------------------- +StartsWith string matcher +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: FAILED: + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "This String" + +Matchers.tests.cpp:<line number>: FAILED: + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "string" (case + insensitive) + +------------------------------------------------------------------------------- +Static arrays are convertible to string + Single item +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::Detail::stringify(singular) == "{ 1 }" ) +with expansion: + "{ 1 }" == "{ 1 }" + +------------------------------------------------------------------------------- +Static arrays are convertible to string + Multiple +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" ) +with expansion: + "{ 3, 2, 1 }" == "{ 3, 2, 1 }" + +------------------------------------------------------------------------------- +Static arrays are convertible to string + Non-trivial inner items +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" ) +with expansion: + "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" + == + "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" + +------------------------------------------------------------------------------- +String matchers +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "string" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "string" (case + insensitive) + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "abc" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "abc" + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "abc" (case + insensitive) + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "this" + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "this" (case + insensitive) + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "substring" + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: " substring" (case + insensitive) + +------------------------------------------------------------------------------- +StringRef + Empty string +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( empty.empty() ) +with expansion: + true + +String.tests.cpp:<line number>: PASSED: + REQUIRE( empty.size() == 0 ) +with expansion: + 0 == 0 + +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp( empty.data(), "" ) == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +StringRef + From string literal +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.empty() == false ) +with expansion: + false == false + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.size() == 5 ) +with expansion: + 5 == 5 + +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp( rawChars, "hello" ) == 0 ) +with expansion: + 0 == 0 + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.data() == rawChars ) +with expansion: + "hello" == "hello" + +------------------------------------------------------------------------------- +StringRef + From sub-string +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original == "original" ) + +String.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( original.data() ) + +------------------------------------------------------------------------------- +StringRef + Copy construction is shallow +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original.begin() == copy.begin() ) +with expansion: + "original string" == "original string" -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( d != Approx( 1.22 ) ) -with expansion: - 1.23 != Approx( 1.22 ) +------------------------------------------------------------------------------- +StringRef + Copy assignment is shallow +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( d != Approx( 1.24 ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( original.begin() == copy.begin() ) with expansion: - 1.23 != Approx( 1.24 ) + "original string" == "original string" -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( d == 1.23_a ) -with expansion: - 1.23 == Approx( 1.23 ) +------------------------------------------------------------------------------- +StringRef + Substrings + zero-based substring +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( d != 1.22_a ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss.empty() == false ) with expansion: - 1.23 != Approx( 1.22 ) + false == false -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( Approx( d ) == 1.23 ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss.size() == 5 ) with expansion: - Approx( 1.23 ) == 1.23 + 5 == 5 -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( Approx( d ) != 1.22 ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strncmp( ss.data(), "hello", 5 ) == 0 ) with expansion: - Approx( 1.23 ) != 1.22 + 0 == 0 -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( Approx( d ) != 1.24 ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss == "hello" ) with expansion: - Approx( 1.23 ) != 1.24 + hello == "hello" -Message from section one ------------------------------------------------------------------------------- -Standard output from all sections is reported - one +StringRef + Substrings + non-zero-based substring ------------------------------------------------------------------------------- -Message.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss.size() == 6 ) +with expansion: + 6 == 6 -No assertions in section 'one' +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp( ss.data(), "world!" ) == 0 ) +with expansion: + 0 == 0 -Message from section two ------------------------------------------------------------------------------- -Standard output from all sections is reported - two +StringRef + Substrings + Pointer values of full refs should match ------------------------------------------------------------------------------- -Message.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... - -No assertions in section 'two' +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.data() == s2.data() ) +with expansion: + "hello world!" == "hello world!" ------------------------------------------------------------------------------- -StartsWith string matcher +StringRef + Substrings + Pointer values of substring refs should also match ------------------------------------------------------------------------------- -Matchers.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) -with expansion: - "this string contains 'abc' as a substring" starts with: "This String" - -Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.data() == ss.data() ) with expansion: - "this string contains 'abc' as a substring" starts with: "string" (case - insensitive) + "hello world!" == "hello world!" ------------------------------------------------------------------------------- -Static arrays are convertible to string - Single item +StringRef + Substrings + Past the end substring ------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( Catch::Detail::stringify(singular) == "{ 1 }" ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.substr(s.size() + 1, 123).empty() ) with expansion: - "{ 1 }" == "{ 1 }" + true ------------------------------------------------------------------------------- -Static arrays are convertible to string - Multiple +StringRef + Substrings + Substring off the end are trimmed ------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp(ss.data(), "world!") == 0 ) with expansion: - "{ 3, 2, 1 }" == "{ 3, 2, 1 }" + 0 == 0 ------------------------------------------------------------------------------- -Static arrays are convertible to string - Non-trivial inner items +StringRef + Substrings + substring start after the end is empty ------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.substr(1'000'000, 1).empty() ) with expansion: - "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" - == - "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" + true ------------------------------------------------------------------------------- -String matchers +StringRef + Comparisons are deep ------------------------------------------------------------------------------- -Matchers.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string" ) ) +String.tests.cpp:<line number>: PASSED: + CHECK( reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) ) with expansion: - "this string contains 'abc' as a substring" contains: "string" + "Hello" != "Hello" -Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( left == right ) with expansion: - "this string contains 'abc' as a substring" contains: "string" (case - insensitive) + Hello == Hello -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), ContainsSubstring( "abc" ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( left != left.substr(0, 3) ) with expansion: - "this string contains 'abc' as a substring" contains: "abc" + Hello != Hel -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) ) -with expansion: - "this string contains 'abc' as a substring" contains: "abc" (case - insensitive) +------------------------------------------------------------------------------- +StringRef + from std::string + implicitly constructed +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( sr == "a standard string" ) with expansion: - "this string contains 'abc' as a substring" starts with: "this" + a standard string == "a standard string" -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( sr.size() == stdStr.size() ) with expansion: - "this string contains 'abc' as a substring" starts with: "this" (case - insensitive) + 17 == 17 -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ) +------------------------------------------------------------------------------- +StringRef + from std::string + explicitly constructed +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( sr == "a standard string" ) with expansion: - "this string contains 'abc' as a substring" ends with: "substring" + a standard string == "a standard string" -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( sr.size() == stdStr.size() ) with expansion: - "this string contains 'abc' as a substring" ends with: " substring" (case - insensitive) + 17 == 17 ------------------------------------------------------------------------------- StringRef - Empty string + from std::string + assigned ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( empty.empty() ) -with expansion: - true - -String.tests.cpp:<line number>: PASSED: - REQUIRE( empty.size() == 0 ) + REQUIRE( sr == "a standard string" ) with expansion: - 0 == 0 + a standard string == "a standard string" String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp( empty.data(), "" ) == 0 ) + REQUIRE( sr.size() == stdStr.size() ) with expansion: - 0 == 0 + 17 == 17 ------------------------------------------------------------------------------- StringRef - From string literal + to std::string + explicitly constructed ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( s.empty() == false ) + REQUIRE( stdStr == "a stringref" ) with expansion: - false == false + "a stringref" == "a stringref" String.tests.cpp:<line number>: PASSED: - REQUIRE( s.size() == 5 ) + REQUIRE( stdStr.size() == sr.size() ) with expansion: - 5 == 5 + 11 == 11 + +------------------------------------------------------------------------------- +StringRef + to std::string + assigned +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp( rawChars, "hello" ) == 0 ) + REQUIRE( stdStr == "a stringref" ) with expansion: - 0 == 0 + "a stringref" == "a stringref" String.tests.cpp:<line number>: PASSED: - REQUIRE( s.data() == rawChars ) + REQUIRE( stdStr.size() == sr.size() ) with expansion: - "hello" == "hello" + 11 == 11 ------------------------------------------------------------------------------- StringRef - From sub-string + std::string += StringRef ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( original == "original" ) - -String.tests.cpp:<line number>: PASSED: - REQUIRE_NOTHROW( original.data() ) + REQUIRE( lhs == "some string += the stringref contents" ) +with expansion: + "some string += the stringref contents" + == + "some string += the stringref contents" ------------------------------------------------------------------------------- StringRef - Copy construction is shallow + StringRef + StringRef ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( original.begin() == copy.begin() ) + REQUIRE( together == "abrakadabra" ) with expansion: - "original string" == "original string" + "abrakadabra" == "abrakadabra" ------------------------------------------------------------------------------- -StringRef - Copy assignment is shallow +StringRef at compilation time + Simple constructors ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( original.begin() == copy.begin() ) -with expansion: - "original string" == "original string" +with message: + empty.size() == 0 + +String.tests.cpp:<line number>: PASSED: +with message: + empty.begin() == empty.end() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.size() == 3 + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.data() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.begin() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.begin() != stringref.end() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.substr(10, 0).empty() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.substr(2, 1).data() == abc + 2 + +String.tests.cpp:<line number>: PASSED: +with message: + stringref[1] == 'b' + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.size() == 2 + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.data() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.begin() != shortened.end() ------------------------------------------------------------------------------- -StringRef - Substrings - zero-based substring +StringRef at compilation time + UDL construction ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( ss.empty() == false ) -with expansion: - false == false +with message: + !(sr1.empty()) String.tests.cpp:<line number>: PASSED: - REQUIRE( ss.size() == 5 ) -with expansion: - 5 == 5 +with message: + sr1.size() == 3 String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strncmp( ss.data(), "hello", 5 ) == 0 ) -with expansion: - 0 == 0 +with message: + sr2.empty() String.tests.cpp:<line number>: PASSED: - REQUIRE( ss == "hello" ) +with message: + sr2.size() == 0 + +------------------------------------------------------------------------------- +Stringifying char arrays with statically known sizes - char +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) with expansion: - hello == "hello" + ""abc"" == ""abc"" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" ------------------------------------------------------------------------------- -StringRef - Substrings - non-zero-based substring +Stringifying char arrays with statically known sizes - signed char ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToString.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( ss.size() == 6 ) +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) with expansion: - 6 == 6 + ""abc"" == ""abc"" -String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp( ss.data(), "world!" ) == 0 ) +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) with expansion: - 0 == 0 + ""abc"" == ""abc"" ------------------------------------------------------------------------------- -StringRef - Substrings - Pointer values of full refs should match +Stringifying char arrays with statically known sizes - unsigned char ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToString.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.data() == s2.data() ) +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) with expansion: - "hello world!" == "hello world!" + ""abc"" == ""abc"" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" ------------------------------------------------------------------------------- -StringRef - Substrings - Pointer values of substring refs should also match +Stringifying std::chrono::duration helpers ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToStringChrono.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.data() == ss.data() ) +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( minute == seconds ) with expansion: - "hello world!" == "hello world!" + 1 m == 60 s + +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( hour != seconds ) +with expansion: + 1 h != 60 s + +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( micro != milli ) +with expansion: + 1 us != 1 ms + +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( nano != micro ) +with expansion: + 1 ns != 1 us ------------------------------------------------------------------------------- -StringRef - Substrings - Past the end substring +Stringifying std::chrono::duration with weird ratios ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToStringChrono.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.substr(s.size() + 1, 123).empty() ) +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( half_minute != femto_second ) with expansion: - true + 1 [30/1]s != 1 fs + +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( pico_second != atto_second ) +with expansion: + 1 ps != 1 as ------------------------------------------------------------------------------- -StringRef - Substrings - Substring off the end are trimmed +Stringifying std::chrono::time_point<system_clock> ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToStringChrono.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp(ss.data(), "world!") == 0 ) +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( now != later ) with expansion: - 0 == 0 + {iso8601-timestamp} + != + {iso8601-timestamp} ------------------------------------------------------------------------------- -StringRef - Substrings - substring start after the end is empty +Tabs and newlines show in output ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.substr(1'000'000, 1).empty() ) +Misc.tests.cpp:<line number>: FAILED: + CHECK( s1 == s2 ) with expansion: - true + "if ($b == 10) { + $a = 20; + }" + == + "if ($b == 10) { + $a = 20; + } + " ------------------------------------------------------------------------------- -StringRef - Comparisons are deep +Tag alias can be registered against tag patterns + The same tag alias can only be registered once ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Tag.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - CHECK( reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) ) +Tag.tests.cpp:<line number>: PASSED: + CHECK_THAT( what, ContainsSubstring( "[@zzz]" ) ) with expansion: - "Hello" != "Hello" + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "[@zzz]" -String.tests.cpp:<line number>: PASSED: - REQUIRE( left == right ) +Tag.tests.cpp:<line number>: PASSED: + CHECK_THAT( what, ContainsSubstring( "file" ) ) with expansion: - Hello == Hello + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "file" -String.tests.cpp:<line number>: PASSED: - REQUIRE( left != left.substr(0, 3) ) +Tag.tests.cpp:<line number>: PASSED: + CHECK_THAT( what, ContainsSubstring( "2" ) ) with expansion: - Hello != Hel + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "2" + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THAT( what, ContainsSubstring( "10" ) ) +with expansion: + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "10" ------------------------------------------------------------------------------- -StringRef - from std::string - implicitly constructed +Tag alias can be registered against tag patterns + Tag aliases must be of the form [@name] ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Tag.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr == "a standard string" ) -with expansion: - a standard string == "a standard string" +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) ) -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr.size() == stdStr.size() ) -with expansion: - 17 == 17 +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) ) ------------------------------------------------------------------------------- -StringRef - from std::string - explicitly constructed +Tags with spaces and non-alphanumerical characters are accepted ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Tag.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr == "a standard string" ) +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags.size() == 2 ) with expansion: - a standard string == "a standard string" + 2 == 2 -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr.size() == stdStr.size() ) +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) ) with expansion: - 17 == 17 + { {?}, {?} } ( Contains: {?} and Contains: {?} ) ------------------------------------------------------------------------------- -StringRef - from std::string - assigned +Template test case method with test types specified inside std::tuple - MyTypes +- 0 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Class.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr == "a standard string" ) -with expansion: - a standard string == "a standard string" - -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr.size() == stdStr.size() ) +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) with expansion: - 17 == 17 + 1 == 1 ------------------------------------------------------------------------------- -StringRef - to std::string - explicitly constructed +Template test case method with test types specified inside std::tuple - MyTypes +- 1 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Class.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( stdStr == "a stringref" ) -with expansion: - "a stringref" == "a stringref" - -String.tests.cpp:<line number>: PASSED: - REQUIRE( stdStr.size() == sr.size() ) +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) with expansion: - 11 == 11 + 1 == 1 ------------------------------------------------------------------------------- -StringRef - to std::string - assigned +Template test case method with test types specified inside std::tuple - MyTypes +- 2 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Class.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( stdStr == "a stringref" ) -with expansion: - "a stringref" == "a stringref" - -String.tests.cpp:<line number>: PASSED: - REQUIRE( stdStr.size() == sr.size() ) +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) with expansion: - 11 == 11 + 1.0 == 1 ------------------------------------------------------------------------------- -StringRef - std::string += StringRef +Template test case with test types specified inside non-copyable and non- +movable std::tuple - NonCopyableAndNonMovableTypes - 0 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( lhs == "some string += the stringref contents" ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - "some string += the stringref contents" - == - "some string += the stringref contents" + 1 > 0 ------------------------------------------------------------------------------- -StringRef - StringRef + StringRef +Template test case with test types specified inside non-copyable and non- +movable std::tuple - NonCopyableAndNonMovableTypes - 1 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( together == "abrakadabra" ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - "abrakadabra" == "abrakadabra" + 4 > 0 ------------------------------------------------------------------------------- -StringRef at compilation time - Simple constructors +Template test case with test types specified inside non-default-constructible +std::tuple - MyNonDefaultConstructibleTypes - 0 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: -with message: - empty.size() == 0 - -String.tests.cpp:<line number>: PASSED: -with message: - empty.begin() == empty.end() - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.size() == 3 - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.data() == abc - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.begin() == abc - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.begin() != stringref.end() - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.substr(10, 0).empty() - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.substr(2, 1).data() == abc + 2 - -String.tests.cpp:<line number>: PASSED: -with message: - stringref[1] == 'b' - -String.tests.cpp:<line number>: PASSED: -with message: - shortened.size() == 2 - -String.tests.cpp:<line number>: PASSED: -with message: - shortened.data() == abc - -String.tests.cpp:<line number>: PASSED: -with message: - shortened.begin() != shortened.end() +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 1 > 0 ------------------------------------------------------------------------------- -StringRef at compilation time - UDL construction +Template test case with test types specified inside non-default-constructible +std::tuple - MyNonDefaultConstructibleTypes - 1 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: -with message: - !(sr1.empty()) - -String.tests.cpp:<line number>: PASSED: -with message: - sr1.size() == 3 - -String.tests.cpp:<line number>: PASSED: -with message: - sr2.empty() - -String.tests.cpp:<line number>: PASSED: -with message: - sr2.size() == 0 +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 4 > 0 ------------------------------------------------------------------------------- -Stringifying char arrays with statically known sizes - char +Template test case with test types specified inside std::tuple - MyTypes - 0 ------------------------------------------------------------------------------- -ToString.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) -with expansion: - ""abc"" == ""abc"" - -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - ""abc"" == ""abc"" + 4 > 0 ------------------------------------------------------------------------------- -Stringifying char arrays with statically known sizes - signed char +Template test case with test types specified inside std::tuple - MyTypes - 1 ------------------------------------------------------------------------------- -ToString.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) -with expansion: - ""abc"" == ""abc"" - -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - ""abc"" == ""abc"" + 1 > 0 ------------------------------------------------------------------------------- -Stringifying char arrays with statically known sizes - unsigned char +Template test case with test types specified inside std::tuple - MyTypes - 2 ------------------------------------------------------------------------------- -ToString.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) -with expansion: - ""abc"" == ""abc"" - -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - ""abc"" == ""abc"" + 4 > 0 ------------------------------------------------------------------------------- -Stringifying std::chrono::duration helpers +TemplateTest: vectors can be sized and resized - float ------------------------------------------------------------------------------- -ToStringChrono.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( minute == seconds ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 1 m == 60 s + 5 == 5 -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( hour != seconds ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) with expansion: - 1 h != 60 s + 5 >= 5 -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( micro != milli ) +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float + resizing bigger changes size and capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 10 ) with expansion: - 1 us != 1 ms + 10 == 10 -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( nano != micro ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 10 ) with expansion: - 1 ns != 1 us + 10 >= 10 ------------------------------------------------------------------------------- -Stringifying std::chrono::duration with weird ratios +TemplateTest: vectors can be sized and resized - float ------------------------------------------------------------------------------- -ToStringChrono.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( half_minute != femto_second ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 1 [30/1]s != 1 fs + 5 == 5 -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( pico_second != atto_second ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) with expansion: - 1 ps != 1 as + 5 >= 5 ------------------------------------------------------------------------------- -Stringifying std::chrono::time_point<system_clock> +TemplateTest: vectors can be sized and resized - float + resizing smaller changes size but not capacity ------------------------------------------------------------------------------- -ToStringChrono.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( now != later ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 0 ) with expansion: - {iso8601-timestamp} - != - {iso8601-timestamp} + 0 == 0 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Tabs and newlines show in output +TemplateTest: vectors can be sized and resized - float + resizing smaller changes size but not capacity + We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: FAILED: - CHECK( s1 == s2 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() == 0 ) with expansion: - "if ($b == 10) { - $a = 20; - }" - == - "if ($b == 10) { - $a = 20; - } - " + 0 == 0 ------------------------------------------------------------------------------- -Tag alias can be registered against tag patterns - The same tag alias can only be registered once +TemplateTest: vectors can be sized and resized - float ------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, ContainsSubstring( "[@zzz]" ) ) -with expansion: - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "[@zzz]" - -Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, ContainsSubstring( "file" ) ) -with expansion: - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "file" - -Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, ContainsSubstring( "2" ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "2" + 5 == 5 -Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, ContainsSubstring( "10" ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) with expansion: - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "10" + 5 >= 5 ------------------------------------------------------------------------------- -Tag alias can be registered against tag patterns - Tag aliases must be of the form [@name] +TemplateTest: vectors can be sized and resized - float + reserving bigger changes capacity but not size ------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Tag.tests.cpp:<line number>: PASSED: - CHECK_THROWS( registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) ) - -Tag.tests.cpp:<line number>: PASSED: - CHECK_THROWS( registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) - -Tag.tests.cpp:<line number>: PASSED: - CHECK_THROWS( registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 -Tag.tests.cpp:<line number>: PASSED: - CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 ------------------------------------------------------------------------------- -Tags with spaces and non-alphanumerical characters are accepted +TemplateTest: vectors can be sized and resized - float ------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Tag.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.tags.size() == 2 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 2 == 2 + 5 == 5 -Tag.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) with expansion: - { {?}, {?} } ( Contains: {?} and Contains: {?} ) + 5 >= 5 ------------------------------------------------------------------------------- -Template test case method with test types specified inside std::tuple - MyTypes -- 0 +TemplateTest: vectors can be sized and resized - float + reserving smaller does not change size or capacity ------------------------------------------------------------------------------- -Class.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Class.tests.cpp:<line number>: PASSED: - REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 1 == 1 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case method with test types specified inside std::tuple - MyTypes -- 1 +TemplateTest: vectors can be sized and resized - int ------------------------------------------------------------------------------- -Class.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Class.tests.cpp:<line number>: PASSED: - REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 1 == 1 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case method with test types specified inside std::tuple - MyTypes -- 2 +TemplateTest: vectors can be sized and resized - int + resizing bigger changes size and capacity ------------------------------------------------------------------------------- -Class.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Class.tests.cpp:<line number>: PASSED: - REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 10 ) with expansion: - 1.0 == 1 + 10 == 10 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 ------------------------------------------------------------------------------- -Template test case with test types specified inside non-copyable and non- -movable std::tuple - NonCopyableAndNonMovableTypes - 0 +TemplateTest: vectors can be sized and resized - int ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 1 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case with test types specified inside non-copyable and non- -movable std::tuple - NonCopyableAndNonMovableTypes - 1 +TemplateTest: vectors can be sized and resized - int + resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 0 ) with expansion: - 4 > 0 + 0 == 0 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case with test types specified inside non-default-constructible -std::tuple - MyNonDefaultConstructibleTypes - 0 +TemplateTest: vectors can be sized and resized - int + resizing smaller changes size but not capacity + We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.capacity() == 0 ) with expansion: - 1 > 0 + 0 == 0 ------------------------------------------------------------------------------- -Template test case with test types specified inside non-default-constructible -std::tuple - MyNonDefaultConstructibleTypes - 1 +TemplateTest: vectors can be sized and resized - int ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 4 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case with test types specified inside std::tuple - MyTypes - 0 +TemplateTest: vectors can be sized and resized - int + reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 4 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 ------------------------------------------------------------------------------- -Template test case with test types specified inside std::tuple - MyTypes - 1 +TemplateTest: vectors can be sized and resized - int ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 1 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case with test types specified inside std::tuple - MyTypes - 2 +TemplateTest: vectors can be sized and resized - int + reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 4 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12152,7 +11580,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12169,7 +11597,7 @@ with expansion: 10 >= 10 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12185,7 +11613,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12202,7 +11630,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12215,7 +11643,7 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12231,7 +11659,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12248,7 +11676,7 @@ with expansion: 10 >= 10 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12264,7 +11692,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12281,7 +11709,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12297,7 +11725,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12314,7 +11742,7 @@ with expansion: 10 >= 10 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12330,7 +11758,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12347,7 +11775,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12360,7 +11788,7 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12376,7 +11804,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12393,7 +11821,7 @@ with expansion: 10 >= 10 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12409,7 +11837,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12426,56 +11854,56 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 10 ) + REQUIRE( v.size() == 2 * V ) with expansion: - 10 == 10 + 12 == 12 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 10 ) + REQUIRE( v.capacity() >= 2 * V ) with expansion: - 10 >= 10 + 12 >= 12 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12487,12 +11915,12 @@ with expansion: 0 == 0 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12505,122 +11933,122 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 10 ) + REQUIRE( v.capacity() >= 2 * V ) with expansion: - 10 >= 10 + 12 >= 12 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 10 ) + REQUIRE( v.size() == 2 * V ) with expansion: - 10 == 10 + 8 == 8 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 10 ) + REQUIRE( v.capacity() >= 2 * V ) with expansion: - 10 >= 10 + 8 >= 8 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12632,12 +12060,12 @@ with expansion: 0 == 0 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12650,73 +12078,73 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 10 ) + REQUIRE( v.capacity() >= 2 * V ) with expansion: - 10 >= 10 + 8 >= 8 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12724,15 +12152,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12741,15 +12169,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == 2 * V ) with expansion: - 12 == 12 + 10 == 10 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= 2 * V ) with expansion: - 12 >= 12 + 10 >= 10 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12757,15 +12185,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12779,10 +12207,10 @@ with expansion: Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12795,7 +12223,7 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12803,15 +12231,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12820,15 +12248,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= 2 * V ) with expansion: - 12 >= 12 + 10 >= 10 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12836,15 +12264,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12853,15 +12281,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12869,15 +12297,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12886,15 +12314,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == 2 * V ) with expansion: - 8 == 8 + 30 == 30 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= 2 * V ) with expansion: - 8 >= 8 + 30 >= 30 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12902,15 +12330,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12924,10 +12352,10 @@ with expansion: Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12940,7 +12368,7 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12948,15 +12376,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12965,15 +12393,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= 2 * V ) with expansion: - 8 >= 8 + 30 >= 30 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12981,15 +12409,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12998,527 +12426,604 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 +Test case with identical tags keeps just one ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +Tag.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags.size() == 1 ) with expansion: - 5 == 5 + 1 == 1 -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags[0] == Tag( "tag1" ) ) with expansion: - 5 >= 5 + {?} == {?} ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - resizing bigger changes size and capacity +Test case with one argument ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +VariadicMacros.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 2 * V ) -with expansion: - 10 == 10 +VariadicMacros.tests.cpp:<line number>: PASSED: +with message: + no assertions -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 2 * V ) +------------------------------------------------------------------------------- +Test enum bit values +------------------------------------------------------------------------------- +Tricky.tests.cpp:<line number> +............................................................................... + +Tricky.tests.cpp:<line number>: PASSED: + REQUIRE( 0x<hex digits> == bit30and31 ) with expansion: - 10 >= 10 + 3221225472 (0x<hex digits>) == 3221225472 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 +Test with special, characters "in name +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +Testing checked-if ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) -with expansion: - 5 == 5 + CHECKED_IF( true ) + +Misc.tests.cpp:<line number>: PASSED: + +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_IF( false ) + +Misc.tests.cpp:<line number>: PASSED: + CHECKED_ELSE( true ) + +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_ELSE( false ) Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) -with expansion: - 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - resizing smaller changes size but not capacity +Testing checked-if 2 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 0 ) -with expansion: - 0 == 0 + CHECKED_IF( true ) -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) -with expansion: - 5 >= 5 +Misc.tests.cpp:<line number>: FAILED: ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - resizing smaller changes size but not capacity - We can use the 'swap trick' to reset the capacity +Testing checked-if 3 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() == 0 ) -with expansion: - 0 == 0 +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_ELSE( false ) + +Misc.tests.cpp:<line number>: FAILED: ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 +The NO_FAIL macro reports a failure but does not fail the test ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +Message.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) -with expansion: - 5 == 5 +Message.tests.cpp:<line number>: FAILED - but was ok: + CHECK_NOFAIL( 1 == 2 ) -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) -with expansion: - 5 >= 5 + +No assertions in test case 'The NO_FAIL macro reports a failure but does not fail the test' ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - reserving bigger changes capacity but not size +The default listing implementation write to provided stream + Listing tags ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +Reporters.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring("[fakeTag]"s) ) with expansion: - 5 == 5 + "All available tags: + 1 [fakeTag] + 1 tag -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 2 * V ) +" contains: "[fakeTag]" + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) ) with expansion: - 10 >= 10 + "Available reporters: + fake reporter: fake description + +" ( contains: "fake reporter" and contains: "fake description" ) ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 +The default listing implementation write to provided stream + Listing tests ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +Reporters.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: - 5 == 5 + "All available test cases: + fake test name + [fakeTestTag] + 1 test case -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +" ( contains: "fake test name" and contains: "fakeTestTag" ) + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing listeners +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) ) with expansion: - 5 >= 5 + "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - reserving smaller does not change size or capacity +This test 'should' fail but doesn't ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) -with expansion: - 5 == 5 +with message: + oops! -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) -with expansion: - 5 >= 5 +------------------------------------------------------------------------------- +Thrown string literals are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + For some reason someone is throwing a string literal! ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 +Tracker ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) with expansion: - 15 >= 15 + true ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - resizing bigger changes size and capacity +Tracker + successfully close one section ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 2 * V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isSuccessfullyCompleted() ) with expansion: - 30 == 30 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 2 * V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) with expansion: - 30 >= 30 - -------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... + false == false -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() ) with expansion: - 15 >= 15 + true ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - resizing smaller changes size but not capacity +Tracker ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 0 ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) with expansion: - 0 == 0 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) with expansion: - 15 >= 15 + true ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - resizing smaller changes size but not capacity - We can use the 'swap trick' to reset the capacity +Tracker + fail one section ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() == 0 ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isComplete() ) with expansion: - 0 == 0 - -------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isSuccessfullyCompleted() == false ) with expansion: - 15 == 15 + false == false -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) with expansion: - 15 >= 15 - -------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - reserving bigger changes capacity but not size -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... + false == false -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 2 * V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() == false ) with expansion: - 30 >= 30 + false == false ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 +Tracker + fail one section + re-enter after failed section ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isOpen() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1b.isOpen() == false ) with expansion: - 15 >= 15 + false == false -------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - reserving smaller does not change size or capacity -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) +with expansion: + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() ) with expansion: - 15 >= 15 + true ------------------------------------------------------------------------------- -Test case with identical tags keeps just one +Tracker ------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Tag.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.tags.size() == 1 ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) with expansion: - 1 == 1 + true -Tag.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.tags[0] == Tag( "tag1" ) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) with expansion: - {?} == {?} + true ------------------------------------------------------------------------------- -Test case with one argument +Tracker + fail one section ------------------------------------------------------------------------------- -VariadicMacros.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -VariadicMacros.tests.cpp:<line number>: PASSED: -with message: - no assertions +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isComplete() ) +with expansion: + true -------------------------------------------------------------------------------- -Test enum bit values -------------------------------------------------------------------------------- -Tricky.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isSuccessfullyCompleted() == false ) +with expansion: + false == false -Tricky.tests.cpp:<line number>: PASSED: - REQUIRE( 0x<hex digits> == bit30and31 ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) with expansion: - 3221225472 (0x<hex digits>) == 3221225472 + false == false -------------------------------------------------------------------------------- -Test with special, characters "in name -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) +with expansion: + true -CmdLine.tests.cpp:<line number>: PASSED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() == false ) +with expansion: + false == false ------------------------------------------------------------------------------- -Testing checked-if +Tracker + fail one section + re-enter after failed section and find next section ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - CHECKED_IF( true ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isOpen() ) +with expansion: + true -Misc.tests.cpp:<line number>: PASSED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1b.isOpen() == false ) +with expansion: + false == false -Misc.tests.cpp:<line number>: FAILED - but was ok: - CHECKED_IF( false ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2.isOpen() ) +with expansion: + true -Misc.tests.cpp:<line number>: PASSED: - CHECKED_ELSE( true ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) +with expansion: + true -Misc.tests.cpp:<line number>: FAILED - but was ok: - CHECKED_ELSE( false ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() ) +with expansion: + true -Misc.tests.cpp:<line number>: PASSED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() ) +with expansion: + true ------------------------------------------------------------------------------- -Testing checked-if 2 +Tracker ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - CHECKED_IF( true ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) +with expansion: + true -Misc.tests.cpp:<line number>: FAILED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) +with expansion: + true ------------------------------------------------------------------------------- -Testing checked-if 3 +Tracker + successfully close one section, then find another ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: FAILED - but was ok: - CHECKED_ELSE( false ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2.isOpen() == false ) +with expansion: + false == false -Misc.tests.cpp:<line number>: FAILED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) +with expansion: + false == false ------------------------------------------------------------------------------- -The NO_FAIL macro reports a failure but does not fail the test +Tracker + successfully close one section, then find another + Re-enter - skips S1 and enters S2 ------------------------------------------------------------------------------- -Message.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Message.tests.cpp:<line number>: FAILED - but was ok: - CHECK_NOFAIL( 1 == 2 ) - - -No assertions in test case 'The NO_FAIL macro reports a failure but does not fail the test' +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isOpen() ) +with expansion: + true -------------------------------------------------------------------------------- -The default listing implementation write to provided stream - Listing tags -------------------------------------------------------------------------------- -Reporters.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1b.isOpen() == false ) +with expansion: + false == false -Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, ContainsSubstring("[fakeTag]"s) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2b.isOpen() ) with expansion: - "All available tags: - 1 [fakeTag] - 1 tag + true -" contains: "[fakeTag]" +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() == false ) +with expansion: + false == false ------------------------------------------------------------------------------- -The default listing implementation write to provided stream - Listing reporters +Tracker + successfully close one section, then find another + Re-enter - skips S1 and enters S2 + Successfully close S2 ------------------------------------------------------------------------------- -Reporters.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) with expansion: - "Available reporters: - fake reporter: fake description - -" ( contains: "fake reporter" and contains: "fake description" ) + true -------------------------------------------------------------------------------- -The default listing implementation write to provided stream - Listing tests -------------------------------------------------------------------------------- -Reporters.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2b.isSuccessfullyCompleted() ) +with expansion: + true -Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isComplete() == false ) with expansion: - "All available test cases: - fake test name - [fakeTestTag] - 1 test case + false == false -" ( contains: "fake test name" and contains: "fakeTestTag" ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isSuccessfullyCompleted() ) +with expansion: + true ------------------------------------------------------------------------------- -The default listing implementation write to provided stream - Listing listeners +Tracker ------------------------------------------------------------------------------- -Reporters.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) with expansion: - "Registered listeners: - fakeListener: fake description + true -" ( contains: "fakeListener" and contains: "fake description" ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) +with expansion: + true ------------------------------------------------------------------------------- -This test 'should' fail but doesn't +Tracker + successfully close one section, then find another ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: -with message: - oops! - -------------------------------------------------------------------------------- -Thrown string literals are translated -------------------------------------------------------------------------------- -Exception.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2.isOpen() == false ) +with expansion: + false == false -Exception.tests.cpp:<line number>: FAILED: -due to unexpected exception with message: - For some reason someone is throwing a string literal! +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) +with expansion: + false == false ------------------------------------------------------------------------------- Tracker + successfully close one section, then find another + Re-enter - skips S1 and enters S2 ------------------------------------------------------------------------------- PartTracker.tests.cpp:<line number> ............................................................................... PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) + REQUIRE( testCase2.isOpen() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) + REQUIRE( s1b.isOpen() == false ) +with expansion: + false == false + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2b.isOpen() ) with expansion: true +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() == false ) +with expansion: + false == false + ------------------------------------------------------------------------------- Tracker - successfully close one section + successfully close one section, then find another + Re-enter - skips S1 and enters S2 + fail S2 ------------------------------------------------------------------------------- PartTracker.tests.cpp:<line number> ............................................................................... PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isSuccessfullyCompleted() ) + REQUIRE( ctx.completedCycle() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) + REQUIRE( s2b.isComplete() ) +with expansion: + true + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2b.isSuccessfullyCompleted() == false ) with expansion: false == false PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) + REQUIRE( testCase2.isSuccessfullyCompleted() == false ) +with expansion: + false == false + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase3.isOpen() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() ) + REQUIRE( s1c.isOpen() == false ) +with expansion: + false == false + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2c.isOpen() == false ) +with expansion: + false == false + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase3.isSuccessfullyCompleted() ) with expansion: true @@ -13540,538 +13045,594 @@ with expansion: ------------------------------------------------------------------------------- Tracker - fail one section + open a nested section ------------------------------------------------------------------------------- PartTracker.tests.cpp:<line number> ............................................................................... PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isComplete() ) + REQUIRE( s2.isOpen() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isSuccessfullyCompleted() == false ) + REQUIRE( s2.isComplete() ) with expansion: - false == false + true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) + REQUIRE( s1.isComplete() == false ) with expansion: false == false PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) + REQUIRE( s1.isComplete() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() == false ) + REQUIRE( testCase.isComplete() == false ) with expansion: false == false +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() ) +with expansion: + true + ------------------------------------------------------------------------------- -Tracker - fail one section - re-enter after failed section +Trim strings ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +StringManip.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isOpen() ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(no_whitespace)) == no_whitespace ) with expansion: - true + "There is no extra whitespace here" + == + "There is no extra whitespace here" -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1b.isOpen() == false ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(leading_whitespace)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(trailing_whitespace)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(whitespace_at_both_ends)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(no_whitespace)) == StringRef(no_whitespace) ) with expansion: - false == false + There is no extra whitespace here + == + There is no extra whitespace here -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) ) with expansion: - true + There is no extra whitespace here + == + There is no extra whitespace here -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) ) with expansion: - true + There is no extra whitespace here + == + There is no extra whitespace here -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) ) with expansion: - true + There is no extra whitespace here + == + There is no extra whitespace here ------------------------------------------------------------------------------- -Tracker +Type conversions of RangeEquals and similar + Container conversions + Two equal containers of different container types ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, RangeEquals( c_array ) ) with expansion: - true + { 1, 2, 3 } elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, UnorderedRangeEquals( c_array ) ) with expansion: - true + { 1, 2, 3 } unordered elements are { 1, 2, 3 } ------------------------------------------------------------------------------- -Tracker - fail one section +Type conversions of RangeEquals and similar + Container conversions + Two equal containers of different container types (differ in array N) ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isComplete() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_3, !RangeEquals( array_int_4 ) ) with expansion: - true + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isSuccessfullyCompleted() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_3, !UnorderedRangeEquals( array_int_4 ) ) with expansion: - false == false + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Type conversions of RangeEquals and similar + Container conversions + Two equal containers of different container types and value types +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, RangeEquals( vector_char_a ) ) with expansion: - true + { 1, 2, 3 } elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, UnorderedRangeEquals( vector_char_a ) ) with expansion: - false == false + { 1, 2, 3 } unordered elements are { 1, 2, 3 } ------------------------------------------------------------------------------- -Tracker - fail one section - re-enter after failed section and find next section +Type conversions of RangeEquals and similar + Container conversions + Two equal containers, one random access, one not ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isOpen() ) -with expansion: - true +MatchersRanges.tests.cpp:<line number>: PASSED: +with message: + ContainerIsRandomAccess( array_int_a ) != ContainerIsRandomAccess( + list_char_a ) -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1b.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, RangeEquals( list_char_a ) ) with expansion: - false == false + { 1, 2, 3 } elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, UnorderedRangeEquals( list_char_a ) ) with expansion: - true + { 1, 2, 3 } unordered elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) -with expansion: - true +------------------------------------------------------------------------------- +Type conversions of RangeEquals and similar + Value type + Two equal containers of different value types +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_int_a, RangeEquals( vector_char_a ) ) with expansion: - true + { 1, 2, 3 } elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_int_a, UnorderedRangeEquals( vector_char_a ) ) with expansion: - true + { 1, 2, 3 } unordered elements are { 1, 2, 3 } ------------------------------------------------------------------------------- -Tracker +Type conversions of RangeEquals and similar + Value type + Two non-equal containers of different value types ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_int_a, !RangeEquals( vector_char_b ) ) with expansion: - true + { 1, 2, 3 } not elements are { 1, 2, 2 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_int_a, !UnorderedRangeEquals( vector_char_b ) ) with expansion: - true + { 1, 2, 3 } not unordered elements are { 1, 2, 2 } ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another +Type conversions of RangeEquals and similar + Ranges with begin that needs ADL ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( a, !RangeEquals( b ) ) with expansion: - false == false + { 1, 2, 3 } not elements are { 3, 2, 1 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( a, UnorderedRangeEquals( b ) ) with expansion: - false == false + { 1, 2, 3 } unordered elements are { 3, 2, 1 } ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another - Re-enter - skips S1 and enters S2 +Type conversions of RangeEquals and similar + Custom predicate + Two equal non-empty containers (close enough) ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_a, RangeEquals( array_a_plus_1, close_enough ) ) with expansion: - true + { 1, 2, 3 } elements are { 2, 3, 4 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1b.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) ) with expansion: - false == false + { 1, 2, 3 } unordered elements are { 2, 3, 4 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isOpen() ) -with expansion: - true +------------------------------------------------------------------------------- +Unexpected exceptions can be translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() == false ) -with expansion: - false == false +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + 3.14 ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another - Re-enter - skips S1 and enters S2 - Successfully close S2 +Upcasting special member functions + Move constructor ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +UniquePtr.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) -with expansion: - true - -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isSuccessfullyCompleted() ) +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( bptr->i == 3 ) with expansion: - true + 3 == 3 -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isComplete() == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Upcasting special member functions + move assignment +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isSuccessfullyCompleted() ) +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( bptr->i == 3 ) with expansion: - true + 3 == 3 ------------------------------------------------------------------------------- -Tracker +Usage of AllMatch range matcher + Basic usage ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllMatch(SizeIs(5)) ) with expansion: - true + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } all match has size == 5 -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllMatch(Contains(0) && Contains(1)) ) with expansion: - true + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains + element 1 ) ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another +Usage of AllMatch range matcher + Type requires ADL found begin and end ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isOpen() == false ) -with expansion: - false == false - -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) ) with expansion: - false == false + { 1, 2, 3, 4, 5 } all match matches undescribed predicate ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another - Re-enter - skips S1 and enters S2 +Usage of AllMatch range matcher + Shortcircuiting + All are read ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, allMatch ) +with expansion: + { 1, 2, 3, 4, 5 } all match matches undescribed predicate + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) with expansion: true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1b.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) with expansion: - false == false + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) with expansion: true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[4] ) with expansion: - false == false + true ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another - Re-enter - skips S1 and enters S2 - fail S2 +Usage of AllMatch range matcher + Shortcircuiting + Short-circuited ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !allMatch ) with expansion: - true + { 1, 2, 3, 4, 5 } not all match matches undescribed predicate -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isComplete() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) with expansion: true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isSuccessfullyCompleted() == false ) -with expansion: - false == false - -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isSuccessfullyCompleted() == false ) -with expansion: - false == false - -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase3.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) with expansion: true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1c.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) with expansion: - false == false + true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2c.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) with expansion: - false == false + !false -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase3.isSuccessfullyCompleted() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) with expansion: - true + !false ------------------------------------------------------------------------------- -Tracker +Usage of AllTrue range matcher + Basic usage + All true evaluates to true ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) with expansion: - true + { true, true, true, true, true } contains only true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + Empty evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) with expansion: - true + { } contains only true ------------------------------------------------------------------------------- -Tracker - open a nested section +Usage of AllTrue range matcher + Basic usage + One false evaluates to false ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) with expansion: - true + { true, true, false, true, true } not contains only true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isComplete() ) -with expansion: - true +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + All false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isComplete() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) with expansion: - false == false + { false, false, false, false, false } not contains only true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isComplete() ) -with expansion: - true +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) with expansion: - false == false + { true, true, true, true, true } contains only true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() ) +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + One false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) with expansion: - true + { true, true, false, true, true } not contains only true ------------------------------------------------------------------------------- -Trim strings +Usage of AllTrue range matcher + Contained type is convertible to bool + All false evaluates to false ------------------------------------------------------------------------------- -StringManip.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(std::string(no_whitespace)) == no_whitespace ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) with expansion: - "There is no extra whitespace here" - == - "There is no extra whitespace here" + { false, false, false, false, false } not contains only true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(std::string(leading_whitespace)) == no_whitespace ) -with expansion: - "There is no extra whitespace here" - == - "There is no extra whitespace here" +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(std::string(trailing_whitespace)) == no_whitespace ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, AllTrue() ) with expansion: - "There is no extra whitespace here" - == - "There is no extra whitespace here" + { true, true, true, true, true } contains only true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(std::string(whitespace_at_both_ends)) == no_whitespace ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) with expansion: - "There is no extra whitespace here" - == - "There is no extra whitespace here" + true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(StringRef(no_whitespace)) == StringRef(no_whitespace) ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) with expansion: - There is no extra whitespace here - == - There is no extra whitespace here + true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) with expansion: - There is no extra whitespace here - == - There is no extra whitespace here + true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) with expansion: - There is no extra whitespace here - == - There is no extra whitespace here + true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[4] ) with expansion: - There is no extra whitespace here - == - There is no extra whitespace here + true ------------------------------------------------------------------------------- -Unexpected exceptions can be translated +Usage of AllTrue range matcher + Shortcircuiting + Short-circuited ------------------------------------------------------------------------------- -Exception.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -Exception.tests.cpp:<line number>: FAILED: -due to unexpected exception with message: - 3.14 +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !AllTrue() ) +with expansion: + { true, true, false, true, true } not contains only true -------------------------------------------------------------------------------- -Upcasting special member functions - Move constructor -------------------------------------------------------------------------------- -UniquePtr.tests.cpp:<line number> -............................................................................... +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true -UniquePtr.tests.cpp:<line number>: PASSED: - REQUIRE( bptr->i == 3 ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) with expansion: - 3 == 3 + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true -------------------------------------------------------------------------------- -Upcasting special member functions - move assignment -------------------------------------------------------------------------------- -UniquePtr.tests.cpp:<line number> -............................................................................... +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false -UniquePtr.tests.cpp:<line number>: PASSED: - REQUIRE( bptr->i == 3 ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) with expansion: - 3 == 3 + !false ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyMatch range matcher Basic usage ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllMatch(SizeIs(5)) ) + REQUIRE_THAT( data, AnyMatch(SizeIs(5)) ) with expansion: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } all match has size == 5 + }, { 1, 0, 0, -1, 5 } } any match has size == 5 MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllMatch(Contains(0) && Contains(1)) ) + REQUIRE_THAT( data, !AnyMatch(Contains(0) && Contains(10)) ) with expansion: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains - element 1 ) + }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains + element 10 ) ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyMatch range matcher Type requires ADL found begin and end ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) ) + REQUIRE_THAT( needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) ) with expansion: - { 1, 2, 3, 4, 5 } all match matches undescribed predicate + { 1, 2, 3, 4, 5 } any match matches undescribed predicate ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyMatch range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -14079,9 +13640,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, allMatch ) + REQUIRE_THAT( mocked, !anyMatch ) with expansion: - { 1, 2, 3, 4, 5 } all match matches undescribed predicate + { 1, 2, 3, 4, 5 } not any match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14109,7 +13670,7 @@ with expansion: true ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyMatch range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -14117,9 +13678,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !allMatch ) + REQUIRE_THAT( mocked, anyMatch ) with expansion: - { 1, 2, 3, 4, 5 } not all match matches undescribed predicate + { 1, 2, 3, 4, 5 } any match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14127,14 +13688,14 @@ with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[1] ) + REQUIRE_FALSE( mocked.m_derefed[1] ) with expansion: - true + !false MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[2] ) + REQUIRE_FALSE( mocked.m_derefed[2] ) with expansion: - true + !false MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( mocked.m_derefed[3] ) @@ -14147,7 +13708,7 @@ with expansion: !false ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Basic usage All true evaluates to true ------------------------------------------------------------------------------- @@ -14155,38 +13716,38 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllTrue() ) + REQUIRE_THAT( data, AnyTrue() ) with expansion: - { true, true, true, true, true } contains only true + { true, true, true, true, true } contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Basic usage - Empty evaluates to true + Empty evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllTrue() ) + REQUIRE_THAT( data, !AnyTrue() ) with expansion: - { } contains only true + { } not contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Basic usage - One false evalutes to false + One true evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllTrue() ) + REQUIRE_THAT( data, AnyTrue() ) with expansion: - { true, true, false, true, true } not contains only true + { false, false, true, false, false } contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Basic usage All false evaluates to false ------------------------------------------------------------------------------- @@ -14194,12 +13755,12 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllTrue() ) + REQUIRE_THAT( data, !AnyTrue() ) with expansion: - { false, false, false, false, false } not contains only true + { false, false, false, false, false } not contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Contained type is convertible to bool All true evaluates to true ------------------------------------------------------------------------------- @@ -14207,25 +13768,25 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllTrue() ) + REQUIRE_THAT( data, AnyTrue() ) with expansion: - { true, true, true, true, true } contains only true + { true, true, true, true, true } contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Contained type is convertible to bool - One false evalutes to false + One true evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllTrue() ) + REQUIRE_THAT( data, AnyTrue() ) with expansion: - { true, true, false, true, true } not contains only true + { false, false, true, false, false } contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Contained type is convertible to bool All false evaluates to false ------------------------------------------------------------------------------- @@ -14233,12 +13794,12 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllTrue() ) + REQUIRE_THAT( data, !AnyTrue() ) with expansion: - { false, false, false, false, false } not contains only true + { false, false, false, false, false } not contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -14246,9 +13807,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, AllTrue() ) + REQUIRE_THAT( mocked, AnyTrue() ) with expansion: - { true, true, true, true, true } contains only true + { false, false, false, false, true } contains at least one true MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14276,7 +13837,7 @@ with expansion: true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -14284,9 +13845,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !AllTrue() ) + REQUIRE_THAT( mocked, AnyTrue() ) with expansion: - { true, true, false, true, true } not contains only true + { false, false, true, true, true } contains at least one true MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14314,39 +13875,39 @@ with expansion: !false ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Basic usage ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyMatch(SizeIs(5)) ) + REQUIRE_THAT( data, NoneMatch(SizeIs(6)) ) with expansion: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } any match has size == 5 + }, { 1, 0, 0, -1, 5 } } none match has size == 6 MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyMatch(Contains(0) && Contains(10)) ) + REQUIRE_THAT( data, !NoneMatch(Contains(0) && Contains(1)) ) with expansion: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains - element 10 ) + }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains + element 1 ) ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Type requires ADL found begin and end ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) ) + REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) ) with expansion: - { 1, 2, 3, 4, 5 } any match matches undescribed predicate + { 1, 2, 3, 4, 5 } none match matches undescribed predicate ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -14354,9 +13915,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !anyMatch ) + REQUIRE_THAT( mocked, noneMatch ) with expansion: - { 1, 2, 3, 4, 5 } not any match matches undescribed predicate + { 1, 2, 3, 4, 5 } none match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14384,7 +13945,7 @@ with expansion: true ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -14392,9 +13953,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, anyMatch ) + REQUIRE_THAT( mocked, !noneMatch ) with expansion: - { 1, 2, 3, 4, 5 } any match matches undescribed predicate + { 1, 2, 3, 4, 5 } not none match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14422,98 +13983,98 @@ with expansion: !false ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Basic usage - All true evaluates to true + All true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyTrue() ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { true, true, true, true, true } contains at least one true + { true, true, true, true, true } not contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Basic usage - Empty evaluates to false + Empty evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyTrue() ) + REQUIRE_THAT( data, NoneTrue() ) with expansion: - { } not contains at least one true + { } contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Basic usage - One true evalutes to true + One true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyTrue() ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { false, false, true, false, false } contains at least one true + { false, false, true, false, false } not contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Basic usage - All false evaluates to false + All false evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyTrue() ) + REQUIRE_THAT( data, NoneTrue() ) with expansion: - { false, false, false, false, false } not contains at least one true + { false, false, false, false, false } contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Contained type is convertible to bool - All true evaluates to true + All true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyTrue() ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { true, true, true, true, true } contains at least one true + { true, true, true, true, true } not contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Contained type is convertible to bool - One true evalutes to true + One true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyTrue() ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { false, false, true, false, false } contains at least one true + { false, false, true, false, false } not contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Contained type is convertible to bool - All false evaluates to false + All false evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyTrue() ) + REQUIRE_THAT( data, NoneTrue() ) with expansion: - { false, false, false, false, false } not contains at least one true + { false, false, false, false, false } contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -14521,9 +14082,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, AnyTrue() ) + REQUIRE_THAT( mocked, NoneTrue() ) with expansion: - { false, false, false, false, true } contains at least one true + { false, false, false, false, false } contains no true MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14551,7 +14112,7 @@ with expansion: true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -14559,9 +14120,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, AnyTrue() ) + REQUIRE_THAT( mocked, !NoneTrue() ) with expansion: - { false, false, true, true, true } contains at least one true + { false, false, true, true, true } not contains no true MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14586,282 +14147,325 @@ with expansion: MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( mocked.m_derefed[4] ) with expansion: - !false + !false + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Empty container matches empty container +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( empty_vector, RangeEquals( empty_vector ) ) +with expansion: + { } elements are { } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Empty container does not match non-empty container +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( empty_vector, !RangeEquals( non_empty_vector ) ) +with expansion: + { } not elements are { 1 } + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( non_empty_vector, !RangeEquals( empty_vector ) ) +with expansion: + { 1 } not elements are { } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Two equal 1-length non-empty containers +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( non_empty_array, RangeEquals( non_empty_array ) ) +with expansion: + { 1 } elements are { 1 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Two equal-sized, equal, non-empty containers +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_a, RangeEquals( array_a ) ) +with expansion: + { 1, 2, 3 } elements are { 1, 2, 3 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Two equal-sized, non-equal, non-empty containers +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_a, !RangeEquals( array_b ) ) +with expansion: + { 1, 2, 3 } not elements are { 2, 2, 3 } + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_a, !RangeEquals( array_c ) ) +with expansion: + { 1, 2, 3 } not elements are { 1, 2, 2 } ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher +Usage of RangeEquals range matcher Basic usage + Two non-equal-sized, non-empty containers (with same first elements) ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneMatch(SizeIs(6)) ) + CHECK_THAT( vector_a, !RangeEquals( vector_b ) ) with expansion: - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } none match has size == 6 + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Custom predicate + Two equal non-empty containers (close enough) +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneMatch(Contains(0) && Contains(1)) ) + CHECK_THAT( vector_a, RangeEquals( vector_a_plus_1, close_enough ) ) with expansion: - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains - element 1 ) + { 1, 2, 3 } elements are { 2, 3, 4 } ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher - Type requires ADL found begin and end +Usage of RangeEquals range matcher + Custom predicate + Two non-equal non-empty containers (close enough) ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) ) + CHECK_THAT( vector_a, !RangeEquals( vector_b, close_enough ) ) with expansion: - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { 1, 2, 3 } not elements are { 3, 3, 4 } ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher - Shortcircuiting - All are read +Usage of RangeEquals range matcher + Ranges that need ADL begin/end ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, noneMatch ) + REQUIRE_THAT( needs_adl1, RangeEquals( needs_adl2 ) ) with expansion: - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[0] ) + REQUIRE_THAT( needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) ) with expansion: - true + { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Check short-circuiting behaviour + Check short-circuits on failure +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[1] ) + REQUIRE_THAT( mocked1, !RangeEquals( arr ) ) with expansion: - true + { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[2] ) + REQUIRE( mocked1.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[3] ) + REQUIRE( mocked1.m_derefed[1] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[4] ) + REQUIRE( mocked1.m_derefed[2] ) with expansion: true +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked1.m_derefed[3] ) +with expansion: + !false + ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher - Shortcircuiting - Short-circuited +Usage of RangeEquals range matcher + Check short-circuiting behaviour + All elements are checked on success ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !noneMatch ) + REQUIRE_THAT( mocked1, RangeEquals( arr ) ) with expansion: - { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[0] ) + REQUIRE( mocked1.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[1] ) -with expansion: - !false - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[2] ) + REQUIRE( mocked1.m_derefed[1] ) with expansion: - !false + true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[3] ) + REQUIRE( mocked1.m_derefed[2] ) with expansion: - !false + true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[4] ) + REQUIRE( mocked1.m_derefed[3] ) with expansion: - !false + true ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher +Usage of UnorderedRangeEquals range matcher Basic usage - All true evaluates to false + Empty container matches empty container ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneTrue() ) + CHECK_THAT( empty_vector, UnorderedRangeEquals( empty_vector ) ) with expansion: - { true, true, true, true, true } not contains no true + { } unordered elements are { } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher +Usage of UnorderedRangeEquals range matcher Basic usage - Empty evaluates to true + Empty container does not match non-empty container ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneTrue() ) + CHECK_THAT( empty_vector, !UnorderedRangeEquals( non_empty_vector ) ) with expansion: - { } contains no true + { } not unordered elements are { 1 } + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( non_empty_vector, !UnorderedRangeEquals( empty_vector ) ) +with expansion: + { 1 } not unordered elements are { } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher +Usage of UnorderedRangeEquals range matcher Basic usage - One true evalutes to false + Two equal 1-length non-empty containers ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneTrue() ) + CHECK_THAT( non_empty_array, UnorderedRangeEquals( non_empty_array ) ) with expansion: - { false, false, true, false, false } not contains no true + { 1 } unordered elements are { 1 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher +Usage of UnorderedRangeEquals range matcher Basic usage - All false evaluates to true + Two equal-sized, equal, non-empty containers ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneTrue() ) + CHECK_THAT( array_a, UnorderedRangeEquals( array_a ) ) with expansion: - { false, false, false, false, false } contains no true + { 1, 2, 3 } unordered elements are { 1, 2, 3 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Contained type is convertible to bool - All true evaluates to false +Usage of UnorderedRangeEquals range matcher + Basic usage + Two equal-sized, non-equal, non-empty containers ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneTrue() ) + CHECK_THAT( array_a, !UnorderedRangeEquals( array_b ) ) with expansion: - { true, true, true, true, true } not contains no true + { 1, 2, 3 } not unordered elements are { 2, 2, 3 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Contained type is convertible to bool - One true evalutes to false +Usage of UnorderedRangeEquals range matcher + Basic usage + Two non-equal-sized, non-empty containers ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneTrue() ) + CHECK_THAT( vector_a, !UnorderedRangeEquals( vector_b ) ) with expansion: - { false, false, true, false, false } not contains no true + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Contained type is convertible to bool - All false evaluates to true +Usage of UnorderedRangeEquals range matcher + Custom predicate + Two equal non-empty containers (close enough) ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneTrue() ) + CHECK_THAT( vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) ) with expansion: - { false, false, false, false, false } contains no true + { 1, 10, 20 } unordered elements are { 11, 21, 2 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Shortcircuiting - All are read +Usage of UnorderedRangeEquals range matcher + Custom predicate + Two non-equal non-empty containers (close enough) ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, NoneTrue() ) -with expansion: - { false, false, false, false, false } contains no true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[0] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[1] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[2] ) + CHECK_THAT( vector_a, !UnorderedRangeEquals( vector_b, close_enough ) ) with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[3] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[4] ) -with expansion: - true + { 1, 10, 21 } not unordered elements are { 11, 21, 3 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Shortcircuiting - Short-circuited +Usage of UnorderedRangeEquals range matcher + Ranges that need ADL begin/end ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !NoneTrue() ) -with expansion: - { false, false, true, true, true } not contains no true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[0] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[1] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[2] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[3] ) -with expansion: - !false - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[4] ) + REQUIRE_THAT( needs_adl1, UnorderedRangeEquals( needs_adl2 ) ) with expansion: - !false + { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } ------------------------------------------------------------------------------- Usage of the SizeIs range matcher @@ -15565,6 +15169,16 @@ with expansion: <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) +------------------------------------------------------------------------------- +a succeeding test can still be skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: PASSED: + +Skip.tests.cpp:<line number>: SKIPPED: + ------------------------------------------------------------------------------- analyse no analysis ------------------------------------------------------------------------------- @@ -16110,6 +15724,34 @@ FloatingPoint.tests.cpp:<line number>: PASSED: with expansion: 1 == 1 +------------------------------------------------------------------------------- +dynamic skipping works with generators +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 41 + +------------------------------------------------------------------------------- +dynamic skipping works with generators +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +dynamic skipping works with generators +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 43 + ------------------------------------------------------------------------------- empty tags are not allowed ------------------------------------------------------------------------------- @@ -16185,6 +15827,67 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: +------------------------------------------------------------------------------- +failed assertions before SKIP cause test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + CHECK( 3 == 4 ) + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing in some unskipped sections causes entire test case to fail + skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing in some unskipped sections causes entire test case to fail + not skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + ------------------------------------------------------------------------------- first tag ------------------------------------------------------------------------------- @@ -16681,6 +16384,40 @@ Misc.tests.cpp:<line number>: PASSED: with expansion: 1 != 2 +a------------------------------------------------------------------------------- +nested sections can be skipped dynamically at runtime + A +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'A' + +! +b1------------------------------------------------------------------------------- +nested sections can be skipped dynamically at runtime + B + B1 +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'B1' + +! +------------------------------------------------------------------------------- +nested sections can be skipped dynamically at runtime + B + B2 +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +! ------------------------------------------------------------------------------- non streamable - with conv. op ------------------------------------------------------------------------------- @@ -17282,6 +17019,33 @@ Misc.tests.cpp:<line number> No assertions in test case 'second tag' +------------------------------------------------------------------------------- +sections can be skipped dynamically at runtime + not skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +sections can be skipped dynamically at runtime + skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +sections can be skipped dynamically at runtime + also not skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: PASSED: + ------------------------------------------------------------------------------- send a single char to INFO ------------------------------------------------------------------------------- @@ -17316,6 +17080,16 @@ Tag.tests.cpp:<line number>: PASSED: with expansion: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +------------------------------------------------------------------------------- +skipped tests can optionally provide a reason +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 43 + ------------------------------------------------------------------------------- splitString ------------------------------------------------------------------------------- @@ -17743,6 +17517,14 @@ Tag.tests.cpp:<line number>: PASSED: with expansion: magic.tag == magic.tag +------------------------------------------------------------------------------- +tests can be skipped dynamically at runtime +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + ------------------------------------------------------------------------------- thrown std::strings are translated ------------------------------------------------------------------------------- @@ -18450,6 +18232,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 394 | 304 passed | 83 failed | 7 failed as expected -assertions: 2299 | 2129 passed | 143 failed | 27 failed as expected +test cases: 409 | 308 passed | 84 failed | 6 skipped | 11 failed as expected +assertions: 2225 | 2048 passed | 145 failed | 32 failed as expected diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 9cba323d9b0a409c01f7ee93fbc323babda82f4f..4cc942dd49d739cf7f8e95ee1a0ab0bc6242e3ea 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -1,4 +1,4 @@ -Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Filters: "*" ~[!nonportable] ~[!benchmark] ~[approvals] Randomness seeded to: 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -164,20 +164,20 @@ with expansion: ------------------------------------------------------------------------------- #1905 -- test spec parser properly clears internal state between compound tests ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase("spec . char")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase("spec , char")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( spec.matches(*fakeTestCase(R"(spec \, char)")) ) with expansion: !false @@ -186,20 +186,20 @@ with expansion: #1912 -- test spec parser handles escaping Various parentheses ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec {a} char)")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec [a] char)")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( spec.matches(*fakeTestCase("differs but has similar tag", "[a]")) ) with expansion: !false @@ -208,10 +208,10 @@ with expansion: #1912 -- test spec parser handles escaping backslash in test name ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec \ char)")) ) with expansion: true @@ -759,6 +759,16 @@ with expansion: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0. 00000000e+00]) +------------------------------------------------------------------------------- +#2615 - Throwing in constructor generator fails test case but does not abort +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + failure to init + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions outside assertions @@ -3944,6 +3954,16 @@ with expansion: == "{** unexpected enum value **}" +------------------------------------------------------------------------------- +Empty generators can SKIP in constructor +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + This generator is empty + ------------------------------------------------------------------------------- Empty stream name opens cout stream ------------------------------------------------------------------------------- @@ -3955,15 +3975,6 @@ Stream.tests.cpp:<line number>: PASSED: with expansion: true -------------------------------------------------------------------------------- -Empty tag is not allowed -------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> -............................................................................... - -Tag.tests.cpp:<line number>: PASSED: - REQUIRE_THROWS( Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) ) - ------------------------------------------------------------------------------- EndsWith string matcher ------------------------------------------------------------------------------- @@ -4280,6 +4291,32 @@ Matchers.tests.cpp:<line number>: PASSED: with expansion: SpecialException::what special exception has value of 2 +------------------------------------------------------------------------------- +Exception message can be matched +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) ) +with expansion: + DerivedException::what matches "starts with: "Derived"" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) ) +with expansion: + DerivedException::what matches "ends with: "::what"" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) ) +with expansion: + DerivedException::what matches "not starts with: "::what"" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) ) +with expansion: + SpecialException::what matches "starts with: "Special"" + ------------------------------------------------------------------------------- Exception messages can be tested for exact match @@ -4439,6 +4476,15 @@ Misc.tests.cpp:<line number>: PASSED: with expansion: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) +------------------------------------------------------------------------------- +Filter generator throws exception for empty generator +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException ) + ------------------------------------------------------------------------------- Floating point matchers: double Relative @@ -4624,6 +4670,18 @@ Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error ) +------------------------------------------------------------------------------- +Floating point matchers: double + IsNaN +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !IsNaN() ) +with expansion: + 1.0 not is NaN + ------------------------------------------------------------------------------- Floating point matchers: float Relative @@ -4817,6 +4875,18 @@ Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error ) +------------------------------------------------------------------------------- +Floating point matchers: float + IsNaN +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !IsNaN() ) +with expansion: + 1.0 not is NaN + ------------------------------------------------------------------------------- Generators -- adapters Filtering by predicate @@ -8054,2170 +8124,1238 @@ Matchers.tests.cpp:<line number>: PASSED: REQUIRE_NOTHROW( ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() ) ------------------------------------------------------------------------------- -Parse test names and tags - Empty test spec should have no filters +Parse uints + proper inputs ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Parse.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE( parseUInt( "0" ) == Optional<unsigned int>{ 0 } ) with expansion: - false == false + {?} == {?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE( parseUInt( "100" ) == Optional<unsigned int>{ 100 } ) with expansion: - false == false + {?} == {?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE( parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } ) with expansion: - false == false + {?} == {?} + +Parse.tests.cpp:<line number>: PASSED: + REQUIRE( parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } ) +with expansion: + {?} == {?} ------------------------------------------------------------------------------- -Parse test names and tags - Test spec from empty string should have no filters +Parse uints + Bad inputs ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Parse.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "" ) ) with expansion: - false == false + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "!!KJHF*#" ) ) with expansion: - false == false + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "-1" ) ) with expansion: - false == false + !{?} -------------------------------------------------------------------------------- -Parse test names and tags - Test spec from just a comma should have no filters -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "4294967296" ) ) +with expansion: + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "42949672964294967296429496729642949672964294967296" ) ) with expansion: - false == false + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "2 4" ) ) with expansion: - false == false + !{?} -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Parse.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( parseUInt( "0x<hex digits>", 10 ) ) with expansion: - false == false + !{?} ------------------------------------------------------------------------------- -Parse test names and tags - Test spec from name should have one filter +Parsed tags are matched case insensitive ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpecParser.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) with expansion: - true == true + true -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) with expansion: - false == false + true -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) with expansion: - true == true + true ------------------------------------------------------------------------------- -Parse test names and tags - Test spec from quoted name should have one filter +Parsing sharding-related cli flags + shard-count ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( cli.parse({ "test", "--shard-count=8" }) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + REQUIRE( config.shardCount == 8 ) with expansion: - true == true + 8 == 8 ------------------------------------------------------------------------------- -Parse test names and tags - Test spec from name should have one filter +Parsing sharding-related cli flags + Negative shard count reports error ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK_FALSE( result ) with expansion: - true == true + !{?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) ) with expansion: - false == false + "Could not parse '-1' as shard count" contains: "Could not parse '-1' as + shard count" + +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + Zero shard count reports error +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK_FALSE( result ) with expansion: - true == true + !{?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) ) with expansion: - false == false + "Shard count must be positive" contains: "Shard count must be positive" ------------------------------------------------------------------------------- -Parse test names and tags - Wildcard at the start +Parsing sharding-related cli flags + shard-index ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( cli.parse({ "test", "--shard-index=2" }) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( config.shardIndex == 2 ) with expansion: - false == false + 2 == 2 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Parsing sharding-related cli flags + Negative shard index reports error +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + CHECK_FALSE( result ) with expansion: - false == false + !{?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( parseTestSpec( "*a" ).matches( *tcA ) == true ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) ) with expansion: - true == true + "Could not parse '-12' as shard index" contains: "Could not parse '-12' as + shard index" ------------------------------------------------------------------------------- -Parse test names and tags - Wildcard at the end +Parsing sharding-related cli flags + Shard index 0 is accepted ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cli.parse({ "test", "--shard-index=0" }) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.shardIndex == 0 ) with expansion: - false == false + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Parsing tags with non-alphabetical characters is pass-through +------------------------------------------------------------------------------- +TestSpecParser.tests.cpp:<line number> +............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) with expansion: - true == true + true +with message: + tagString := "[tag with spaces]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) with expansion: - false == false + true +with message: + tagString := "[tag with spaces]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( parseTestSpec( "a*" ).matches( *tcA ) == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) with expansion: - true == true + true +with message: + tagString := "[tag with spaces]" ------------------------------------------------------------------------------- -Parse test names and tags - Wildcard at both ends +Parsing tags with non-alphabetical characters is pass-through ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpecParser.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.hasFilters() ) with expansion: - true == true + true +with message: + tagString := "[I said "good day" sir!]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.getInvalidSpecs().empty() ) with expansion: - false == false + true +with message: + tagString := "[I said "good day" sir!]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +TestSpecParser.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches( testCase ) ) with expansion: - false == false + true +with message: + tagString := "[I said "good day" sir!]" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Parsing warnings + NoAssertions +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + REQUIRE( cli.parse( { "test", "-w", "NoAssertions" } ) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( parseTestSpec( "*a*" ).matches( *tcA ) == true ) + REQUIRE( config.warnings == WarnAbout::NoAssertions ) with expansion: - true == true + 1 == 1 ------------------------------------------------------------------------------- -Parse test names and tags - Redundant wildcard at the start +Parsing warnings + NoTests is no longer supported ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + REQUIRE_FALSE( cli.parse( { "test", "-w", "NoTests" } ) ) with expansion: - true == true + !{?} + +------------------------------------------------------------------------------- +Parsing warnings + Combining multiple warnings +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ) with expansion: - false == false + 3 == 3 ------------------------------------------------------------------------------- -Parse test names and tags - Redundant wildcard at the end +Pointers can be compared to null ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Condition.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( p == 0 ) with expansion: - true == true + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( p == pNULL ) with expansion: - true == true + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( p != 0 ) with expansion: - false == false + 0x<hex digits> != 0 -------------------------------------------------------------------------------- -Parse test names and tags - Redundant wildcard at both ends -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( cp != 0 ) +with expansion: + 0x<hex digits> != 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( cpc != 0 ) with expansion: - true == true + 0x<hex digits> != 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( returnsNull() == 0 ) with expansion: - true == true + {null string} == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( returnsConstNull() == 0 ) with expansion: - false == false + {null string} == 0 + +Condition.tests.cpp:<line number>: PASSED: + REQUIRE( 0 != p ) +with expansion: + 0 != 0x<hex digits> ------------------------------------------------------------------------------- -Parse test names and tags - Wildcard at both ends, redundant at start +Precision of floating point stringification can be set + Floats ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +ToStringGeneral.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) +ToStringGeneral.tests.cpp:<line number>: PASSED: + CHECK( str1.size() == 3 + 5 ) with expansion: - true == true + 8 == 8 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( str2.size() == 3 + 10 ) with expansion: - false == false + 13 == 13 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Precision of floating point stringification can be set + Double +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) +ToStringGeneral.tests.cpp:<line number>: PASSED: + CHECK( str1.size() == 2 + 5 ) with expansion: - true == true + 7 == 7 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( str2.size() == 2 + 15 ) with expansion: - true == true + 17 == 17 ------------------------------------------------------------------------------- -Parse test names and tags - Just wildcard +Predicate matcher can accept const char* ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Matchers.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( "foo", Predicate<const char*>( []( const char* const& ) { return true; } ) ) with expansion: - true == true + "foo" matches undescribed predicate -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Process can be configured on command line + empty args don't cause a crash +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK( result ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + CHECK( config.processName == "" ) with expansion: - true == true + "" == "" ------------------------------------------------------------------------------- -Parse test names and tags - Single tag +Process can be configured on command line + default - no arguments ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( result ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK( config.processName == "test" ) with expansion: - true == true + "test" == "test" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( config.shouldDebugBreak == false ) with expansion: false == false -------------------------------------------------------------------------------- -Parse test names and tags - Single tag, two matches -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( config.abortAfter == -1 ) with expansion: - true == true + -1 == -1 CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( config.noThrow == false ) with expansion: false == false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK( config.reporterSpecifications.empty() ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK_FALSE( cfg.hasTestFilters() ) with expansion: - true == true - -------------------------------------------------------------------------------- -Parse test names and tags - Two tags -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... + !false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cfg.getReporterSpecs().size() == 1 ) with expansion: - true == true + 1 == 1 CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + CHECK( cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } ) with expansion: - false == false + {?} == {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + CHECK( cfg.getProcessedReporterSpecs().size() == 1 ) with expansion: - false == false + 1 == 1 CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK( cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } ) with expansion: - true == true + {?} == {?} ------------------------------------------------------------------------------- -Parse test names and tags - Two tags, spare separated +Process can be configured on command line + test lists + Specify one test case using ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( cfg.hasTestFilters() ) with expansion: - false == false + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false ) with expansion: false == false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) ) with expansion: - true == true + true ------------------------------------------------------------------------------- -Parse test names and tags - Wildcarded name and tag +Process can be configured on command line + test lists + Specify one test case exclusion using exclude: ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( cfg.hasTestFilters() ) with expansion: - false == false + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false ) with expansion: false == false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) ) with expansion: - false == false + true ------------------------------------------------------------------------------- -Parse test names and tags - Single tag exclusion +Process can be configured on command line + test lists + Specify one test case exclusion using ~ ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( cfg.hasTestFilters() ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false ) with expansion: false == false CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) ) with expansion: - false == false + true ------------------------------------------------------------------------------- -Parse test names and tags - One tag exclusion and one tag inclusion +Process can be configured on command line + reporter + -r/console ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } ) with expansion: - false == false + { {?} } == { {?} } +with message: + result.errorMessage() := "" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + -r/xml +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK( result ) with expansion: - true == true + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } ) with expansion: - false == false + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- -Parse test names and tags - One tag exclusion and one wldcarded name inclusion +Process can be configured on command line + reporter + --reporter/junit ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } ) with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) -with expansion: - true == true + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- -Parse test names and tags - One tag exclusion, using exclude:, and one wldcarded name inclusion +Process can be configured on command line + reporter + must match one of the available ones ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( !result ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Unrecognized reporter") ) with expansion: - false == false + "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" + contains: "Unrecognized reporter" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + With output file +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( result ) with expansion: - false == false + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } ) with expansion: - true == true + { {?} } == { {?} } +with message: + result.errorMessage() := "" ------------------------------------------------------------------------------- -Parse test names and tags - name exclusion +Process can be configured on command line + reporter + With Windows-like absolute path as output file ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( result ) with expansion: - true == true + {?} +with message: + result.errorMessage() := "" CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } ) with expansion: - true == true + { {?} } == { {?} } +with message: + result.errorMessage() := "" -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + All with output files +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } ) with expansion: - true == true + { {?}, {?} } == { {?}, {?} } ------------------------------------------------------------------------------- -Parse test names and tags - wildcarded name exclusion +Process can be configured on command line + reporter + Multiple reporters + Mixed output files and default output ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } ) with expansion: - true == true + { {?}, {?} } == { {?}, {?} } -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Multiple reporters + cannot have multiple reporters with default output +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( !result ) with expansion: - false == false + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") ) with expansion: - false == false + "Only one reporter may have unspecified output file." contains: "Only one + reporter may have unspecified output file." ------------------------------------------------------------------------------- -Parse test names and tags - wildcarded name exclusion with tag inclusion +Process can be configured on command line + debugger + -b ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) -with expansion: - true == true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) + CHECK( cli.parse({"test", "-b"}) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + REQUIRE( config.shouldDebugBreak == true ) with expansion: true == true -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) -with expansion: - false == false - ------------------------------------------------------------------------------- -Parse test names and tags - wildcarded name exclusion, using exclude:, with tag inclusion +Process can be configured on command line + debugger + --break ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cli.parse({"test", "--break"}) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == true ) + REQUIRE( config.shouldDebugBreak ) with expansion: - true == true + true -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == true ) -with expansion: - true == true +------------------------------------------------------------------------------- +Process can be configured on command line + abort + -a aborts after first failure +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK( cli.parse({"test", "-a"}) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE( config.abortAfter == 1 ) with expansion: - false == false + 1 == 1 ------------------------------------------------------------------------------- -Parse test names and tags - two wildcarded names +Process can be configured on command line + abort + -x 2 aborts after two failures ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( cli.parse({"test", "-x", "2"}) ) with expansion: - true == true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.abortAfter == 2 ) with expansion: - false == false + 2 == 2 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + abort + -x must be numeric +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == true ) + CHECK( !result ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops") ) with expansion: - false == false + "Unable to convert 'oops' to destination type" ( contains: "convert" and + contains: "oops" ) ------------------------------------------------------------------------------- -Parse test names and tags - empty tag +Process can be configured on command line + abort + wait-for-keypress + Accepted options ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.waitForKeypress == std::get<1>(input) ) with expansion: - false == false + 0 == 0 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE( config.waitForKeypress == std::get<1>(input) ) with expansion: - false == false + 1 == 1 ------------------------------------------------------------------------------- -Parse test names and tags - empty quoted name +Process can be configured on command line + abort + wait-for-keypress + Accepted options ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == false ) + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE( config.waitForKeypress == std::get<1>(input) ) with expansion: - false == false + 2 == 2 -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == false ) + REQUIRE( config.waitForKeypress == std::get<1>(input) ) with expansion: - false == false + 3 == 3 ------------------------------------------------------------------------------- -Parse test names and tags - quoted string followed by tag exclusion +Process can be configured on command line + abort + wait-for-keypress + invalid options are reported ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.hasFilters() == true ) + CHECK( !result ) with expansion: - true == true + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcA ) == false ) + REQUIRE_THAT( result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both") ) with expansion: - false == false + "keypress argument must be one of: never, start, exit or both. 'sometimes' + not recognised" ( contains: "never" and contains: "both" ) -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcB ) == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Process can be configured on command line + nothrow + -e +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcC ) == false ) + CHECK( cli.parse({"test", "-e"}) ) with expansion: - false == false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *tcD ) == true ) + REQUIRE( config.noThrow ) with expansion: - true == true + true ------------------------------------------------------------------------------- -Parse test names and tags - Leading and trailing spaces in test spec +Process can be configured on command line + nothrow + --nothrow ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ) + CHECK( cli.parse({"test", "--nothrow"}) ) with expansion: - true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ) + REQUIRE( config.noThrow ) with expansion: true ------------------------------------------------------------------------------- -Parse test names and tags - Leading and trailing spaces in test name +Process can be configured on command line + output filename + -o filename ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ) + CHECK( cli.parse({"test", "-o", "filename.ext"}) ) with expansion: - true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ) + REQUIRE( config.defaultOutputFilename == "filename.ext" ) with expansion: - true + "filename.ext" == "filename.ext" ------------------------------------------------------------------------------- -Parse test names and tags - Shortened hide tags are split apart when parsing +Process can be configured on command line + output filename + --out ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) ) + CHECK( cli.parse({"test", "--out", "filename.ext"}) ) with expansion: - true + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( spec.matches(*fakeTestCase("only foo", "[foo]")) ) + REQUIRE( config.defaultOutputFilename == "filename.ext" ) with expansion: - !false + "filename.ext" == "filename.ext" ------------------------------------------------------------------------------- -Parse test names and tags - Shortened hide tags also properly handle exclusion +Process can be configured on command line + combinations + Single character flags can be combined ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) ) + CHECK( cli.parse({"test", "-abe"}) ) with expansion: - !false + {?} CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( spec.matches(*fakeTestCase("only foo", "[foo]")) ) + CHECK( config.abortAfter == 1 ) with expansion: - !false + 1 == 1 CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( spec.matches(*fakeTestCase("only hidden", "[.]")) ) + CHECK( config.shouldDebugBreak ) with expansion: - !false + true CmdLine.tests.cpp:<line number>: PASSED: - CHECK( spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) ) + CHECK( config.noThrow == true ) with expansion: - true + true == true ------------------------------------------------------------------------------- -Parsed tags are matched case insensitive +Process can be configured on command line + use-colour + without option ------------------------------------------------------------------------------- -TestSpecParser.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.hasFilters() ) -with expansion: - true - -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.getInvalidSpecs().empty() ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test"}) ) with expansion: - true + {?} -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.matches( testCase ) ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) with expansion: - true + 0 == 0 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - shard-count +Process can be configured on command line + use-colour + auto ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--shard-count=8" }) ) + CHECK( cli.parse( { "test", "--colour-mode", "default" } ) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shardCount == 8 ) + REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) with expansion: - 8 == 8 + 0 == 0 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - Negative shard count reports error +Process can be configured on command line + use-colour + yes ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( result ) + CHECK( cli.parse({"test", "--colour-mode", "ansi"}) ) with expansion: - !{?} + {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard count must be a positive number") ) + REQUIRE( config.defaultColourMode == ColourMode::ANSI ) with expansion: - "Shard count must be a positive number" contains: "Shard count must be a - positive number" + 1 == 1 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - Zero shard count reports error +Process can be configured on command line + use-colour + no ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( result ) + CHECK( cli.parse({"test", "--colour-mode", "none"}) ) with expansion: - !{?} + {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard count must be a positive number") ) + REQUIRE( config.defaultColourMode == ColourMode::None ) with expansion: - "Shard count must be a positive number" contains: "Shard count must be a - positive number" + 3 == 3 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - shard-index +Process can be configured on command line + use-colour + error ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--shard-index=2" }) ) + CHECK( !result ) with expansion: - {?} + true CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shardIndex == 2 ) + CHECK_THAT( result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) ) with expansion: - 2 == 2 + "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not + recognised" contains: "colour mode must be one of" ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - Negative shard index reports error +Process can be configured on command line + Benchmark options + samples ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( result ) + CHECK( cli.parse({ "test", "--benchmark-samples=200" }) ) with expansion: - !{?} + {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") ) + REQUIRE( config.benchmarkSamples == 200 ) with expansion: - "Shard index must be a non-negative number" contains: "Shard index must be a - non-negative number" + 200 == 200 ------------------------------------------------------------------------------- -Parsing sharding-related cli flags - Shard index 0 is accepted +Process can be configured on command line + Benchmark options + resamples ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--shard-index=0" }) ) + CHECK( cli.parse({ "test", "--benchmark-resamples=20000" }) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shardIndex == 0 ) + REQUIRE( config.benchmarkResamples == 20000 ) with expansion: - 0 == 0 + 20000 (0x<hex digits>) == 20000 (0x<hex digits>) ------------------------------------------------------------------------------- -Parsing tags with non-alphabetical characters is pass-through +Process can be configured on command line + Benchmark options + confidence-interval ------------------------------------------------------------------------------- -TestSpecParser.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.hasFilters() ) -with expansion: - true -with message: - tagString := "[tag with spaces]" - -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.getInvalidSpecs().empty() ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) ) with expansion: - true -with message: - tagString := "[tag with spaces]" + {?} -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.matches( testCase ) ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkConfidenceInterval == Catch::Approx(0.99) ) with expansion: - true -with message: - tagString := "[tag with spaces]" + 0.99 == Approx( 0.99 ) ------------------------------------------------------------------------------- -Parsing tags with non-alphabetical characters is pass-through +Process can be configured on command line + Benchmark options + no-analysis ------------------------------------------------------------------------------- -TestSpecParser.tests.cpp:<line number> +CmdLine.tests.cpp:<line number> ............................................................................... -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.hasFilters() ) -with expansion: - true -with message: - tagString := "[I said "good day" sir!]" - -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.getInvalidSpecs().empty() ) +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-no-analysis" }) ) with expansion: - true -with message: - tagString := "[I said "good day" sir!]" + {?} -TestSpecParser.tests.cpp:<line number>: PASSED: - REQUIRE( spec.matches( testCase ) ) +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkNoAnalysis ) with expansion: true -with message: - tagString := "[I said "good day" sir!]" ------------------------------------------------------------------------------- -Parsing warnings - NoAssertions +Process can be configured on command line + Benchmark options + warmup-time ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cli.parse( { "test", "-w", "NoAssertions" } ) ) + CHECK( cli.parse({ "test", "--benchmark-warmup-time=10" }) ) with expansion: {?} CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.warnings == WarnAbout::NoAssertions ) + REQUIRE( config.benchmarkWarmupTime == 10 ) with expansion: - 1 == 1 + 10 == 10 ------------------------------------------------------------------------------- -Parsing warnings - NoTests is no longer supported +Product with differing arities - std::tuple<int, double, float> ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( cli.parse( { "test", "-w", "NoTests" } ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) with expansion: - !{?} + 3 >= 1 ------------------------------------------------------------------------------- -Parsing warnings - Combining multiple warnings +Product with differing arities - std::tuple<int, double> ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) with expansion: - 3 == 3 + 2 >= 1 ------------------------------------------------------------------------------- -Pointers can be compared to null +Product with differing arities - std::tuple<int> ------------------------------------------------------------------------------- -Condition.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( p == 0 ) -with expansion: - 0 == 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( p == pNULL ) -with expansion: - 0 == 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( p != 0 ) -with expansion: - 0x<hex digits> != 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( cp != 0 ) -with expansion: - 0x<hex digits> != 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( cpc != 0 ) -with expansion: - 0x<hex digits> != 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( returnsNull() == 0 ) -with expansion: - {null string} == 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( returnsConstNull() == 0 ) -with expansion: - {null string} == 0 - -Condition.tests.cpp:<line number>: PASSED: - REQUIRE( 0 != p ) -with expansion: - 0 != 0x<hex digits> - -------------------------------------------------------------------------------- -Precision of floating point stringification can be set - Floats -------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> -............................................................................... - -ToStringGeneral.tests.cpp:<line number>: PASSED: - CHECK( str1.size() == 3 + 5 ) -with expansion: - 8 == 8 - -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( str2.size() == 3 + 10 ) -with expansion: - 13 == 13 - -------------------------------------------------------------------------------- -Precision of floating point stringification can be set - Double -------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> -............................................................................... - -ToStringGeneral.tests.cpp:<line number>: PASSED: - CHECK( str1.size() == 2 + 5 ) -with expansion: - 7 == 7 - -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( str2.size() == 2 + 15 ) -with expansion: - 17 == 17 - -------------------------------------------------------------------------------- -Predicate matcher can accept const char* -------------------------------------------------------------------------------- -Matchers.tests.cpp:<line number> -............................................................................... - -Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( "foo", Predicate<const char*>( []( const char* const& ) { return true; } ) ) -with expansion: - "foo" matches undescribed predicate - -------------------------------------------------------------------------------- -Process can be configured on command line - empty args don't cause a crash -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.processName == "" ) -with expansion: - "" == "" - -------------------------------------------------------------------------------- -Process can be configured on command line - default - no arguments -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.processName == "test" ) -with expansion: - "test" == "test" - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.shouldDebugBreak == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.abortAfter == -1 ) -with expansion: - -1 == -1 - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.noThrow == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.reporterSpecifications.empty() ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK_FALSE( cfg.hasTestFilters() ) -with expansion: - !false - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cfg.getReporterSpecs().size() == 1 ) -with expansion: - 1 == 1 - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cfg.getReporterSpecs()[0] == Catch::ReporterSpec{ expectedReporter, {}, {}, {} } ) -with expansion: - {?} == {?} - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cfg.getProcessedReporterSpecs().size() == 1 ) -with expansion: - 1 == 1 - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cfg.getProcessedReporterSpecs()[0] == Catch::ProcessedReporterSpec{ expectedReporter, std::string{}, Catch::ColourMode::PlatformDefault, {} } ) -with expansion: - {?} == {?} - -------------------------------------------------------------------------------- -Process can be configured on command line - test lists - Specify one test case using -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.hasTestFilters() ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - test lists - Specify one test case exclusion using exclude: -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.hasTestFilters() ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - test lists - Specify one test case exclusion using ~ -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.hasTestFilters() ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("test1")) == false ) -with expansion: - false == false - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - -r/console -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", {}, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - -r/xml -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", {}, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - --reporter/junit -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "junit", {}, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - must match one of the available ones -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Unrecognized reporter") ) -with expansion: - "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" - contains: "Unrecognized reporter" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - With output file -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "out.txt"s, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - With Windows-like absolute path as output file -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( result ) -with expansion: - {?} -with message: - result.errorMessage() := "" - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "console", "C:\\Temp\\out.txt"s, {}, {} } } ) -with expansion: - { {?} } == { {?} } -with message: - result.errorMessage() := "" - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - Multiple reporters - All with output files -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "junit::out=output-junit.xml" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "junit", "output-junit.xml"s, {}, {} } } ) -with expansion: - { {?}, {?} } == { {?}, {?} } - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - Multiple reporters - Mixed output files and default output -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "-r", "xml::out=output.xml", "-r", "console" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.reporterSpecifications == vec_Specs{ { "xml", "output.xml"s, {}, {} }, { "console", {}, {}, {} } } ) -with expansion: - { {?}, {?} } == { {?}, {?} } - -------------------------------------------------------------------------------- -Process can be configured on command line - reporter - Multiple reporters - cannot have multiple reporters with default output -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("Only one reporter may have unspecified output file.") ) -with expansion: - "Only one reporter may have unspecified output file." contains: "Only one - reporter may have unspecified output file." - -------------------------------------------------------------------------------- -Process can be configured on command line - debugger - -b -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-b"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shouldDebugBreak == true ) -with expansion: - true == true - -------------------------------------------------------------------------------- -Process can be configured on command line - debugger - --break -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--break"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.shouldDebugBreak ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - -a aborts after first failure -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-a"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.abortAfter == 1 ) -with expansion: - 1 == 1 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - -x 2 aborts after two failures -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-x", "2"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.abortAfter == 2 ) -with expansion: - 2 == 2 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - -x must be numeric -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("convert") && ContainsSubstring("oops") ) -with expansion: - "Unable to convert 'oops' to destination type" ( contains: "convert" and - contains: "oops" ) - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - Accepted options -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.waitForKeypress == std::get<1>(input) ) -with expansion: - 0 == 0 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - Accepted options -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.waitForKeypress == std::get<1>(input) ) -with expansion: - 1 == 1 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - Accepted options -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.waitForKeypress == std::get<1>(input) ) -with expansion: - 2 == 2 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - Accepted options -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.waitForKeypress == std::get<1>(input) ) -with expansion: - 3 == 3 - -------------------------------------------------------------------------------- -Process can be configured on command line - abort - wait-for-keypress - invalid options are reported -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( result.errorMessage(), ContainsSubstring("never") && ContainsSubstring("both") ) -with expansion: - "keypress argument must be one of: never, start, exit or both. 'sometimes' - not recognised" ( contains: "never" and contains: "both" ) - -------------------------------------------------------------------------------- -Process can be configured on command line - nothrow - -e -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-e"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.noThrow ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - nothrow - --nothrow -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--nothrow"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.noThrow ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - output filename - -o filename -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-o", "filename.ext"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultOutputFilename == "filename.ext" ) -with expansion: - "filename.ext" == "filename.ext" - -------------------------------------------------------------------------------- -Process can be configured on command line - output filename - --out -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--out", "filename.ext"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultOutputFilename == "filename.ext" ) -with expansion: - "filename.ext" == "filename.ext" - -------------------------------------------------------------------------------- -Process can be configured on command line - combinations - Single character flags can be combined -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "-abe"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.abortAfter == 1 ) -with expansion: - 1 == 1 - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.shouldDebugBreak ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( config.noThrow == true ) -with expansion: - true == true - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - without option -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) -with expansion: - 0 == 0 - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - auto -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse( { "test", "--colour-mode", "default" } ) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultColourMode == ColourMode::PlatformDefault ) -with expansion: - 0 == 0 - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - yes -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--colour-mode", "ansi"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultColourMode == ColourMode::ANSI ) -with expansion: - 1 == 1 - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - no -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({"test", "--colour-mode", "none"}) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.defaultColourMode == ColourMode::None ) -with expansion: - 3 == 3 - -------------------------------------------------------------------------------- -Process can be configured on command line - use-colour - error -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( !result ) -with expansion: - true - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK_THAT( result.errorMessage(), ContainsSubstring( "colour mode must be one of" ) ) -with expansion: - "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not - recognised" contains: "colour mode must be one of" - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - samples -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-samples=200" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkSamples == 200 ) -with expansion: - 200 == 200 - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - resamples -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-resamples=20000" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkResamples == 20000 ) -with expansion: - 20000 (0x<hex digits>) == 20000 (0x<hex digits>) - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - confidence-interval -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkConfidenceInterval == Catch::Approx(0.99) ) -with expansion: - 0.99 == Approx( 0.99 ) - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - no-analysis -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-no-analysis" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkNoAnalysis ) -with expansion: - true - -------------------------------------------------------------------------------- -Process can be configured on command line - Benchmark options - warmup-time -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... - -CmdLine.tests.cpp:<line number>: PASSED: - CHECK( cli.parse({ "test", "--benchmark-warmup-time=10" }) ) -with expansion: - {?} - -CmdLine.tests.cpp:<line number>: PASSED: - REQUIRE( config.benchmarkWarmupTime == 10 ) -with expansion: - 10 == 10 - -------------------------------------------------------------------------------- -Product with differing arities - std::tuple<int, double, float> -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... - -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( std::tuple_size<TestType>::value >= 1 ) -with expansion: - 3 >= 1 - -------------------------------------------------------------------------------- -Product with differing arities - std::tuple<int, double> -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... - -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( std::tuple_size<TestType>::value >= 1 ) -with expansion: - 2 >= 1 - -------------------------------------------------------------------------------- -Product with differing arities - std::tuple<int> -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... - -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( std::tuple_size<TestType>::value >= 1 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) with expansion: 1 >= 1 @@ -11247,889 +10385,1179 @@ Approx.tests.cpp:<line number>: PASSED: with expansion: 1.23 == Approx( 1.23 ) -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( d != Approx( 1.22 ) ) +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != Approx( 1.22 ) ) +with expansion: + 1.23 != Approx( 1.22 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != Approx( 1.24 ) ) +with expansion: + 1.23 != Approx( 1.24 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d == 1.23_a ) +with expansion: + 1.23 == Approx( 1.23 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != 1.22_a ) +with expansion: + 1.23 != Approx( 1.22 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( Approx( d ) == 1.23 ) +with expansion: + Approx( 1.23 ) == 1.23 + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( Approx( d ) != 1.22 ) +with expansion: + Approx( 1.23 ) != 1.22 + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( Approx( d ) != 1.24 ) +with expansion: + Approx( 1.23 ) != 1.24 + +------------------------------------------------------------------------------- +Standard output from all sections is reported + one +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'one' + +------------------------------------------------------------------------------- +Standard output from all sections is reported + two +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'two' + +------------------------------------------------------------------------------- +StartsWith string matcher +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: FAILED: + CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "This String" + +Matchers.tests.cpp:<line number>: FAILED: + CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "string" (case + insensitive) + +------------------------------------------------------------------------------- +Static arrays are convertible to string + Single item +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::Detail::stringify(singular) == "{ 1 }" ) +with expansion: + "{ 1 }" == "{ 1 }" + +------------------------------------------------------------------------------- +Static arrays are convertible to string + Multiple +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" ) +with expansion: + "{ 3, 2, 1 }" == "{ 3, 2, 1 }" + +------------------------------------------------------------------------------- +Static arrays are convertible to string + Non-trivial inner items +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" ) +with expansion: + "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" + == + "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" + +------------------------------------------------------------------------------- +String matchers +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "string" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "string" (case + insensitive) + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "abc" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "abc" + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "abc" (case + insensitive) + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "this" + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "this" (case + insensitive) + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "substring" + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: " substring" (case + insensitive) + +------------------------------------------------------------------------------- +StringRef + Empty string +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( empty.empty() ) +with expansion: + true + +String.tests.cpp:<line number>: PASSED: + REQUIRE( empty.size() == 0 ) +with expansion: + 0 == 0 + +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp( empty.data(), "" ) == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +StringRef + From string literal +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.empty() == false ) +with expansion: + false == false + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.size() == 5 ) +with expansion: + 5 == 5 + +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp( rawChars, "hello" ) == 0 ) +with expansion: + 0 == 0 + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.data() == rawChars ) +with expansion: + "hello" == "hello" + +------------------------------------------------------------------------------- +StringRef + From sub-string +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original == "original" ) + +String.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( original.data() ) + +------------------------------------------------------------------------------- +StringRef + Copy construction is shallow +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original.begin() == copy.begin() ) with expansion: - 1.23 != Approx( 1.22 ) + "original string" == "original string" -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( d != Approx( 1.24 ) ) -with expansion: - 1.23 != Approx( 1.24 ) +------------------------------------------------------------------------------- +StringRef + Copy assignment is shallow +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( d == 1.23_a ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( original.begin() == copy.begin() ) with expansion: - 1.23 == Approx( 1.23 ) + "original string" == "original string" -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( d != 1.22_a ) +------------------------------------------------------------------------------- +StringRef + Substrings + zero-based substring +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss.empty() == false ) with expansion: - 1.23 != Approx( 1.22 ) + false == false -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( Approx( d ) == 1.23 ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss.size() == 5 ) with expansion: - Approx( 1.23 ) == 1.23 + 5 == 5 -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( Approx( d ) != 1.22 ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strncmp( ss.data(), "hello", 5 ) == 0 ) with expansion: - Approx( 1.23 ) != 1.22 + 0 == 0 -Approx.tests.cpp:<line number>: PASSED: - REQUIRE( Approx( d ) != 1.24 ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss == "hello" ) with expansion: - Approx( 1.23 ) != 1.24 + hello == "hello" ------------------------------------------------------------------------------- -Standard output from all sections is reported - one +StringRef + Substrings + non-zero-based substring ------------------------------------------------------------------------------- -Message.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss.size() == 6 ) +with expansion: + 6 == 6 -No assertions in section 'one' +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp( ss.data(), "world!" ) == 0 ) +with expansion: + 0 == 0 ------------------------------------------------------------------------------- -Standard output from all sections is reported - two +StringRef + Substrings + Pointer values of full refs should match ------------------------------------------------------------------------------- -Message.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... - -No assertions in section 'two' +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.data() == s2.data() ) +with expansion: + "hello world!" == "hello world!" ------------------------------------------------------------------------------- -StartsWith string matcher +StringRef + Substrings + Pointer values of substring refs should also match ------------------------------------------------------------------------------- -Matchers.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) -with expansion: - "this string contains 'abc' as a substring" starts with: "This String" - -Matchers.tests.cpp:<line number>: FAILED: - CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.data() == ss.data() ) with expansion: - "this string contains 'abc' as a substring" starts with: "string" (case - insensitive) + "hello world!" == "hello world!" ------------------------------------------------------------------------------- -Static arrays are convertible to string - Single item +StringRef + Substrings + Past the end substring ------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( Catch::Detail::stringify(singular) == "{ 1 }" ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.substr(s.size() + 1, 123).empty() ) with expansion: - "{ 1 }" == "{ 1 }" + true ------------------------------------------------------------------------------- -Static arrays are convertible to string - Multiple +StringRef + Substrings + Substring off the end are trimmed ------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp(ss.data(), "world!") == 0 ) with expansion: - "{ 3, 2, 1 }" == "{ 3, 2, 1 }" + 0 == 0 ------------------------------------------------------------------------------- -Static arrays are convertible to string - Non-trivial inner items +StringRef + Substrings + substring start after the end is empty ------------------------------------------------------------------------------- -ToStringGeneral.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -ToStringGeneral.tests.cpp:<line number>: PASSED: - REQUIRE( Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.substr(1'000'000, 1).empty() ) with expansion: - "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" - == - "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" + true ------------------------------------------------------------------------------- -String matchers +StringRef + Comparisons are deep ------------------------------------------------------------------------------- -Matchers.tests.cpp:<line number> +String.tests.cpp:<line number> ............................................................................... -Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string" ) ) +String.tests.cpp:<line number>: PASSED: + CHECK( reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) ) with expansion: - "this string contains 'abc' as a substring" contains: "string" + "Hello" != "Hello" -Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( testStringForMatching(), ContainsSubstring( "string", Catch::CaseSensitive::No ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( left == right ) with expansion: - "this string contains 'abc' as a substring" contains: "string" (case - insensitive) + Hello == Hello -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), ContainsSubstring( "abc" ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( left != left.substr(0, 3) ) with expansion: - "this string contains 'abc' as a substring" contains: "abc" + Hello != Hel -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), ContainsSubstring( "aBC", Catch::CaseSensitive::No ) ) -with expansion: - "this string contains 'abc' as a substring" contains: "abc" (case - insensitive) +------------------------------------------------------------------------------- +StringRef + from std::string + implicitly constructed +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( sr == "a standard string" ) with expansion: - "this string contains 'abc' as a substring" starts with: "this" + a standard string == "a standard string" -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( sr.size() == stdStr.size() ) with expansion: - "this string contains 'abc' as a substring" starts with: "this" (case - insensitive) + 17 == 17 -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ) +------------------------------------------------------------------------------- +StringRef + from std::string + explicitly constructed +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( sr == "a standard string" ) with expansion: - "this string contains 'abc' as a substring" ends with: "substring" + a standard string == "a standard string" -Matchers.tests.cpp:<line number>: PASSED: - CHECK_THAT( testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) ) +String.tests.cpp:<line number>: PASSED: + REQUIRE( sr.size() == stdStr.size() ) with expansion: - "this string contains 'abc' as a substring" ends with: " substring" (case - insensitive) + 17 == 17 ------------------------------------------------------------------------------- StringRef - Empty string + from std::string + assigned ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( empty.empty() ) -with expansion: - true - -String.tests.cpp:<line number>: PASSED: - REQUIRE( empty.size() == 0 ) + REQUIRE( sr == "a standard string" ) with expansion: - 0 == 0 + a standard string == "a standard string" String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp( empty.data(), "" ) == 0 ) + REQUIRE( sr.size() == stdStr.size() ) with expansion: - 0 == 0 + 17 == 17 ------------------------------------------------------------------------------- StringRef - From string literal + to std::string + explicitly constructed ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( s.empty() == false ) + REQUIRE( stdStr == "a stringref" ) with expansion: - false == false + "a stringref" == "a stringref" String.tests.cpp:<line number>: PASSED: - REQUIRE( s.size() == 5 ) + REQUIRE( stdStr.size() == sr.size() ) with expansion: - 5 == 5 + 11 == 11 + +------------------------------------------------------------------------------- +StringRef + to std::string + assigned +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp( rawChars, "hello" ) == 0 ) + REQUIRE( stdStr == "a stringref" ) with expansion: - 0 == 0 + "a stringref" == "a stringref" String.tests.cpp:<line number>: PASSED: - REQUIRE( s.data() == rawChars ) + REQUIRE( stdStr.size() == sr.size() ) with expansion: - "hello" == "hello" + 11 == 11 ------------------------------------------------------------------------------- StringRef - From sub-string + std::string += StringRef ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( original == "original" ) - -String.tests.cpp:<line number>: PASSED: - REQUIRE_NOTHROW( original.data() ) + REQUIRE( lhs == "some string += the stringref contents" ) +with expansion: + "some string += the stringref contents" + == + "some string += the stringref contents" ------------------------------------------------------------------------------- StringRef - Copy construction is shallow + StringRef + StringRef ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( original.begin() == copy.begin() ) + REQUIRE( together == "abrakadabra" ) with expansion: - "original string" == "original string" + "abrakadabra" == "abrakadabra" ------------------------------------------------------------------------------- -StringRef - Copy assignment is shallow +StringRef at compilation time + Simple constructors ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( original.begin() == copy.begin() ) -with expansion: - "original string" == "original string" +with message: + empty.size() == 0 + +String.tests.cpp:<line number>: PASSED: +with message: + empty.begin() == empty.end() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.size() == 3 + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.data() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.begin() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.begin() != stringref.end() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.substr(10, 0).empty() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.substr(2, 1).data() == abc + 2 + +String.tests.cpp:<line number>: PASSED: +with message: + stringref[1] == 'b' + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.size() == 2 + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.data() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.begin() != shortened.end() ------------------------------------------------------------------------------- -StringRef - Substrings - zero-based substring +StringRef at compilation time + UDL construction ------------------------------------------------------------------------------- String.tests.cpp:<line number> ............................................................................... String.tests.cpp:<line number>: PASSED: - REQUIRE( ss.empty() == false ) -with expansion: - false == false +with message: + !(sr1.empty()) String.tests.cpp:<line number>: PASSED: - REQUIRE( ss.size() == 5 ) -with expansion: - 5 == 5 +with message: + sr1.size() == 3 String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strncmp( ss.data(), "hello", 5 ) == 0 ) -with expansion: - 0 == 0 +with message: + sr2.empty() String.tests.cpp:<line number>: PASSED: - REQUIRE( ss == "hello" ) +with message: + sr2.size() == 0 + +------------------------------------------------------------------------------- +Stringifying char arrays with statically known sizes - char +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) with expansion: - hello == "hello" + ""abc"" == ""abc"" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" ------------------------------------------------------------------------------- -StringRef - Substrings - non-zero-based substring +Stringifying char arrays with statically known sizes - signed char ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToString.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( ss.size() == 6 ) +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) with expansion: - 6 == 6 + ""abc"" == ""abc"" -String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp( ss.data(), "world!" ) == 0 ) +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) with expansion: - 0 == 0 + ""abc"" == ""abc"" ------------------------------------------------------------------------------- -StringRef - Substrings - Pointer values of full refs should match +Stringifying char arrays with statically known sizes - unsigned char ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToString.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.data() == s2.data() ) +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) with expansion: - "hello world!" == "hello world!" + ""abc"" == ""abc"" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +with expansion: + ""abc"" == ""abc"" ------------------------------------------------------------------------------- -StringRef - Substrings - Pointer values of substring refs should also match +Stringifying std::chrono::duration helpers ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToStringChrono.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.data() == ss.data() ) +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( minute == seconds ) with expansion: - "hello world!" == "hello world!" + 1 m == 60 s + +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( hour != seconds ) +with expansion: + 1 h != 60 s + +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( micro != milli ) +with expansion: + 1 us != 1 ms + +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( nano != micro ) +with expansion: + 1 ns != 1 us ------------------------------------------------------------------------------- -StringRef - Substrings - Past the end substring +Stringifying std::chrono::duration with weird ratios ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToStringChrono.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.substr(s.size() + 1, 123).empty() ) +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( half_minute != femto_second ) with expansion: - true + 1 [30/1]s != 1 fs + +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( pico_second != atto_second ) +with expansion: + 1 ps != 1 as ------------------------------------------------------------------------------- -StringRef - Substrings - Substring off the end are trimmed +Stringifying std::chrono::time_point<system_clock> ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +ToStringChrono.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( std::strcmp(ss.data(), "world!") == 0 ) +ToStringChrono.tests.cpp:<line number>: PASSED: + REQUIRE( now != later ) with expansion: - 0 == 0 + {iso8601-timestamp} + != + {iso8601-timestamp} ------------------------------------------------------------------------------- -StringRef - Substrings - substring start after the end is empty +Tabs and newlines show in output ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( s.substr(1'000'000, 1).empty() ) +Misc.tests.cpp:<line number>: FAILED: + CHECK( s1 == s2 ) with expansion: - true + "if ($b == 10) { + $a = 20; + }" + == + "if ($b == 10) { + $a = 20; + } + " ------------------------------------------------------------------------------- -StringRef - Comparisons are deep +Tag alias can be registered against tag patterns + The same tag alias can only be registered once ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Tag.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - CHECK( reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) ) +Tag.tests.cpp:<line number>: PASSED: + CHECK_THAT( what, ContainsSubstring( "[@zzz]" ) ) with expansion: - "Hello" != "Hello" + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "[@zzz]" -String.tests.cpp:<line number>: PASSED: - REQUIRE( left == right ) +Tag.tests.cpp:<line number>: PASSED: + CHECK_THAT( what, ContainsSubstring( "file" ) ) with expansion: - Hello == Hello + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "file" -String.tests.cpp:<line number>: PASSED: - REQUIRE( left != left.substr(0, 3) ) +Tag.tests.cpp:<line number>: PASSED: + CHECK_THAT( what, ContainsSubstring( "2" ) ) with expansion: - Hello != Hel + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "2" + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THAT( what, ContainsSubstring( "10" ) ) +with expansion: + "error: tag alias, '[@zzz]' already registered. + First seen at: file:2 + Redefined at: file:10" contains: "10" ------------------------------------------------------------------------------- -StringRef - from std::string - implicitly constructed +Tag alias can be registered against tag patterns + Tag aliases must be of the form [@name] ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Tag.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr == "a standard string" ) -with expansion: - a standard string == "a standard string" +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) ) -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr.size() == stdStr.size() ) -with expansion: - 17 == 17 +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) ) ------------------------------------------------------------------------------- -StringRef - from std::string - explicitly constructed +Tags with spaces and non-alphanumerical characters are accepted ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Tag.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr == "a standard string" ) +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags.size() == 2 ) with expansion: - a standard string == "a standard string" + 2 == 2 -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr.size() == stdStr.size() ) +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) ) with expansion: - 17 == 17 + { {?}, {?} } ( Contains: {?} and Contains: {?} ) ------------------------------------------------------------------------------- -StringRef - from std::string - assigned +Template test case method with test types specified inside std::tuple - MyTypes +- 0 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Class.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr == "a standard string" ) -with expansion: - a standard string == "a standard string" - -String.tests.cpp:<line number>: PASSED: - REQUIRE( sr.size() == stdStr.size() ) +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) with expansion: - 17 == 17 + 1 == 1 ------------------------------------------------------------------------------- -StringRef - to std::string - explicitly constructed +Template test case method with test types specified inside std::tuple - MyTypes +- 1 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Class.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( stdStr == "a stringref" ) -with expansion: - "a stringref" == "a stringref" - -String.tests.cpp:<line number>: PASSED: - REQUIRE( stdStr.size() == sr.size() ) +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) with expansion: - 11 == 11 + 1 == 1 ------------------------------------------------------------------------------- -StringRef - to std::string - assigned +Template test case method with test types specified inside std::tuple - MyTypes +- 2 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Class.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( stdStr == "a stringref" ) -with expansion: - "a stringref" == "a stringref" - -String.tests.cpp:<line number>: PASSED: - REQUIRE( stdStr.size() == sr.size() ) +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) with expansion: - 11 == 11 + 1.0 == 1 ------------------------------------------------------------------------------- -StringRef - std::string += StringRef +Template test case with test types specified inside non-copyable and non- +movable std::tuple - NonCopyableAndNonMovableTypes - 0 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( lhs == "some string += the stringref contents" ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - "some string += the stringref contents" - == - "some string += the stringref contents" + 1 > 0 ------------------------------------------------------------------------------- -StringRef - StringRef + StringRef +Template test case with test types specified inside non-copyable and non- +movable std::tuple - NonCopyableAndNonMovableTypes - 1 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: - REQUIRE( together == "abrakadabra" ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - "abrakadabra" == "abrakadabra" + 4 > 0 ------------------------------------------------------------------------------- -StringRef at compilation time - Simple constructors +Template test case with test types specified inside non-default-constructible +std::tuple - MyNonDefaultConstructibleTypes - 0 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: -with message: - empty.size() == 0 - -String.tests.cpp:<line number>: PASSED: -with message: - empty.begin() == empty.end() - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.size() == 3 - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.data() == abc - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.begin() == abc - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.begin() != stringref.end() - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.substr(10, 0).empty() - -String.tests.cpp:<line number>: PASSED: -with message: - stringref.substr(2, 1).data() == abc + 2 - -String.tests.cpp:<line number>: PASSED: -with message: - stringref[1] == 'b' - -String.tests.cpp:<line number>: PASSED: -with message: - shortened.size() == 2 - -String.tests.cpp:<line number>: PASSED: -with message: - shortened.data() == abc - -String.tests.cpp:<line number>: PASSED: -with message: - shortened.begin() != shortened.end() +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 1 > 0 ------------------------------------------------------------------------------- -StringRef at compilation time - UDL construction +Template test case with test types specified inside non-default-constructible +std::tuple - MyNonDefaultConstructibleTypes - 1 ------------------------------------------------------------------------------- -String.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -String.tests.cpp:<line number>: PASSED: -with message: - !(sr1.empty()) - -String.tests.cpp:<line number>: PASSED: -with message: - sr1.size() == 3 - -String.tests.cpp:<line number>: PASSED: -with message: - sr2.empty() - -String.tests.cpp:<line number>: PASSED: -with message: - sr2.size() == 0 +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 4 > 0 ------------------------------------------------------------------------------- -Stringifying char arrays with statically known sizes - char +Template test case with test types specified inside std::tuple - MyTypes - 0 ------------------------------------------------------------------------------- -ToString.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) -with expansion: - ""abc"" == ""abc"" - -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - ""abc"" == ""abc"" + 4 > 0 ------------------------------------------------------------------------------- -Stringifying char arrays with statically known sizes - signed char +Template test case with test types specified inside std::tuple - MyTypes - 1 ------------------------------------------------------------------------------- -ToString.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) -with expansion: - ""abc"" == ""abc"" - -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - ""abc"" == ""abc"" + 1 > 0 ------------------------------------------------------------------------------- -Stringifying char arrays with statically known sizes - unsigned char +Template test case with test types specified inside std::tuple - MyTypes - 2 ------------------------------------------------------------------------------- -ToString.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s ) -with expansion: - ""abc"" == ""abc"" - -ToString.tests.cpp:<line number>: PASSED: - CHECK( ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) with expansion: - ""abc"" == ""abc"" + 4 > 0 ------------------------------------------------------------------------------- -Stringifying std::chrono::duration helpers +TemplateTest: vectors can be sized and resized - float ------------------------------------------------------------------------------- -ToStringChrono.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( minute == seconds ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 1 m == 60 s + 5 == 5 -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( hour != seconds ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) with expansion: - 1 h != 60 s + 5 >= 5 -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( micro != milli ) +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float + resizing bigger changes size and capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 10 ) with expansion: - 1 us != 1 ms + 10 == 10 -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( nano != micro ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 10 ) with expansion: - 1 ns != 1 us + 10 >= 10 ------------------------------------------------------------------------------- -Stringifying std::chrono::duration with weird ratios +TemplateTest: vectors can be sized and resized - float ------------------------------------------------------------------------------- -ToStringChrono.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( half_minute != femto_second ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 1 [30/1]s != 1 fs + 5 == 5 -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( pico_second != atto_second ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) with expansion: - 1 ps != 1 as + 5 >= 5 ------------------------------------------------------------------------------- -Stringifying std::chrono::time_point<system_clock> +TemplateTest: vectors can be sized and resized - float + resizing smaller changes size but not capacity ------------------------------------------------------------------------------- -ToStringChrono.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -ToStringChrono.tests.cpp:<line number>: PASSED: - REQUIRE( now != later ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 0 ) with expansion: - {iso8601-timestamp} - != - {iso8601-timestamp} + 0 == 0 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Tabs and newlines show in output +TemplateTest: vectors can be sized and resized - float + resizing smaller changes size but not capacity + We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: FAILED: - CHECK( s1 == s2 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() == 0 ) with expansion: - "if ($b == 10) { - $a = 20; - }" - == - "if ($b == 10) { - $a = 20; - } - " + 0 == 0 ------------------------------------------------------------------------------- -Tag alias can be registered against tag patterns - The same tag alias can only be registered once +TemplateTest: vectors can be sized and resized - float ------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, ContainsSubstring( "[@zzz]" ) ) -with expansion: - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "[@zzz]" - -Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, ContainsSubstring( "file" ) ) -with expansion: - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "file" - -Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, ContainsSubstring( "2" ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "2" + 5 == 5 -Tag.tests.cpp:<line number>: PASSED: - CHECK_THAT( what, ContainsSubstring( "10" ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) with expansion: - "error: tag alias, '[@zzz]' already registered. - First seen at: file:2 - Redefined at: file:10" contains: "10" + 5 >= 5 ------------------------------------------------------------------------------- -Tag alias can be registered against tag patterns - Tag aliases must be of the form [@name] +TemplateTest: vectors can be sized and resized - float + reserving bigger changes capacity but not size ------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Tag.tests.cpp:<line number>: PASSED: - CHECK_THROWS( registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) ) - -Tag.tests.cpp:<line number>: PASSED: - CHECK_THROWS( registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) - -Tag.tests.cpp:<line number>: PASSED: - CHECK_THROWS( registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 -Tag.tests.cpp:<line number>: PASSED: - CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 ------------------------------------------------------------------------------- -Tags with spaces and non-alphanumerical characters are accepted +TemplateTest: vectors can be sized and resized - float ------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Tag.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.tags.size() == 2 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 2 == 2 + 5 == 5 -Tag.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) with expansion: - { {?}, {?} } ( Contains: {?} and Contains: {?} ) + 5 >= 5 ------------------------------------------------------------------------------- -Template test case method with test types specified inside std::tuple - MyTypes -- 0 +TemplateTest: vectors can be sized and resized - float + reserving smaller does not change size or capacity ------------------------------------------------------------------------------- -Class.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Class.tests.cpp:<line number>: PASSED: - REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 1 == 1 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case method with test types specified inside std::tuple - MyTypes -- 1 +TemplateTest: vectors can be sized and resized - int ------------------------------------------------------------------------------- -Class.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Class.tests.cpp:<line number>: PASSED: - REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 5 ) with expansion: - 1 == 1 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case method with test types specified inside std::tuple - MyTypes -- 2 +TemplateTest: vectors can be sized and resized - int + resizing bigger changes size and capacity ------------------------------------------------------------------------------- -Class.tests.cpp:<line number> +Misc.tests.cpp:<line number> ............................................................................... -Class.tests.cpp:<line number>: PASSED: - REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 10 ) with expansion: - 1.0 == 1 + 10 == 10 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 ------------------------------------------------------------------------------- -Template test case with test types specified inside non-copyable and non- -movable std::tuple - NonCopyableAndNonMovableTypes - 0 +TemplateTest: vectors can be sized and resized - int ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 1 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case with test types specified inside non-copyable and non- -movable std::tuple - NonCopyableAndNonMovableTypes - 1 +TemplateTest: vectors can be sized and resized - int + resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 0 ) with expansion: - 4 > 0 + 0 == 0 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case with test types specified inside non-default-constructible -std::tuple - MyNonDefaultConstructibleTypes - 0 +TemplateTest: vectors can be sized and resized - int + resizing smaller changes size but not capacity + We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.capacity() == 0 ) with expansion: - 1 > 0 + 0 == 0 ------------------------------------------------------------------------------- -Template test case with test types specified inside non-default-constructible -std::tuple - MyNonDefaultConstructibleTypes - 1 +TemplateTest: vectors can be sized and resized - int ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 4 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case with test types specified inside std::tuple - MyTypes - 0 +TemplateTest: vectors can be sized and resized - int + reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 4 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 ------------------------------------------------------------------------------- -Template test case with test types specified inside std::tuple - MyTypes - 1 +TemplateTest: vectors can be sized and resized - int ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 1 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -Template test case with test types specified inside std::tuple - MyTypes - 2 +TemplateTest: vectors can be sized and resized - int + reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( sizeof(TestType) > 0 ) + REQUIRE( v.size() == 5 ) with expansion: - 4 > 0 + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12145,7 +11573,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12162,7 +11590,7 @@ with expansion: 10 >= 10 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12178,7 +11606,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12195,7 +11623,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12208,7 +11636,7 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12224,7 +11652,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12241,7 +11669,7 @@ with expansion: 10 >= 10 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12257,7 +11685,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - float +TemplateTest: vectors can be sized and resized - std::string reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12274,7 +11702,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12290,7 +11718,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12307,7 +11735,7 @@ with expansion: 10 >= 10 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12323,7 +11751,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12340,7 +11768,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12353,7 +11781,7 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12369,7 +11797,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12386,7 +11814,7 @@ with expansion: 10 >= 10 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12402,7 +11830,7 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - int +TemplateTest: vectors can be sized and resized - std::tuple<int,float> reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12419,56 +11847,56 @@ with expansion: 5 >= 5 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 10 ) + REQUIRE( v.size() == 2 * V ) with expansion: - 10 == 10 + 12 == 12 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 10 ) + REQUIRE( v.capacity() >= 2 * V ) with expansion: - 10 >= 10 + 12 >= 12 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12480,12 +11908,12 @@ with expansion: 0 == 0 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12498,122 +11926,122 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 10 ) + REQUIRE( v.capacity() >= 2 * V ) with expansion: - 10 >= 10 + 12 >= 12 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::string +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 6 == 6 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 6 >= 6 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 10 ) + REQUIRE( v.size() == 2 * V ) with expansion: - 10 == 10 + 8 == 8 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 10 ) + REQUIRE( v.capacity() >= 2 * V ) with expansion: - 10 >= 10 + 8 >= 8 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12625,12 +12053,12 @@ with expansion: 0 == 0 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12643,73 +12071,73 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 10 ) + REQUIRE( v.capacity() >= 2 * V ) with expansion: - 10 >= 10 + 8 >= 8 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTest: vectors can be sized and resized - std::tuple<int,float> +TemplateTestSig: vectors can be sized and resized - float,4 reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 5 ) + REQUIRE( v.size() == V ) with expansion: - 5 == 5 + 4 == 4 Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 5 ) + REQUIRE( v.capacity() >= V ) with expansion: - 5 >= 5 + 4 >= 4 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12717,15 +12145,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12734,15 +12162,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == 2 * V ) with expansion: - 12 == 12 + 10 == 10 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= 2 * V ) with expansion: - 12 >= 12 + 10 >= 10 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12750,15 +12178,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12772,10 +12200,10 @@ with expansion: Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12788,7 +12216,7 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12796,15 +12224,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12813,15 +12241,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= 2 * V ) with expansion: - 12 >= 12 + 10 >= 10 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12829,15 +12257,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +TemplateTestSig: vectors can be sized and resized - int,5 reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12846,15 +12274,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 6 == 6 + 5 == 5 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 6 >= 6 + 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12862,15 +12290,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 resizing bigger changes size and capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12879,15 +12307,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == 2 * V ) with expansion: - 8 == 8 + 30 == 30 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= 2 * V ) with expansion: - 8 >= 8 + 30 >= 30 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12895,15 +12323,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 resizing smaller changes size but not capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12917,10 +12345,10 @@ with expansion: Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 resizing smaller changes size but not capacity We can use the 'swap trick' to reset the capacity ------------------------------------------------------------------------------- @@ -12933,7 +12361,7 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12941,15 +12369,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 reserving bigger changes capacity but not size ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12958,15 +12386,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= 2 * V ) with expansion: - 8 >= 8 + 30 >= 30 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... @@ -12974,15 +12402,15 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - float,4 +TemplateTestSig: vectors can be sized and resized - std::string,15 reserving smaller does not change size or capacity ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> @@ -12991,527 +12419,604 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.size() == V ) with expansion: - 4 == 4 + 15 == 15 Misc.tests.cpp:<line number>: PASSED: REQUIRE( v.capacity() >= V ) with expansion: - 4 >= 4 + 15 >= 15 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 +Test case with identical tags keeps just one ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +Tag.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags.size() == 1 ) with expansion: - 5 == 5 + 1 == 1 -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +Tag.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.tags[0] == Tag( "tag1" ) ) with expansion: - 5 >= 5 + {?} == {?} ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - resizing bigger changes size and capacity +Test case with one argument ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +VariadicMacros.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 2 * V ) -with expansion: - 10 == 10 +VariadicMacros.tests.cpp:<line number>: PASSED: +with message: + no assertions -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 2 * V ) +------------------------------------------------------------------------------- +Test enum bit values +------------------------------------------------------------------------------- +Tricky.tests.cpp:<line number> +............................................................................... + +Tricky.tests.cpp:<line number>: PASSED: + REQUIRE( 0x<hex digits> == bit30and31 ) with expansion: - 10 >= 10 + 3221225472 (0x<hex digits>) == 3221225472 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 +Test with special, characters "in name +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +Testing checked-if ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) -with expansion: - 5 == 5 + CHECKED_IF( true ) + +Misc.tests.cpp:<line number>: PASSED: + +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_IF( false ) + +Misc.tests.cpp:<line number>: PASSED: + CHECKED_ELSE( true ) + +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_ELSE( false ) Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) -with expansion: - 5 >= 5 ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - resizing smaller changes size but not capacity +Testing checked-if 2 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 0 ) -with expansion: - 0 == 0 + CHECKED_IF( true ) -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) -with expansion: - 5 >= 5 +Misc.tests.cpp:<line number>: FAILED: ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - resizing smaller changes size but not capacity - We can use the 'swap trick' to reset the capacity +Testing checked-if 3 ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() == 0 ) -with expansion: - 0 == 0 +Misc.tests.cpp:<line number>: FAILED - but was ok: + CHECKED_ELSE( false ) + +Misc.tests.cpp:<line number>: FAILED: ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 +The NO_FAIL macro reports a failure but does not fail the test ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +Message.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) -with expansion: - 5 == 5 +Message.tests.cpp:<line number>: FAILED - but was ok: + CHECK_NOFAIL( 1 == 2 ) -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) -with expansion: - 5 >= 5 + +No assertions in test case 'The NO_FAIL macro reports a failure but does not fail the test' ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - reserving bigger changes capacity but not size +The default listing implementation write to provided stream + Listing tags ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +Reporters.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring("[fakeTag]"s) ) with expansion: - 5 == 5 + "All available tags: + 1 [fakeTag] + 1 tag -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 2 * V ) +" contains: "[fakeTag]" + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) ) with expansion: - 10 >= 10 + "Available reporters: + fake reporter: fake description + +" ( contains: "fake reporter" and contains: "fake description" ) ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 +The default listing implementation write to provided stream + Listing tests ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +Reporters.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) with expansion: - 5 == 5 + "All available test cases: + fake test name + [fakeTestTag] + 1 test case -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +" ( contains: "fake test name" and contains: "fakeTestTag" ) + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing listeners +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) ) with expansion: - 5 >= 5 + "Registered listeners: + fakeListener: fake description + +" ( contains: "fakeListener" and contains: "fake description" ) ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - int,5 - reserving smaller does not change size or capacity +This test 'should' fail but doesn't ------------------------------------------------------------------------------- Misc.tests.cpp:<line number> ............................................................................... Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) -with expansion: - 5 == 5 +with message: + oops! -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) -with expansion: - 5 >= 5 +------------------------------------------------------------------------------- +Thrown string literals are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + For some reason someone is throwing a string literal! ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 +Tracker ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) with expansion: - 15 >= 15 + true ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - resizing bigger changes size and capacity +Tracker + successfully close one section ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 2 * V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isSuccessfullyCompleted() ) with expansion: - 30 == 30 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 2 * V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) with expansion: - 30 >= 30 - -------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... + false == false -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() ) with expansion: - 15 >= 15 + true ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - resizing smaller changes size but not capacity +Tracker ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == 0 ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) with expansion: - 0 == 0 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) with expansion: - 15 >= 15 + true ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - resizing smaller changes size but not capacity - We can use the 'swap trick' to reset the capacity +Tracker + fail one section ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() == 0 ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isComplete() ) with expansion: - 0 == 0 - -------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isSuccessfullyCompleted() == false ) with expansion: - 15 == 15 + false == false -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) with expansion: - 15 >= 15 - -------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - reserving bigger changes capacity but not size -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... + false == false -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= 2 * V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() == false ) with expansion: - 30 >= 30 + false == false ------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 +Tracker + fail one section + re-enter after failed section ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isOpen() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1b.isOpen() == false ) with expansion: - 15 >= 15 + false == false -------------------------------------------------------------------------------- -TemplateTestSig: vectors can be sized and resized - std::string,15 - reserving smaller does not change size or capacity -------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) +with expansion: + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.size() == V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() ) with expansion: - 15 == 15 + true -Misc.tests.cpp:<line number>: PASSED: - REQUIRE( v.capacity() >= V ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() ) with expansion: - 15 >= 15 + true ------------------------------------------------------------------------------- -Test case with identical tags keeps just one +Tracker ------------------------------------------------------------------------------- -Tag.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Tag.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.tags.size() == 1 ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) with expansion: - 1 == 1 + true -Tag.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.tags[0] == Tag( "tag1" ) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) with expansion: - {?} == {?} + true ------------------------------------------------------------------------------- -Test case with one argument +Tracker + fail one section ------------------------------------------------------------------------------- -VariadicMacros.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -VariadicMacros.tests.cpp:<line number>: PASSED: -with message: - no assertions +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isComplete() ) +with expansion: + true -------------------------------------------------------------------------------- -Test enum bit values -------------------------------------------------------------------------------- -Tricky.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isSuccessfullyCompleted() == false ) +with expansion: + false == false -Tricky.tests.cpp:<line number>: PASSED: - REQUIRE( 0x<hex digits> == bit30and31 ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) with expansion: - 3221225472 (0x<hex digits>) == 3221225472 + false == false -------------------------------------------------------------------------------- -Test with special, characters "in name -------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) +with expansion: + true -CmdLine.tests.cpp:<line number>: PASSED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() == false ) +with expansion: + false == false ------------------------------------------------------------------------------- -Testing checked-if +Tracker + fail one section + re-enter after failed section and find next section ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - CHECKED_IF( true ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isOpen() ) +with expansion: + true -Misc.tests.cpp:<line number>: PASSED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1b.isOpen() == false ) +with expansion: + false == false -Misc.tests.cpp:<line number>: FAILED - but was ok: - CHECKED_IF( false ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2.isOpen() ) +with expansion: + true -Misc.tests.cpp:<line number>: PASSED: - CHECKED_ELSE( true ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) +with expansion: + true -Misc.tests.cpp:<line number>: FAILED - but was ok: - CHECKED_ELSE( false ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() ) +with expansion: + true -Misc.tests.cpp:<line number>: PASSED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isSuccessfullyCompleted() ) +with expansion: + true ------------------------------------------------------------------------------- -Testing checked-if 2 +Tracker ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: - CHECKED_IF( true ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) +with expansion: + true -Misc.tests.cpp:<line number>: FAILED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) +with expansion: + true ------------------------------------------------------------------------------- -Testing checked-if 3 +Tracker + successfully close one section, then find another ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: FAILED - but was ok: - CHECKED_ELSE( false ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2.isOpen() == false ) +with expansion: + false == false -Misc.tests.cpp:<line number>: FAILED: +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) +with expansion: + false == false ------------------------------------------------------------------------------- -The NO_FAIL macro reports a failure but does not fail the test +Tracker + successfully close one section, then find another + Re-enter - skips S1 and enters S2 ------------------------------------------------------------------------------- -Message.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Message.tests.cpp:<line number>: FAILED - but was ok: - CHECK_NOFAIL( 1 == 2 ) - - -No assertions in test case 'The NO_FAIL macro reports a failure but does not fail the test' +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isOpen() ) +with expansion: + true -------------------------------------------------------------------------------- -The default listing implementation write to provided stream - Listing tags -------------------------------------------------------------------------------- -Reporters.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1b.isOpen() == false ) +with expansion: + false == false -Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, ContainsSubstring("[fakeTag]"s) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2b.isOpen() ) with expansion: - "All available tags: - 1 [fakeTag] - 1 tag + true -" contains: "[fakeTag]" +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() == false ) +with expansion: + false == false ------------------------------------------------------------------------------- -The default listing implementation write to provided stream - Listing reporters +Tracker + successfully close one section, then find another + Re-enter - skips S1 and enters S2 + Successfully close S2 ------------------------------------------------------------------------------- -Reporters.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, ContainsSubstring( "fake reporter"s ) && ContainsSubstring( "fake description"s ) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() ) with expansion: - "Available reporters: - fake reporter: fake description - -" ( contains: "fake reporter" and contains: "fake description" ) + true -------------------------------------------------------------------------------- -The default listing implementation write to provided stream - Listing tests -------------------------------------------------------------------------------- -Reporters.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2b.isSuccessfullyCompleted() ) +with expansion: + true -Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, ContainsSubstring( "fake test name"s ) && ContainsSubstring( "fakeTestTag"s ) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isComplete() == false ) with expansion: - "All available test cases: - fake test name - [fakeTestTag] - 1 test case + false == false -" ( contains: "fake test name" and contains: "fakeTestTag" ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase2.isSuccessfullyCompleted() ) +with expansion: + true ------------------------------------------------------------------------------- -The default listing implementation write to provided stream - Listing listeners +Tracker ------------------------------------------------------------------------------- -Reporters.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Reporters.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( listingString, ContainsSubstring( "fakeListener"s ) && ContainsSubstring( "fake description"s ) ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isOpen() ) with expansion: - "Registered listeners: - fakeListener: fake description + true -" ( contains: "fakeListener" and contains: "fake description" ) +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s1.isOpen() ) +with expansion: + true ------------------------------------------------------------------------------- -This test 'should' fail but doesn't +Tracker + successfully close one section, then find another ------------------------------------------------------------------------------- -Misc.tests.cpp:<line number> +PartTracker.tests.cpp:<line number> ............................................................................... -Misc.tests.cpp:<line number>: PASSED: -with message: - oops! - -------------------------------------------------------------------------------- -Thrown string literals are translated -------------------------------------------------------------------------------- -Exception.tests.cpp:<line number> -............................................................................... +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2.isOpen() == false ) +with expansion: + false == false -Exception.tests.cpp:<line number>: FAILED: -due to unexpected exception with message: - For some reason someone is throwing a string literal! +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() == false ) +with expansion: + false == false ------------------------------------------------------------------------------- Tracker + successfully close one section, then find another + Re-enter - skips S1 and enters S2 ------------------------------------------------------------------------------- PartTracker.tests.cpp:<line number> ............................................................................... PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) + REQUIRE( testCase2.isOpen() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) + REQUIRE( s1b.isOpen() == false ) +with expansion: + false == false + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2b.isOpen() ) with expansion: true +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( ctx.completedCycle() == false ) +with expansion: + false == false + ------------------------------------------------------------------------------- Tracker - successfully close one section + successfully close one section, then find another + Re-enter - skips S1 and enters S2 + fail S2 ------------------------------------------------------------------------------- PartTracker.tests.cpp:<line number> ............................................................................... PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isSuccessfullyCompleted() ) + REQUIRE( ctx.completedCycle() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) + REQUIRE( s2b.isComplete() ) +with expansion: + true + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2b.isSuccessfullyCompleted() == false ) with expansion: false == false PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) + REQUIRE( testCase2.isSuccessfullyCompleted() == false ) +with expansion: + false == false + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase3.isOpen() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() ) + REQUIRE( s1c.isOpen() == false ) +with expansion: + false == false + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( s2c.isOpen() == false ) +with expansion: + false == false + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase3.isSuccessfullyCompleted() ) with expansion: true @@ -13533,538 +13038,594 @@ with expansion: ------------------------------------------------------------------------------- Tracker - fail one section + open a nested section ------------------------------------------------------------------------------- PartTracker.tests.cpp:<line number> ............................................................................... PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isComplete() ) + REQUIRE( s2.isOpen() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isSuccessfullyCompleted() == false ) + REQUIRE( s2.isComplete() ) with expansion: - false == false + true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) + REQUIRE( s1.isComplete() == false ) with expansion: false == false PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) + REQUIRE( s1.isComplete() ) with expansion: true PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() == false ) + REQUIRE( testCase.isComplete() == false ) with expansion: false == false +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( testCase.isComplete() ) +with expansion: + true + ------------------------------------------------------------------------------- -Tracker - fail one section - re-enter after failed section +Trim strings ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +StringManip.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isOpen() ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(no_whitespace)) == no_whitespace ) with expansion: - true + "There is no extra whitespace here" + == + "There is no extra whitespace here" -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1b.isOpen() == false ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(leading_whitespace)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(trailing_whitespace)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(whitespace_at_both_ends)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(no_whitespace)) == StringRef(no_whitespace) ) with expansion: - false == false + There is no extra whitespace here + == + There is no extra whitespace here -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) ) with expansion: - true + There is no extra whitespace here + == + There is no extra whitespace here -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) ) with expansion: - true + There is no extra whitespace here + == + There is no extra whitespace here -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() ) +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) ) with expansion: - true + There is no extra whitespace here + == + There is no extra whitespace here ------------------------------------------------------------------------------- -Tracker +Type conversions of RangeEquals and similar + Container conversions + Two equal containers of different container types ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, RangeEquals( c_array ) ) with expansion: - true + { 1, 2, 3 } elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, UnorderedRangeEquals( c_array ) ) with expansion: - true + { 1, 2, 3 } unordered elements are { 1, 2, 3 } ------------------------------------------------------------------------------- -Tracker - fail one section +Type conversions of RangeEquals and similar + Container conversions + Two equal containers of different container types (differ in array N) ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isComplete() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_3, !RangeEquals( array_int_4 ) ) with expansion: - true + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isSuccessfullyCompleted() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_3, !UnorderedRangeEquals( array_int_4 ) ) with expansion: - false == false + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Type conversions of RangeEquals and similar + Container conversions + Two equal containers of different container types and value types +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, RangeEquals( vector_char_a ) ) with expansion: - true + { 1, 2, 3 } elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, UnorderedRangeEquals( vector_char_a ) ) with expansion: - false == false + { 1, 2, 3 } unordered elements are { 1, 2, 3 } ------------------------------------------------------------------------------- -Tracker - fail one section - re-enter after failed section and find next section +Type conversions of RangeEquals and similar + Container conversions + Two equal containers, one random access, one not ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isOpen() ) -with expansion: - true +MatchersRanges.tests.cpp:<line number>: PASSED: +with message: + ContainerIsRandomAccess( array_int_a ) != ContainerIsRandomAccess( + list_char_a ) -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1b.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, RangeEquals( list_char_a ) ) with expansion: - false == false + { 1, 2, 3 } elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_int_a, UnorderedRangeEquals( list_char_a ) ) with expansion: - true + { 1, 2, 3 } unordered elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) -with expansion: - true +------------------------------------------------------------------------------- +Type conversions of RangeEquals and similar + Value type + Two equal containers of different value types +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_int_a, RangeEquals( vector_char_a ) ) with expansion: - true + { 1, 2, 3 } elements are { 1, 2, 3 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isSuccessfullyCompleted() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_int_a, UnorderedRangeEquals( vector_char_a ) ) with expansion: - true + { 1, 2, 3 } unordered elements are { 1, 2, 3 } ------------------------------------------------------------------------------- -Tracker +Type conversions of RangeEquals and similar + Value type + Two non-equal containers of different value types ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_int_a, !RangeEquals( vector_char_b ) ) with expansion: - true + { 1, 2, 3 } not elements are { 1, 2, 2 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_int_a, !UnorderedRangeEquals( vector_char_b ) ) with expansion: - true + { 1, 2, 3 } not unordered elements are { 1, 2, 2 } ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another +Type conversions of RangeEquals and similar + Ranges with begin that needs ADL ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( a, !RangeEquals( b ) ) with expansion: - false == false + { 1, 2, 3 } not elements are { 3, 2, 1 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( a, UnorderedRangeEquals( b ) ) with expansion: - false == false + { 1, 2, 3 } unordered elements are { 3, 2, 1 } ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another - Re-enter - skips S1 and enters S2 +Type conversions of RangeEquals and similar + Custom predicate + Two equal non-empty containers (close enough) ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_a, RangeEquals( array_a_plus_1, close_enough ) ) with expansion: - true + { 1, 2, 3 } elements are { 2, 3, 4 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1b.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) ) with expansion: - false == false + { 1, 2, 3 } unordered elements are { 2, 3, 4 } -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isOpen() ) -with expansion: - true +------------------------------------------------------------------------------- +Unexpected exceptions can be translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() == false ) -with expansion: - false == false +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + 3.14 ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another - Re-enter - skips S1 and enters S2 - Successfully close S2 +Upcasting special member functions + Move constructor ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +UniquePtr.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) -with expansion: - true - -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isSuccessfullyCompleted() ) +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( bptr->i == 3 ) with expansion: - true + 3 == 3 -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isComplete() == false ) -with expansion: - false == false +------------------------------------------------------------------------------- +Upcasting special member functions + move assignment +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isSuccessfullyCompleted() ) +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( bptr->i == 3 ) with expansion: - true + 3 == 3 ------------------------------------------------------------------------------- -Tracker +Usage of AllMatch range matcher + Basic usage ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllMatch(SizeIs(5)) ) with expansion: - true + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } all match has size == 5 -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllMatch(Contains(0) && Contains(1)) ) with expansion: - true + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains + element 1 ) ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another +Usage of AllMatch range matcher + Type requires ADL found begin and end ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isOpen() == false ) -with expansion: - false == false - -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) ) with expansion: - false == false + { 1, 2, 3, 4, 5 } all match matches undescribed predicate ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another - Re-enter - skips S1 and enters S2 +Usage of AllMatch range matcher + Shortcircuiting + All are read ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, allMatch ) +with expansion: + { 1, 2, 3, 4, 5 } all match matches undescribed predicate + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) with expansion: true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1b.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) with expansion: - false == false + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) with expansion: true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[4] ) with expansion: - false == false + true ------------------------------------------------------------------------------- -Tracker - successfully close one section, then find another - Re-enter - skips S1 and enters S2 - fail S2 +Usage of AllMatch range matcher + Shortcircuiting + Short-circuited ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( ctx.completedCycle() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !allMatch ) with expansion: - true + { 1, 2, 3, 4, 5 } not all match matches undescribed predicate -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isComplete() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) with expansion: true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2b.isSuccessfullyCompleted() == false ) -with expansion: - false == false - -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase2.isSuccessfullyCompleted() == false ) -with expansion: - false == false - -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase3.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) with expansion: true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1c.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) with expansion: - false == false + true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2c.isOpen() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) with expansion: - false == false + !false -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase3.isSuccessfullyCompleted() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) with expansion: - true + !false ------------------------------------------------------------------------------- -Tracker +Usage of AllTrue range matcher + Basic usage + All true evaluates to true ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) with expansion: - true + { true, true, true, true, true } contains only true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isOpen() ) +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + Empty evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) with expansion: - true + { } contains only true ------------------------------------------------------------------------------- -Tracker - open a nested section +Usage of AllTrue range matcher + Basic usage + One false evaluates to false ------------------------------------------------------------------------------- -PartTracker.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isOpen() ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) with expansion: - true + { true, true, false, true, true } not contains only true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s2.isComplete() ) -with expansion: - true +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Basic usage + All false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isComplete() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) with expansion: - false == false + { false, false, false, false, false } not contains only true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( s1.isComplete() ) -with expansion: - true +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + All true evaluates to true +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() == false ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllTrue() ) with expansion: - false == false + { true, true, true, true, true } contains only true -PartTracker.tests.cpp:<line number>: PASSED: - REQUIRE( testCase.isComplete() ) +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Contained type is convertible to bool + One false evaluates to false +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) with expansion: - true + { true, true, false, true, true } not contains only true ------------------------------------------------------------------------------- -Trim strings +Usage of AllTrue range matcher + Contained type is convertible to bool + All false evaluates to false ------------------------------------------------------------------------------- -StringManip.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(std::string(no_whitespace)) == no_whitespace ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllTrue() ) with expansion: - "There is no extra whitespace here" - == - "There is no extra whitespace here" + { false, false, false, false, false } not contains only true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(std::string(leading_whitespace)) == no_whitespace ) -with expansion: - "There is no extra whitespace here" - == - "There is no extra whitespace here" +------------------------------------------------------------------------------- +Usage of AllTrue range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(std::string(trailing_whitespace)) == no_whitespace ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, AllTrue() ) with expansion: - "There is no extra whitespace here" - == - "There is no extra whitespace here" + { true, true, true, true, true } contains only true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(std::string(whitespace_at_both_ends)) == no_whitespace ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) with expansion: - "There is no extra whitespace here" - == - "There is no extra whitespace here" + true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(StringRef(no_whitespace)) == StringRef(no_whitespace) ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) with expansion: - There is no extra whitespace here - == - There is no extra whitespace here + true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) with expansion: - There is no extra whitespace here - == - There is no extra whitespace here + true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[3] ) with expansion: - There is no extra whitespace here - == - There is no extra whitespace here + true -StringManip.tests.cpp:<line number>: PASSED: - REQUIRE( trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[4] ) with expansion: - There is no extra whitespace here - == - There is no extra whitespace here + true ------------------------------------------------------------------------------- -Unexpected exceptions can be translated +Usage of AllTrue range matcher + Shortcircuiting + Short-circuited ------------------------------------------------------------------------------- -Exception.tests.cpp:<line number> +MatchersRanges.tests.cpp:<line number> ............................................................................... -Exception.tests.cpp:<line number>: FAILED: -due to unexpected exception with message: - 3.14 +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !AllTrue() ) +with expansion: + { true, true, false, true, true } not contains only true -------------------------------------------------------------------------------- -Upcasting special member functions - Move constructor -------------------------------------------------------------------------------- -UniquePtr.tests.cpp:<line number> -............................................................................... +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[0] ) +with expansion: + true -UniquePtr.tests.cpp:<line number>: PASSED: - REQUIRE( bptr->i == 3 ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[1] ) with expansion: - 3 == 3 + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.m_derefed[2] ) +with expansion: + true -------------------------------------------------------------------------------- -Upcasting special member functions - move assignment -------------------------------------------------------------------------------- -UniquePtr.tests.cpp:<line number> -............................................................................... +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[3] ) +with expansion: + !false -UniquePtr.tests.cpp:<line number>: PASSED: - REQUIRE( bptr->i == 3 ) +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.m_derefed[4] ) with expansion: - 3 == 3 + !false ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyMatch range matcher Basic usage ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllMatch(SizeIs(5)) ) + REQUIRE_THAT( data, AnyMatch(SizeIs(5)) ) with expansion: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } all match has size == 5 + }, { 1, 0, 0, -1, 5 } } any match has size == 5 MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllMatch(Contains(0) && Contains(1)) ) + REQUIRE_THAT( data, !AnyMatch(Contains(0) && Contains(10)) ) with expansion: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains - element 1 ) + }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains + element 10 ) ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyMatch range matcher Type requires ADL found begin and end ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) ) + REQUIRE_THAT( needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) ) with expansion: - { 1, 2, 3, 4, 5 } all match matches undescribed predicate + { 1, 2, 3, 4, 5 } any match matches undescribed predicate ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyMatch range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -14072,9 +13633,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, allMatch ) + REQUIRE_THAT( mocked, !anyMatch ) with expansion: - { 1, 2, 3, 4, 5 } all match matches undescribed predicate + { 1, 2, 3, 4, 5 } not any match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14102,7 +13663,7 @@ with expansion: true ------------------------------------------------------------------------------- -Usage of AllMatch range matcher +Usage of AnyMatch range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -14110,9 +13671,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !allMatch ) + REQUIRE_THAT( mocked, anyMatch ) with expansion: - { 1, 2, 3, 4, 5 } not all match matches undescribed predicate + { 1, 2, 3, 4, 5 } any match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14120,14 +13681,14 @@ with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[1] ) + REQUIRE_FALSE( mocked.m_derefed[1] ) with expansion: - true + !false MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[2] ) + REQUIRE_FALSE( mocked.m_derefed[2] ) with expansion: - true + !false MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( mocked.m_derefed[3] ) @@ -14140,7 +13701,7 @@ with expansion: !false ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Basic usage All true evaluates to true ------------------------------------------------------------------------------- @@ -14148,38 +13709,38 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllTrue() ) + REQUIRE_THAT( data, AnyTrue() ) with expansion: - { true, true, true, true, true } contains only true + { true, true, true, true, true } contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Basic usage - Empty evaluates to true + Empty evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllTrue() ) + REQUIRE_THAT( data, !AnyTrue() ) with expansion: - { } contains only true + { } not contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Basic usage - One false evalutes to false + One true evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllTrue() ) + REQUIRE_THAT( data, AnyTrue() ) with expansion: - { true, true, false, true, true } not contains only true + { false, false, true, false, false } contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Basic usage All false evaluates to false ------------------------------------------------------------------------------- @@ -14187,12 +13748,12 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllTrue() ) + REQUIRE_THAT( data, !AnyTrue() ) with expansion: - { false, false, false, false, false } not contains only true + { false, false, false, false, false } not contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Contained type is convertible to bool All true evaluates to true ------------------------------------------------------------------------------- @@ -14200,25 +13761,25 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AllTrue() ) + REQUIRE_THAT( data, AnyTrue() ) with expansion: - { true, true, true, true, true } contains only true + { true, true, true, true, true } contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Contained type is convertible to bool - One false evalutes to false + One true evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllTrue() ) + REQUIRE_THAT( data, AnyTrue() ) with expansion: - { true, true, false, true, true } not contains only true + { false, false, true, false, false } contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Contained type is convertible to bool All false evaluates to false ------------------------------------------------------------------------------- @@ -14226,12 +13787,12 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AllTrue() ) + REQUIRE_THAT( data, !AnyTrue() ) with expansion: - { false, false, false, false, false } not contains only true + { false, false, false, false, false } not contains at least one true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -14239,9 +13800,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, AllTrue() ) + REQUIRE_THAT( mocked, AnyTrue() ) with expansion: - { true, true, true, true, true } contains only true + { false, false, false, false, true } contains at least one true MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14269,7 +13830,7 @@ with expansion: true ------------------------------------------------------------------------------- -Usage of AllTrue range matcher +Usage of AnyTrue range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -14277,9 +13838,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !AllTrue() ) + REQUIRE_THAT( mocked, AnyTrue() ) with expansion: - { true, true, false, true, true } not contains only true + { false, false, true, true, true } contains at least one true MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14307,39 +13868,39 @@ with expansion: !false ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Basic usage ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyMatch(SizeIs(5)) ) + REQUIRE_THAT( data, NoneMatch(SizeIs(6)) ) with expansion: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } any match has size == 5 + }, { 1, 0, 0, -1, 5 } } none match has size == 6 MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyMatch(Contains(0) && Contains(10)) ) + REQUIRE_THAT( data, !NoneMatch(Contains(0) && Contains(1)) ) with expansion: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains - element 10 ) + }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains + element 1 ) ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Type requires ADL found begin and end ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) ) + REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) ) with expansion: - { 1, 2, 3, 4, 5 } any match matches undescribed predicate + { 1, 2, 3, 4, 5 } none match matches undescribed predicate ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -14347,9 +13908,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !anyMatch ) + REQUIRE_THAT( mocked, noneMatch ) with expansion: - { 1, 2, 3, 4, 5 } not any match matches undescribed predicate + { 1, 2, 3, 4, 5 } none match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14377,7 +13938,7 @@ with expansion: true ------------------------------------------------------------------------------- -Usage of AnyMatch range matcher +Usage of NoneMatch range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -14385,9 +13946,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, anyMatch ) + REQUIRE_THAT( mocked, !noneMatch ) with expansion: - { 1, 2, 3, 4, 5 } any match matches undescribed predicate + { 1, 2, 3, 4, 5 } not none match matches undescribed predicate MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14415,98 +13976,98 @@ with expansion: !false ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Basic usage - All true evaluates to true + All true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyTrue() ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { true, true, true, true, true } contains at least one true + { true, true, true, true, true } not contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Basic usage - Empty evaluates to false + Empty evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyTrue() ) + REQUIRE_THAT( data, NoneTrue() ) with expansion: - { } not contains at least one true + { } contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Basic usage - One true evalutes to true + One true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyTrue() ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { false, false, true, false, false } contains at least one true + { false, false, true, false, false } not contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Basic usage - All false evaluates to false + All false evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyTrue() ) + REQUIRE_THAT( data, NoneTrue() ) with expansion: - { false, false, false, false, false } not contains at least one true + { false, false, false, false, false } contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Contained type is convertible to bool - All true evaluates to true + All true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyTrue() ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { true, true, true, true, true } contains at least one true + { true, true, true, true, true } not contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Contained type is convertible to bool - One true evalutes to true + One true evaluates to false ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, AnyTrue() ) + REQUIRE_THAT( data, !NoneTrue() ) with expansion: - { false, false, true, false, false } contains at least one true + { false, false, true, false, false } not contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Contained type is convertible to bool - All false evaluates to false + All false evaluates to true ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !AnyTrue() ) + REQUIRE_THAT( data, NoneTrue() ) with expansion: - { false, false, false, false, false } not contains at least one true + { false, false, false, false, false } contains no true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Shortcircuiting All are read ------------------------------------------------------------------------------- @@ -14514,9 +14075,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, AnyTrue() ) + REQUIRE_THAT( mocked, NoneTrue() ) with expansion: - { false, false, false, false, true } contains at least one true + { false, false, false, false, false } contains no true MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14544,7 +14105,7 @@ with expansion: true ------------------------------------------------------------------------------- -Usage of AnyTrue range matcher +Usage of NoneTrue range matcher Shortcircuiting Short-circuited ------------------------------------------------------------------------------- @@ -14552,9 +14113,9 @@ MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, AnyTrue() ) + REQUIRE_THAT( mocked, !NoneTrue() ) with expansion: - { false, false, true, true, true } contains at least one true + { false, false, true, true, true } not contains no true MatchersRanges.tests.cpp:<line number>: PASSED: REQUIRE( mocked.m_derefed[0] ) @@ -14582,279 +14143,322 @@ with expansion: !false ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher +Usage of RangeEquals range matcher + Basic usage + Empty container matches empty container +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( empty_vector, RangeEquals( empty_vector ) ) +with expansion: + { } elements are { } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Empty container does not match non-empty container +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( empty_vector, !RangeEquals( non_empty_vector ) ) +with expansion: + { } not elements are { 1 } + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( non_empty_vector, !RangeEquals( empty_vector ) ) +with expansion: + { 1 } not elements are { } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Two equal 1-length non-empty containers +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( non_empty_array, RangeEquals( non_empty_array ) ) +with expansion: + { 1 } elements are { 1 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Two equal-sized, equal, non-empty containers +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_a, RangeEquals( array_a ) ) +with expansion: + { 1, 2, 3 } elements are { 1, 2, 3 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Basic usage + Two equal-sized, non-equal, non-empty containers +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_a, !RangeEquals( array_b ) ) +with expansion: + { 1, 2, 3 } not elements are { 2, 2, 3 } + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( array_a, !RangeEquals( array_c ) ) +with expansion: + { 1, 2, 3 } not elements are { 1, 2, 2 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher Basic usage + Two non-equal-sized, non-empty containers (with same first elements) ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneMatch(SizeIs(6)) ) + CHECK_THAT( vector_a, !RangeEquals( vector_b ) ) with expansion: - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } none match has size == 6 + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Custom predicate + Two equal non-empty containers (close enough) +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneMatch(Contains(0) && Contains(1)) ) + CHECK_THAT( vector_a, RangeEquals( vector_a_plus_1, close_enough ) ) with expansion: - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 - }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains - element 1 ) + { 1, 2, 3 } elements are { 2, 3, 4 } ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher - Type requires ADL found begin and end +Usage of RangeEquals range matcher + Custom predicate + Two non-equal non-empty containers (close enough) ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) ) + CHECK_THAT( vector_a, !RangeEquals( vector_b, close_enough ) ) with expansion: - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { 1, 2, 3 } not elements are { 3, 3, 4 } ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher - Shortcircuiting - All are read +Usage of RangeEquals range matcher + Ranges that need ADL begin/end ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, noneMatch ) + REQUIRE_THAT( needs_adl1, RangeEquals( needs_adl2 ) ) with expansion: - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[0] ) + REQUIRE_THAT( needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) ) with expansion: - true + { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } + +------------------------------------------------------------------------------- +Usage of RangeEquals range matcher + Check short-circuiting behaviour + Check short-circuits on failure +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[1] ) + REQUIRE_THAT( mocked1, !RangeEquals( arr ) ) with expansion: - true + { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[2] ) + REQUIRE( mocked1.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[3] ) + REQUIRE( mocked1.m_derefed[1] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[4] ) + REQUIRE( mocked1.m_derefed[2] ) with expansion: true +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked1.m_derefed[3] ) +with expansion: + !false + ------------------------------------------------------------------------------- -Usage of NoneMatch range matcher - Shortcircuiting - Short-circuited +Usage of RangeEquals range matcher + Check short-circuiting behaviour + All elements are checked on success ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !noneMatch ) + REQUIRE_THAT( mocked1, RangeEquals( arr ) ) with expansion: - { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[0] ) + REQUIRE( mocked1.m_derefed[0] ) with expansion: true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[1] ) -with expansion: - !false - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[2] ) + REQUIRE( mocked1.m_derefed[1] ) with expansion: - !false + true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[3] ) + REQUIRE( mocked1.m_derefed[2] ) with expansion: - !false + true MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[4] ) + REQUIRE( mocked1.m_derefed[3] ) with expansion: - !false + true ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher +Usage of UnorderedRangeEquals range matcher Basic usage - All true evaluates to false + Empty container matches empty container ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneTrue() ) + CHECK_THAT( empty_vector, UnorderedRangeEquals( empty_vector ) ) with expansion: - { true, true, true, true, true } not contains no true + { } unordered elements are { } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher +Usage of UnorderedRangeEquals range matcher Basic usage - Empty evaluates to true + Empty container does not match non-empty container ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneTrue() ) + CHECK_THAT( empty_vector, !UnorderedRangeEquals( non_empty_vector ) ) with expansion: - { } contains no true + { } not unordered elements are { 1 } + +MatchersRanges.tests.cpp:<line number>: PASSED: + CHECK_THAT( non_empty_vector, !UnorderedRangeEquals( empty_vector ) ) +with expansion: + { 1 } not unordered elements are { } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher +Usage of UnorderedRangeEquals range matcher Basic usage - One true evalutes to false + Two equal 1-length non-empty containers ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneTrue() ) + CHECK_THAT( non_empty_array, UnorderedRangeEquals( non_empty_array ) ) with expansion: - { false, false, true, false, false } not contains no true + { 1 } unordered elements are { 1 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher +Usage of UnorderedRangeEquals range matcher Basic usage - All false evaluates to true + Two equal-sized, equal, non-empty containers ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneTrue() ) + CHECK_THAT( array_a, UnorderedRangeEquals( array_a ) ) with expansion: - { false, false, false, false, false } contains no true + { 1, 2, 3 } unordered elements are { 1, 2, 3 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Contained type is convertible to bool - All true evaluates to false +Usage of UnorderedRangeEquals range matcher + Basic usage + Two equal-sized, non-equal, non-empty containers ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneTrue() ) + CHECK_THAT( array_a, !UnorderedRangeEquals( array_b ) ) with expansion: - { true, true, true, true, true } not contains no true + { 1, 2, 3 } not unordered elements are { 2, 2, 3 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Contained type is convertible to bool - One true evalutes to false +Usage of UnorderedRangeEquals range matcher + Basic usage + Two non-equal-sized, non-empty containers ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, !NoneTrue() ) + CHECK_THAT( vector_a, !UnorderedRangeEquals( vector_b ) ) with expansion: - { false, false, true, false, false } not contains no true + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Contained type is convertible to bool - All false evaluates to true +Usage of UnorderedRangeEquals range matcher + Custom predicate + Two equal non-empty containers (close enough) ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( data, NoneTrue() ) + CHECK_THAT( vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) ) with expansion: - { false, false, false, false, false } contains no true + { 1, 10, 20 } unordered elements are { 11, 21, 2 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Shortcircuiting - All are read +Usage of UnorderedRangeEquals range matcher + Custom predicate + Two non-equal non-empty containers (close enough) ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, NoneTrue() ) -with expansion: - { false, false, false, false, false } contains no true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[0] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[1] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[2] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[3] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[4] ) + CHECK_THAT( vector_a, !UnorderedRangeEquals( vector_b, close_enough ) ) with expansion: - true + { 1, 10, 21 } not unordered elements are { 11, 21, 3 } ------------------------------------------------------------------------------- -Usage of NoneTrue range matcher - Shortcircuiting - Short-circuited +Usage of UnorderedRangeEquals range matcher + Ranges that need ADL begin/end ------------------------------------------------------------------------------- MatchersRanges.tests.cpp:<line number> ............................................................................... MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( mocked, !NoneTrue() ) -with expansion: - { false, false, true, true, true } not contains no true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[0] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[1] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE( mocked.m_derefed[2] ) -with expansion: - true - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[3] ) -with expansion: - !false - -MatchersRanges.tests.cpp:<line number>: PASSED: - REQUIRE_FALSE( mocked.m_derefed[4] ) + REQUIRE_THAT( needs_adl1, UnorderedRangeEquals( needs_adl2 ) ) with expansion: - !false + { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } ------------------------------------------------------------------------------- Usage of the SizeIs range matcher @@ -15558,6 +15162,16 @@ with expansion: <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) +------------------------------------------------------------------------------- +a succeeding test can still be skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: PASSED: + +Skip.tests.cpp:<line number>: SKIPPED: + ------------------------------------------------------------------------------- analyse no analysis ------------------------------------------------------------------------------- @@ -16103,6 +15717,34 @@ FloatingPoint.tests.cpp:<line number>: PASSED: with expansion: 1 == 1 +------------------------------------------------------------------------------- +dynamic skipping works with generators +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 41 + +------------------------------------------------------------------------------- +dynamic skipping works with generators +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +dynamic skipping works with generators +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 43 + ------------------------------------------------------------------------------- empty tags are not allowed ------------------------------------------------------------------------------- @@ -16178,6 +15820,67 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: +------------------------------------------------------------------------------- +failed assertions before SKIP cause test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + CHECK( 3 == 4 ) + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + +------------------------------------------------------------------------------- +failing for some generator values causes entire test case to fail +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing in some unskipped sections causes entire test case to fail + skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +failing in some unskipped sections causes entire test case to fail + not skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: FAILED: + ------------------------------------------------------------------------------- first tag ------------------------------------------------------------------------------- @@ -16673,6 +16376,37 @@ Misc.tests.cpp:<line number>: PASSED: with expansion: 1 != 2 +------------------------------------------------------------------------------- +nested sections can be skipped dynamically at runtime + A +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'A' + +------------------------------------------------------------------------------- +nested sections can be skipped dynamically at runtime + B + B1 +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + + +No assertions in section 'B1' + +------------------------------------------------------------------------------- +nested sections can be skipped dynamically at runtime + B + B2 +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + ------------------------------------------------------------------------------- non streamable - with conv. op ------------------------------------------------------------------------------- @@ -17274,6 +17008,33 @@ Misc.tests.cpp:<line number> No assertions in test case 'second tag' +------------------------------------------------------------------------------- +sections can be skipped dynamically at runtime + not skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +sections can be skipped dynamically at runtime + skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + +------------------------------------------------------------------------------- +sections can be skipped dynamically at runtime + also not skipped +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: PASSED: + ------------------------------------------------------------------------------- send a single char to INFO ------------------------------------------------------------------------------- @@ -17308,6 +17069,16 @@ Tag.tests.cpp:<line number>: PASSED: with expansion: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +------------------------------------------------------------------------------- +skipped tests can optionally provide a reason +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: +explicitly with message: + skipping because answer = 43 + ------------------------------------------------------------------------------- splitString ------------------------------------------------------------------------------- @@ -17735,6 +17506,14 @@ Tag.tests.cpp:<line number>: PASSED: with expansion: magic.tag == magic.tag +------------------------------------------------------------------------------- +tests can be skipped dynamically at runtime +------------------------------------------------------------------------------- +Skip.tests.cpp:<line number> +............................................................................... + +Skip.tests.cpp:<line number>: SKIPPED: + ------------------------------------------------------------------------------- thrown std::strings are translated ------------------------------------------------------------------------------- @@ -18442,6 +18221,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 394 | 304 passed | 83 failed | 7 failed as expected -assertions: 2299 | 2129 passed | 143 failed | 27 failed as expected +test cases: 409 | 308 passed | 84 failed | 6 skipped | 11 failed as expected +assertions: 2225 | 2048 passed | 145 failed | 32 failed as expected diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt index ede2d59ccf17f8d576d2f42646d84a7dfa044e29..41b7612a90d152389939fde40c37cef23481f0f2 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt @@ -1,4 +1,4 @@ -Filters: ~[!nonportable]~[!benchmark]~[approvals] * +Filters: "*" ~[!nonportable] ~[!benchmark] ~[approvals] Randomness seeded to: 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -166,20 +166,20 @@ with expansion: ------------------------------------------------------------------------------- #1905 -- test spec parser properly clears internal state between compound tests ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase("spec . char")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase("spec , char")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( spec.matches(*fakeTestCase(R"(spec \, char)")) ) with expansion: !false @@ -188,20 +188,20 @@ with expansion: #1912 -- test spec parser handles escaping Various parentheses ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec {a} char)")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec [a] char)")) ) with expansion: true -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE_FALSE( spec.matches(*fakeTestCase("differs but has similar tag", "[a]")) ) with expansion: !false @@ -210,10 +210,10 @@ with expansion: #1912 -- test spec parser handles escaping backslash in test name ------------------------------------------------------------------------------- -CmdLine.tests.cpp:<line number> +TestSpec.tests.cpp:<line number> ............................................................................... -CmdLine.tests.cpp:<line number>: PASSED: +TestSpec.tests.cpp:<line number>: PASSED: REQUIRE( spec.matches(*fakeTestCase(R"(spec \ char)")) ) with expansion: true @@ -761,6 +761,16 @@ with expansion: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0. 00000000e+00]) +------------------------------------------------------------------------------- +#2615 - Throwing in constructor generator fails test case but does not abort +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + failure to init + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions outside assertions @@ -941,6 +951,6 @@ Condition.tests.cpp:<line number>: FAILED: CHECK( true != true ) =============================================================================== -test cases: 32 | 27 passed | 3 failed | 2 failed as expected -assertions: 101 | 94 passed | 4 failed | 3 failed as expected +test cases: 33 | 27 passed | 3 failed | 3 failed as expected +assertions: 102 | 94 passed | 4 failed | 4 failed as expected diff --git a/packages/Catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt index 12717aa5f9f952bf9128bbb1dcc76d27196adbbf..bb1748448861e028a0723d770f6d3a4573e77aa8 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/default.sw.multi.approved.txt @@ -6,3 +6,6 @@ A string sent to stderr via clog Message from section one Message from section two loose text artifact +a! +b1! +! diff --git a/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt index f7411501da435924af1beab2f932c8a6be983a1a..c992154c414f38d1e9d3b0843f4dbd6f81a455a3 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="17" failures="126" tests="2299" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="128" skipped="12" tests="2237" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> - <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> + <property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/> </properties> <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="#1027: Bitfields can be captured" time="{duration}" status="run"/> @@ -19,7 +19,7 @@ <failure type="FAIL"> FAILED: 1514 -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> <system-out> This would not be caught previously @@ -48,13 +48,21 @@ Nor would this <testcase classname="<exe-name>.global" name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="#2152 - ULP checks between differently signed values were wrong - double" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="#2152 - ULP checks between differently signed values were wrong - float" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#2615 - Throwing in constructor generator fails test case but does not abort" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <error type="TEST_CASE"> +FAILED: +failure to init +at Generators.tests.cpp:<line number> + </error> + </testcase> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <error type="TEST_CASE"> FAILED: expected exception answer := 42 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/inside REQUIRE_NOTHROW" time="{duration}" status="run"> @@ -64,7 +72,7 @@ FAILED: REQUIRE_NOTHROW( thisThrows() ) expected exception answer := 42 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/inside REQUIRE_THROWS" time="{duration}" status="run"/> @@ -77,7 +85,7 @@ FAILED: CHECK( f() == 0 ) with expansion: 1 == 0 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="#872" time="{duration}" status="run"/> @@ -90,52 +98,52 @@ Misc.tests.cpp:<line number> <failure message="false != false" type="CHECK"> FAILED: CHECK( false != false ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="true != true" type="CHECK"> FAILED: CHECK( true != true ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!true" type="CHECK"> FAILED: CHECK( !true ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!(true)" type="CHECK_FALSE"> FAILED: CHECK_FALSE( true ) with expansion: !true -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!trueValue" type="CHECK"> FAILED: CHECK( !trueValue ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!(trueValue)" type="CHECK_FALSE"> FAILED: CHECK_FALSE( trueValue ) with expansion: !true -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!(1 == 1)" type="CHECK"> FAILED: CHECK( !(1 == 1) ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!(1 == 1)" type="CHECK_FALSE"> FAILED: CHECK_FALSE( 1 == 1 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="'Not' checks that should succeed" time="{duration}" status="run"/> @@ -151,7 +159,7 @@ FAILED: REQUIRE( s == "world" ) with expansion: "hello" == "world" -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that succeeds" time="{duration}" status="run"/> @@ -161,7 +169,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" time="{duration}" status="run"> @@ -170,7 +178,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" time="{duration}" status="run"> @@ -179,7 +187,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" time="{duration}" status="run"> @@ -188,7 +196,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" time="{duration}" status="run"/> @@ -201,7 +209,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 6 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" time="{duration}" status="run"> @@ -210,7 +218,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 2 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" time="{duration}" status="run"> @@ -219,7 +227,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 6 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" time="{duration}" status="run"> @@ -228,7 +236,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 2 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" time="{duration}" status="run"/> @@ -241,7 +249,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1.0 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" time="{duration}" status="run"> @@ -250,7 +258,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1.0f == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" time="{duration}" status="run"> @@ -259,7 +267,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" time="{duration}" status="run"/> @@ -271,7 +279,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 1 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" time="{duration}" status="run"> @@ -280,7 +288,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 3 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" time="{duration}" status="run"> @@ -289,7 +297,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 6 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" time="{duration}" status="run"/> @@ -301,7 +309,7 @@ FAILED: REQUIRE( m_a == 2 ) with expansion: 1 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that succeeds" time="{duration}" status="run"/> @@ -318,7 +326,7 @@ Class.tests.cpp:<line number> <failure type="FAIL"> FAILED: to infinity and beyond -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="A couple of nested sections followed by a failure/Outer/Inner" time="{duration}" status="run"/> @@ -328,14 +336,14 @@ FAILED: CHECK( &o1 == &o2 ) with expansion: 0x<hex digits> == 0x<hex digits> -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> <failure message="o1 == o2" type="CHECK"> FAILED: CHECK( o1 == o2 ) with expansion: {?} == {?} -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Absolute margin" time="{duration}" status="run"/> @@ -345,7 +353,7 @@ Tricky.tests.cpp:<line number> FAILED: {Unknown expression after the reported line} unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Anonymous test case 1" time="{duration}" status="run"/> @@ -415,14 +423,14 @@ FAILED: with expansion: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), ContainsSubstring( "STRING" )" type="CHECK_THAT"> FAILED: CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Copy and then generate a range/from var and iterators" time="{duration}" status="run"/> @@ -434,7 +442,7 @@ Matchers.tests.cpp:<line number> FAILED: REQUIRE_NOTHROW( throwCustom() ) custom exception - not std -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for throwing as something else" time="{duration}" status="run"> @@ -442,27 +450,33 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE_THROWS_AS( throwCustom(), std::exception ) custom exception - not std -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Custom std-exceptions can be custom translated" time="{duration}" status="run"> <error type="TEST_CASE"> FAILED: custom std exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Empty generators can SKIP in constructor" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +This generator is empty +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="Empty stream name opens cout stream" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Empty tag is not allowed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="EndsWith string matcher" time="{duration}" status="run"> <failure message="testStringForMatching(), EndsWith( "Substring" )" type="CHECK_THAT"> FAILED: CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "Substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No )" type="CHECK_THAT"> FAILED: @@ -470,7 +484,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Enums can quickly have stringification enabled using REGISTER_ENUM" time="{duration}" status="run"/> @@ -483,91 +497,91 @@ FAILED: CHECK( data.int_seven == 6 ) with expansion: 7 == 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven == 8" type="CHECK"> FAILED: CHECK( data.int_seven == 8 ) with expansion: 7 == 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven == 0" type="CHECK"> FAILED: CHECK( data.int_seven == 0 ) with expansion: 7 == 0 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one == Approx( 9.11f )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one == Approx( 9.11f ) ) with expansion: 9.1f == Approx( 9.1099996567 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one == Approx( 9.0f )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one == Approx( 9.0f ) ) with expansion: 9.1f == Approx( 9.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one == Approx( 1 )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one == Approx( 1 ) ) with expansion: 9.1f == Approx( 1.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one == Approx( 0 )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one == Approx( 0 ) ) with expansion: 9.1f == Approx( 0.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.double_pi == Approx( 3.1415 )" type="CHECK"> FAILED: CHECK( data.double_pi == Approx( 3.1415 ) ) with expansion: 3.1415926535 == Approx( 3.1415 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello == "goodbye"" type="CHECK"> FAILED: CHECK( data.str_hello == "goodbye" ) with expansion: "hello" == "goodbye" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello == "hell"" type="CHECK"> FAILED: CHECK( data.str_hello == "hell" ) with expansion: "hello" == "hell" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello == "hello1"" type="CHECK"> FAILED: CHECK( data.str_hello == "hello1" ) with expansion: "hello" == "hello1" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello.size() == 6" type="CHECK"> FAILED: CHECK( data.str_hello.size() == 6 ) with expansion: 5 == 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="x == Approx( 1.301 )" type="CHECK"> FAILED: CHECK( x == Approx( 1.301 ) ) with expansion: 1.3 == Approx( 1.301 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Equality checks that should succeed" time="{duration}" status="run"/> @@ -579,7 +593,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No )" type="CHECK_THAT"> FAILED: @@ -587,7 +601,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" time="{duration}" status="run"/> @@ -595,12 +609,12 @@ Matchers.tests.cpp:<line number> <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }" type="CHECK_THROWS_MATCHES"> FAILED: CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }" type="REQUIRE_THROWS_MATCHES"> FAILED: REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that fail/Type mismatch" time="{duration}" status="run"> @@ -608,13 +622,13 @@ Matchers.tests.cpp:<line number> FAILED: CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </error> <error message="throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }" type="REQUIRE_THROWS_MATCHES"> FAILED: REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}" status="run"> @@ -623,17 +637,18 @@ FAILED: CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 }" type="REQUIRE_THROWS_MATCHES"> FAILED: REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that succeed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Exception message can be matched" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Exception messages can be tested for/exact match" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Exception messages can be tested for/different case" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Exception messages can be tested for/wildcarded" time="{duration}" status="run"/> @@ -643,53 +658,56 @@ Matchers.tests.cpp:<line number> FAILED: CHECK_THROWS_AS( thisThrows(), std::string ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> <failure message="thisDoesntThrow(), std::domain_error" type="CHECK_THROWS_AS"> FAILED: CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </failure> <error message="thisThrows()" type="CHECK_NOTHROW"> FAILED: CHECK_NOTHROW( thisThrows() ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="FAIL aborts the test" time="{duration}" status="run"> <failure type="FAIL"> FAILED: This is a failure -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="FAIL does not require an argument" time="{duration}" status="run"> <failure type="FAIL"> FAILED: -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="FAIL_CHECK does not abort the test" time="{duration}" status="run"> <failure type="FAIL_CHECK"> FAILED: This is a failure -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Factorials are computed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Filter generator throws exception for empty generator" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative/Some subnormal values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Margin" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/ULPs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Composed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/IsNaN" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative/Some subnormal values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Margin" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/ULPs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Composed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/IsNaN" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Basic usage" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Throws if there are no matching values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Shortening a range" time="{duration}" status="run"/> @@ -743,7 +761,7 @@ with expansion: 2 == 1 this message should be logged so should this -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="INFO gets logged on failure, even if captured before successful assertions" time="{duration}" status="run"> @@ -754,7 +772,7 @@ with expansion: 2 == 1 this message may be logged later this message should be logged -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> <failure message="a == 0" type="CHECK"> FAILED: @@ -764,7 +782,7 @@ with expansion: this message may be logged later this message should be logged and this, but later -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="INFO is reset for each loop" time="{duration}" status="run"> @@ -775,7 +793,7 @@ with expansion: 10 < 10 current counter 10 i := 10 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Inequality checks that should fail" time="{duration}" status="run"> @@ -785,35 +803,35 @@ FAILED: CHECK( data.int_seven != 7 ) with expansion: 7 != 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one != Approx( 9.1f )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one != Approx( 9.1f ) ) with expansion: 9.1f != Approx( 9.1000003815 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.double_pi != Approx( 3.1415926535 )" type="CHECK"> FAILED: CHECK( data.double_pi != Approx( 3.1415926535 ) ) with expansion: 3.1415926535 != Approx( 3.1415926535 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello != "hello"" type="CHECK"> FAILED: CHECK( data.str_hello != "hello" ) with expansion: "hello" != "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello.size() != 5" type="CHECK"> FAILED: CHECK( data.str_hello.size() != 5 ) with expansion: 5 != 5 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Inequality checks that should succeed" time="{duration}" status="run"/> @@ -830,7 +848,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Matchers can be negated (Not) with the ! operator" time="{duration}" status="run"/> @@ -840,35 +858,35 @@ FAILED: CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/1/A" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/2/A" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/1/B" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/2/B" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mismatching exception messages failing the test" time="{duration}" status="run"> @@ -877,7 +895,7 @@ FAILED: REQUIRE_THROWS_WITH( thisThrows(), "should fail" ) with expansion: "expected exception" equals: "should fail" -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Multireporter calls reporters and listeners in correct order" time="{duration}" status="run"/> @@ -890,7 +908,7 @@ Exception.tests.cpp:<line number> <error type="TEST_CASE"> FAILED: custom exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Objects that evaluated in boolean contexts can be checked" time="{duration}" status="run"/> @@ -901,133 +919,133 @@ FAILED: CHECK( data.int_seven > 7 ) with expansion: 7 > 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven < 7" type="CHECK"> FAILED: CHECK( data.int_seven < 7 ) with expansion: 7 < 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven > 8" type="CHECK"> FAILED: CHECK( data.int_seven > 8 ) with expansion: 7 > 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven < 6" type="CHECK"> FAILED: CHECK( data.int_seven < 6 ) with expansion: 7 < 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven < 0" type="CHECK"> FAILED: CHECK( data.int_seven < 0 ) with expansion: 7 < 0 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven < -1" type="CHECK"> FAILED: CHECK( data.int_seven < -1 ) with expansion: 7 < -1 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven >= 8" type="CHECK"> FAILED: CHECK( data.int_seven >= 8 ) with expansion: 7 >= 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven <= 6" type="CHECK"> FAILED: CHECK( data.int_seven <= 6 ) with expansion: 7 <= 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one < 9" type="CHECK"> FAILED: CHECK( data.float_nine_point_one < 9 ) with expansion: 9.1f < 9 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one > 10" type="CHECK"> FAILED: CHECK( data.float_nine_point_one > 10 ) with expansion: 9.1f > 10 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one > 9.2" type="CHECK"> FAILED: CHECK( data.float_nine_point_one > 9.2 ) with expansion: 9.1f > 9.2 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello > "hello"" type="CHECK"> FAILED: CHECK( data.str_hello > "hello" ) with expansion: "hello" > "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello < "hello"" type="CHECK"> FAILED: CHECK( data.str_hello < "hello" ) with expansion: "hello" < "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello > "hellp"" type="CHECK"> FAILED: CHECK( data.str_hello > "hellp" ) with expansion: "hello" > "hellp" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello > "z"" type="CHECK"> FAILED: CHECK( data.str_hello > "z" ) with expansion: "hello" > "z" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello < "hellm"" type="CHECK"> FAILED: CHECK( data.str_hello < "hellm" ) with expansion: "hello" < "hellm" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello < "a"" type="CHECK"> FAILED: CHECK( data.str_hello < "a" ) with expansion: "hello" < "a" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello >= "z"" type="CHECK"> FAILED: CHECK( data.str_hello >= "z" ) with expansion: "hello" >= "z" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello <= "a"" type="CHECK"> FAILED: CHECK( data.str_hello <= "a" ) with expansion: "hello" <= "a" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Ordering comparison checks that should succeed" time="{duration}" status="run"/> @@ -1037,52 +1055,19 @@ Condition.tests.cpp:<line number> <failure type="FAIL"> FAILED: Message from section one -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Output from all sections is reported/two" time="{duration}" status="run"> <failure type="FAIL"> FAILED: Message from section two -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Overloaded comma or address-of operators are not used" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Empty test spec should have no filters" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from empty string should have no filters" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from just a comma should have no filters" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from name should have one filter" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from quoted name should have one filter" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from name should have one filter" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at the start" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at the end" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at both ends" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at the start" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at the end" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at both ends" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at both ends, redundant at start" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Just wildcard" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag, two matches" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Two tags" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Two tags, spare separated" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcarded name and tag" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag exclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion and one tag inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion and one wldcarded name inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion, using exclude:, and one wldcarded name inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/name exclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion with tag inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion, using exclude:, with tag inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/two wildcarded names" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/empty tag" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/empty quoted name" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/quoted string followed by tag exclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Leading and trailing spaces in test spec" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Leading and trailing spaces in test name" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Shortened hide tags are split apart when parsing" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Shortened hide tags also properly handle exclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse uints/proper inputs" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse uints/Bad inputs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Parsed tags are matched case insensitive" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/shard-count" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Negative shard count reports error" time="{duration}" status="run"/> @@ -1146,7 +1131,7 @@ FAILED: CHECK( truthy(false) ) with expansion: Hey, its truthy! -Decomposition.tests.cpp:<line number> +at Decomposition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Regex string matcher" time="{duration}" status="run"> @@ -1156,7 +1141,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), Matches( "contains 'abc' as a substring" )" type="CHECK_THAT"> FAILED: @@ -1164,7 +1149,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), Matches( "this string contains 'abc' as a" )" type="CHECK_THAT"> FAILED: @@ -1172,7 +1157,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Registering reporter with '::' in name fails" time="{duration}" status="run"/> @@ -1236,7 +1221,7 @@ FAILED: CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "This String" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No )" type="CHECK_THAT"> FAILED: @@ -1244,7 +1229,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Static arrays are convertible to string/Single item" time="{duration}" status="run"/> @@ -1292,7 +1277,7 @@ with expansion: $a = 20; } " -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" time="{duration}" status="run"/> @@ -1365,14 +1350,14 @@ Misc.tests.cpp:<line number> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Testing checked-if 3" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="The NO_FAIL macro reports a failure but does not fail the test" time="{duration}" status="run"/> @@ -1385,7 +1370,7 @@ Misc.tests.cpp:<line number> <error type="TEST_CASE"> FAILED: For some reason someone is throwing a string literal! -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Tracker" time="{duration}" status="run"/> @@ -1399,11 +1384,19 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2/fail S2" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Tracker/open a nested section" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Trim strings" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types (differ in array N)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types and value types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers, one random access, one not" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Value type/Two equal containers of different value types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Value type/Two non-equal containers of different value types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Ranges with begin that needs ADL" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Custom predicate/Two equal non-empty containers (close enough)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Unexpected exceptions can be translated" time="{duration}" status="run"> <error type="TEST_CASE"> FAILED: 3.14 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Upcasting special member functions/Move constructor" time="{duration}" status="run"/> @@ -1414,10 +1407,10 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/All true evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/Empty evaluates to true" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/One false evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/One false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/All false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/All true evaluates to true" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/All false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> @@ -1427,10 +1420,10 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/All true evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/Empty evaluates to false" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/One true evalutes to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/One true evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/All false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All true evaluates to true" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evalutes to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> @@ -1440,13 +1433,33 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/All true evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/Empty evaluates to true" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/One true evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/One true evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/All false evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All true evaluates to false" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All false evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Empty container matches empty container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Empty container does not match non-empty container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Two equal 1-length non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Two equal-sized, equal, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Two equal-sized, non-equal, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Two non-equal-sized, non-empty containers (with same first elements)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Custom predicate/Two equal non-empty containers (close enough)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Custom predicate/Two non-equal non-empty containers (close enough)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Ranges that need ADL begin/end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Check short-circuiting behaviour/Check short-circuits on failure" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Check short-circuiting behaviour/All elements are checked on success" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Empty container matches empty container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Empty container does not match non-empty container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal 1-length non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal-sized, equal, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal-sized, non-equal, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two non-equal-sized, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Custom predicate/Two equal non-empty containers (close enough)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Custom predicate/Two non-equal non-empty containers (close enough)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Ranges that need ADL begin/end" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Some with stdlib containers" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Type requires ADL found size free function" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Type has size member" time="{duration}" status="run"/> @@ -1462,7 +1475,7 @@ FAILED: CHECK_THAT( empty, Approx( t1 ) ) with expansion: { } is approx: { 1.0, 2.0 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector Approx matcher -- failing/Just different vectors" time="{duration}" status="run"> @@ -1471,7 +1484,7 @@ FAILED: CHECK_THAT( v1, Approx( v2 ) ) with expansion: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector matchers/Contains (element)" time="{duration}" status="run"/> @@ -1485,14 +1498,14 @@ FAILED: CHECK_THAT( v, VectorContains( -1 ) ) with expansion: { 1, 2, 3 } Contains: -1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="empty, VectorContains( 1 )" type="CHECK_THAT"> FAILED: CHECK_THAT( empty, VectorContains( 1 ) ) with expansion: { } Contains: 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector matchers that fail/Contains (vector)" time="{duration}" status="run"> @@ -1501,14 +1514,14 @@ FAILED: CHECK_THAT( empty, Contains( v ) ) with expansion: { } Contains: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="v, Contains( v2 )" type="CHECK_THAT"> FAILED: CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 4 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector matchers that fail/Equals" time="{duration}" status="run"> @@ -1517,28 +1530,28 @@ FAILED: CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="v2, Equals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( v2, Equals( v ) ) with expansion: { 1, 2 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="empty, Equals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( empty, Equals( v ) ) with expansion: { } Equals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="v, Equals( empty )" type="CHECK_THAT"> FAILED: CHECK_THAT( v, Equals( empty ) ) with expansion: { 1, 2, 3 } Equals: { } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector matchers that fail/UnorderedEquals" time="{duration}" status="run"> @@ -1547,28 +1560,28 @@ FAILED: CHECK_THAT( v, UnorderedEquals( empty ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="empty, UnorderedEquals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( empty, UnorderedEquals( v ) ) with expansion: { } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="permuted, UnorderedEquals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="permuted, UnorderedEquals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 3, 1 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="When checked exceptions are thrown they can be expected or unexpected" time="{duration}" status="run"/> @@ -1576,7 +1589,7 @@ Matchers.tests.cpp:<line number> <error type="TEST_CASE"> FAILED: unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown during a CHECK the test should continue" time="{duration}" status="run"> @@ -1584,7 +1597,7 @@ Exception.tests.cpp:<line number> FAILED: CHECK( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" time="{duration}" status="run"> @@ -1592,7 +1605,7 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown from functions they are always failures" time="{duration}" status="run"> @@ -1600,14 +1613,14 @@ Exception.tests.cpp:<line number> FAILED: CHECK( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown from sections they are always failures/section name" time="{duration}" status="run"> <error type="TEST_CASE"> FAILED: unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="X/level/0/a" time="{duration}" status="run"/> @@ -1623,6 +1636,12 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (1)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (x7F)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="XmlWriter writes boolean attributes as true/false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="a succeeding test can still be skipped" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="analyse no analysis" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="array<int, N> -> toString" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="benchmark function call/without chronometer" time="{duration}" status="run"/> @@ -1635,7 +1654,7 @@ FAILED: REQUIRE( testCheckedElse( false ) ) with expansion: false -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="checkedIf" time="{duration}" status="run"/> @@ -1645,7 +1664,7 @@ FAILED: REQUIRE( testCheckedIf( false ) ) with expansion: false -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="classify_outliers/none" time="{duration}" status="run"/> @@ -1657,25 +1676,80 @@ Misc.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="comparisons between const int variables" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="comparisons between int variables" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="convertToBits" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="dynamic skipping works with generators" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +skipping because answer = 41 +at Skip.tests.cpp:<line number> + </skipped> + <skipped type="SKIP"> +SKIPPED +skipping because answer = 43 +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="empty tags are not allowed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="erfc_inv" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="estimate_clock_resolution" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/d (leaf)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/e (leaf)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="even more nested SECTION tests/f (leaf)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="failed assertions before SKIP cause test case to fail" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure message="3 == 4" type="CHECK"> +FAILED: + CHECK( 3 == 4 ) +at Skip.tests.cpp:<line number> + </failure> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="failing for some generator values causes entire test case to fail" time="{duration}" status="run"> + <failure type="FAIL"> +FAILED: +at Skip.tests.cpp:<line number> + </failure> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + <failure type="FAIL"> +FAILED: +at Skip.tests.cpp:<line number> + </failure> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="failing in some unskipped sections causes entire test case to fail/skipped" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="failing in some unskipped sections causes entire test case to fail/not skipped" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +at Skip.tests.cpp:<line number> + </failure> + </testcase> <testcase classname="<exe-name>.global" name="is_unary_function" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="just failure" time="{duration}" status="run"> <failure type="FAIL"> FAILED: Previous info should not be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="just failure after unscoped info" time="{duration}" status="run"> <failure type="FAIL"> FAILED: previous unscoped info SHOULD not be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="long long" time="{duration}" status="run"/> @@ -1685,7 +1759,7 @@ FAILED: CHECK( b > a ) with expansion: 0 > 1 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 1" time="{duration}" status="run"> @@ -1694,7 +1768,7 @@ FAILED: CHECK( b > a ) with expansion: 1 > 1 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 2" time="{duration}" status="run"/> @@ -1712,7 +1786,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[0] (1) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1720,7 +1794,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[1] (1) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1728,7 +1802,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[3] (3) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1736,7 +1810,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[4] (5) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1744,7 +1818,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[6] (13) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1752,7 +1826,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[7] (21) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="makeStream recognizes %debug stream name" time="{duration}" status="run"/> @@ -1768,13 +1842,26 @@ FAILED: REQUIRE( a == b ) with expansion: 1 == 2 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/not equal" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/less than" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal/not equal" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="nested sections can be skipped dynamically at runtime/B2/B" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="nested sections can be skipped dynamically at runtime/B" time="{duration}" status="run"> + <system-out> +a! +b1! +! + </system-out> + </testcase> <testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="normal_cdf" time="{duration}" status="run"/> @@ -1785,7 +1872,7 @@ Misc.tests.cpp:<line number> FAILED: REQUIRE( false ) this SHOULD be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="null strings" time="{duration}" status="run"/> @@ -1802,7 +1889,7 @@ FAILED: REQUIRE( false ) this SHOULD be seen this SHOULD also be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="prints unscoped info only for the first assertion" time="{duration}" status="run"> @@ -1810,7 +1897,7 @@ Message.tests.cpp:<line number> FAILED: CHECK( false ) this SHOULD be seen only ONCE -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="random SECTION tests/doesn't equal" time="{duration}" status="run"/> @@ -1826,12 +1913,20 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="resolution" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="run_for_at_least, chronometer" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="run_for_at_least, int" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="sections can be skipped dynamically at runtime/not skipped" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="sections can be skipped dynamically at runtime/skipped" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="sections can be skipped dynamically at runtime/also not skipped" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="send a single char to INFO" time="{duration}" status="run"> <failure message="false" type="REQUIRE"> FAILED: REQUIRE( false ) 3 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="sends information to INFO" time="{duration}" status="run"> @@ -1840,10 +1935,17 @@ FAILED: REQUIRE( false ) hi i := 7 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="shortened hide tags are split apart" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="skipped tests can optionally provide a reason" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +skipping because answer = 43 +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="splitString" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="stacks unscoped info in loops" time="{duration}" status="run"> <failure message="false" type="CHECK"> @@ -1853,7 +1955,7 @@ Count 1 to 3... 1 2 3 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> <failure message="false" type="CHECK"> FAILED: @@ -1862,7 +1964,7 @@ Count 4 to 6... 4 5 6 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="startsWith" time="{duration}" status="run"/> @@ -1888,11 +1990,17 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="strlen3" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="tables" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="tags with dots in later positions are not parsed as hidden" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tests can be skipped dynamically at runtime" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="thrown std::strings are translated" time="{duration}" status="run"> <error type="TEST_CASE"> FAILED: Why would you throw a std::string? -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="toString on const wchar_t const pointer returns the string contents" time="{duration}" status="run"/> @@ -1937,6 +2045,9 @@ This would not be caught previously A string sent directly to stdout Message from section one Message from section two +a! +b1! +! </system-out> <system-err> Nor would this diff --git a/packages/Catch2/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index aa0860a3c9ac8cae0b873305b50103cf93a29d71..79c3236506da7d2fce43fa4a1db8b6d30ddf3d37 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuites> - <testsuite name="<exe-name>" errors="17" failures="126" tests="2299" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="128" skipped="12" tests="2237" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> - <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> + <property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/> </properties> <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="#1027: Bitfields can be captured" time="{duration}" status="run"/> @@ -18,7 +18,7 @@ <failure type="FAIL"> FAILED: 1514 -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> <system-out> This would not be caught previously @@ -47,13 +47,21 @@ Nor would this <testcase classname="<exe-name>.global" name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="#2152 - ULP checks between differently signed values were wrong - double" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="#2152 - ULP checks between differently signed values were wrong - float" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#2615 - Throwing in constructor generator fails test case but does not abort" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <error type="TEST_CASE"> +FAILED: +failure to init +at Generators.tests.cpp:<line number> + </error> + </testcase> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <error type="TEST_CASE"> FAILED: expected exception answer := 42 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/inside REQUIRE_NOTHROW" time="{duration}" status="run"> @@ -63,7 +71,7 @@ FAILED: REQUIRE_NOTHROW( thisThrows() ) expected exception answer := 42 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/inside REQUIRE_THROWS" time="{duration}" status="run"/> @@ -76,7 +84,7 @@ FAILED: CHECK( f() == 0 ) with expansion: 1 == 0 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="#872" time="{duration}" status="run"/> @@ -89,52 +97,52 @@ Misc.tests.cpp:<line number> <failure message="false != false" type="CHECK"> FAILED: CHECK( false != false ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="true != true" type="CHECK"> FAILED: CHECK( true != true ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!true" type="CHECK"> FAILED: CHECK( !true ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!(true)" type="CHECK_FALSE"> FAILED: CHECK_FALSE( true ) with expansion: !true -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!trueValue" type="CHECK"> FAILED: CHECK( !trueValue ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!(trueValue)" type="CHECK_FALSE"> FAILED: CHECK_FALSE( trueValue ) with expansion: !true -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!(1 == 1)" type="CHECK"> FAILED: CHECK( !(1 == 1) ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="!(1 == 1)" type="CHECK_FALSE"> FAILED: CHECK_FALSE( 1 == 1 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="'Not' checks that should succeed" time="{duration}" status="run"/> @@ -150,7 +158,7 @@ FAILED: REQUIRE( s == "world" ) with expansion: "hello" == "world" -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that succeeds" time="{duration}" status="run"/> @@ -160,7 +168,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" time="{duration}" status="run"> @@ -169,7 +177,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" time="{duration}" status="run"> @@ -178,7 +186,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" time="{duration}" status="run"> @@ -187,7 +195,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" time="{duration}" status="run"/> @@ -200,7 +208,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 6 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" time="{duration}" status="run"> @@ -209,7 +217,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 2 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" time="{duration}" status="run"> @@ -218,7 +226,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 6 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" time="{duration}" status="run"> @@ -227,7 +235,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 2 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" time="{duration}" status="run"/> @@ -240,7 +248,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1.0 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" time="{duration}" status="run"> @@ -249,7 +257,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1.0f == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" time="{duration}" status="run"> @@ -258,7 +266,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" time="{duration}" status="run"/> @@ -270,7 +278,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 1 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" time="{duration}" status="run"> @@ -279,7 +287,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 3 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" time="{duration}" status="run"> @@ -288,7 +296,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 6 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" time="{duration}" status="run"/> @@ -300,7 +308,7 @@ FAILED: REQUIRE( m_a == 2 ) with expansion: 1 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that succeeds" time="{duration}" status="run"/> @@ -317,7 +325,7 @@ Class.tests.cpp:<line number> <failure type="FAIL"> FAILED: to infinity and beyond -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="A couple of nested sections followed by a failure/Outer/Inner" time="{duration}" status="run"/> @@ -327,14 +335,14 @@ FAILED: CHECK( &o1 == &o2 ) with expansion: 0x<hex digits> == 0x<hex digits> -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> <failure message="o1 == o2" type="CHECK"> FAILED: CHECK( o1 == o2 ) with expansion: {?} == {?} -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Absolute margin" time="{duration}" status="run"/> @@ -344,7 +352,7 @@ Tricky.tests.cpp:<line number> FAILED: {Unknown expression after the reported line} unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Anonymous test case 1" time="{duration}" status="run"/> @@ -414,14 +422,14 @@ FAILED: with expansion: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), ContainsSubstring( "STRING" )" type="CHECK_THAT"> FAILED: CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Copy and then generate a range/from var and iterators" time="{duration}" status="run"/> @@ -433,7 +441,7 @@ Matchers.tests.cpp:<line number> FAILED: REQUIRE_NOTHROW( throwCustom() ) custom exception - not std -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for throwing as something else" time="{duration}" status="run"> @@ -441,27 +449,33 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE_THROWS_AS( throwCustom(), std::exception ) custom exception - not std -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Custom std-exceptions can be custom translated" time="{duration}" status="run"> <error type="TEST_CASE"> FAILED: custom std exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Empty generators can SKIP in constructor" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +This generator is empty +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="Empty stream name opens cout stream" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Empty tag is not allowed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="EndsWith string matcher" time="{duration}" status="run"> <failure message="testStringForMatching(), EndsWith( "Substring" )" type="CHECK_THAT"> FAILED: CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "Substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No )" type="CHECK_THAT"> FAILED: @@ -469,7 +483,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Enums can quickly have stringification enabled using REGISTER_ENUM" time="{duration}" status="run"/> @@ -482,91 +496,91 @@ FAILED: CHECK( data.int_seven == 6 ) with expansion: 7 == 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven == 8" type="CHECK"> FAILED: CHECK( data.int_seven == 8 ) with expansion: 7 == 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven == 0" type="CHECK"> FAILED: CHECK( data.int_seven == 0 ) with expansion: 7 == 0 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one == Approx( 9.11f )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one == Approx( 9.11f ) ) with expansion: 9.1f == Approx( 9.1099996567 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one == Approx( 9.0f )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one == Approx( 9.0f ) ) with expansion: 9.1f == Approx( 9.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one == Approx( 1 )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one == Approx( 1 ) ) with expansion: 9.1f == Approx( 1.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one == Approx( 0 )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one == Approx( 0 ) ) with expansion: 9.1f == Approx( 0.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.double_pi == Approx( 3.1415 )" type="CHECK"> FAILED: CHECK( data.double_pi == Approx( 3.1415 ) ) with expansion: 3.1415926535 == Approx( 3.1415 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello == "goodbye"" type="CHECK"> FAILED: CHECK( data.str_hello == "goodbye" ) with expansion: "hello" == "goodbye" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello == "hell"" type="CHECK"> FAILED: CHECK( data.str_hello == "hell" ) with expansion: "hello" == "hell" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello == "hello1"" type="CHECK"> FAILED: CHECK( data.str_hello == "hello1" ) with expansion: "hello" == "hello1" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello.size() == 6" type="CHECK"> FAILED: CHECK( data.str_hello.size() == 6 ) with expansion: 5 == 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="x == Approx( 1.301 )" type="CHECK"> FAILED: CHECK( x == Approx( 1.301 ) ) with expansion: 1.3 == Approx( 1.301 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Equality checks that should succeed" time="{duration}" status="run"/> @@ -578,7 +592,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No )" type="CHECK_THAT"> FAILED: @@ -586,7 +600,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" time="{duration}" status="run"/> @@ -594,12 +608,12 @@ Matchers.tests.cpp:<line number> <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }" type="CHECK_THROWS_MATCHES"> FAILED: CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }" type="REQUIRE_THROWS_MATCHES"> FAILED: REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that fail/Type mismatch" time="{duration}" status="run"> @@ -607,13 +621,13 @@ Matchers.tests.cpp:<line number> FAILED: CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </error> <error message="throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }" type="REQUIRE_THROWS_MATCHES"> FAILED: REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}" status="run"> @@ -622,17 +636,18 @@ FAILED: CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 }" type="REQUIRE_THROWS_MATCHES"> FAILED: REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that succeed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Exception message can be matched" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Exception messages can be tested for/exact match" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Exception messages can be tested for/different case" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Exception messages can be tested for/wildcarded" time="{duration}" status="run"/> @@ -642,53 +657,56 @@ Matchers.tests.cpp:<line number> FAILED: CHECK_THROWS_AS( thisThrows(), std::string ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> <failure message="thisDoesntThrow(), std::domain_error" type="CHECK_THROWS_AS"> FAILED: CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </failure> <error message="thisThrows()" type="CHECK_NOTHROW"> FAILED: CHECK_NOTHROW( thisThrows() ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="FAIL aborts the test" time="{duration}" status="run"> <failure type="FAIL"> FAILED: This is a failure -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="FAIL does not require an argument" time="{duration}" status="run"> <failure type="FAIL"> FAILED: -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="FAIL_CHECK does not abort the test" time="{duration}" status="run"> <failure type="FAIL_CHECK"> FAILED: This is a failure -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Factorials are computed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Filter generator throws exception for empty generator" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative/Some subnormal values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Margin" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/ULPs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Composed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: double/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/IsNaN" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative/Some subnormal values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Margin" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/ULPs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Composed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Floating point matchers: float/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/IsNaN" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Basic usage" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Throws if there are no matching values" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Generators -- adapters/Shortening a range" time="{duration}" status="run"/> @@ -742,7 +760,7 @@ with expansion: 2 == 1 this message should be logged so should this -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="INFO gets logged on failure, even if captured before successful assertions" time="{duration}" status="run"> @@ -753,7 +771,7 @@ with expansion: 2 == 1 this message may be logged later this message should be logged -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> <failure message="a == 0" type="CHECK"> FAILED: @@ -763,7 +781,7 @@ with expansion: this message may be logged later this message should be logged and this, but later -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="INFO is reset for each loop" time="{duration}" status="run"> @@ -774,7 +792,7 @@ with expansion: 10 < 10 current counter 10 i := 10 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Inequality checks that should fail" time="{duration}" status="run"> @@ -784,35 +802,35 @@ FAILED: CHECK( data.int_seven != 7 ) with expansion: 7 != 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one != Approx( 9.1f )" type="CHECK"> FAILED: CHECK( data.float_nine_point_one != Approx( 9.1f ) ) with expansion: 9.1f != Approx( 9.1000003815 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.double_pi != Approx( 3.1415926535 )" type="CHECK"> FAILED: CHECK( data.double_pi != Approx( 3.1415926535 ) ) with expansion: 3.1415926535 != Approx( 3.1415926535 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello != "hello"" type="CHECK"> FAILED: CHECK( data.str_hello != "hello" ) with expansion: "hello" != "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello.size() != 5" type="CHECK"> FAILED: CHECK( data.str_hello.size() != 5 ) with expansion: 5 != 5 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Inequality checks that should succeed" time="{duration}" status="run"/> @@ -829,7 +847,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Matchers can be negated (Not) with the ! operator" time="{duration}" status="run"/> @@ -839,35 +857,35 @@ FAILED: CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/1/A" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/2/A" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/1/B" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mayfail test case with nested sections/2/B" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Mismatching exception messages failing the test" time="{duration}" status="run"> @@ -876,7 +894,7 @@ FAILED: REQUIRE_THROWS_WITH( thisThrows(), "should fail" ) with expansion: "expected exception" equals: "should fail" -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Multireporter calls reporters and listeners in correct order" time="{duration}" status="run"/> @@ -889,7 +907,7 @@ Exception.tests.cpp:<line number> <error type="TEST_CASE"> FAILED: custom exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Objects that evaluated in boolean contexts can be checked" time="{duration}" status="run"/> @@ -900,133 +918,133 @@ FAILED: CHECK( data.int_seven > 7 ) with expansion: 7 > 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven < 7" type="CHECK"> FAILED: CHECK( data.int_seven < 7 ) with expansion: 7 < 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven > 8" type="CHECK"> FAILED: CHECK( data.int_seven > 8 ) with expansion: 7 > 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven < 6" type="CHECK"> FAILED: CHECK( data.int_seven < 6 ) with expansion: 7 < 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven < 0" type="CHECK"> FAILED: CHECK( data.int_seven < 0 ) with expansion: 7 < 0 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven < -1" type="CHECK"> FAILED: CHECK( data.int_seven < -1 ) with expansion: 7 < -1 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven >= 8" type="CHECK"> FAILED: CHECK( data.int_seven >= 8 ) with expansion: 7 >= 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.int_seven <= 6" type="CHECK"> FAILED: CHECK( data.int_seven <= 6 ) with expansion: 7 <= 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one < 9" type="CHECK"> FAILED: CHECK( data.float_nine_point_one < 9 ) with expansion: 9.1f < 9 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one > 10" type="CHECK"> FAILED: CHECK( data.float_nine_point_one > 10 ) with expansion: 9.1f > 10 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.float_nine_point_one > 9.2" type="CHECK"> FAILED: CHECK( data.float_nine_point_one > 9.2 ) with expansion: 9.1f > 9.2 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello > "hello"" type="CHECK"> FAILED: CHECK( data.str_hello > "hello" ) with expansion: "hello" > "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello < "hello"" type="CHECK"> FAILED: CHECK( data.str_hello < "hello" ) with expansion: "hello" < "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello > "hellp"" type="CHECK"> FAILED: CHECK( data.str_hello > "hellp" ) with expansion: "hello" > "hellp" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello > "z"" type="CHECK"> FAILED: CHECK( data.str_hello > "z" ) with expansion: "hello" > "z" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello < "hellm"" type="CHECK"> FAILED: CHECK( data.str_hello < "hellm" ) with expansion: "hello" < "hellm" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello < "a"" type="CHECK"> FAILED: CHECK( data.str_hello < "a" ) with expansion: "hello" < "a" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello >= "z"" type="CHECK"> FAILED: CHECK( data.str_hello >= "z" ) with expansion: "hello" >= "z" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="data.str_hello <= "a"" type="CHECK"> FAILED: CHECK( data.str_hello <= "a" ) with expansion: "hello" <= "a" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Ordering comparison checks that should succeed" time="{duration}" status="run"/> @@ -1036,52 +1054,19 @@ Condition.tests.cpp:<line number> <failure type="FAIL"> FAILED: Message from section one -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Output from all sections is reported/two" time="{duration}" status="run"> <failure type="FAIL"> FAILED: Message from section two -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Overloaded comma or address-of operators are not used" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Empty test spec should have no filters" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from empty string should have no filters" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from just a comma should have no filters" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from name should have one filter" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from quoted name should have one filter" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from name should have one filter" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at the start" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at the end" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at both ends" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at the start" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at the end" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at both ends" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at both ends, redundant at start" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Just wildcard" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag, two matches" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Two tags" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Two tags, spare separated" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcarded name and tag" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag exclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion and one tag inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion and one wldcarded name inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion, using exclude:, and one wldcarded name inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/name exclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion with tag inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion, using exclude:, with tag inclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/two wildcarded names" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/empty tag" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/empty quoted name" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/quoted string followed by tag exclusion" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Leading and trailing spaces in test spec" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Leading and trailing spaces in test name" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Shortened hide tags are split apart when parsing" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Parse test names and tags/Shortened hide tags also properly handle exclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse uints/proper inputs" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse uints/Bad inputs" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Parsed tags are matched case insensitive" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/shard-count" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Negative shard count reports error" time="{duration}" status="run"/> @@ -1145,7 +1130,7 @@ FAILED: CHECK( truthy(false) ) with expansion: Hey, its truthy! -Decomposition.tests.cpp:<line number> +at Decomposition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Regex string matcher" time="{duration}" status="run"> @@ -1155,7 +1140,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), Matches( "contains 'abc' as a substring" )" type="CHECK_THAT"> FAILED: @@ -1163,7 +1148,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), Matches( "this string contains 'abc' as a" )" type="CHECK_THAT"> FAILED: @@ -1171,7 +1156,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Registering reporter with '::' in name fails" time="{duration}" status="run"/> @@ -1235,7 +1220,7 @@ FAILED: CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "This String" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No )" type="CHECK_THAT"> FAILED: @@ -1243,7 +1228,7 @@ FAILED: with expansion: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Static arrays are convertible to string/Single item" time="{duration}" status="run"/> @@ -1291,7 +1276,7 @@ with expansion: $a = 20; } " -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" time="{duration}" status="run"/> @@ -1364,14 +1349,14 @@ Misc.tests.cpp:<line number> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Testing checked-if 3" time="{duration}" status="run"> <skipped message="TEST_CASE tagged with !mayfail"/> <failure type="FAIL"> FAILED: -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="The NO_FAIL macro reports a failure but does not fail the test" time="{duration}" status="run"/> @@ -1384,7 +1369,7 @@ Misc.tests.cpp:<line number> <error type="TEST_CASE"> FAILED: For some reason someone is throwing a string literal! -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Tracker" time="{duration}" status="run"/> @@ -1398,11 +1383,19 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2/fail S2" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Tracker/open a nested section" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Trim strings" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types (differ in array N)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types and value types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers, one random access, one not" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Value type/Two equal containers of different value types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Value type/Two non-equal containers of different value types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Ranges with begin that needs ADL" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Type conversions of RangeEquals and similar/Custom predicate/Two equal non-empty containers (close enough)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Unexpected exceptions can be translated" time="{duration}" status="run"> <error type="TEST_CASE"> FAILED: 3.14 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Upcasting special member functions/Move constructor" time="{duration}" status="run"/> @@ -1413,10 +1406,10 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/All true evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/Empty evaluates to true" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/One false evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/One false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Basic usage/All false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/All true evaluates to true" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Contained type is convertible to bool/All false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AllTrue range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> @@ -1426,10 +1419,10 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/All true evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/Empty evaluates to false" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/One true evalutes to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/One true evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Basic usage/All false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All true evaluates to true" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evalutes to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All false evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of AnyTrue range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> @@ -1439,13 +1432,33 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/All true evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/Empty evaluates to true" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/One true evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/One true evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Basic usage/All false evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All true evaluates to false" time="{duration}" status="run"/> - <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evalutes to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evaluates to false" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All false evaluates to true" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of NoneTrue range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Empty container matches empty container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Empty container does not match non-empty container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Two equal 1-length non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Two equal-sized, equal, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Two equal-sized, non-equal, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Basic usage/Two non-equal-sized, non-empty containers (with same first elements)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Custom predicate/Two equal non-empty containers (close enough)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Custom predicate/Two non-equal non-empty containers (close enough)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Ranges that need ADL begin/end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Check short-circuiting behaviour/Check short-circuits on failure" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of RangeEquals range matcher/Check short-circuiting behaviour/All elements are checked on success" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Empty container matches empty container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Empty container does not match non-empty container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal 1-length non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal-sized, equal, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal-sized, non-equal, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two non-equal-sized, non-empty containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Custom predicate/Two equal non-empty containers (close enough)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Custom predicate/Two non-equal non-empty containers (close enough)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of UnorderedRangeEquals range matcher/Ranges that need ADL begin/end" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Some with stdlib containers" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Type requires ADL found size free function" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Type has size member" time="{duration}" status="run"/> @@ -1461,7 +1474,7 @@ FAILED: CHECK_THAT( empty, Approx( t1 ) ) with expansion: { } is approx: { 1.0, 2.0 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector Approx matcher -- failing/Just different vectors" time="{duration}" status="run"> @@ -1470,7 +1483,7 @@ FAILED: CHECK_THAT( v1, Approx( v2 ) ) with expansion: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector matchers/Contains (element)" time="{duration}" status="run"/> @@ -1484,14 +1497,14 @@ FAILED: CHECK_THAT( v, VectorContains( -1 ) ) with expansion: { 1, 2, 3 } Contains: -1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="empty, VectorContains( 1 )" type="CHECK_THAT"> FAILED: CHECK_THAT( empty, VectorContains( 1 ) ) with expansion: { } Contains: 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector matchers that fail/Contains (vector)" time="{duration}" status="run"> @@ -1500,14 +1513,14 @@ FAILED: CHECK_THAT( empty, Contains( v ) ) with expansion: { } Contains: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="v, Contains( v2 )" type="CHECK_THAT"> FAILED: CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 4 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector matchers that fail/Equals" time="{duration}" status="run"> @@ -1516,28 +1529,28 @@ FAILED: CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="v2, Equals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( v2, Equals( v ) ) with expansion: { 1, 2 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="empty, Equals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( empty, Equals( v ) ) with expansion: { } Equals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="v, Equals( empty )" type="CHECK_THAT"> FAILED: CHECK_THAT( v, Equals( empty ) ) with expansion: { 1, 2, 3 } Equals: { } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Vector matchers that fail/UnorderedEquals" time="{duration}" status="run"> @@ -1546,28 +1559,28 @@ FAILED: CHECK_THAT( v, UnorderedEquals( empty ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="empty, UnorderedEquals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( empty, UnorderedEquals( v ) ) with expansion: { } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="permuted, UnorderedEquals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="permuted, UnorderedEquals( v )" type="CHECK_THAT"> FAILED: CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 3, 1 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="When checked exceptions are thrown they can be expected or unexpected" time="{duration}" status="run"/> @@ -1575,7 +1588,7 @@ Matchers.tests.cpp:<line number> <error type="TEST_CASE"> FAILED: unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown during a CHECK the test should continue" time="{duration}" status="run"> @@ -1583,7 +1596,7 @@ Exception.tests.cpp:<line number> FAILED: CHECK( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" time="{duration}" status="run"> @@ -1591,7 +1604,7 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown from functions they are always failures" time="{duration}" status="run"> @@ -1599,14 +1612,14 @@ Exception.tests.cpp:<line number> FAILED: CHECK( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown from sections they are always failures/section name" time="{duration}" status="run"> <error type="TEST_CASE"> FAILED: unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="X/level/0/a" time="{duration}" status="run"/> @@ -1622,6 +1635,12 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (1)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (x7F)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="XmlWriter writes boolean attributes as true/false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="a succeeding test can still be skipped" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="analyse no analysis" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="array<int, N> -> toString" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="benchmark function call/without chronometer" time="{duration}" status="run"/> @@ -1634,7 +1653,7 @@ FAILED: REQUIRE( testCheckedElse( false ) ) with expansion: false -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="checkedIf" time="{duration}" status="run"/> @@ -1644,7 +1663,7 @@ FAILED: REQUIRE( testCheckedIf( false ) ) with expansion: false -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="classify_outliers/none" time="{duration}" status="run"/> @@ -1656,25 +1675,80 @@ Misc.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="comparisons between const int variables" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="comparisons between int variables" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="convertToBits" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="dynamic skipping works with generators" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +skipping because answer = 41 +at Skip.tests.cpp:<line number> + </skipped> + <skipped type="SKIP"> +SKIPPED +skipping because answer = 43 +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="empty tags are not allowed" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="erfc_inv" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="estimate_clock_resolution" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/d (leaf)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/e (leaf)" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="even more nested SECTION tests/f (leaf)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="failed assertions before SKIP cause test case to fail" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure message="3 == 4" type="CHECK"> +FAILED: + CHECK( 3 == 4 ) +at Skip.tests.cpp:<line number> + </failure> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="failing for some generator values causes entire test case to fail" time="{duration}" status="run"> + <failure type="FAIL"> +FAILED: +at Skip.tests.cpp:<line number> + </failure> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + <failure type="FAIL"> +FAILED: +at Skip.tests.cpp:<line number> + </failure> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="failing in some unskipped sections causes entire test case to fail/skipped" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="failing in some unskipped sections causes entire test case to fail/not skipped" time="{duration}" status="run"> + <skipped message="TEST_CASE tagged with !mayfail"/> + <failure type="FAIL"> +FAILED: +at Skip.tests.cpp:<line number> + </failure> + </testcase> <testcase classname="<exe-name>.global" name="is_unary_function" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="just failure" time="{duration}" status="run"> <failure type="FAIL"> FAILED: Previous info should not be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="just failure after unscoped info" time="{duration}" status="run"> <failure type="FAIL"> FAILED: previous unscoped info SHOULD not be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="long long" time="{duration}" status="run"/> @@ -1684,7 +1758,7 @@ FAILED: CHECK( b > a ) with expansion: 0 > 1 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 1" time="{duration}" status="run"> @@ -1693,7 +1767,7 @@ FAILED: CHECK( b > a ) with expansion: 1 > 1 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 2" time="{duration}" status="run"/> @@ -1711,7 +1785,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[0] (1) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1719,7 +1793,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[1] (1) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1727,7 +1801,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[3] (3) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1735,7 +1809,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[4] (5) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1743,7 +1817,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[6] (13) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="( fib[i] % 2 ) == 0" type="CHECK"> FAILED: @@ -1751,7 +1825,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[7] (21) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="makeStream recognizes %debug stream name" time="{duration}" status="run"/> @@ -1767,13 +1841,26 @@ FAILED: REQUIRE( a == b ) with expansion: 1 == 2 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/not equal" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/less than" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal/not equal" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="nested sections can be skipped dynamically at runtime/B2/B" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="nested sections can be skipped dynamically at runtime/B" time="{duration}" status="run"> + <system-out> +a! +b1! +! + </system-out> + </testcase> <testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="normal_cdf" time="{duration}" status="run"/> @@ -1784,7 +1871,7 @@ Misc.tests.cpp:<line number> FAILED: REQUIRE( false ) this SHOULD be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="null strings" time="{duration}" status="run"/> @@ -1801,7 +1888,7 @@ FAILED: REQUIRE( false ) this SHOULD be seen this SHOULD also be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="prints unscoped info only for the first assertion" time="{duration}" status="run"> @@ -1809,7 +1896,7 @@ Message.tests.cpp:<line number> FAILED: CHECK( false ) this SHOULD be seen only ONCE -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="random SECTION tests/doesn't equal" time="{duration}" status="run"/> @@ -1825,12 +1912,20 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="resolution" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="run_for_at_least, chronometer" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="run_for_at_least, int" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="sections can be skipped dynamically at runtime/not skipped" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="sections can be skipped dynamically at runtime/skipped" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> + <testcase classname="<exe-name>.global" name="sections can be skipped dynamically at runtime/also not skipped" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="send a single char to INFO" time="{duration}" status="run"> <failure message="false" type="REQUIRE"> FAILED: REQUIRE( false ) 3 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="sends information to INFO" time="{duration}" status="run"> @@ -1839,10 +1934,17 @@ FAILED: REQUIRE( false ) hi i := 7 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="shortened hide tags are split apart" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="skipped tests can optionally provide a reason" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +skipping because answer = 43 +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="splitString" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="stacks unscoped info in loops" time="{duration}" status="run"> <failure message="false" type="CHECK"> @@ -1852,7 +1954,7 @@ Count 1 to 3... 1 2 3 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> <failure message="false" type="CHECK"> FAILED: @@ -1861,7 +1963,7 @@ Count 4 to 6... 4 5 6 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="startsWith" time="{duration}" status="run"/> @@ -1887,11 +1989,17 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="strlen3" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="tables" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="tags with dots in later positions are not parsed as hidden" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tests can be skipped dynamically at runtime" time="{duration}" status="run"> + <skipped type="SKIP"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testcase> <testcase classname="<exe-name>.global" name="thrown std::strings are translated" time="{duration}" status="run"> <error type="TEST_CASE"> FAILED: Why would you throw a std::string? -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="toString on const wchar_t const pointer returns the string contents" time="{duration}" status="run"/> @@ -1936,6 +2044,9 @@ This would not be caught previously A string sent directly to stdout Message from section one Message from section two +a! +b1! +! </system-out> <system-err> Nor would this diff --git a/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index a9319a62800b1b8db2548b700c25d6ff75422164..592887f9c43fa5ccfcd1f8234c06cb639a640112 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- rng-seed=1 --> +<!-- filters='"*" ~[!nonportable] ~[!benchmark] ~[approvals]' rng-seed=1 --> <testExecutions version="1"loose text artifact > <file path="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp"> @@ -9,44 +9,6 @@ <testCase name="is_unary_function" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp"> - <testCase name="#1905 -- test spec parser properly clears internal state between compound tests" duration="{duration}"/> - <testCase name="#1912 -- test spec parser handles escaping/Various parentheses" duration="{duration}"/> - <testCase name="#1912 -- test spec parser handles escaping/backslash in test name" duration="{duration}"/> - <testCase name="Parse test names and tags/Empty test spec should have no filters" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from empty string should have no filters" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from just a comma should have no filters" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from name should have one filter" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from quoted name should have one filter" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from name should have one filter" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcard at the start" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcard at the end" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcard at both ends" duration="{duration}"/> - <testCase name="Parse test names and tags/Redundant wildcard at the start" duration="{duration}"/> - <testCase name="Parse test names and tags/Redundant wildcard at the end" duration="{duration}"/> - <testCase name="Parse test names and tags/Redundant wildcard at both ends" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcard at both ends, redundant at start" duration="{duration}"/> - <testCase name="Parse test names and tags/Just wildcard" duration="{duration}"/> - <testCase name="Parse test names and tags/Single tag" duration="{duration}"/> - <testCase name="Parse test names and tags/Single tag, two matches" duration="{duration}"/> - <testCase name="Parse test names and tags/Two tags" duration="{duration}"/> - <testCase name="Parse test names and tags/Two tags, spare separated" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcarded name and tag" duration="{duration}"/> - <testCase name="Parse test names and tags/Single tag exclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/One tag exclusion and one tag inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/One tag exclusion and one wldcarded name inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/One tag exclusion, using exclude:, and one wldcarded name inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/name exclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/wildcarded name exclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/wildcarded name exclusion with tag inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/wildcarded name exclusion, using exclude:, with tag inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/two wildcarded names" duration="{duration}"/> - <testCase name="Parse test names and tags/empty tag" duration="{duration}"/> - <testCase name="Parse test names and tags/empty quoted name" duration="{duration}"/> - <testCase name="Parse test names and tags/quoted string followed by tag exclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/Leading and trailing spaces in test spec" duration="{duration}"/> - <testCase name="Parse test names and tags/Leading and trailing spaces in test name" duration="{duration}"/> - <testCase name="Parse test names and tags/Shortened hide tags are split apart when parsing" duration="{duration}"/> - <testCase name="Parse test names and tags/Shortened hide tags also properly handle exclusion" duration="{duration}"/> <testCase name="Parsing sharding-related cli flags/shard-count" duration="{duration}"/> <testCase name="Parsing sharding-related cli flags/Negative shard count reports error" duration="{duration}"/> <testCase name="Parsing sharding-related cli flags/Zero shard count reports error" duration="{duration}"/> @@ -109,6 +71,7 @@ <testCase name="convertToBits" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp"> + <testCase name="Filter generator throws exception for empty generator" duration="{duration}"/> <testCase name="Generators internals/Single value" duration="{duration}"/> <testCase name="Generators internals/Preset values" duration="{duration}"/> <testCase name="Generators internals/Generator combinator" duration="{duration}"/> @@ -157,6 +120,10 @@ <testCase name="warmup" duration="{duration}"/> <testCase name="weighted_average_quantile" duration="{duration}"/> </file> + <file path="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp"> + <testCase name="Parse uints/proper inputs" duration="{duration}"/> + <testCase name="Parse uints/Bad inputs" duration="{duration}"/> + </file> <file path="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp"> <testCase name="#1938 - GENERATE after a section/A" duration="{duration}"/> <testCase name="#1938 - GENERATE after a section/B" duration="{duration}"/> @@ -266,7 +233,6 @@ <testCase name="startsWith" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp"> - <testCase name="Empty tag is not allowed" duration="{duration}"/> <testCase name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" duration="{duration}"/> <testCase name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" duration="{duration}"/> <testCase name="Tags with spaces and non-alphanumerical characters are accepted" duration="{duration}"/> @@ -283,6 +249,11 @@ <testCase name="Hashing different test cases produces different result/Different tags" duration="{duration}"/> <testCase name="Hashing test case produces same hash across multiple calls" duration="{duration}"/> </file> + <file path="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp"> + <testCase name="#1905 -- test spec parser properly clears internal state between compound tests" duration="{duration}"/> + <testCase name="#1912 -- test spec parser handles escaping/Various parentheses" duration="{duration}"/> + <testCase name="#1912 -- test spec parser handles escaping/backslash in test name" duration="{duration}"/> + </file> <file path="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp"> <testCase name="Parsed tags are matched case insensitive" duration="{duration}"/> <testCase name="Parsing tags with non-alphabetical characters is pass-through" duration="{duration}"/> @@ -359,7 +330,7 @@ FAILED: REQUIRE( s == "world" ) with expansion: "hello" == "world" -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A METHOD_AS_TEST_CASE based test run that succeeds" duration="{duration}"/> @@ -369,7 +340,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" duration="{duration}"> @@ -378,7 +349,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" duration="{duration}"> @@ -387,7 +358,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" duration="{duration}"> @@ -396,7 +367,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" duration="{duration}"/> @@ -409,7 +380,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 6 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" duration="{duration}"> @@ -418,7 +389,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 2 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" duration="{duration}"> @@ -427,7 +398,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 6 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" duration="{duration}"> @@ -436,7 +407,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 2 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" duration="{duration}"/> @@ -449,7 +420,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1.0 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" duration="{duration}"> @@ -458,7 +429,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1.0f == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" duration="{duration}"> @@ -467,7 +438,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" duration="{duration}"/> @@ -479,7 +450,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 1 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" duration="{duration}"> @@ -488,7 +459,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 3 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" duration="{duration}"> @@ -497,7 +468,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 6 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" duration="{duration}"/> @@ -509,7 +480,7 @@ FAILED: REQUIRE( m_a == 2 ) with expansion: 1 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEST_CASE_METHOD based test run that succeeds" duration="{duration}"/> @@ -537,52 +508,52 @@ Class.tests.cpp:<line number> <failure message="CHECK(false != false)"> FAILED: CHECK( false != false ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(true != true)"> FAILED: CHECK( true != true ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(!true)"> FAILED: CHECK( !true ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK_FALSE(!(true))"> FAILED: CHECK_FALSE( true ) with expansion: !true -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(!trueValue)"> FAILED: CHECK( !trueValue ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK_FALSE(!(trueValue))"> FAILED: CHECK_FALSE( trueValue ) with expansion: !true -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(!(1 == 1))"> FAILED: CHECK( !(1 == 1) ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK_FALSE(!(1 == 1))"> FAILED: CHECK_FALSE( 1 == 1 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testCase> <testCase name="'Not' checks that should succeed" duration="{duration}"/> @@ -595,91 +566,91 @@ FAILED: CHECK( data.int_seven == 6 ) with expansion: 7 == 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.int_seven == 8)"> FAILED: CHECK( data.int_seven == 8 ) with expansion: 7 == 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.int_seven == 0)"> FAILED: CHECK( data.int_seven == 0 ) with expansion: 7 == 0 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one == Approx( 9.11f ))"> FAILED: CHECK( data.float_nine_point_one == Approx( 9.11f ) ) with expansion: 9.1f == Approx( 9.1099996567 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one == Approx( 9.0f ))"> FAILED: CHECK( data.float_nine_point_one == Approx( 9.0f ) ) with expansion: 9.1f == Approx( 9.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one == Approx( 1 ))"> FAILED: CHECK( data.float_nine_point_one == Approx( 1 ) ) with expansion: 9.1f == Approx( 1.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one == Approx( 0 ))"> FAILED: CHECK( data.float_nine_point_one == Approx( 0 ) ) with expansion: 9.1f == Approx( 0.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.double_pi == Approx( 3.1415 ))"> FAILED: CHECK( data.double_pi == Approx( 3.1415 ) ) with expansion: 3.1415926535 == Approx( 3.1415 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello == "goodbye")"> FAILED: CHECK( data.str_hello == "goodbye" ) with expansion: "hello" == "goodbye" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello == "hell")"> FAILED: CHECK( data.str_hello == "hell" ) with expansion: "hello" == "hell" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello == "hello1")"> FAILED: CHECK( data.str_hello == "hello1" ) with expansion: "hello" == "hello1" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello.size() == 6)"> FAILED: CHECK( data.str_hello.size() == 6 ) with expansion: 5 == 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(x == Approx( 1.301 ))"> FAILED: CHECK( x == Approx( 1.301 ) ) with expansion: 1.3 == Approx( 1.301 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Equality checks that should succeed" duration="{duration}"/> @@ -689,60 +660,60 @@ FAILED: CHECK( data.int_seven != 7 ) with expansion: 7 != 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one != Approx( 9.1f ))"> FAILED: CHECK( data.float_nine_point_one != Approx( 9.1f ) ) with expansion: 9.1f != Approx( 9.1000003815 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.double_pi != Approx( 3.1415926535 ))"> FAILED: CHECK( data.double_pi != Approx( 3.1415926535 ) ) with expansion: 3.1415926535 != Approx( 3.1415926535 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello != "hello")"> FAILED: CHECK( data.str_hello != "hello" ) with expansion: "hello" != "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello.size() != 5)"> FAILED: CHECK( data.str_hello.size() != 5 ) with expansion: 5 != 5 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Inequality checks that should succeed" duration="{duration}"/> <testCase name="Mayfail test case with nested sections/1/A" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Mayfail test case with nested sections/2/A" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Mayfail test case with nested sections/1/B" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Mayfail test case with nested sections/2/B" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Ordering comparison checks that should fail" duration="{duration}"> @@ -751,133 +722,133 @@ FAILED: CHECK( data.int_seven > 7 ) with expansion: 7 > 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven < 7)"> FAILED: CHECK( data.int_seven < 7 ) with expansion: 7 < 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven > 8)"> FAILED: CHECK( data.int_seven > 8 ) with expansion: 7 > 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven < 6)"> FAILED: CHECK( data.int_seven < 6 ) with expansion: 7 < 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven < 0)"> FAILED: CHECK( data.int_seven < 0 ) with expansion: 7 < 0 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven < -1)"> FAILED: CHECK( data.int_seven < -1 ) with expansion: 7 < -1 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven >= 8)"> FAILED: CHECK( data.int_seven >= 8 ) with expansion: 7 >= 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven <= 6)"> FAILED: CHECK( data.int_seven <= 6 ) with expansion: 7 <= 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.float_nine_point_one < 9)"> FAILED: CHECK( data.float_nine_point_one < 9 ) with expansion: 9.1f < 9 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.float_nine_point_one > 10)"> FAILED: CHECK( data.float_nine_point_one > 10 ) with expansion: 9.1f > 10 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.float_nine_point_one > 9.2)"> FAILED: CHECK( data.float_nine_point_one > 9.2 ) with expansion: 9.1f > 9.2 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello > "hello")"> FAILED: CHECK( data.str_hello > "hello" ) with expansion: "hello" > "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello < "hello")"> FAILED: CHECK( data.str_hello < "hello" ) with expansion: "hello" < "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello > "hellp")"> FAILED: CHECK( data.str_hello > "hellp" ) with expansion: "hello" > "hellp" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello > "z")"> FAILED: CHECK( data.str_hello > "z" ) with expansion: "hello" > "z" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello < "hellm")"> FAILED: CHECK( data.str_hello < "hellm" ) with expansion: "hello" < "hellm" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello < "a")"> FAILED: CHECK( data.str_hello < "a" ) with expansion: "hello" < "a" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello >= "z")"> FAILED: CHECK( data.str_hello >= "z" ) with expansion: "hello" >= "z" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello <= "a")"> FAILED: CHECK( data.str_hello <= "a" ) with expansion: "hello" <= "a" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testCase> <testCase name="Ordering comparison checks that should succeed" duration="{duration}"/> @@ -892,7 +863,7 @@ FAILED: CHECK( truthy(false) ) with expansion: Hey, its truthy! -Decomposition.tests.cpp:<line number> +at Decomposition.tests.cpp:<line number> </failure> </testCase> </file> @@ -910,7 +881,7 @@ Decomposition.tests.cpp:<line number> FAILED: expected exception answer := 42 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </skipped> </testCase> <testCase name="#748 - captures with unexpected exceptions/inside REQUIRE_NOTHROW" duration="{duration}"> @@ -919,7 +890,7 @@ FAILED: REQUIRE_NOTHROW( thisThrows() ) expected exception answer := 42 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </skipped> </testCase> <testCase name="#748 - captures with unexpected exceptions/inside REQUIRE_THROWS" duration="{duration}"/> @@ -928,7 +899,7 @@ Exception.tests.cpp:<line number> FAILED: {Unknown expression after the reported line} unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Custom exceptions can be translated when testing for nothrow" duration="{duration}"> @@ -936,7 +907,7 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE_NOTHROW( throwCustom() ) custom exception - not std -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Custom exceptions can be translated when testing for throwing as something else" duration="{duration}"> @@ -944,14 +915,14 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE_THROWS_AS( throwCustom(), std::exception ) custom exception - not std -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Custom std-exceptions can be custom translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: custom std exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Exception messages can be tested for/exact match" duration="{duration}"/> @@ -962,18 +933,18 @@ Exception.tests.cpp:<line number> FAILED: CHECK_THROWS_AS( thisThrows(), std::string ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> <failure message="CHECK_THROWS_AS(thisDoesntThrow(), std::domain_error)"> FAILED: CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </failure> <error message="CHECK_NOTHROW(thisThrows())"> FAILED: CHECK_NOTHROW( thisThrows() ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Mismatching exception messages failing the test" duration="{duration}"> @@ -982,28 +953,28 @@ FAILED: REQUIRE_THROWS_WITH( thisThrows(), "should fail" ) with expansion: "expected exception" equals: "should fail" -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </failure> </testCase> <testCase name="Non-std exceptions can be translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: custom exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Thrown string literals are translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: For some reason someone is throwing a string literal! -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Unexpected exceptions can be translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: 3.14 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When checked exceptions are thrown they can be expected or unexpected" duration="{duration}"/> @@ -1011,7 +982,7 @@ Exception.tests.cpp:<line number> <error message="TEST_CASE()"> FAILED: unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When unchecked exceptions are thrown during a CHECK the test should continue" duration="{duration}"> @@ -1019,7 +990,7 @@ Exception.tests.cpp:<line number> FAILED: CHECK( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" duration="{duration}"> @@ -1027,7 +998,7 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When unchecked exceptions are thrown from functions they are always failures" duration="{duration}"> @@ -1035,27 +1006,34 @@ Exception.tests.cpp:<line number> FAILED: CHECK( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When unchecked exceptions are thrown from sections they are always failures/section name" duration="{duration}"> <error message="TEST_CASE()"> FAILED: unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="thrown std::strings are translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: Why would you throw a std::string? -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> </file> <file path="tests/<exe-name>/UsageTests/Generators.tests.cpp"> <testCase name="#1913 - GENERATE inside a for loop should not keep recreating the generator" duration="{duration}"/> <testCase name="#1913 - GENERATEs can share a line" duration="{duration}"/> + <testCase name="#2615 - Throwing in constructor generator fails test case but does not abort" duration="{duration}"> + <skipped message="TEST_CASE()"> +FAILED: +failure to init +at Generators.tests.cpp:<line number> + </skipped> + </testCase> <testCase name="3x3x3 ints" duration="{duration}"/> <testCase name="Copy and then generate a range/from var and iterators" duration="{duration}"/> <testCase name="Copy and then generate a range/From a temporary container" duration="{duration}"/> @@ -1099,14 +1077,14 @@ FAILED: CHECK_THAT( testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), ContainsSubstring( "STRING" ))"> FAILED: CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="EndsWith string matcher" duration="{duration}"> @@ -1115,14 +1093,14 @@ FAILED: CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "Substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ))"> FAILED: CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Equals" duration="{duration}"/> @@ -1132,26 +1110,26 @@ FAILED: CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ))"> FAILED: CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Exception matchers that fail/No exception" duration="{duration}"> <failure message="CHECK_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{ 1 })"> FAILED: CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="REQUIRE_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{ 1 })"> FAILED: REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Exception matchers that fail/Type mismatch" duration="{duration}"> @@ -1159,13 +1137,13 @@ Matchers.tests.cpp:<line number> FAILED: CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </error> <error message="REQUIRE_THROWS_MATCHES(throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 })"> FAILED: REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </error> </testCase> <testCase name="Exception matchers that fail/Contents are wrong" duration="{duration}"> @@ -1174,17 +1152,18 @@ FAILED: CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="REQUIRE_THROWS_MATCHES(throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 })"> FAILED: REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Exception matchers that succeed" duration="{duration}"/> + <testCase name="Exception message can be matched" duration="{duration}"/> <testCase name="Exceptions matchers" duration="{duration}"/> <testCase name="Floating point matchers: double/Relative" duration="{duration}"/> <testCase name="Floating point matchers: double/Relative/Some subnormal values" duration="{duration}"/> @@ -1192,12 +1171,14 @@ Matchers.tests.cpp:<line number> <testCase name="Floating point matchers: double/ULPs" duration="{duration}"/> <testCase name="Floating point matchers: double/Composed" duration="{duration}"/> <testCase name="Floating point matchers: double/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: double/IsNaN" duration="{duration}"/> <testCase name="Floating point matchers: float/Relative" duration="{duration}"/> <testCase name="Floating point matchers: float/Relative/Some subnormal values" duration="{duration}"/> <testCase name="Floating point matchers: float/Margin" duration="{duration}"/> <testCase name="Floating point matchers: float/ULPs" duration="{duration}"/> <testCase name="Floating point matchers: float/Composed" duration="{duration}"/> <testCase name="Floating point matchers: float/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: float/IsNaN" duration="{duration}"/> <testCase name="Matchers can be (AllOf) composed with the && operator" duration="{duration}"/> <testCase name="Matchers can be (AnyOf) composed with the || operator" duration="{duration}"/> <testCase name="Matchers can be composed with both && and ||" duration="{duration}"/> @@ -1207,7 +1188,7 @@ FAILED: CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Matchers can be negated (Not) with the ! operator" duration="{duration}"/> @@ -1217,7 +1198,7 @@ FAILED: CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Overloaded comma or address-of operators are not used" duration="{duration}"/> @@ -1228,21 +1209,21 @@ FAILED: CHECK_THAT( testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), Matches( "contains 'abc' as a substring" ))"> FAILED: CHECK_THAT( testStringForMatching(), Matches( "contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), Matches( "this string contains 'abc' as a" ))"> FAILED: CHECK_THAT( testStringForMatching(), Matches( "this string contains 'abc' as a" ) ) with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Regression test #1" duration="{duration}"/> @@ -1252,14 +1233,14 @@ FAILED: CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "This String" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ))"> FAILED: CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="String matchers" duration="{duration}"/> @@ -1273,7 +1254,7 @@ FAILED: CHECK_THAT( empty, Approx( t1 ) ) with expansion: { } is approx: { 1.0, 2.0 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector Approx matcher -- failing/Just different vectors" duration="{duration}"> @@ -1282,7 +1263,7 @@ FAILED: CHECK_THAT( v1, Approx( v2 ) ) with expansion: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector matchers/Contains (element)" duration="{duration}"/> @@ -1296,14 +1277,14 @@ FAILED: CHECK_THAT( v, VectorContains( -1 ) ) with expansion: { 1, 2, 3 } Contains: -1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(empty, VectorContains( 1 ))"> FAILED: CHECK_THAT( empty, VectorContains( 1 ) ) with expansion: { } Contains: 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector matchers that fail/Contains (vector)" duration="{duration}"> @@ -1312,14 +1293,14 @@ FAILED: CHECK_THAT( empty, Contains( v ) ) with expansion: { } Contains: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(v, Contains( v2 ))"> FAILED: CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 4 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector matchers that fail/Equals" duration="{duration}"> @@ -1328,28 +1309,28 @@ FAILED: CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(v2, Equals( v ))"> FAILED: CHECK_THAT( v2, Equals( v ) ) with expansion: { 1, 2 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(empty, Equals( v ))"> FAILED: CHECK_THAT( empty, Equals( v ) ) with expansion: { } Equals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(v, Equals( empty ))"> FAILED: CHECK_THAT( v, Equals( empty ) ) with expansion: { 1, 2, 3 } Equals: { } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector matchers that fail/UnorderedEquals" duration="{duration}"> @@ -1358,28 +1339,28 @@ FAILED: CHECK_THAT( v, UnorderedEquals( empty ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(empty, UnorderedEquals( v ))"> FAILED: CHECK_THAT( empty, UnorderedEquals( v ) ) with expansion: { } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(permuted, UnorderedEquals( v ))"> FAILED: CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(permuted, UnorderedEquals( v ))"> FAILED: CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 3, 1 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> </file> @@ -1393,16 +1374,24 @@ Matchers.tests.cpp:<line number> <testCase name="Basic use of the Empty range matcher/Simple, std-provided containers" duration="{duration}"/> <testCase name="Basic use of the Empty range matcher/Type with empty" duration="{duration}"/> <testCase name="Basic use of the Empty range matcher/Type requires ADL found empty free function" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types (differ in array N)" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types and value types" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers, one random access, one not" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Value type/Two equal containers of different value types" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Value type/Two non-equal containers of different value types" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Ranges with begin that needs ADL" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Custom predicate/Two equal non-empty containers (close enough)" duration="{duration}"/> <testCase name="Usage of AllMatch range matcher/Basic usage" duration="{duration}"/> <testCase name="Usage of AllMatch range matcher/Type requires ADL found begin and end" duration="{duration}"/> <testCase name="Usage of AllMatch range matcher/Shortcircuiting/All are read" duration="{duration}"/> <testCase name="Usage of AllMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Basic usage/All true evaluates to true" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Basic usage/Empty evaluates to true" duration="{duration}"/> - <testCase name="Usage of AllTrue range matcher/Basic usage/One false evalutes to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Basic usage/One false evaluates to false" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Basic usage/All false evaluates to false" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/All true evaluates to true" duration="{duration}"/> - <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evalutes to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evaluates to false" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/All false evaluates to false" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> @@ -1412,10 +1401,10 @@ Matchers.tests.cpp:<line number> <testCase name="Usage of AnyMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Basic usage/All true evaluates to true" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Basic usage/Empty evaluates to false" duration="{duration}"/> - <testCase name="Usage of AnyTrue range matcher/Basic usage/One true evalutes to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Basic usage/One true evaluates to true" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Basic usage/All false evaluates to false" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All true evaluates to true" duration="{duration}"/> - <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evalutes to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evaluates to true" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All false evaluates to false" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> @@ -1425,13 +1414,33 @@ Matchers.tests.cpp:<line number> <testCase name="Usage of NoneMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Basic usage/All true evaluates to false" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Basic usage/Empty evaluates to true" duration="{duration}"/> - <testCase name="Usage of NoneTrue range matcher/Basic usage/One true evalutes to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Basic usage/One true evaluates to false" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Basic usage/All false evaluates to true" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All true evaluates to false" duration="{duration}"/> - <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evalutes to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evaluates to false" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All false evaluates to true" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Empty container matches empty container" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Empty container does not match non-empty container" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Two equal 1-length non-empty containers" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Two equal-sized, equal, non-empty containers" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Two equal-sized, non-equal, non-empty containers" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Two non-equal-sized, non-empty containers (with same first elements)" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Custom predicate/Two equal non-empty containers (close enough)" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Custom predicate/Two non-equal non-empty containers (close enough)" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Ranges that need ADL begin/end" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Check short-circuiting behaviour/Check short-circuits on failure" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Check short-circuiting behaviour/All elements are checked on success" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Empty container matches empty container" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Empty container does not match non-empty container" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal 1-length non-empty containers" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal-sized, equal, non-empty containers" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal-sized, non-equal, non-empty containers" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two non-equal-sized, non-empty containers" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Custom predicate/Two equal non-empty containers (close enough)" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Custom predicate/Two non-equal non-empty containers (close enough)" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Ranges that need ADL begin/end" duration="{duration}"/> <testCase name="Usage of the SizeIs range matcher/Some with stdlib containers" duration="{duration}"/> <testCase name="Usage of the SizeIs range matcher/Type requires ADL found size free function" duration="{duration}"/> <testCase name="Usage of the SizeIs range matcher/Type has size member" duration="{duration}"/> @@ -1445,20 +1454,20 @@ Matchers.tests.cpp:<line number> <failure message="FAIL()"> FAILED: This is a failure -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="FAIL does not require an argument" duration="{duration}"> <failure message="FAIL()"> FAILED: -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="FAIL_CHECK does not abort the test" duration="{duration}"> <failure message="FAIL_CHECK()"> FAILED: This is a failure -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="INFO and WARN do not abort tests" duration="{duration}"/> @@ -1470,7 +1479,7 @@ with expansion: 2 == 1 this message should be logged so should this -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="INFO gets logged on failure, even if captured before successful assertions" duration="{duration}"> @@ -1481,7 +1490,7 @@ with expansion: 2 == 1 this message may be logged later this message should be logged -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> <failure message="CHECK(a == 0)"> FAILED: @@ -1491,7 +1500,7 @@ with expansion: this message may be logged later this message should be logged and this, but later -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="INFO is reset for each loop" duration="{duration}"> @@ -1502,21 +1511,21 @@ with expansion: 10 < 10 current counter 10 i := 10 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="Output from all sections is reported/one" duration="{duration}"> <failure message="FAIL()"> FAILED: Message from section one -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="Output from all sections is reported/two" duration="{duration}"> <failure message="FAIL()"> FAILED: Message from section two -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="SUCCEED counts as a test pass" duration="{duration}"/> @@ -1527,14 +1536,14 @@ Message.tests.cpp:<line number> <failure message="FAIL()"> FAILED: Previous info should not be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="just failure after unscoped info" duration="{duration}"> <failure message="FAIL()"> FAILED: previous unscoped info SHOULD not be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="mix info, unscoped info and warning" duration="{duration}"/> @@ -1543,7 +1552,7 @@ Message.tests.cpp:<line number> FAILED: REQUIRE( false ) this SHOULD be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="print unscoped info if passing unscoped info is printed" duration="{duration}"/> @@ -1553,7 +1562,7 @@ FAILED: REQUIRE( false ) this SHOULD be seen this SHOULD also be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="prints unscoped info only for the first assertion" duration="{duration}"> @@ -1561,7 +1570,7 @@ Message.tests.cpp:<line number> FAILED: CHECK( false ) this SHOULD be seen only ONCE -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="sends information to INFO" duration="{duration}"> @@ -1570,7 +1579,7 @@ FAILED: REQUIRE( false ) hi i := 7 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="stacks unscoped info in loops" duration="{duration}"> @@ -1581,7 +1590,7 @@ Count 1 to 3... 1 2 3 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> <failure message="CHECK(false)"> FAILED: @@ -1590,7 +1599,7 @@ Count 4 to 6... 4 5 6 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> </file> @@ -1606,7 +1615,7 @@ FAILED: CHECK( f() == 0 ) with expansion: 1 == 0 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </skipped> </testCase> <testCase name="#961 -- Dynamically created sections should all be reported/Looped section 0" duration="{duration}"/> @@ -1626,7 +1635,7 @@ Misc.tests.cpp:<line number> <failure message="FAIL()"> FAILED: to infinity and beyond -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="A couple of nested sections followed by a failure/Outer/Inner" duration="{duration}"/> @@ -1650,7 +1659,7 @@ with expansion: $a = 20; } " -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0" duration="{duration}"/> @@ -1712,13 +1721,13 @@ Misc.tests.cpp:<line number> <testCase name="Testing checked-if 2" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </skipped> </testCase> <testCase name="Testing checked-if 3" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </skipped> </testCase> <testCase name="This test 'should' fail but doesn't" duration="{duration}"/> @@ -1729,7 +1738,7 @@ FAILED: REQUIRE( testCheckedElse( false ) ) with expansion: false -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="checkedIf" duration="{duration}"/> @@ -1739,7 +1748,7 @@ FAILED: REQUIRE( testCheckedIf( false ) ) with expansion: false -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="even more nested SECTION tests/c/d (leaf)" duration="{duration}"/> @@ -1752,7 +1761,7 @@ FAILED: CHECK( b > a ) with expansion: 0 > 1 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="looped SECTION tests/b is currently: 1" duration="{duration}"> @@ -1761,7 +1770,7 @@ FAILED: CHECK( b > a ) with expansion: 1 > 1 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="looped SECTION tests/b is currently: 2" duration="{duration}"/> @@ -1779,7 +1788,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[0] (1) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1787,7 +1796,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[1] (1) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1795,7 +1804,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[3] (3) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1803,7 +1812,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[4] (5) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1811,7 +1820,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[6] (13) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1819,7 +1828,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[7] (21) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="more nested SECTION tests/equal/doesn't equal" duration="{duration}"> @@ -1828,7 +1837,7 @@ FAILED: REQUIRE( a == b ) with expansion: 1 == 2 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="more nested SECTION tests/doesn't equal/not equal" duration="{duration}"/> @@ -1844,7 +1853,7 @@ Misc.tests.cpp:<line number> FAILED: REQUIRE( false ) 3 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="toString on const wchar_t const pointer returns the string contents" duration="{duration}"/> @@ -1860,6 +1869,102 @@ Misc.tests.cpp:<line number> <testCase name="xmlentitycheck/embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" duration="{duration}"/> <testCase name="xmlentitycheck/encoded chars: these should all be encoded: &&&"""<<<&"<<&"" duration="{duration}"/> </file> + <file path="tests/<exe-name>/UsageTests/Skip.tests.cpp"> + <testCase name="Empty generators can SKIP in constructor" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +This generator is empty +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="a succeeding test can still be skipped" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="dynamic skipping works with generators" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +skipping because answer = 41 +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="SKIP()"> +SKIPPED +skipping because answer = 43 +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="failed assertions before SKIP cause test case to fail" duration="{duration}"> + <skipped message="CHECK(3 == 4)"> +FAILED: + CHECK( 3 == 4 ) +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="failing for some generator values causes entire test case to fail" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="FAIL()"> +FAILED: +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="failing in some unskipped sections causes entire test case to fail/skipped" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="failing in some unskipped sections causes entire test case to fail/not skipped" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="nested sections can be skipped dynamically at runtime/B2/B" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="nested sections can be skipped dynamically at runtime/B" duration="{duration}"/> + <testCase name="sections can be skipped dynamically at runtime/not skipped" duration="{duration}"/> + <testCase name="sections can be skipped dynamically at runtime/skipped" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="sections can be skipped dynamically at runtime/also not skipped" duration="{duration}"/> + <testCase name="skipped tests can optionally provide a reason" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +skipping because answer = 43 +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="tests can be skipped dynamically at runtime" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + </file> <file path="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp"> <testCase name="Stringifying std::chrono::duration helpers" duration="{duration}"/> <testCase name="Stringifying std::chrono::duration with weird ratios" duration="{duration}"/> @@ -1921,7 +2026,7 @@ Misc.tests.cpp:<line number> <failure message="FAIL()"> FAILED: 1514 -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> </testCase> <testCase name="(unimplemented) static bools can be evaluated/compare to true" duration="{duration}"/> @@ -1935,14 +2040,14 @@ FAILED: CHECK( &o1 == &o2 ) with expansion: 0x<hex digits> == 0x<hex digits> -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> <failure message="CHECK(o1 == o2)"> FAILED: CHECK( o1 == o2 ) with expansion: {?} == {?} -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> </testCase> <testCase name="An expression with side-effects should only be evaluated once" duration="{duration}"/> diff --git a/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index 97b2d988175f0bf3ff007e9364015e972e9dbb52..3509287f788c0346c0681014e08e1c7fdb182223 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- rng-seed=1 --> +<!-- filters='"*" ~[!nonportable] ~[!benchmark] ~[approvals]' rng-seed=1 --> <testExecutions version="1"> <file path="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp"> <testCase name="Clara::Arg supports single-arg parse the way Opt does" duration="{duration}"/> @@ -8,44 +8,6 @@ <testCase name="is_unary_function" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp"> - <testCase name="#1905 -- test spec parser properly clears internal state between compound tests" duration="{duration}"/> - <testCase name="#1912 -- test spec parser handles escaping/Various parentheses" duration="{duration}"/> - <testCase name="#1912 -- test spec parser handles escaping/backslash in test name" duration="{duration}"/> - <testCase name="Parse test names and tags/Empty test spec should have no filters" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from empty string should have no filters" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from just a comma should have no filters" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from name should have one filter" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from quoted name should have one filter" duration="{duration}"/> - <testCase name="Parse test names and tags/Test spec from name should have one filter" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcard at the start" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcard at the end" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcard at both ends" duration="{duration}"/> - <testCase name="Parse test names and tags/Redundant wildcard at the start" duration="{duration}"/> - <testCase name="Parse test names and tags/Redundant wildcard at the end" duration="{duration}"/> - <testCase name="Parse test names and tags/Redundant wildcard at both ends" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcard at both ends, redundant at start" duration="{duration}"/> - <testCase name="Parse test names and tags/Just wildcard" duration="{duration}"/> - <testCase name="Parse test names and tags/Single tag" duration="{duration}"/> - <testCase name="Parse test names and tags/Single tag, two matches" duration="{duration}"/> - <testCase name="Parse test names and tags/Two tags" duration="{duration}"/> - <testCase name="Parse test names and tags/Two tags, spare separated" duration="{duration}"/> - <testCase name="Parse test names and tags/Wildcarded name and tag" duration="{duration}"/> - <testCase name="Parse test names and tags/Single tag exclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/One tag exclusion and one tag inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/One tag exclusion and one wldcarded name inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/One tag exclusion, using exclude:, and one wldcarded name inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/name exclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/wildcarded name exclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/wildcarded name exclusion with tag inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/wildcarded name exclusion, using exclude:, with tag inclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/two wildcarded names" duration="{duration}"/> - <testCase name="Parse test names and tags/empty tag" duration="{duration}"/> - <testCase name="Parse test names and tags/empty quoted name" duration="{duration}"/> - <testCase name="Parse test names and tags/quoted string followed by tag exclusion" duration="{duration}"/> - <testCase name="Parse test names and tags/Leading and trailing spaces in test spec" duration="{duration}"/> - <testCase name="Parse test names and tags/Leading and trailing spaces in test name" duration="{duration}"/> - <testCase name="Parse test names and tags/Shortened hide tags are split apart when parsing" duration="{duration}"/> - <testCase name="Parse test names and tags/Shortened hide tags also properly handle exclusion" duration="{duration}"/> <testCase name="Parsing sharding-related cli flags/shard-count" duration="{duration}"/> <testCase name="Parsing sharding-related cli flags/Negative shard count reports error" duration="{duration}"/> <testCase name="Parsing sharding-related cli flags/Zero shard count reports error" duration="{duration}"/> @@ -108,6 +70,7 @@ <testCase name="convertToBits" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp"> + <testCase name="Filter generator throws exception for empty generator" duration="{duration}"/> <testCase name="Generators internals/Single value" duration="{duration}"/> <testCase name="Generators internals/Preset values" duration="{duration}"/> <testCase name="Generators internals/Generator combinator" duration="{duration}"/> @@ -156,6 +119,10 @@ <testCase name="warmup" duration="{duration}"/> <testCase name="weighted_average_quantile" duration="{duration}"/> </file> + <file path="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp"> + <testCase name="Parse uints/proper inputs" duration="{duration}"/> + <testCase name="Parse uints/Bad inputs" duration="{duration}"/> + </file> <file path="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp"> <testCase name="#1938 - GENERATE after a section/A" duration="{duration}"/> <testCase name="#1938 - GENERATE after a section/B" duration="{duration}"/> @@ -265,7 +232,6 @@ <testCase name="startsWith" duration="{duration}"/> </file> <file path="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp"> - <testCase name="Empty tag is not allowed" duration="{duration}"/> <testCase name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" duration="{duration}"/> <testCase name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" duration="{duration}"/> <testCase name="Tags with spaces and non-alphanumerical characters are accepted" duration="{duration}"/> @@ -282,6 +248,11 @@ <testCase name="Hashing different test cases produces different result/Different tags" duration="{duration}"/> <testCase name="Hashing test case produces same hash across multiple calls" duration="{duration}"/> </file> + <file path="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp"> + <testCase name="#1905 -- test spec parser properly clears internal state between compound tests" duration="{duration}"/> + <testCase name="#1912 -- test spec parser handles escaping/Various parentheses" duration="{duration}"/> + <testCase name="#1912 -- test spec parser handles escaping/backslash in test name" duration="{duration}"/> + </file> <file path="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp"> <testCase name="Parsed tags are matched case insensitive" duration="{duration}"/> <testCase name="Parsing tags with non-alphabetical characters is pass-through" duration="{duration}"/> @@ -358,7 +329,7 @@ FAILED: REQUIRE( s == "world" ) with expansion: "hello" == "world" -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A METHOD_AS_TEST_CASE based test run that succeeds" duration="{duration}"/> @@ -368,7 +339,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" duration="{duration}"> @@ -377,7 +348,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" duration="{duration}"> @@ -386,7 +357,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" duration="{duration}"> @@ -395,7 +366,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) with expansion: 0 == 1 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" duration="{duration}"/> @@ -408,7 +379,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 6 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" duration="{duration}"> @@ -417,7 +388,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 2 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" duration="{duration}"> @@ -426,7 +397,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 6 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" duration="{duration}"> @@ -435,7 +406,7 @@ FAILED: REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) with expansion: 2 < 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" duration="{duration}"/> @@ -448,7 +419,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1.0 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" duration="{duration}"> @@ -457,7 +428,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1.0f == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" duration="{duration}"> @@ -466,7 +437,7 @@ FAILED: REQUIRE( Template_Fixture<TestType>::m_a == 2 ) with expansion: 1 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" duration="{duration}"/> @@ -478,7 +449,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 1 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" duration="{duration}"> @@ -487,7 +458,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 3 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" duration="{duration}"> @@ -496,7 +467,7 @@ FAILED: REQUIRE( Nttp_Fixture<V>::value == 0 ) with expansion: 6 == 0 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" duration="{duration}"/> @@ -508,7 +479,7 @@ FAILED: REQUIRE( m_a == 2 ) with expansion: 1 == 2 -Class.tests.cpp:<line number> +at Class.tests.cpp:<line number> </failure> </testCase> <testCase name="A TEST_CASE_METHOD based test run that succeeds" duration="{duration}"/> @@ -536,52 +507,52 @@ Class.tests.cpp:<line number> <failure message="CHECK(false != false)"> FAILED: CHECK( false != false ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(true != true)"> FAILED: CHECK( true != true ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(!true)"> FAILED: CHECK( !true ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK_FALSE(!(true))"> FAILED: CHECK_FALSE( true ) with expansion: !true -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(!trueValue)"> FAILED: CHECK( !trueValue ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK_FALSE(!(trueValue))"> FAILED: CHECK_FALSE( trueValue ) with expansion: !true -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(!(1 == 1))"> FAILED: CHECK( !(1 == 1) ) with expansion: false -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK_FALSE(!(1 == 1))"> FAILED: CHECK_FALSE( 1 == 1 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testCase> <testCase name="'Not' checks that should succeed" duration="{duration}"/> @@ -594,91 +565,91 @@ FAILED: CHECK( data.int_seven == 6 ) with expansion: 7 == 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.int_seven == 8)"> FAILED: CHECK( data.int_seven == 8 ) with expansion: 7 == 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.int_seven == 0)"> FAILED: CHECK( data.int_seven == 0 ) with expansion: 7 == 0 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one == Approx( 9.11f ))"> FAILED: CHECK( data.float_nine_point_one == Approx( 9.11f ) ) with expansion: 9.1f == Approx( 9.1099996567 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one == Approx( 9.0f ))"> FAILED: CHECK( data.float_nine_point_one == Approx( 9.0f ) ) with expansion: 9.1f == Approx( 9.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one == Approx( 1 ))"> FAILED: CHECK( data.float_nine_point_one == Approx( 1 ) ) with expansion: 9.1f == Approx( 1.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one == Approx( 0 ))"> FAILED: CHECK( data.float_nine_point_one == Approx( 0 ) ) with expansion: 9.1f == Approx( 0.0 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.double_pi == Approx( 3.1415 ))"> FAILED: CHECK( data.double_pi == Approx( 3.1415 ) ) with expansion: 3.1415926535 == Approx( 3.1415 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello == "goodbye")"> FAILED: CHECK( data.str_hello == "goodbye" ) with expansion: "hello" == "goodbye" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello == "hell")"> FAILED: CHECK( data.str_hello == "hell" ) with expansion: "hello" == "hell" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello == "hello1")"> FAILED: CHECK( data.str_hello == "hello1" ) with expansion: "hello" == "hello1" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello.size() == 6)"> FAILED: CHECK( data.str_hello.size() == 6 ) with expansion: 5 == 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(x == Approx( 1.301 ))"> FAILED: CHECK( x == Approx( 1.301 ) ) with expansion: 1.3 == Approx( 1.301 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Equality checks that should succeed" duration="{duration}"/> @@ -688,60 +659,60 @@ FAILED: CHECK( data.int_seven != 7 ) with expansion: 7 != 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.float_nine_point_one != Approx( 9.1f ))"> FAILED: CHECK( data.float_nine_point_one != Approx( 9.1f ) ) with expansion: 9.1f != Approx( 9.1000003815 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.double_pi != Approx( 3.1415926535 ))"> FAILED: CHECK( data.double_pi != Approx( 3.1415926535 ) ) with expansion: 3.1415926535 != Approx( 3.1415926535 ) -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello != "hello")"> FAILED: CHECK( data.str_hello != "hello" ) with expansion: "hello" != "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> <skipped message="CHECK(data.str_hello.size() != 5)"> FAILED: CHECK( data.str_hello.size() != 5 ) with expansion: 5 != 5 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Inequality checks that should succeed" duration="{duration}"/> <testCase name="Mayfail test case with nested sections/1/A" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Mayfail test case with nested sections/2/A" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Mayfail test case with nested sections/1/B" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Mayfail test case with nested sections/2/B" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </skipped> </testCase> <testCase name="Ordering comparison checks that should fail" duration="{duration}"> @@ -750,133 +721,133 @@ FAILED: CHECK( data.int_seven > 7 ) with expansion: 7 > 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven < 7)"> FAILED: CHECK( data.int_seven < 7 ) with expansion: 7 < 7 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven > 8)"> FAILED: CHECK( data.int_seven > 8 ) with expansion: 7 > 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven < 6)"> FAILED: CHECK( data.int_seven < 6 ) with expansion: 7 < 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven < 0)"> FAILED: CHECK( data.int_seven < 0 ) with expansion: 7 < 0 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven < -1)"> FAILED: CHECK( data.int_seven < -1 ) with expansion: 7 < -1 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven >= 8)"> FAILED: CHECK( data.int_seven >= 8 ) with expansion: 7 >= 8 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.int_seven <= 6)"> FAILED: CHECK( data.int_seven <= 6 ) with expansion: 7 <= 6 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.float_nine_point_one < 9)"> FAILED: CHECK( data.float_nine_point_one < 9 ) with expansion: 9.1f < 9 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.float_nine_point_one > 10)"> FAILED: CHECK( data.float_nine_point_one > 10 ) with expansion: 9.1f > 10 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.float_nine_point_one > 9.2)"> FAILED: CHECK( data.float_nine_point_one > 9.2 ) with expansion: 9.1f > 9.2 -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello > "hello")"> FAILED: CHECK( data.str_hello > "hello" ) with expansion: "hello" > "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello < "hello")"> FAILED: CHECK( data.str_hello < "hello" ) with expansion: "hello" < "hello" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello > "hellp")"> FAILED: CHECK( data.str_hello > "hellp" ) with expansion: "hello" > "hellp" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello > "z")"> FAILED: CHECK( data.str_hello > "z" ) with expansion: "hello" > "z" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello < "hellm")"> FAILED: CHECK( data.str_hello < "hellm" ) with expansion: "hello" < "hellm" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello < "a")"> FAILED: CHECK( data.str_hello < "a" ) with expansion: "hello" < "a" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello >= "z")"> FAILED: CHECK( data.str_hello >= "z" ) with expansion: "hello" >= "z" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> <failure message="CHECK(data.str_hello <= "a")"> FAILED: CHECK( data.str_hello <= "a" ) with expansion: "hello" <= "a" -Condition.tests.cpp:<line number> +at Condition.tests.cpp:<line number> </failure> </testCase> <testCase name="Ordering comparison checks that should succeed" duration="{duration}"/> @@ -891,7 +862,7 @@ FAILED: CHECK( truthy(false) ) with expansion: Hey, its truthy! -Decomposition.tests.cpp:<line number> +at Decomposition.tests.cpp:<line number> </failure> </testCase> </file> @@ -909,7 +880,7 @@ Decomposition.tests.cpp:<line number> FAILED: expected exception answer := 42 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </skipped> </testCase> <testCase name="#748 - captures with unexpected exceptions/inside REQUIRE_NOTHROW" duration="{duration}"> @@ -918,7 +889,7 @@ FAILED: REQUIRE_NOTHROW( thisThrows() ) expected exception answer := 42 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </skipped> </testCase> <testCase name="#748 - captures with unexpected exceptions/inside REQUIRE_THROWS" duration="{duration}"/> @@ -927,7 +898,7 @@ Exception.tests.cpp:<line number> FAILED: {Unknown expression after the reported line} unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Custom exceptions can be translated when testing for nothrow" duration="{duration}"> @@ -935,7 +906,7 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE_NOTHROW( throwCustom() ) custom exception - not std -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Custom exceptions can be translated when testing for throwing as something else" duration="{duration}"> @@ -943,14 +914,14 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE_THROWS_AS( throwCustom(), std::exception ) custom exception - not std -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Custom std-exceptions can be custom translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: custom std exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Exception messages can be tested for/exact match" duration="{duration}"/> @@ -961,18 +932,18 @@ Exception.tests.cpp:<line number> FAILED: CHECK_THROWS_AS( thisThrows(), std::string ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> <failure message="CHECK_THROWS_AS(thisDoesntThrow(), std::domain_error)"> FAILED: CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </failure> <error message="CHECK_NOTHROW(thisThrows())"> FAILED: CHECK_NOTHROW( thisThrows() ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Mismatching exception messages failing the test" duration="{duration}"> @@ -981,28 +952,28 @@ FAILED: REQUIRE_THROWS_WITH( thisThrows(), "should fail" ) with expansion: "expected exception" equals: "should fail" -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </failure> </testCase> <testCase name="Non-std exceptions can be translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: custom exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Thrown string literals are translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: For some reason someone is throwing a string literal! -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="Unexpected exceptions can be translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: 3.14 -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When checked exceptions are thrown they can be expected or unexpected" duration="{duration}"/> @@ -1010,7 +981,7 @@ Exception.tests.cpp:<line number> <error message="TEST_CASE()"> FAILED: unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When unchecked exceptions are thrown during a CHECK the test should continue" duration="{duration}"> @@ -1018,7 +989,7 @@ Exception.tests.cpp:<line number> FAILED: CHECK( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" duration="{duration}"> @@ -1026,7 +997,7 @@ Exception.tests.cpp:<line number> FAILED: REQUIRE( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When unchecked exceptions are thrown from functions they are always failures" duration="{duration}"> @@ -1034,27 +1005,34 @@ Exception.tests.cpp:<line number> FAILED: CHECK( thisThrows() == 0 ) expected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="When unchecked exceptions are thrown from sections they are always failures/section name" duration="{duration}"> <error message="TEST_CASE()"> FAILED: unexpected exception -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> <testCase name="thrown std::strings are translated" duration="{duration}"> <error message="TEST_CASE()"> FAILED: Why would you throw a std::string? -Exception.tests.cpp:<line number> +at Exception.tests.cpp:<line number> </error> </testCase> </file> <file path="tests/<exe-name>/UsageTests/Generators.tests.cpp"> <testCase name="#1913 - GENERATE inside a for loop should not keep recreating the generator" duration="{duration}"/> <testCase name="#1913 - GENERATEs can share a line" duration="{duration}"/> + <testCase name="#2615 - Throwing in constructor generator fails test case but does not abort" duration="{duration}"> + <skipped message="TEST_CASE()"> +FAILED: +failure to init +at Generators.tests.cpp:<line number> + </skipped> + </testCase> <testCase name="3x3x3 ints" duration="{duration}"/> <testCase name="Copy and then generate a range/from var and iterators" duration="{duration}"/> <testCase name="Copy and then generate a range/From a temporary container" duration="{duration}"/> @@ -1098,14 +1076,14 @@ FAILED: CHECK_THAT( testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), ContainsSubstring( "STRING" ))"> FAILED: CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) ) with expansion: "this string contains 'abc' as a substring" contains: "STRING" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="EndsWith string matcher" duration="{duration}"> @@ -1114,14 +1092,14 @@ FAILED: CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) ) with expansion: "this string contains 'abc' as a substring" ends with: "Substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ))"> FAILED: CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Equals" duration="{duration}"/> @@ -1131,26 +1109,26 @@ FAILED: CHECK_THAT( testStringForMatching(), Equals( "this string contains 'ABC' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ))"> FAILED: CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Exception matchers that fail/No exception" duration="{duration}"> <failure message="CHECK_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{ 1 })"> FAILED: CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="REQUIRE_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{ 1 })"> FAILED: REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Exception matchers that fail/Type mismatch" duration="{duration}"> @@ -1158,13 +1136,13 @@ Matchers.tests.cpp:<line number> FAILED: CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </error> <error message="REQUIRE_THROWS_MATCHES(throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 })"> FAILED: REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } ) Unknown exception -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </error> </testCase> <testCase name="Exception matchers that fail/Contents are wrong" duration="{duration}"> @@ -1173,17 +1151,18 @@ FAILED: CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="REQUIRE_THROWS_MATCHES(throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 })"> FAILED: REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } ) with expansion: SpecialException::what special exception has value of 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Exception matchers that succeed" duration="{duration}"/> + <testCase name="Exception message can be matched" duration="{duration}"/> <testCase name="Exceptions matchers" duration="{duration}"/> <testCase name="Floating point matchers: double/Relative" duration="{duration}"/> <testCase name="Floating point matchers: double/Relative/Some subnormal values" duration="{duration}"/> @@ -1191,12 +1170,14 @@ Matchers.tests.cpp:<line number> <testCase name="Floating point matchers: double/ULPs" duration="{duration}"/> <testCase name="Floating point matchers: double/Composed" duration="{duration}"/> <testCase name="Floating point matchers: double/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: double/IsNaN" duration="{duration}"/> <testCase name="Floating point matchers: float/Relative" duration="{duration}"/> <testCase name="Floating point matchers: float/Relative/Some subnormal values" duration="{duration}"/> <testCase name="Floating point matchers: float/Margin" duration="{duration}"/> <testCase name="Floating point matchers: float/ULPs" duration="{duration}"/> <testCase name="Floating point matchers: float/Composed" duration="{duration}"/> <testCase name="Floating point matchers: float/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: float/IsNaN" duration="{duration}"/> <testCase name="Matchers can be (AllOf) composed with the && operator" duration="{duration}"/> <testCase name="Matchers can be (AnyOf) composed with the || operator" duration="{duration}"/> <testCase name="Matchers can be composed with both && and ||" duration="{duration}"/> @@ -1206,7 +1187,7 @@ FAILED: CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) || ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) ) with expansion: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Matchers can be negated (Not) with the ! operator" duration="{duration}"/> @@ -1216,7 +1197,7 @@ FAILED: CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) ) with expansion: "this string contains 'abc' as a substring" not contains: "substring" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Overloaded comma or address-of operators are not used" duration="{duration}"/> @@ -1227,21 +1208,21 @@ FAILED: CHECK_THAT( testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), Matches( "contains 'abc' as a substring" ))"> FAILED: CHECK_THAT( testStringForMatching(), Matches( "contains 'abc' as a substring" ) ) with expansion: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), Matches( "this string contains 'abc' as a" ))"> FAILED: CHECK_THAT( testStringForMatching(), Matches( "this string contains 'abc' as a" ) ) with expansion: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Regression test #1" duration="{duration}"/> @@ -1251,14 +1232,14 @@ FAILED: CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) ) with expansion: "this string contains 'abc' as a substring" starts with: "This String" -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ))"> FAILED: CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) ) with expansion: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="String matchers" duration="{duration}"/> @@ -1272,7 +1253,7 @@ FAILED: CHECK_THAT( empty, Approx( t1 ) ) with expansion: { } is approx: { 1.0, 2.0 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector Approx matcher -- failing/Just different vectors" duration="{duration}"> @@ -1281,7 +1262,7 @@ FAILED: CHECK_THAT( v1, Approx( v2 ) ) with expansion: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector matchers/Contains (element)" duration="{duration}"/> @@ -1295,14 +1276,14 @@ FAILED: CHECK_THAT( v, VectorContains( -1 ) ) with expansion: { 1, 2, 3 } Contains: -1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(empty, VectorContains( 1 ))"> FAILED: CHECK_THAT( empty, VectorContains( 1 ) ) with expansion: { } Contains: 1 -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector matchers that fail/Contains (vector)" duration="{duration}"> @@ -1311,14 +1292,14 @@ FAILED: CHECK_THAT( empty, Contains( v ) ) with expansion: { } Contains: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(v, Contains( v2 ))"> FAILED: CHECK_THAT( v, Contains( v2 ) ) with expansion: { 1, 2, 3 } Contains: { 1, 2, 4 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector matchers that fail/Equals" duration="{duration}"> @@ -1327,28 +1308,28 @@ FAILED: CHECK_THAT( v, Equals( v2 ) ) with expansion: { 1, 2, 3 } Equals: { 1, 2 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(v2, Equals( v ))"> FAILED: CHECK_THAT( v2, Equals( v ) ) with expansion: { 1, 2 } Equals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(empty, Equals( v ))"> FAILED: CHECK_THAT( empty, Equals( v ) ) with expansion: { } Equals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(v, Equals( empty ))"> FAILED: CHECK_THAT( v, Equals( empty ) ) with expansion: { 1, 2, 3 } Equals: { } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> <testCase name="Vector matchers that fail/UnorderedEquals" duration="{duration}"> @@ -1357,28 +1338,28 @@ FAILED: CHECK_THAT( v, UnorderedEquals( empty ) ) with expansion: { 1, 2, 3 } UnorderedEquals: { } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(empty, UnorderedEquals( v ))"> FAILED: CHECK_THAT( empty, UnorderedEquals( v ) ) with expansion: { } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(permuted, UnorderedEquals( v ))"> FAILED: CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 1, 3 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> <failure message="CHECK_THAT(permuted, UnorderedEquals( v ))"> FAILED: CHECK_THAT( permuted, UnorderedEquals( v ) ) with expansion: { 3, 1 } UnorderedEquals: { 1, 2, 3 } -Matchers.tests.cpp:<line number> +at Matchers.tests.cpp:<line number> </failure> </testCase> </file> @@ -1392,16 +1373,24 @@ Matchers.tests.cpp:<line number> <testCase name="Basic use of the Empty range matcher/Simple, std-provided containers" duration="{duration}"/> <testCase name="Basic use of the Empty range matcher/Type with empty" duration="{duration}"/> <testCase name="Basic use of the Empty range matcher/Type requires ADL found empty free function" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types (differ in array N)" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers of different container types and value types" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Container conversions/Two equal containers, one random access, one not" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Value type/Two equal containers of different value types" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Value type/Two non-equal containers of different value types" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Ranges with begin that needs ADL" duration="{duration}"/> + <testCase name="Type conversions of RangeEquals and similar/Custom predicate/Two equal non-empty containers (close enough)" duration="{duration}"/> <testCase name="Usage of AllMatch range matcher/Basic usage" duration="{duration}"/> <testCase name="Usage of AllMatch range matcher/Type requires ADL found begin and end" duration="{duration}"/> <testCase name="Usage of AllMatch range matcher/Shortcircuiting/All are read" duration="{duration}"/> <testCase name="Usage of AllMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Basic usage/All true evaluates to true" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Basic usage/Empty evaluates to true" duration="{duration}"/> - <testCase name="Usage of AllTrue range matcher/Basic usage/One false evalutes to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Basic usage/One false evaluates to false" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Basic usage/All false evaluates to false" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/All true evaluates to true" duration="{duration}"/> - <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evalutes to false" duration="{duration}"/> + <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/One false evaluates to false" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Contained type is convertible to bool/All false evaluates to false" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> <testCase name="Usage of AllTrue range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> @@ -1411,10 +1400,10 @@ Matchers.tests.cpp:<line number> <testCase name="Usage of AnyMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Basic usage/All true evaluates to true" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Basic usage/Empty evaluates to false" duration="{duration}"/> - <testCase name="Usage of AnyTrue range matcher/Basic usage/One true evalutes to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Basic usage/One true evaluates to true" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Basic usage/All false evaluates to false" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All true evaluates to true" duration="{duration}"/> - <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evalutes to true" duration="{duration}"/> + <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/One true evaluates to true" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Contained type is convertible to bool/All false evaluates to false" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> <testCase name="Usage of AnyTrue range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> @@ -1424,13 +1413,33 @@ Matchers.tests.cpp:<line number> <testCase name="Usage of NoneMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Basic usage/All true evaluates to false" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Basic usage/Empty evaluates to true" duration="{duration}"/> - <testCase name="Usage of NoneTrue range matcher/Basic usage/One true evalutes to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Basic usage/One true evaluates to false" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Basic usage/All false evaluates to true" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All true evaluates to false" duration="{duration}"/> - <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evalutes to false" duration="{duration}"/> + <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/One true evaluates to false" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Contained type is convertible to bool/All false evaluates to true" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Shortcircuiting/All are read" duration="{duration}"/> <testCase name="Usage of NoneTrue range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Empty container matches empty container" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Empty container does not match non-empty container" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Two equal 1-length non-empty containers" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Two equal-sized, equal, non-empty containers" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Two equal-sized, non-equal, non-empty containers" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Basic usage/Two non-equal-sized, non-empty containers (with same first elements)" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Custom predicate/Two equal non-empty containers (close enough)" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Custom predicate/Two non-equal non-empty containers (close enough)" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Ranges that need ADL begin/end" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Check short-circuiting behaviour/Check short-circuits on failure" duration="{duration}"/> + <testCase name="Usage of RangeEquals range matcher/Check short-circuiting behaviour/All elements are checked on success" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Empty container matches empty container" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Empty container does not match non-empty container" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal 1-length non-empty containers" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal-sized, equal, non-empty containers" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two equal-sized, non-equal, non-empty containers" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Basic usage/Two non-equal-sized, non-empty containers" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Custom predicate/Two equal non-empty containers (close enough)" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Custom predicate/Two non-equal non-empty containers (close enough)" duration="{duration}"/> + <testCase name="Usage of UnorderedRangeEquals range matcher/Ranges that need ADL begin/end" duration="{duration}"/> <testCase name="Usage of the SizeIs range matcher/Some with stdlib containers" duration="{duration}"/> <testCase name="Usage of the SizeIs range matcher/Type requires ADL found size free function" duration="{duration}"/> <testCase name="Usage of the SizeIs range matcher/Type has size member" duration="{duration}"/> @@ -1444,20 +1453,20 @@ Matchers.tests.cpp:<line number> <failure message="FAIL()"> FAILED: This is a failure -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="FAIL does not require an argument" duration="{duration}"> <failure message="FAIL()"> FAILED: -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="FAIL_CHECK does not abort the test" duration="{duration}"> <failure message="FAIL_CHECK()"> FAILED: This is a failure -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="INFO and WARN do not abort tests" duration="{duration}"/> @@ -1469,7 +1478,7 @@ with expansion: 2 == 1 this message should be logged so should this -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="INFO gets logged on failure, even if captured before successful assertions" duration="{duration}"> @@ -1480,7 +1489,7 @@ with expansion: 2 == 1 this message may be logged later this message should be logged -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> <failure message="CHECK(a == 0)"> FAILED: @@ -1490,7 +1499,7 @@ with expansion: this message may be logged later this message should be logged and this, but later -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="INFO is reset for each loop" duration="{duration}"> @@ -1501,21 +1510,21 @@ with expansion: 10 < 10 current counter 10 i := 10 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="Output from all sections is reported/one" duration="{duration}"> <failure message="FAIL()"> FAILED: Message from section one -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="Output from all sections is reported/two" duration="{duration}"> <failure message="FAIL()"> FAILED: Message from section two -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="SUCCEED counts as a test pass" duration="{duration}"/> @@ -1526,14 +1535,14 @@ Message.tests.cpp:<line number> <failure message="FAIL()"> FAILED: Previous info should not be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="just failure after unscoped info" duration="{duration}"> <failure message="FAIL()"> FAILED: previous unscoped info SHOULD not be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="mix info, unscoped info and warning" duration="{duration}"/> @@ -1542,7 +1551,7 @@ Message.tests.cpp:<line number> FAILED: REQUIRE( false ) this SHOULD be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="print unscoped info if passing unscoped info is printed" duration="{duration}"/> @@ -1552,7 +1561,7 @@ FAILED: REQUIRE( false ) this SHOULD be seen this SHOULD also be seen -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="prints unscoped info only for the first assertion" duration="{duration}"> @@ -1560,7 +1569,7 @@ Message.tests.cpp:<line number> FAILED: CHECK( false ) this SHOULD be seen only ONCE -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="sends information to INFO" duration="{duration}"> @@ -1569,7 +1578,7 @@ FAILED: REQUIRE( false ) hi i := 7 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> <testCase name="stacks unscoped info in loops" duration="{duration}"> @@ -1580,7 +1589,7 @@ Count 1 to 3... 1 2 3 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> <failure message="CHECK(false)"> FAILED: @@ -1589,7 +1598,7 @@ Count 4 to 6... 4 5 6 -Message.tests.cpp:<line number> +at Message.tests.cpp:<line number> </failure> </testCase> </file> @@ -1605,7 +1614,7 @@ FAILED: CHECK( f() == 0 ) with expansion: 1 == 0 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </skipped> </testCase> <testCase name="#961 -- Dynamically created sections should all be reported/Looped section 0" duration="{duration}"/> @@ -1625,7 +1634,7 @@ Misc.tests.cpp:<line number> <failure message="FAIL()"> FAILED: to infinity and beyond -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="A couple of nested sections followed by a failure/Outer/Inner" duration="{duration}"/> @@ -1649,7 +1658,7 @@ with expansion: $a = 20; } " -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0" duration="{duration}"/> @@ -1711,13 +1720,13 @@ Misc.tests.cpp:<line number> <testCase name="Testing checked-if 2" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </skipped> </testCase> <testCase name="Testing checked-if 3" duration="{duration}"> <skipped message="FAIL()"> FAILED: -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </skipped> </testCase> <testCase name="This test 'should' fail but doesn't" duration="{duration}"/> @@ -1728,7 +1737,7 @@ FAILED: REQUIRE( testCheckedElse( false ) ) with expansion: false -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="checkedIf" duration="{duration}"/> @@ -1738,7 +1747,7 @@ FAILED: REQUIRE( testCheckedIf( false ) ) with expansion: false -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="even more nested SECTION tests/c/d (leaf)" duration="{duration}"/> @@ -1751,7 +1760,7 @@ FAILED: CHECK( b > a ) with expansion: 0 > 1 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="looped SECTION tests/b is currently: 1" duration="{duration}"> @@ -1760,7 +1769,7 @@ FAILED: CHECK( b > a ) with expansion: 1 > 1 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="looped SECTION tests/b is currently: 2" duration="{duration}"/> @@ -1778,7 +1787,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[0] (1) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1786,7 +1795,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[1] (1) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1794,7 +1803,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[3] (3) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1802,7 +1811,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[4] (5) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1810,7 +1819,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[6] (13) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> <failure message="CHECK(( fib[i] % 2 ) == 0)"> FAILED: @@ -1818,7 +1827,7 @@ FAILED: with expansion: 1 == 0 Testing if fib[7] (21) is even -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="more nested SECTION tests/equal/doesn't equal" duration="{duration}"> @@ -1827,7 +1836,7 @@ FAILED: REQUIRE( a == b ) with expansion: 1 == 2 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="more nested SECTION tests/doesn't equal/not equal" duration="{duration}"/> @@ -1843,7 +1852,7 @@ Misc.tests.cpp:<line number> FAILED: REQUIRE( false ) 3 -Misc.tests.cpp:<line number> +at Misc.tests.cpp:<line number> </failure> </testCase> <testCase name="toString on const wchar_t const pointer returns the string contents" duration="{duration}"/> @@ -1859,6 +1868,102 @@ Misc.tests.cpp:<line number> <testCase name="xmlentitycheck/embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" duration="{duration}"/> <testCase name="xmlentitycheck/encoded chars: these should all be encoded: &&&"""<<<&"<<&"" duration="{duration}"/> </file> + <file path="tests/<exe-name>/UsageTests/Skip.tests.cpp"> + <testCase name="Empty generators can SKIP in constructor" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +This generator is empty +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="a succeeding test can still be skipped" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="dynamic skipping works with generators" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +skipping because answer = 41 +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="SKIP()"> +SKIPPED +skipping because answer = 43 +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="failed assertions before SKIP cause test case to fail" duration="{duration}"> + <skipped message="CHECK(3 == 4)"> +FAILED: + CHECK( 3 == 4 ) +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="failing for some generator values causes entire test case to fail" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="FAIL()"> +FAILED: +at Skip.tests.cpp:<line number> + </skipped> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="failing in some unskipped sections causes entire test case to fail/skipped" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="failing in some unskipped sections causes entire test case to fail/not skipped" duration="{duration}"> + <skipped message="FAIL()"> +FAILED: +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="nested sections can be skipped dynamically at runtime/B2/B" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="nested sections can be skipped dynamically at runtime/B" duration="{duration}"/> + <testCase name="sections can be skipped dynamically at runtime/not skipped" duration="{duration}"/> + <testCase name="sections can be skipped dynamically at runtime/skipped" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="sections can be skipped dynamically at runtime/also not skipped" duration="{duration}"/> + <testCase name="skipped tests can optionally provide a reason" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +skipping because answer = 43 +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="tests can be skipped dynamically at runtime" duration="{duration}"> + <skipped message="SKIP()"> +SKIPPED +at Skip.tests.cpp:<line number> + </skipped> + </testCase> + </file> <file path="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp"> <testCase name="Stringifying std::chrono::duration helpers" duration="{duration}"/> <testCase name="Stringifying std::chrono::duration with weird ratios" duration="{duration}"/> @@ -1920,7 +2025,7 @@ Misc.tests.cpp:<line number> <failure message="FAIL()"> FAILED: 1514 -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> </testCase> <testCase name="(unimplemented) static bools can be evaluated/compare to true" duration="{duration}"/> @@ -1934,14 +2039,14 @@ FAILED: CHECK( &o1 == &o2 ) with expansion: 0x<hex digits> == 0x<hex digits> -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> <failure message="CHECK(o1 == o2)"> FAILED: CHECK( o1 == o2 ) with expansion: {?} == {?} -Tricky.tests.cpp:<line number> +at Tricky.tests.cpp:<line number> </failure> </testCase> <testCase name="An expression with side-effects should only be evaluated once" duration="{duration}"/> diff --git a/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt index 2c7adae54de162c2d455a82333d4cc393fb727d8..acd0a1c14934133acd85defa52b363fce72ddcae 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -1,3 +1,4 @@ +# filters: "*" ~[!nonportable] ~[!benchmark] ~[approvals] # rng-seed: 1 # # A test name that starts with a # ok {test-number} - with 1 message: 'yay' @@ -163,6 +164,8 @@ ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0 ok {test-number} - smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) # #2152 - ULP checks between differently signed values were wrong - float ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) +# #2615 - Throwing in constructor generator fails test case but does not abort +not ok {test-number} - unexpected exception with message: 'failure to init' # #748 - captures with unexpected exceptions not ok {test-number} - unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' # #748 - captures with unexpected exceptions @@ -981,10 +984,10 @@ ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1" ok {test-number} - enumInfo->lookup(1) == "Value2" for: Value2 == "Value2" # Directly creating an EnumInfo ok {test-number} - enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}" +# Empty generators can SKIP in constructor +ok {test-number} - # SKIP 'This generator is empty' # Empty stream name opens cout stream ok {test-number} - Catch::makeStream( "" )->isConsole() for: true -# Empty tag is not allowed -ok {test-number} - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) # EndsWith string matcher not ok {test-number} - testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring" # EndsWith string matcher @@ -1075,6 +1078,14 @@ not ok {test-number} - throwsSpecialException( 4 ), SpecialException, ExceptionM ok {test-number} - throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 # Exception matchers that succeed ok {test-number} - throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } for: SpecialException::what special exception has value of 2 +# Exception message can be matched +ok {test-number} - throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) for: DerivedException::what matches "starts with: "Derived"" +# Exception message can be matched +ok {test-number} - throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) for: DerivedException::what matches "ends with: "::what"" +# Exception message can be matched +ok {test-number} - throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) for: DerivedException::what matches "not starts with: "::what"" +# Exception message can be matched +ok {test-number} - throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) for: SpecialException::what matches "starts with: "Special"" # Exception messages can be tested for ok {test-number} - thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" # Exception messages can be tested for @@ -1119,6 +1130,8 @@ ok {test-number} - Factorial(2) == 2 for: 2 == 2 ok {test-number} - Factorial(3) == 6 for: 6 == 6 # Factorials are computed ok {test-number} - Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) +# Filter generator throws exception for empty generator +ok {test-number} - filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException # Floating point matchers: double ok {test-number} - 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other # Floating point matchers: double @@ -1177,6 +1190,8 @@ ok {test-number} - WithinRel( 1., 0. ) ok {test-number} - WithinRel( 1., -0.2 ), std::domain_error # Floating point matchers: double ok {test-number} - WithinRel( 1., 1. ), std::domain_error +# Floating point matchers: double +ok {test-number} - 1., !IsNaN() for: 1.0 not is NaN # Floating point matchers: float ok {test-number} - 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other # Floating point matchers: float @@ -1241,6 +1256,8 @@ ok {test-number} - WithinRel( 1.f, 0.f ) ok {test-number} - WithinRel( 1.f, -0.2f ), std::domain_error # Floating point matchers: float ok {test-number} - WithinRel( 1.f, 1.f ), std::domain_error +# Floating point matchers: float +ok {test-number} - 1., !IsNaN() for: 1.0 not is NaN # Generators -- adapters ok {test-number} - i % 2 == 0 for: 0 == 0 # Generators -- adapters @@ -2081,308 +2098,28 @@ ok {test-number} - &EvilMatcher(), EvilAddressOfOperatorUsed ok {test-number} - EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) # Overloaded comma or address-of operators are not used ok {test-number} - ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - parseTestSpec( "*a" ).matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - parseTestSpec( "a*" ).matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - parseTestSpec( "*a*" ).matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark" ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( "aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( "aardvark" ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark" ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( "aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( "aardvark" ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) for: true -# Parse test names and tags -ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false -# Parse test names and tags -ok {test-number} - !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) for: !false -# Parse test names and tags -ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false -# Parse test names and tags -ok {test-number} - !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false -# Parse test names and tags -ok {test-number} - spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true +# Parse uints +ok {test-number} - parseUInt( "0" ) == Optional<unsigned int>{ 0 } for: {?} == {?} +# Parse uints +ok {test-number} - parseUInt( "100" ) == Optional<unsigned int>{ 100 } for: {?} == {?} +# Parse uints +ok {test-number} - parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } for: {?} == {?} +# Parse uints +ok {test-number} - parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } for: {?} == {?} +# Parse uints +ok {test-number} - !(parseUInt( "" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "!!KJHF*#" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "-1" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "4294967296" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "42949672964294967296429496729642949672964294967296" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "2 4" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "0x<hex digits>", 10 )) for: !{?} # Parsed tags are matched case insensitive ok {test-number} - spec.hasFilters() for: true # Parsed tags are matched case insensitive @@ -2396,11 +2133,11 @@ ok {test-number} - config.shardCount == 8 for: 8 == 8 # Parsing sharding-related cli flags ok {test-number} - !(result) for: !{?} # Parsing sharding-related cli flags -ok {test-number} - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +ok {test-number} - result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) for: "Could not parse '-1' as shard count" contains: "Could not parse '-1' as shard count" # Parsing sharding-related cli flags ok {test-number} - !(result) for: !{?} # Parsing sharding-related cli flags -ok {test-number} - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +ok {test-number} - result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) for: "Shard count must be positive" contains: "Shard count must be positive" # Parsing sharding-related cli flags ok {test-number} - cli.parse({ "test", "--shard-index=2" }) for: {?} # Parsing sharding-related cli flags @@ -2408,7 +2145,7 @@ ok {test-number} - config.shardIndex == 2 for: 2 == 2 # Parsing sharding-related cli flags ok {test-number} - !(result) for: !{?} # Parsing sharding-related cli flags -ok {test-number} - result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" +ok {test-number} - result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) for: "Could not parse '-12' as shard index" contains: "Could not parse '-12' as shard index" # Parsing sharding-related cli flags ok {test-number} - cli.parse({ "test", "--shard-index=0" }) for: {?} # Parsing sharding-related cli flags @@ -3494,6 +3231,40 @@ ok {test-number} - trim(StringRef(leading_whitespace)) == StringRef(no_whitespac ok {test-number} - trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here # Trim strings ok {test-number} - trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, RangeEquals( c_array ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, UnorderedRangeEquals( c_array ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_3, !RangeEquals( array_int_4 ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_3, !UnorderedRangeEquals( array_int_4 ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, RangeEquals( vector_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, UnorderedRangeEquals( vector_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - with 1 message: 'ContainerIsRandomAccess( array_int_a ) != ContainerIsRandomAccess( list_char_a )' +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, RangeEquals( list_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, UnorderedRangeEquals( list_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_int_a, RangeEquals( vector_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_int_a, UnorderedRangeEquals( vector_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_int_a, !RangeEquals( vector_char_b ) for: { 1, 2, 3 } not elements are { 1, 2, 2 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_int_a, !UnorderedRangeEquals( vector_char_b ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 2 } +# Type conversions of RangeEquals and similar +ok {test-number} - a, !RangeEquals( b ) for: { 1, 2, 3 } not elements are { 3, 2, 1 } +# Type conversions of RangeEquals and similar +ok {test-number} - a, UnorderedRangeEquals( b ) for: { 1, 2, 3 } unordered elements are { 3, 2, 1 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_a, RangeEquals( array_a_plus_1, close_enough ) for: { 1, 2, 3 } elements are { 2, 3, 4 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) for: { 1, 2, 3 } unordered elements are { 2, 3, 4 } # Unexpected exceptions can be translated not ok {test-number} - unexpected exception with message: '3.14' # Upcasting special member functions @@ -3704,6 +3475,70 @@ ok {test-number} - mocked.m_derefed[2] for: true ok {test-number} - !(mocked.m_derefed[3]) for: !false # Usage of NoneTrue range matcher ok {test-number} - !(mocked.m_derefed[4]) for: !false +# Usage of RangeEquals range matcher +ok {test-number} - empty_vector, RangeEquals( empty_vector ) for: { } elements are { } +# Usage of RangeEquals range matcher +ok {test-number} - empty_vector, !RangeEquals( non_empty_vector ) for: { } not elements are { 1 } +# Usage of RangeEquals range matcher +ok {test-number} - non_empty_vector, !RangeEquals( empty_vector ) for: { 1 } not elements are { } +# Usage of RangeEquals range matcher +ok {test-number} - non_empty_array, RangeEquals( non_empty_array ) for: { 1 } elements are { 1 } +# Usage of RangeEquals range matcher +ok {test-number} - array_a, RangeEquals( array_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Usage of RangeEquals range matcher +ok {test-number} - array_a, !RangeEquals( array_b ) for: { 1, 2, 3 } not elements are { 2, 2, 3 } +# Usage of RangeEquals range matcher +ok {test-number} - array_a, !RangeEquals( array_c ) for: { 1, 2, 3 } not elements are { 1, 2, 2 } +# Usage of RangeEquals range matcher +ok {test-number} - vector_a, !RangeEquals( vector_b ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - vector_a, RangeEquals( vector_a_plus_1, close_enough ) for: { 1, 2, 3 } elements are { 2, 3, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - vector_a, !RangeEquals( vector_b, close_enough ) for: { 1, 2, 3 } not elements are { 3, 3, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - needs_adl1, RangeEquals( needs_adl2 ) for: { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } +# Usage of RangeEquals range matcher +ok {test-number} - needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) for: { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } +# Usage of RangeEquals range matcher +ok {test-number} - mocked1, !RangeEquals( arr ) for: { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[0] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[1] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[2] for: true +# Usage of RangeEquals range matcher +ok {test-number} - !(mocked1.m_derefed[3]) for: !false +# Usage of RangeEquals range matcher +ok {test-number} - mocked1, RangeEquals( arr ) for: { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[0] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[1] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[2] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[3] for: true +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - empty_vector, UnorderedRangeEquals( empty_vector ) for: { } unordered elements are { } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - empty_vector, !UnorderedRangeEquals( non_empty_vector ) for: { } not unordered elements are { 1 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - non_empty_vector, !UnorderedRangeEquals( empty_vector ) for: { 1 } not unordered elements are { } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - non_empty_array, UnorderedRangeEquals( non_empty_array ) for: { 1 } unordered elements are { 1 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - array_a, UnorderedRangeEquals( array_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - array_a, !UnorderedRangeEquals( array_b ) for: { 1, 2, 3 } not unordered elements are { 2, 2, 3 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - vector_a, !UnorderedRangeEquals( vector_b ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) for: { 1, 10, 20 } unordered elements are { 11, 21, 2 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - vector_a, !UnorderedRangeEquals( vector_b, close_enough ) for: { 1, 10, 21 } not unordered elements are { 11, 21, 3 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - needs_adl1, UnorderedRangeEquals( needs_adl2 ) for: { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } # Usage of the SizeIs range matcher ok {test-number} - empty_vec, SizeIs(0) for: { } has size == 0 # Usage of the SizeIs range matcher @@ -3880,6 +3715,10 @@ ok {test-number} - encode( "[\x01]" ) == "[\\x01]" for: "[\x01]" == "[\x01]" ok {test-number} - encode( "[\x7F]" ) == "[\\x7F]" for: "[\x7F]" == "[\x7F]" # XmlWriter writes boolean attributes as true/false ok {test-number} - stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) +# a succeeding test can still be skipped +ok {test-number} - +# a succeeding test can still be skipped +ok {test-number} - # SKIP # analyse no analysis ok {test-number} - analysis.mean.point.count() == 23 for: 23.0 == 23 # analyse no analysis @@ -4050,6 +3889,12 @@ ok {test-number} - convertToBits( -0. ) == ( 1ULL << 63 ) for: 92233720368547758 ok {test-number} - convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 for: 1 == 1 # convertToBits ok {test-number} - convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 for: 1 == 1 +# dynamic skipping works with generators +ok {test-number} - # SKIP 'skipping because answer = 41' +# dynamic skipping works with generators +ok {test-number} - +# dynamic skipping works with generators +ok {test-number} - # SKIP 'skipping because answer = 43' # empty tags are not allowed ok {test-number} - Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) # erfc_inv @@ -4068,6 +3913,22 @@ ok {test-number} - ok {test-number} - # even more nested SECTION tests ok {test-number} - +# failed assertions before SKIP cause test case to fail +not ok {test-number} - 3 == 4 +# failed assertions before SKIP cause test case to fail +ok {test-number} - # SKIP +# failing for some generator values causes entire test case to fail +not ok {test-number} - explicitly +# failing for some generator values causes entire test case to fail +ok {test-number} - # SKIP +# failing for some generator values causes entire test case to fail +not ok {test-number} - explicitly +# failing for some generator values causes entire test case to fail +ok {test-number} - # SKIP +# failing in some unskipped sections causes entire test case to fail +ok {test-number} - # SKIP +# failing in some unskipped sections causes entire test case to fail +not ok {test-number} - explicitly loose text artifact # is_unary_function ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value' @@ -4177,6 +4038,11 @@ ok {test-number} - a != b for: 1 != 2 ok {test-number} - b != a for: 2 != 1 # nested SECTION tests ok {test-number} - a != b for: 1 != 2 +a! +b1! +# nested sections can be skipped dynamically at runtime +ok {test-number} - # SKIP +! # non streamable - with conv. op ok {test-number} - s == "7" for: "7" == "7" # non-copyable objects @@ -4341,12 +4207,20 @@ ok {test-number} - Timing.elapsed >= time for: 128 ns >= 100 ns ok {test-number} - Timing.result == Timing.iterations + 17 for: 145 == 145 # run_for_at_least, int ok {test-number} - Timing.iterations >= time.count() for: 128 >= 100 +# sections can be skipped dynamically at runtime +ok {test-number} - +# sections can be skipped dynamically at runtime +ok {test-number} - # SKIP +# sections can be skipped dynamically at runtime +ok {test-number} - # send a single char to INFO not ok {test-number} - false with 1 message: '3' # sends information to INFO not ok {test-number} - false with 2 messages: 'hi' and 'i := 7' # shortened hide tags are split apart ok {test-number} - testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +# skipped tests can optionally provide a reason +ok {test-number} - # SKIP 'skipping because answer = 43' # splitString ok {test-number} - splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { } # splitString @@ -4429,6 +4303,8 @@ ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>( ok {test-number} - testcase.tags.size() == 1 for: 1 == 1 # tags with dots in later positions are not parsed as hidden ok {test-number} - testcase.tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag +# tests can be skipped dynamically at runtime +ok {test-number} - # SKIP # thrown std::strings are translated not ok {test-number} - unexpected exception with message: 'Why would you throw a std::string?' # toString on const wchar_t const pointer returns the string contents @@ -4601,5 +4477,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2299 +1..2237 diff --git a/packages/Catch2/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index d13b493c904716a157a80e11c1fb2a89a91d7d5c..033290497de6d943581107ed1b2026cdde1c3ccd 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -1,3 +1,4 @@ +# filters: "*" ~[!nonportable] ~[!benchmark] ~[approvals] # rng-seed: 1 # # A test name that starts with a # ok {test-number} - with 1 message: 'yay' @@ -161,6 +162,8 @@ ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0 ok {test-number} - smallest_non_zero, WithinULP( -smallest_non_zero, 2 ) for: 0.0f is within 2 ULPs of -1.40129846e-45f ([-4.20389539e-45, 1.40129846e-45]) # #2152 - ULP checks between differently signed values were wrong - float ok {test-number} - smallest_non_zero, !WithinULP( -smallest_non_zero, 1 ) for: 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) +# #2615 - Throwing in constructor generator fails test case but does not abort +not ok {test-number} - unexpected exception with message: 'failure to init' # #748 - captures with unexpected exceptions not ok {test-number} - unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' # #748 - captures with unexpected exceptions @@ -979,10 +982,10 @@ ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1" ok {test-number} - enumInfo->lookup(1) == "Value2" for: Value2 == "Value2" # Directly creating an EnumInfo ok {test-number} - enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}" +# Empty generators can SKIP in constructor +ok {test-number} - # SKIP 'This generator is empty' # Empty stream name opens cout stream ok {test-number} - Catch::makeStream( "" )->isConsole() for: true -# Empty tag is not allowed -ok {test-number} - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) # EndsWith string matcher not ok {test-number} - testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring" # EndsWith string matcher @@ -1073,6 +1076,14 @@ not ok {test-number} - throwsSpecialException( 4 ), SpecialException, ExceptionM ok {test-number} - throwsSpecialException( 1 ), SpecialException, ExceptionMatcher{ 1 } for: SpecialException::what special exception has value of 1 # Exception matchers that succeed ok {test-number} - throwsSpecialException( 2 ), SpecialException, ExceptionMatcher{ 2 } for: SpecialException::what special exception has value of 2 +# Exception message can be matched +ok {test-number} - throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) for: DerivedException::what matches "starts with: "Derived"" +# Exception message can be matched +ok {test-number} - throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) for: DerivedException::what matches "ends with: "::what"" +# Exception message can be matched +ok {test-number} - throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) for: DerivedException::what matches "not starts with: "::what"" +# Exception message can be matched +ok {test-number} - throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) for: SpecialException::what matches "starts with: "Special"" # Exception messages can be tested for ok {test-number} - thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" # Exception messages can be tested for @@ -1117,6 +1128,8 @@ ok {test-number} - Factorial(2) == 2 for: 2 == 2 ok {test-number} - Factorial(3) == 6 for: 6 == 6 # Factorials are computed ok {test-number} - Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) +# Filter generator throws exception for empty generator +ok {test-number} - filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException # Floating point matchers: double ok {test-number} - 10., WithinRel( 11.1, 0.1 ) for: 10.0 and 11.1 are within 10% of each other # Floating point matchers: double @@ -1175,6 +1188,8 @@ ok {test-number} - WithinRel( 1., 0. ) ok {test-number} - WithinRel( 1., -0.2 ), std::domain_error # Floating point matchers: double ok {test-number} - WithinRel( 1., 1. ), std::domain_error +# Floating point matchers: double +ok {test-number} - 1., !IsNaN() for: 1.0 not is NaN # Floating point matchers: float ok {test-number} - 10.f, WithinRel( 11.1f, 0.1f ) for: 10.0f and 11.1 are within 10% of each other # Floating point matchers: float @@ -1239,6 +1254,8 @@ ok {test-number} - WithinRel( 1.f, 0.f ) ok {test-number} - WithinRel( 1.f, -0.2f ), std::domain_error # Floating point matchers: float ok {test-number} - WithinRel( 1.f, 1.f ), std::domain_error +# Floating point matchers: float +ok {test-number} - 1., !IsNaN() for: 1.0 not is NaN # Generators -- adapters ok {test-number} - i % 2 == 0 for: 0 == 0 # Generators -- adapters @@ -2079,308 +2096,28 @@ ok {test-number} - &EvilMatcher(), EvilAddressOfOperatorUsed ok {test-number} - EvilMatcher() || ( EvilMatcher() && !EvilMatcher() ) # Overloaded comma or address-of operators are not used ok {test-number} - ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - parseTestSpec( "*a" ).matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - parseTestSpec( "a*" ).matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - parseTestSpec( "*a*" ).matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.hasFilters() == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *tcA ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcB ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcC ) == false for: false == false -# Parse test names and tags -ok {test-number} - spec.matches( *tcD ) == true for: true == true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark" ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( "aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( "aardvark" ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark" ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( "aardvark " ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches( *fakeTestCase( "aardvark" ) ) for: true -# Parse test names and tags -ok {test-number} - spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) for: true -# Parse test names and tags -ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false -# Parse test names and tags -ok {test-number} - !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) for: !false -# Parse test names and tags -ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false -# Parse test names and tags -ok {test-number} - !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false -# Parse test names and tags -ok {test-number} - spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true +# Parse uints +ok {test-number} - parseUInt( "0" ) == Optional<unsigned int>{ 0 } for: {?} == {?} +# Parse uints +ok {test-number} - parseUInt( "100" ) == Optional<unsigned int>{ 100 } for: {?} == {?} +# Parse uints +ok {test-number} - parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } for: {?} == {?} +# Parse uints +ok {test-number} - parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } for: {?} == {?} +# Parse uints +ok {test-number} - !(parseUInt( "" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "!!KJHF*#" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "-1" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "4294967296" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "42949672964294967296429496729642949672964294967296" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "2 4" )) for: !{?} +# Parse uints +ok {test-number} - !(parseUInt( "0x<hex digits>", 10 )) for: !{?} # Parsed tags are matched case insensitive ok {test-number} - spec.hasFilters() for: true # Parsed tags are matched case insensitive @@ -2394,11 +2131,11 @@ ok {test-number} - config.shardCount == 8 for: 8 == 8 # Parsing sharding-related cli flags ok {test-number} - !(result) for: !{?} # Parsing sharding-related cli flags -ok {test-number} - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +ok {test-number} - result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) for: "Could not parse '-1' as shard count" contains: "Could not parse '-1' as shard count" # Parsing sharding-related cli flags ok {test-number} - !(result) for: !{?} # Parsing sharding-related cli flags -ok {test-number} - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") for: "Shard count must be a positive number" contains: "Shard count must be a positive number" +ok {test-number} - result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) for: "Shard count must be positive" contains: "Shard count must be positive" # Parsing sharding-related cli flags ok {test-number} - cli.parse({ "test", "--shard-index=2" }) for: {?} # Parsing sharding-related cli flags @@ -2406,7 +2143,7 @@ ok {test-number} - config.shardIndex == 2 for: 2 == 2 # Parsing sharding-related cli flags ok {test-number} - !(result) for: !{?} # Parsing sharding-related cli flags -ok {test-number} - result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" +ok {test-number} - result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) for: "Could not parse '-12' as shard index" contains: "Could not parse '-12' as shard index" # Parsing sharding-related cli flags ok {test-number} - cli.parse({ "test", "--shard-index=0" }) for: {?} # Parsing sharding-related cli flags @@ -3487,6 +3224,40 @@ ok {test-number} - trim(StringRef(leading_whitespace)) == StringRef(no_whitespac ok {test-number} - trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here # Trim strings ok {test-number} - trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, RangeEquals( c_array ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, UnorderedRangeEquals( c_array ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_3, !RangeEquals( array_int_4 ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_3, !UnorderedRangeEquals( array_int_4 ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, RangeEquals( vector_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, UnorderedRangeEquals( vector_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - with 1 message: 'ContainerIsRandomAccess( array_int_a ) != ContainerIsRandomAccess( list_char_a )' +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, RangeEquals( list_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - array_int_a, UnorderedRangeEquals( list_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_int_a, RangeEquals( vector_char_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_int_a, UnorderedRangeEquals( vector_char_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_int_a, !RangeEquals( vector_char_b ) for: { 1, 2, 3 } not elements are { 1, 2, 2 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_int_a, !UnorderedRangeEquals( vector_char_b ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 2 } +# Type conversions of RangeEquals and similar +ok {test-number} - a, !RangeEquals( b ) for: { 1, 2, 3 } not elements are { 3, 2, 1 } +# Type conversions of RangeEquals and similar +ok {test-number} - a, UnorderedRangeEquals( b ) for: { 1, 2, 3 } unordered elements are { 3, 2, 1 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_a, RangeEquals( array_a_plus_1, close_enough ) for: { 1, 2, 3 } elements are { 2, 3, 4 } +# Type conversions of RangeEquals and similar +ok {test-number} - vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) for: { 1, 2, 3 } unordered elements are { 2, 3, 4 } # Unexpected exceptions can be translated not ok {test-number} - unexpected exception with message: '3.14' # Upcasting special member functions @@ -3697,6 +3468,70 @@ ok {test-number} - mocked.m_derefed[2] for: true ok {test-number} - !(mocked.m_derefed[3]) for: !false # Usage of NoneTrue range matcher ok {test-number} - !(mocked.m_derefed[4]) for: !false +# Usage of RangeEquals range matcher +ok {test-number} - empty_vector, RangeEquals( empty_vector ) for: { } elements are { } +# Usage of RangeEquals range matcher +ok {test-number} - empty_vector, !RangeEquals( non_empty_vector ) for: { } not elements are { 1 } +# Usage of RangeEquals range matcher +ok {test-number} - non_empty_vector, !RangeEquals( empty_vector ) for: { 1 } not elements are { } +# Usage of RangeEquals range matcher +ok {test-number} - non_empty_array, RangeEquals( non_empty_array ) for: { 1 } elements are { 1 } +# Usage of RangeEquals range matcher +ok {test-number} - array_a, RangeEquals( array_a ) for: { 1, 2, 3 } elements are { 1, 2, 3 } +# Usage of RangeEquals range matcher +ok {test-number} - array_a, !RangeEquals( array_b ) for: { 1, 2, 3 } not elements are { 2, 2, 3 } +# Usage of RangeEquals range matcher +ok {test-number} - array_a, !RangeEquals( array_c ) for: { 1, 2, 3 } not elements are { 1, 2, 2 } +# Usage of RangeEquals range matcher +ok {test-number} - vector_a, !RangeEquals( vector_b ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - vector_a, RangeEquals( vector_a_plus_1, close_enough ) for: { 1, 2, 3 } elements are { 2, 3, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - vector_a, !RangeEquals( vector_b, close_enough ) for: { 1, 2, 3 } not elements are { 3, 3, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - needs_adl1, RangeEquals( needs_adl2 ) for: { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } +# Usage of RangeEquals range matcher +ok {test-number} - needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) for: { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } +# Usage of RangeEquals range matcher +ok {test-number} - mocked1, !RangeEquals( arr ) for: { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[0] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[1] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[2] for: true +# Usage of RangeEquals range matcher +ok {test-number} - !(mocked1.m_derefed[3]) for: !false +# Usage of RangeEquals range matcher +ok {test-number} - mocked1, RangeEquals( arr ) for: { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[0] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[1] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[2] for: true +# Usage of RangeEquals range matcher +ok {test-number} - mocked1.m_derefed[3] for: true +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - empty_vector, UnorderedRangeEquals( empty_vector ) for: { } unordered elements are { } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - empty_vector, !UnorderedRangeEquals( non_empty_vector ) for: { } not unordered elements are { 1 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - non_empty_vector, !UnorderedRangeEquals( empty_vector ) for: { 1 } not unordered elements are { } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - non_empty_array, UnorderedRangeEquals( non_empty_array ) for: { 1 } unordered elements are { 1 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - array_a, UnorderedRangeEquals( array_a ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - array_a, !UnorderedRangeEquals( array_b ) for: { 1, 2, 3 } not unordered elements are { 2, 2, 3 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - vector_a, !UnorderedRangeEquals( vector_b ) for: { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) for: { 1, 10, 20 } unordered elements are { 11, 21, 2 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - vector_a, !UnorderedRangeEquals( vector_b, close_enough ) for: { 1, 10, 21 } not unordered elements are { 11, 21, 3 } +# Usage of UnorderedRangeEquals range matcher +ok {test-number} - needs_adl1, UnorderedRangeEquals( needs_adl2 ) for: { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } # Usage of the SizeIs range matcher ok {test-number} - empty_vec, SizeIs(0) for: { } has size == 0 # Usage of the SizeIs range matcher @@ -3873,6 +3708,10 @@ ok {test-number} - encode( "[\x01]" ) == "[\\x01]" for: "[\x01]" == "[\x01]" ok {test-number} - encode( "[\x7F]" ) == "[\\x7F]" for: "[\x7F]" == "[\x7F]" # XmlWriter writes boolean attributes as true/false ok {test-number} - stream.str(), ContainsSubstring(R"(attr1="true")") && ContainsSubstring(R"(attr2="false")") for: "<?xml version="1.0" encoding="UTF-8"?> <Element1 attr1="true" attr2="false"/> " ( contains: "attr1="true"" and contains: "attr2="false"" ) +# a succeeding test can still be skipped +ok {test-number} - +# a succeeding test can still be skipped +ok {test-number} - # SKIP # analyse no analysis ok {test-number} - analysis.mean.point.count() == 23 for: 23.0 == 23 # analyse no analysis @@ -4043,6 +3882,12 @@ ok {test-number} - convertToBits( -0. ) == ( 1ULL << 63 ) for: 92233720368547758 ok {test-number} - convertToBits( std::numeric_limits<float>::denorm_min() ) == 1 for: 1 == 1 # convertToBits ok {test-number} - convertToBits( std::numeric_limits<double>::denorm_min() ) == 1 for: 1 == 1 +# dynamic skipping works with generators +ok {test-number} - # SKIP 'skipping because answer = 41' +# dynamic skipping works with generators +ok {test-number} - +# dynamic skipping works with generators +ok {test-number} - # SKIP 'skipping because answer = 43' # empty tags are not allowed ok {test-number} - Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) # erfc_inv @@ -4061,6 +3906,22 @@ ok {test-number} - ok {test-number} - # even more nested SECTION tests ok {test-number} - +# failed assertions before SKIP cause test case to fail +not ok {test-number} - 3 == 4 +# failed assertions before SKIP cause test case to fail +ok {test-number} - # SKIP +# failing for some generator values causes entire test case to fail +not ok {test-number} - explicitly +# failing for some generator values causes entire test case to fail +ok {test-number} - # SKIP +# failing for some generator values causes entire test case to fail +not ok {test-number} - explicitly +# failing for some generator values causes entire test case to fail +ok {test-number} - # SKIP +# failing in some unskipped sections causes entire test case to fail +ok {test-number} - # SKIP +# failing in some unskipped sections causes entire test case to fail +not ok {test-number} - explicitly # is_unary_function ok {test-number} - with 1 message: 'Catch::Clara::Detail::is_unary_function<decltype(unary1)>::value' # is_unary_function @@ -4169,6 +4030,8 @@ ok {test-number} - a != b for: 1 != 2 ok {test-number} - b != a for: 2 != 1 # nested SECTION tests ok {test-number} - a != b for: 1 != 2 +# nested sections can be skipped dynamically at runtime +ok {test-number} - # SKIP # non streamable - with conv. op ok {test-number} - s == "7" for: "7" == "7" # non-copyable objects @@ -4333,12 +4196,20 @@ ok {test-number} - Timing.elapsed >= time for: 128 ns >= 100 ns ok {test-number} - Timing.result == Timing.iterations + 17 for: 145 == 145 # run_for_at_least, int ok {test-number} - Timing.iterations >= time.count() for: 128 >= 100 +# sections can be skipped dynamically at runtime +ok {test-number} - +# sections can be skipped dynamically at runtime +ok {test-number} - # SKIP +# sections can be skipped dynamically at runtime +ok {test-number} - # send a single char to INFO not ok {test-number} - false with 1 message: '3' # sends information to INFO not ok {test-number} - false with 2 messages: 'hi' and 'i := 7' # shortened hide tags are split apart ok {test-number} - testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} ) +# skipped tests can optionally provide a reason +ok {test-number} - # SKIP 'skipping because answer = 43' # splitString ok {test-number} - splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { } # splitString @@ -4421,6 +4292,8 @@ ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>( ok {test-number} - testcase.tags.size() == 1 for: 1 == 1 # tags with dots in later positions are not parsed as hidden ok {test-number} - testcase.tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag +# tests can be skipped dynamically at runtime +ok {test-number} - # SKIP # thrown std::strings are translated not ok {test-number} - unexpected exception with message: 'Why would you throw a std::string?' # toString on const wchar_t const pointer returns the string contents @@ -4593,5 +4466,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2299 +1..2237 diff --git a/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 526f00a90f1b93d419920afb5d450bf9e675e8fc..a298633a16618590108f292f8d14a428e1ba47b6 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -18,7 +18,7 @@ ##teamcity[testStarted name='#1455 - INFO and WARN can start with a linebreak'] ##teamcity[testFinished name='#1455 - INFO and WARN can start with a linebreak' duration="{duration}"] ##teamcity[testStarted name='#1514: stderr/stdout is not captured in tests aborted by an exception'] -Tricky.tests.cpp:<line number>|nexplicit failure with message:|n "1514"'] +##teamcity[testFailed name='#1514: stderr/stdout is not captured in tests aborted by an exception' message='Tricky.tests.cpp:<line number>|n...............................................................................|n|nTricky.tests.cpp:<line number>|nexplicit failure with message:|n "1514"'] ##teamcity[testStdOut name='#1514: stderr/stdout is not captured in tests aborted by an exception' out='This would not be caught previously|n'] ##teamcity[testStdErr name='#1514: stderr/stdout is not captured in tests aborted by an exception' out='Nor would this|n'] ##teamcity[testFinished name='#1514: stderr/stdout is not captured in tests aborted by an exception' duration="{duration}"] @@ -52,30 +52,33 @@ Tricky.tests.cpp:<line number>|nexplicit failure with message:|n "1514"'] ##teamcity[testFinished name='#2152 - ULP checks between differently signed values were wrong - double' duration="{duration}"] ##teamcity[testStarted name='#2152 - ULP checks between differently signed values were wrong - float'] ##teamcity[testFinished name='#2152 - ULP checks between differently signed values were wrong - float' duration="{duration}"] +##teamcity[testStarted name='#2615 - Throwing in constructor generator fails test case but does not abort'] +##teamcity[testIgnored name='#2615 - Throwing in constructor generator fails test case but does not abort' message='Generators.tests.cpp:<line number>|n...............................................................................|n|nGenerators.tests.cpp:<line number>|nunexpected exception with message:|n "failure to init"- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='#2615 - Throwing in constructor generator fails test case but does not abort' duration="{duration}"] ##teamcity[testStarted name='#748 - captures with unexpected exceptions'] -Exception.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"- failure ignore as test marked as |'ok to fail|'|n'] -Exception.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|ninside REQUIRE_NOTHROW|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='#748 - captures with unexpected exceptions' duration="{duration}"] ##teamcity[testStarted name='#809'] ##teamcity[testFinished name='#809' duration="{duration}"] ##teamcity[testStarted name='#833'] ##teamcity[testFinished name='#833' duration="{duration}"] ##teamcity[testStarted name='#835 -- errno should not be touched by Catch2'] -Misc.tests.cpp:<line number>|nexpression failed|n CHECK( f() == 0 )|nwith expansion:|n 1 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#835 -- errno should not be touched by Catch2' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n CHECK( f() == 0 )|nwith expansion:|n 1 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='#835 -- errno should not be touched by Catch2' duration="{duration}"] ##teamcity[testStarted name='#872'] ##teamcity[testFinished name='#872' duration="{duration}"] ##teamcity[testStarted name='#961 -- Dynamically created sections should all be reported'] ##teamcity[testFinished name='#961 -- Dynamically created sections should all be reported' duration="{duration}"] ##teamcity[testStarted name='|'Not|' checks that should fail'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( false != false )|nwith expansion:|n false != false|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( true != true )|nwith expansion:|n true != true|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !true )|nwith expansion:|n false|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( true )|nwith expansion:|n !true|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !trueValue )|nwith expansion:|n false|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( trueValue )|nwith expansion:|n !true|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !(1 == 1) )|nwith expansion:|n false|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( 1 == 1 )|nwith expansion:|n !(1 == 1)|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexpression failed|n CHECK( false != false )|nwith expansion:|n false != false|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( true != true )|nwith expansion:|n true != true|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !true )|nwith expansion:|n false|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( true )|nwith expansion:|n !true|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !trueValue )|nwith expansion:|n false|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( trueValue )|nwith expansion:|n !true|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !(1 == 1) )|nwith expansion:|n false|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( 1 == 1 )|nwith expansion:|n !(1 == 1)|n'] ##teamcity[testFinished name='|'Not|' checks that should fail' duration="{duration}"] ##teamcity[testStarted name='|'Not|' checks that should succeed'] ##teamcity[testFinished name='|'Not|' checks that should succeed' duration="{duration}"] @@ -84,21 +87,21 @@ Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( 1 == 1 )|nw ##teamcity[testStarted name='3x3x3 ints'] ##teamcity[testFinished name='3x3x3 ints' duration="{duration}"] ##teamcity[testStarted name='A METHOD_AS_TEST_CASE based test run that fails'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( s == "world" )|nwith expansion:|n "hello" == "world"|n'] +##teamcity[testFailed name='A METHOD_AS_TEST_CASE based test run that fails' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( s == "world" )|nwith expansion:|n "hello" == "world"|n'] ##teamcity[testFinished name='A METHOD_AS_TEST_CASE based test run that fails' duration="{duration}"] ##teamcity[testStarted name='A METHOD_AS_TEST_CASE based test run that succeeds'] ##teamcity[testFinished name='A METHOD_AS_TEST_CASE based test run that succeeds' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>' duration="{duration}"] @@ -109,16 +112,16 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2< ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>' duration="{duration}"] @@ -129,13 +132,13 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2< ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - double'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0 == 2|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - double' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0 == 2|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - double' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - float'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0f == 2|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - float' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0f == 2|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - float' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - int'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - int' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - int' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double' duration="{duration}"] @@ -144,13 +147,13 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<Te ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 1 == 0|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 3 == 0|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 3 == 0|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 6 == 0|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 6 == 0|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1' duration="{duration}"] @@ -159,7 +162,7 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::va ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that fails'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFailed name='A TEST_CASE_METHOD based test run that fails' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that fails' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that succeeds'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that succeeds' duration="{duration}"] @@ -182,11 +185,11 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( m_a == 2 )|nwith ex ##teamcity[testStarted name='A comparison that uses literals instead of the normal constructor'] ##teamcity[testFinished name='A comparison that uses literals instead of the normal constructor' duration="{duration}"] ##teamcity[testStarted name='A couple of nested sections followed by a failure'] -Misc.tests.cpp:<line number>|nexplicit failure with message:|n "to infinity and beyond"'] +##teamcity[testFailed name='A couple of nested sections followed by a failure' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexplicit failure with message:|n "to infinity and beyond"'] ##teamcity[testFinished name='A couple of nested sections followed by a failure' duration="{duration}"] ##teamcity[testStarted name='A failing expression with a non streamable type is still captured'] -Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( &o1 == &o2 )|nwith expansion:|n 0x<hex digits> == 0x<hex digits>|n'] -Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( o1 == o2 )|nwith expansion:|n {?} == {?}|n'] +##teamcity[testFailed name='A failing expression with a non streamable type is still captured' message='Tricky.tests.cpp:<line number>|n...............................................................................|n|nTricky.tests.cpp:<line number>|nexpression failed|n CHECK( &o1 == &o2 )|nwith expansion:|n 0x<hex digits> == 0x<hex digits>|n'] +##teamcity[testFailed name='A failing expression with a non streamable type is still captured' message='Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( o1 == o2 )|nwith expansion:|n {?} == {?}|n'] ##teamcity[testFinished name='A failing expression with a non streamable type is still captured' duration="{duration}"] ##teamcity[testStarted name='Absolute margin'] ##teamcity[testFinished name='Absolute margin' duration="{duration}"] @@ -195,7 +198,7 @@ Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( o1 == o2 )|nwith exp ##teamcity[testStarted name='An expression with side-effects should only be evaluated once'] ##teamcity[testFinished name='An expression with side-effects should only be evaluated once' duration="{duration}"] ##teamcity[testStarted name='An unchecked exception reports the line of the last assertion'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n'] +##teamcity[testFailed name='An unchecked exception reports the line of the last assertion' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n'] ##teamcity[testFinished name='An unchecked exception reports the line of the last assertion' duration="{duration}"] ##teamcity[testStarted name='Anonymous test case 1'] ##teamcity[testFinished name='Anonymous test case 1' duration="{duration}"] @@ -276,33 +279,34 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##teamcity[testStarted name='Composed matchers shortcircuit'] ##teamcity[testFinished name='Composed matchers shortcircuit' duration="{duration}"] ##teamcity[testStarted name='Contains string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "not there" (case insensitive)|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "STRING"|n'] +##teamcity[testFailed name='Contains string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "not there" (case insensitive)|n'] +##teamcity[testFailed name='Contains string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "STRING"|n'] ##teamcity[testFinished name='Contains string matcher' duration="{duration}"] ##teamcity[testStarted name='Copy and then generate a range'] ##teamcity[testFinished name='Copy and then generate a range' duration="{duration}"] ##teamcity[testStarted name='Cout stream properly declares it writes to stdout'] ##teamcity[testFinished name='Cout stream properly declares it writes to stdout' duration="{duration}"] ##teamcity[testStarted name='Custom exceptions can be translated when testing for nothrow'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_NOTHROW( throwCustom() )|nwith expansion:|n throwCustom()|n'] +##teamcity[testFailed name='Custom exceptions can be translated when testing for nothrow' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_NOTHROW( throwCustom() )|nwith expansion:|n throwCustom()|n'] ##teamcity[testFinished name='Custom exceptions can be translated when testing for nothrow' duration="{duration}"] ##teamcity[testStarted name='Custom exceptions can be translated when testing for throwing as something else'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_THROWS_AS( throwCustom(), std::exception )|nwith expansion:|n throwCustom(), std::exception|n'] +##teamcity[testFailed name='Custom exceptions can be translated when testing for throwing as something else' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_THROWS_AS( throwCustom(), std::exception )|nwith expansion:|n throwCustom(), std::exception|n'] ##teamcity[testFinished name='Custom exceptions can be translated when testing for throwing as something else' duration="{duration}"] ##teamcity[testStarted name='Custom std-exceptions can be custom translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom std exception"'] +##teamcity[testFailed name='Custom std-exceptions can be custom translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "custom std exception"'] ##teamcity[testFinished name='Custom std-exceptions can be custom translated' duration="{duration}"] ##teamcity[testStarted name='Default scale is invisible to comparison'] ##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"] ##teamcity[testStarted name='Directly creating an EnumInfo'] ##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"] +##teamcity[testStarted name='Empty generators can SKIP in constructor'] +##teamcity[testIgnored name='Empty generators can SKIP in constructor' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip with message:|n "This generator is empty"'] +##teamcity[testFinished name='Empty generators can SKIP in constructor' duration="{duration}"] ##teamcity[testStarted name='Empty stream name opens cout stream'] ##teamcity[testFinished name='Empty stream name opens cout stream' duration="{duration}"] -##teamcity[testStarted name='Empty tag is not allowed'] -##teamcity[testFinished name='Empty tag is not allowed' duration="{duration}"] ##teamcity[testStarted name='EndsWith string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n'] +##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n'] +##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n'] ##teamcity[testFinished name='EndsWith string matcher' duration="{duration}"] ##teamcity[testStarted name='Enums can quickly have stringification enabled using REGISTER_ENUM'] ##teamcity[testFinished name='Enums can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"] @@ -311,60 +315,64 @@ Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringFor ##teamcity[testStarted name='Epsilon only applies to Approx|'s value'] ##teamcity[testFinished name='Epsilon only applies to Approx|'s value' duration="{duration}"] ##teamcity[testStarted name='Equality checks that should fail'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 6 )|nwith expansion:|n 7 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 8 )|nwith expansion:|n 7 == 8|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 0 )|nwith expansion:|n 7 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.11f ) )|nwith expansion:|n 9.1f == Approx( 9.1099996567 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.0f ) )|nwith expansion:|n 9.1f == Approx( 9.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 1 ) )|nwith expansion:|n 9.1f == Approx( 1.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 0 ) )|nwith expansion:|n 9.1f == Approx( 0.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi == Approx( 3.1415 ) )|nwith expansion:|n 3.1415926535 == Approx( 3.1415 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "goodbye" )|nwith expansion:|n "hello" == "goodbye"|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hell" )|nwith expansion:|n "hello" == "hell"|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hello1" )|nwith expansion:|n "hello" == "hello1"|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() == 6 )|nwith expansion:|n 5 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( x == Approx( 1.301 ) )|nwith expansion:|n 1.3 == Approx( 1.301 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 6 )|nwith expansion:|n 7 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 8 )|nwith expansion:|n 7 == 8|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 0 )|nwith expansion:|n 7 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.11f ) )|nwith expansion:|n 9.1f == Approx( 9.1099996567 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.0f ) )|nwith expansion:|n 9.1f == Approx( 9.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 1 ) )|nwith expansion:|n 9.1f == Approx( 1.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 0 ) )|nwith expansion:|n 9.1f == Approx( 0.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi == Approx( 3.1415 ) )|nwith expansion:|n 3.1415926535 == Approx( 3.1415 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "goodbye" )|nwith expansion:|n "hello" == "goodbye"|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hell" )|nwith expansion:|n "hello" == "hell"|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hello1" )|nwith expansion:|n "hello" == "hello1"|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() == 6 )|nwith expansion:|n 5 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( x == Approx( 1.301 ) )|nwith expansion:|n 1.3 == Approx( 1.301 )|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Equality checks that should fail' duration="{duration}"] ##teamcity[testStarted name='Equality checks that should succeed'] ##teamcity[testFinished name='Equality checks that should succeed' duration="{duration}"] ##teamcity[testStarted name='Equals'] ##teamcity[testFinished name='Equals' duration="{duration}"] ##teamcity[testStarted name='Equals string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "this string contains |'ABC|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "this string contains |'ABC|' as a substring"|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "something else" (case insensitive)|n'] +##teamcity[testFailed name='Equals string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "this string contains |'ABC|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "this string contains |'ABC|' as a substring"|n'] +##teamcity[testFailed name='Equals string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "something else" (case insensitive)|n'] ##teamcity[testFinished name='Equals string matcher' duration="{duration}"] ##teamcity[testStarted name='Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified'] ##teamcity[testFinished name='Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified' duration="{duration}"] ##teamcity[testStarted name='Exception matchers that fail'] -Matchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] -Matchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] -Matchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] -Matchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] +##teamcity[testFailed name='Exception matchers that fail' message='-------------------------------------------------------------------------------|nNo exception|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] +##teamcity[testFailed name='Exception matchers that fail' message='Matchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] +##teamcity[testFailed name='Exception matchers that fail' message='-------------------------------------------------------------------------------|nType mismatch|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] +##teamcity[testFailed name='Exception matchers that fail' message='Matchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] +##teamcity[testFailed name='Exception matchers that fail' message='-------------------------------------------------------------------------------|nContents are wrong|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] +##teamcity[testFailed name='Exception matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] ##teamcity[testFinished name='Exception matchers that fail' duration="{duration}"] ##teamcity[testStarted name='Exception matchers that succeed'] ##teamcity[testFinished name='Exception matchers that succeed' duration="{duration}"] +##teamcity[testStarted name='Exception message can be matched'] +##teamcity[testFinished name='Exception message can be matched' duration="{duration}"] ##teamcity[testStarted name='Exception messages can be tested for'] ##teamcity[testFinished name='Exception messages can be tested for' duration="{duration}"] ##teamcity[testStarted name='Exceptions matchers'] ##teamcity[testFinished name='Exceptions matchers' duration="{duration}"] ##teamcity[testStarted name='Expected exceptions that don|'t throw or unexpected exceptions fail the test'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_THROWS_AS( thisThrows(), std::string )|nwith expansion:|n thisThrows(), std::string|n'] -Exception.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error )|nwith expansion:|n thisDoesntThrow(), std::domain_error|n'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n'] +##teamcity[testFailed name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_THROWS_AS( thisThrows(), std::string )|nwith expansion:|n thisThrows(), std::string|n'] +##teamcity[testFailed name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' message='Exception.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error )|nwith expansion:|n thisDoesntThrow(), std::domain_error|n'] +##teamcity[testFailed name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' message='Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n'] ##teamcity[testFinished name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' duration="{duration}"] ##teamcity[testStarted name='FAIL aborts the test'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] +##teamcity[testFailed name='FAIL aborts the test' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] ##teamcity[testFinished name='FAIL aborts the test' duration="{duration}"] ##teamcity[testStarted name='FAIL does not require an argument'] -Message.tests.cpp:<line number>|nexplicit failure'] +##teamcity[testFailed name='FAIL does not require an argument' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure'] ##teamcity[testFinished name='FAIL does not require an argument' duration="{duration}"] ##teamcity[testStarted name='FAIL_CHECK does not abort the test'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] +##teamcity[testFailed name='FAIL_CHECK does not abort the test' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] ##teamcity[testFinished name='FAIL_CHECK does not abort the test' duration="{duration}"] ##teamcity[testStarted name='Factorials are computed'] ##teamcity[testFinished name='Factorials are computed' duration="{duration}"] +##teamcity[testStarted name='Filter generator throws exception for empty generator'] +##teamcity[testFinished name='Filter generator throws exception for empty generator' duration="{duration}"] ##teamcity[testStarted name='Floating point matchers: double'] ##teamcity[testFinished name='Floating point matchers: double' duration="{duration}"] ##teamcity[testStarted name='Floating point matchers: float'] @@ -388,21 +396,21 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a fa ##teamcity[testStarted name='INFO and WARN do not abort tests'] ##teamcity[testFinished name='INFO and WARN do not abort tests' duration="{duration}"] ##teamcity[testStarted name='INFO gets logged on failure'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message should be logged"|n "so should this"|n REQUIRE( a == 1 )|nwith expansion:|n 2 == 1|n'] +##teamcity[testFailed name='INFO gets logged on failure' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "this message should be logged"|n "so should this"|n REQUIRE( a == 1 )|nwith expansion:|n 2 == 1|n'] ##teamcity[testFinished name='INFO gets logged on failure' duration="{duration}"] ##teamcity[testStarted name='INFO gets logged on failure, even if captured before successful assertions'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n CHECK( a == 1 )|nwith expansion:|n 2 == 1|n'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n "and this, but later"|n CHECK( a == 0 )|nwith expansion:|n 2 == 0|n'] +##teamcity[testFailed name='INFO gets logged on failure, even if captured before successful assertions' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n CHECK( a == 1 )|nwith expansion:|n 2 == 1|n'] +##teamcity[testFailed name='INFO gets logged on failure, even if captured before successful assertions' message='Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n "and this, but later"|n CHECK( a == 0 )|nwith expansion:|n 2 == 0|n'] ##teamcity[testFinished name='INFO gets logged on failure, even if captured before successful assertions' duration="{duration}"] ##teamcity[testStarted name='INFO is reset for each loop'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "current counter 10"|n "i := 10"|n REQUIRE( i < 10 )|nwith expansion:|n 10 < 10|n'] +##teamcity[testFailed name='INFO is reset for each loop' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "current counter 10"|n "i := 10"|n REQUIRE( i < 10 )|nwith expansion:|n 10 < 10|n'] ##teamcity[testFinished name='INFO is reset for each loop' duration="{duration}"] ##teamcity[testStarted name='Inequality checks that should fail'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven != 7 )|nwith expansion:|n 7 != 7|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one != Approx( 9.1f ) )|nwith expansion:|n 9.1f != Approx( 9.1000003815 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi != Approx( 3.1415926535 ) )|nwith expansion:|n 3.1415926535 != Approx( 3.1415926535 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello != "hello" )|nwith expansion:|n "hello" != "hello"|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() != 5 )|nwith expansion:|n 5 != 5|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven != 7 )|nwith expansion:|n 7 != 7|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one != Approx( 9.1f ) )|nwith expansion:|n 9.1f != Approx( 9.1000003815 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi != Approx( 3.1415926535 ) )|nwith expansion:|n 3.1415926535 != Approx( 3.1415926535 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello != "hello" )|nwith expansion:|n "hello" != "hello"|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() != 5 )|nwith expansion:|n 5 != 5|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Inequality checks that should fail' duration="{duration}"] ##teamcity[testStarted name='Inequality checks that should succeed'] ##teamcity[testFinished name='Inequality checks that should succeed' duration="{duration}"] @@ -419,21 +427,21 @@ Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.si ##teamcity[testStarted name='Matchers can be composed with both && and ||||'] ##teamcity[testFinished name='Matchers can be composed with both && and ||||' duration="{duration}"] ##teamcity[testStarted name='Matchers can be composed with both && and |||| - failing'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) |||| ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )|n'] +##teamcity[testFailed name='Matchers can be composed with both && and |||| - failing' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) |||| ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )|n'] ##teamcity[testFinished name='Matchers can be composed with both && and |||| - failing' duration="{duration}"] ##teamcity[testStarted name='Matchers can be negated (Not) with the ! operator'] ##teamcity[testFinished name='Matchers can be negated (Not) with the ! operator' duration="{duration}"] ##teamcity[testStarted name='Matchers can be negated (Not) with the ! operator - failing'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" not contains: "substring"|n'] +##teamcity[testFailed name='Matchers can be negated (Not) with the ! operator - failing' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" not contains: "substring"|n'] ##teamcity[testFinished name='Matchers can be negated (Not) with the ! operator - failing' duration="{duration}"] ##teamcity[testStarted name='Mayfail test case with nested sections'] -Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Mayfail test case with nested sections' message='-------------------------------------------------------------------------------|nA|n1|n-------------------------------------------------------------------------------|nCondition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Mayfail test case with nested sections' message='-------------------------------------------------------------------------------|nA|n2|n-------------------------------------------------------------------------------|nCondition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Mayfail test case with nested sections' message='-------------------------------------------------------------------------------|nB|n1|n-------------------------------------------------------------------------------|nCondition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Mayfail test case with nested sections' message='-------------------------------------------------------------------------------|nB|n2|n-------------------------------------------------------------------------------|nCondition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Mayfail test case with nested sections' duration="{duration}"] ##teamcity[testStarted name='Mismatching exception messages failing the test'] -Exception.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_WITH( thisThrows(), "should fail" )|nwith expansion:|n "expected exception" equals: "should fail"|n'] +##teamcity[testFailed name='Mismatching exception messages failing the test' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_WITH( thisThrows(), "should fail" )|nwith expansion:|n "expected exception" equals: "should fail"|n'] ##teamcity[testFinished name='Mismatching exception messages failing the test' duration="{duration}"] ##teamcity[testStarted name='Multireporter calls reporters and listeners in correct order'] ##teamcity[testFinished name='Multireporter calls reporters and listeners in correct order' duration="{duration}"] @@ -444,45 +452,45 @@ Exception.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_WITH( thi ##teamcity[testStarted name='Nice descriptive name'] ##teamcity[testFinished name='Nice descriptive name' duration="{duration}"] ##teamcity[testStarted name='Non-std exceptions can be translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception"'] +##teamcity[testFailed name='Non-std exceptions can be translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception"'] ##teamcity[testFinished name='Non-std exceptions can be translated' duration="{duration}"] ##teamcity[testStarted name='Objects that evaluated in boolean contexts can be checked'] ##teamcity[testFinished name='Objects that evaluated in boolean contexts can be checked' duration="{duration}"] ##teamcity[testStarted name='Optionally static assertions'] ##teamcity[testFinished name='Optionally static assertions' duration="{duration}"] ##teamcity[testStarted name='Ordering comparison checks that should fail'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 7 )|nwith expansion:|n 7 > 7|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 7 )|nwith expansion:|n 7 < 7|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 8 )|nwith expansion:|n 7 > 8|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 6 )|nwith expansion:|n 7 < 6|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 0 )|nwith expansion:|n 7 < 0|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < -1 )|nwith expansion:|n 7 < -1|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven >= 8 )|nwith expansion:|n 7 >= 8|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven <= 6 )|nwith expansion:|n 7 <= 6|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one < 9 )|nwith expansion:|n 9.1f < 9|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 10 )|nwith expansion:|n 9.1f > 10|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 9.2 )|nwith expansion:|n 9.1f > 9.2|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hello" )|nwith expansion:|n "hello" > "hello"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hello" )|nwith expansion:|n "hello" < "hello"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hellp" )|nwith expansion:|n "hello" > "hellp"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "z" )|nwith expansion:|n "hello" > "z"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hellm" )|nwith expansion:|n "hello" < "hellm"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "a" )|nwith expansion:|n "hello" < "a"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello >= "z" )|nwith expansion:|n "hello" >= "z"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello <= "a" )|nwith expansion:|n "hello" <= "a"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 7 )|nwith expansion:|n 7 > 7|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 7 )|nwith expansion:|n 7 < 7|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 8 )|nwith expansion:|n 7 > 8|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 6 )|nwith expansion:|n 7 < 6|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 0 )|nwith expansion:|n 7 < 0|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < -1 )|nwith expansion:|n 7 < -1|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven >= 8 )|nwith expansion:|n 7 >= 8|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven <= 6 )|nwith expansion:|n 7 <= 6|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one < 9 )|nwith expansion:|n 9.1f < 9|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 10 )|nwith expansion:|n 9.1f > 10|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 9.2 )|nwith expansion:|n 9.1f > 9.2|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hello" )|nwith expansion:|n "hello" > "hello"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hello" )|nwith expansion:|n "hello" < "hello"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hellp" )|nwith expansion:|n "hello" > "hellp"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "z" )|nwith expansion:|n "hello" > "z"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hellm" )|nwith expansion:|n "hello" < "hellm"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "a" )|nwith expansion:|n "hello" < "a"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello >= "z" )|nwith expansion:|n "hello" >= "z"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello <= "a" )|nwith expansion:|n "hello" <= "a"|n'] ##teamcity[testFinished name='Ordering comparison checks that should fail' duration="{duration}"] ##teamcity[testStarted name='Ordering comparison checks that should succeed'] ##teamcity[testFinished name='Ordering comparison checks that should succeed' duration="{duration}"] ##teamcity[testStarted name='Our PCG implementation provides expected results for known seeds'] ##teamcity[testFinished name='Our PCG implementation provides expected results for known seeds' duration="{duration}"] ##teamcity[testStarted name='Output from all sections is reported'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section one"'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section two"'] +##teamcity[testFailed name='Output from all sections is reported' message='-------------------------------------------------------------------------------|none|n-------------------------------------------------------------------------------|nMessage.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section one"'] +##teamcity[testFailed name='Output from all sections is reported' message='-------------------------------------------------------------------------------|ntwo|n-------------------------------------------------------------------------------|nMessage.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section two"'] ##teamcity[testFinished name='Output from all sections is reported' duration="{duration}"] ##teamcity[testStarted name='Overloaded comma or address-of operators are not used'] ##teamcity[testFinished name='Overloaded comma or address-of operators are not used' duration="{duration}"] -##teamcity[testStarted name='Parse test names and tags'] -##teamcity[testFinished name='Parse test names and tags' duration="{duration}"] +##teamcity[testStarted name='Parse uints'] +##teamcity[testFinished name='Parse uints' duration="{duration}"] ##teamcity[testStarted name='Parsed tags are matched case insensitive'] ##teamcity[testFinished name='Parsed tags are matched case insensitive' duration="{duration}"] ##teamcity[testStarted name='Parsing sharding-related cli flags'] @@ -512,12 +520,12 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from ##teamcity[testStarted name='Range type with sentinel'] ##teamcity[testFinished name='Range type with sentinel' duration="{duration}"] ##teamcity[testStarted name='Reconstruction should be based on stringification: #914'] -Decomposition.tests.cpp:<line number>|nexpression failed|n CHECK( truthy(false) )|nwith expansion:|n Hey, its truthy!|n'] +##teamcity[testFailed name='Reconstruction should be based on stringification: #914' message='Decomposition.tests.cpp:<line number>|n...............................................................................|n|nDecomposition.tests.cpp:<line number>|nexpression failed|n CHECK( truthy(false) )|nwith expansion:|n Hey, its truthy!|n'] ##teamcity[testFinished name='Reconstruction should be based on stringification: #914' duration="{duration}"] ##teamcity[testStarted name='Regex string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this STRING contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this STRING contains |'abc|' as a substring" case sensitively|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this string contains |'abc|' as a" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n'] +##teamcity[testFailed name='Regex string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this STRING contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this STRING contains |'abc|' as a substring" case sensitively|n'] +##teamcity[testFailed name='Regex string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n'] +##teamcity[testFailed name='Regex string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this string contains |'abc|' as a" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n'] ##teamcity[testFinished name='Regex string matcher' duration="{duration}"] ##teamcity[testStarted name='Registering reporter with |'::|' in name fails'] ##teamcity[testFinished name='Registering reporter with |'::|' in name fails' duration="{duration}"] @@ -549,8 +557,8 @@ Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringFor ##teamcity[testStdOut name='Standard output from all sections is reported' out='Message from section one|nMessage from section two|n'] ##teamcity[testFinished name='Standard output from all sections is reported' duration="{duration}"] ##teamcity[testStarted name='StartsWith string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "This String"|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "string" (case insensitive)|n'] +##teamcity[testFailed name='StartsWith string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "This String"|n'] +##teamcity[testFailed name='StartsWith string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "string" (case insensitive)|n'] ##teamcity[testFinished name='StartsWith string matcher' duration="{duration}"] ##teamcity[testStarted name='Static arrays are convertible to string'] ##teamcity[testFinished name='Static arrays are convertible to string' duration="{duration}"] @@ -573,7 +581,7 @@ Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringFor ##teamcity[testStarted name='Stringifying std::chrono::time_point<system_clock>'] ##teamcity[testFinished name='Stringifying std::chrono::time_point<system_clock>' duration="{duration}"] ##teamcity[testStarted name='Tabs and newlines show in output'] -Misc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expansion:|n "if ($b == 10) {|n $a = 20;|n}"|n==|n"if ($b == 10) {|n $a = 20;|n}|n"|n'] +##teamcity[testFailed name='Tabs and newlines show in output' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expansion:|n "if ($b == 10) {|n $a = 20;|n}"|n==|n"if ($b == 10) {|n $a = 20;|n}|n"|n'] ##teamcity[testFinished name='Tabs and newlines show in output' duration="{duration}"] ##teamcity[testStarted name='Tag alias can be registered against tag patterns'] ##teamcity[testFinished name='Tag alias can be registered against tag patterns' duration="{duration}"] @@ -626,10 +634,10 @@ Misc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expan ##teamcity[testStarted name='Testing checked-if'] ##teamcity[testFinished name='Testing checked-if' duration="{duration}"] ##teamcity[testStarted name='Testing checked-if 2'] -Misc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Testing checked-if 2' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Testing checked-if 2' duration="{duration}"] ##teamcity[testStarted name='Testing checked-if 3'] -Misc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Testing checked-if 3' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Testing checked-if 3' duration="{duration}"] ##teamcity[testStarted name='The NO_FAIL macro reports a failure but does not fail the test'] ##teamcity[testFinished name='The NO_FAIL macro reports a failure but does not fail the test' duration="{duration}"] @@ -638,14 +646,16 @@ Misc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as ##teamcity[testStarted name='This test |'should|' fail but doesn|'t'] ##teamcity[testFinished name='This test |'should|' fail but doesn|'t' duration="{duration}"] ##teamcity[testStarted name='Thrown string literals are translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "For some reason someone is throwing a string literal!"'] +##teamcity[testFailed name='Thrown string literals are translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "For some reason someone is throwing a string literal!"'] ##teamcity[testFinished name='Thrown string literals are translated' duration="{duration}"] ##teamcity[testStarted name='Tracker'] ##teamcity[testFinished name='Tracker' duration="{duration}"] ##teamcity[testStarted name='Trim strings'] ##teamcity[testFinished name='Trim strings' duration="{duration}"] +##teamcity[testStarted name='Type conversions of RangeEquals and similar'] +##teamcity[testFinished name='Type conversions of RangeEquals and similar' duration="{duration}"] ##teamcity[testStarted name='Unexpected exceptions can be translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"'] +##teamcity[testFailed name='Unexpected exceptions can be translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"'] ##teamcity[testFinished name='Unexpected exceptions can be translated' duration="{duration}"] ##teamcity[testStarted name='Upcasting special member functions'] ##teamcity[testFinished name='Upcasting special member functions' duration="{duration}"] @@ -661,6 +671,10 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"' ##teamcity[testFinished name='Usage of NoneMatch range matcher' duration="{duration}"] ##teamcity[testStarted name='Usage of NoneTrue range matcher'] ##teamcity[testFinished name='Usage of NoneTrue range matcher' duration="{duration}"] +##teamcity[testStarted name='Usage of RangeEquals range matcher'] +##teamcity[testFinished name='Usage of RangeEquals range matcher' duration="{duration}"] +##teamcity[testStarted name='Usage of UnorderedRangeEquals range matcher'] +##teamcity[testFinished name='Usage of UnorderedRangeEquals range matcher' duration="{duration}"] ##teamcity[testStarted name='Usage of the SizeIs range matcher'] ##teamcity[testFinished name='Usage of the SizeIs range matcher' duration="{duration}"] ##teamcity[testStarted name='Use a custom approx'] @@ -670,41 +684,41 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"' ##teamcity[testStarted name='Vector Approx matcher'] ##teamcity[testFinished name='Vector Approx matcher' duration="{duration}"] ##teamcity[testStarted name='Vector Approx matcher -- failing'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Approx( t1 ) )|nwith expansion:|n { } is approx: { 1.0, 2.0 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v1, Approx( v2 ) )|nwith expansion:|n { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 }|n'] +##teamcity[testFailed name='Vector Approx matcher -- failing' message='-------------------------------------------------------------------------------|nEmpty and non empty vectors are not approx equal|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Approx( t1 ) )|nwith expansion:|n { } is approx: { 1.0, 2.0 }|n'] +##teamcity[testFailed name='Vector Approx matcher -- failing' message='-------------------------------------------------------------------------------|nJust different vectors|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v1, Approx( v2 ) )|nwith expansion:|n { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 }|n'] ##teamcity[testFinished name='Vector Approx matcher -- failing' duration="{duration}"] ##teamcity[testStarted name='Vector matchers'] ##teamcity[testFinished name='Vector matchers' duration="{duration}"] ##teamcity[testStarted name='Vector matchers that fail'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, VectorContains( -1 ) )|nwith expansion:|n { 1, 2, 3 } Contains: -1|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, VectorContains( 1 ) )|nwith expansion:|n { } Contains: 1|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Contains( v ) )|nwith expansion:|n { } Contains: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Contains( v2 ) )|nwith expansion:|n { 1, 2, 3 } Contains: { 1, 2, 4 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals( v2 ) )|nwith expansion:|n { 1, 2, 3 } Equals: { 1, 2 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v2, Equals( v ) )|nwith expansion:|n { 1, 2 } Equals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Equals( v ) )|nwith expansion:|n { } Equals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals( empty ) )|nwith expansion:|n { 1, 2, 3 } Equals: { }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, UnorderedEquals( empty ) )|nwith expansion:|n { 1, 2, 3 } UnorderedEquals: { }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, UnorderedEquals( v ) )|nwith expansion:|n { } UnorderedEquals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 1, 3 } UnorderedEquals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 3, 1 } UnorderedEquals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='-------------------------------------------------------------------------------|nContains (element)|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, VectorContains( -1 ) )|nwith expansion:|n { 1, 2, 3 } Contains: -1|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, VectorContains( 1 ) )|nwith expansion:|n { } Contains: 1|n'] +##teamcity[testFailed name='Vector matchers that fail' message='-------------------------------------------------------------------------------|nContains (vector)|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Contains( v ) )|nwith expansion:|n { } Contains: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Contains( v2 ) )|nwith expansion:|n { 1, 2, 3 } Contains: { 1, 2, 4 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='-------------------------------------------------------------------------------|nEquals|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals( v2 ) )|nwith expansion:|n { 1, 2, 3 } Equals: { 1, 2 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v2, Equals( v ) )|nwith expansion:|n { 1, 2 } Equals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Equals( v ) )|nwith expansion:|n { } Equals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals( empty ) )|nwith expansion:|n { 1, 2, 3 } Equals: { }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='-------------------------------------------------------------------------------|nUnorderedEquals|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, UnorderedEquals( empty ) )|nwith expansion:|n { 1, 2, 3 } UnorderedEquals: { }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, UnorderedEquals( v ) )|nwith expansion:|n { } UnorderedEquals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 1, 3 } UnorderedEquals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 3, 1 } UnorderedEquals: { 1, 2, 3 }|n'] ##teamcity[testFinished name='Vector matchers that fail' duration="{duration}"] ##teamcity[testStarted name='When checked exceptions are thrown they can be expected or unexpected'] ##teamcity[testFinished name='When checked exceptions are thrown they can be expected or unexpected' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown directly they are always failures'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] +##teamcity[testFailed name='When unchecked exceptions are thrown directly they are always failures' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] ##teamcity[testFinished name='When unchecked exceptions are thrown directly they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown during a CHECK the test should continue'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFailed name='When unchecked exceptions are thrown during a CHECK the test should continue' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown during a CHECK the test should continue' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown during a REQUIRE the test should abort fail'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n REQUIRE( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFailed name='When unchecked exceptions are thrown during a REQUIRE the test should abort fail' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n REQUIRE( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown during a REQUIRE the test should abort fail' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown from functions they are always failures'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFailed name='When unchecked exceptions are thrown from functions they are always failures' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown from functions they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown from sections they are always failures'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] +##teamcity[testFailed name='When unchecked exceptions are thrown from sections they are always failures' message='-------------------------------------------------------------------------------|nsection name|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] ##teamcity[testFinished name='When unchecked exceptions are thrown from sections they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown, but caught, they do not affect the test'] ##teamcity[testFinished name='When unchecked exceptions are thrown, but caught, they do not affect the test' duration="{duration}"] @@ -720,6 +734,9 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##teamcity[testFinished name='XmlEncode' duration="{duration}"] ##teamcity[testStarted name='XmlWriter writes boolean attributes as true/false'] ##teamcity[testFinished name='XmlWriter writes boolean attributes as true/false' duration="{duration}"] +##teamcity[testStarted name='a succeeding test can still be skipped'] +##teamcity[testIgnored name='a succeeding test can still be skipped' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='a succeeding test can still be skipped' duration="{duration}"] ##teamcity[testStarted name='analyse no analysis'] ##teamcity[testFinished name='analyse no analysis' duration="{duration}"] ##teamcity[testStarted name='array<int, N> -> toString'] @@ -731,12 +748,12 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##teamcity[testStarted name='checkedElse'] ##teamcity[testFinished name='checkedElse' duration="{duration}"] ##teamcity[testStarted name='checkedElse, failing'] -Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedElse( false ) )|nwith expansion:|n false|n'] +##teamcity[testFailed name='checkedElse, failing' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedElse( false ) )|nwith expansion:|n false|n'] ##teamcity[testFinished name='checkedElse, failing' duration="{duration}"] ##teamcity[testStarted name='checkedIf'] ##teamcity[testFinished name='checkedIf' duration="{duration}"] ##teamcity[testStarted name='checkedIf, failing'] -Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ) )|nwith expansion:|n false|n'] +##teamcity[testFailed name='checkedIf, failing' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ) )|nwith expansion:|n false|n'] ##teamcity[testFinished name='checkedIf, failing' duration="{duration}"] ##teamcity[testStarted name='classify_outliers'] ##teamcity[testFinished name='classify_outliers' duration="{duration}"] @@ -746,6 +763,10 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ##teamcity[testFinished name='comparisons between int variables' duration="{duration}"] ##teamcity[testStarted name='convertToBits'] ##teamcity[testFinished name='convertToBits' duration="{duration}"] +##teamcity[testStarted name='dynamic skipping works with generators'] +##teamcity[testIgnored name='dynamic skipping works with generators' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip with message:|n "skipping because answer = 41"'] +##teamcity[testIgnored name='dynamic skipping works with generators' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip with message:|n "skipping because answer = 43"'] +##teamcity[testFinished name='dynamic skipping works with generators' duration="{duration}"] ##teamcity[testStarted name='empty tags are not allowed'] ##teamcity[testFinished name='empty tags are not allowed' duration="{duration}"] ##teamcity[testStarted name='erfc_inv'] @@ -754,6 +775,20 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ##teamcity[testFinished name='estimate_clock_resolution' duration="{duration}"] ##teamcity[testStarted name='even more nested SECTION tests'] ##teamcity[testFinished name='even more nested SECTION tests' duration="{duration}"] +##teamcity[testStarted name='failed assertions before SKIP cause test case to fail'] +##teamcity[testIgnored name='failed assertions before SKIP cause test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexpression failed|n CHECK( 3 == 4 )|nwith expansion:|n 3 == 4|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='failed assertions before SKIP cause test case to fail' message='Skip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='failed assertions before SKIP cause test case to fail' duration="{duration}"] +##teamcity[testStarted name='failing for some generator values causes entire test case to fail'] +##teamcity[testIgnored name='failing for some generator values causes entire test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='failing for some generator values causes entire test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testIgnored name='failing for some generator values causes entire test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='failing for some generator values causes entire test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='failing for some generator values causes entire test case to fail' duration="{duration}"] +##teamcity[testStarted name='failing in some unskipped sections causes entire test case to fail'] +##teamcity[testIgnored name='failing in some unskipped sections causes entire test case to fail' message='-------------------------------------------------------------------------------|nskipped|n-------------------------------------------------------------------------------|nSkip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testIgnored name='failing in some unskipped sections causes entire test case to fail' message='-------------------------------------------------------------------------------|nnot skipped|n-------------------------------------------------------------------------------|nSkip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='failing in some unskipped sections causes entire test case to fail' duration="{duration}"] ##teamcity[testStarted name='first tag'] ##teamcity[testFinished name='first tag' duration="{duration}"] ##teamcity[testStarted name='has printf'] @@ -762,10 +797,10 @@ loose text artifact ##teamcity[testStarted name='is_unary_function'] ##teamcity[testFinished name='is_unary_function' duration="{duration}"] ##teamcity[testStarted name='just failure'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "Previous info should not be seen"'] +##teamcity[testFailed name='just failure' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "Previous info should not be seen"'] ##teamcity[testFinished name='just failure' duration="{duration}"] ##teamcity[testStarted name='just failure after unscoped info'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "previous unscoped info SHOULD not be seen"'] +##teamcity[testFailed name='just failure after unscoped info' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "previous unscoped info SHOULD not be seen"'] ##teamcity[testFinished name='just failure after unscoped info' duration="{duration}"] ##teamcity[testStarted name='just info'] ##teamcity[testFinished name='just info' duration="{duration}"] @@ -774,16 +809,16 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "previous uns ##teamcity[testStarted name='long long'] ##teamcity[testFinished name='long long' duration="{duration}"] ##teamcity[testStarted name='looped SECTION tests'] -Misc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 0 > 1|n'] -Misc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 1 > 1|n'] +##teamcity[testFailed name='looped SECTION tests' message='-------------------------------------------------------------------------------|nb is currently: 0|n-------------------------------------------------------------------------------|nMisc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 0 > 1|n'] +##teamcity[testFailed name='looped SECTION tests' message='-------------------------------------------------------------------------------|nb is currently: 1|n-------------------------------------------------------------------------------|nMisc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 1 > 1|n'] ##teamcity[testFinished name='looped SECTION tests' duration="{duration}"] ##teamcity[testStarted name='looped tests'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[0|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[1|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[3|] (3) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[4|] (5) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[6|] (13) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[7|] (21) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[0|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[1|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[3|] (3) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[4|] (5) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[6|] (13) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[7|] (21) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] ##teamcity[testFinished name='looped tests' duration="{duration}"] ##teamcity[testStarted name='makeStream recognizes %debug stream name'] ##teamcity[testFinished name='makeStream recognizes %debug stream name' duration="{duration}"] @@ -796,10 +831,14 @@ Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib ##teamcity[testStarted name='mix info, unscoped info and warning'] ##teamcity[testFinished name='mix info, unscoped info and warning' duration="{duration}"] ##teamcity[testStarted name='more nested SECTION tests'] -Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( a == b )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFailed name='more nested SECTION tests' message='-------------------------------------------------------------------------------|ndoesn|'t equal|nequal|n-------------------------------------------------------------------------------|nMisc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n REQUIRE( a == b )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='more nested SECTION tests' duration="{duration}"] ##teamcity[testStarted name='nested SECTION tests'] ##teamcity[testFinished name='nested SECTION tests' duration="{duration}"] +##teamcity[testStarted name='nested sections can be skipped dynamically at runtime'] +##teamcity[testIgnored name='nested sections can be skipped dynamically at runtime' message='-------------------------------------------------------------------------------|nB|nB2|n-------------------------------------------------------------------------------|nSkip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testStdOut name='nested sections can be skipped dynamically at runtime' out='a!|nb1!|n!|n'] +##teamcity[testFinished name='nested sections can be skipped dynamically at runtime' duration="{duration}"] ##teamcity[testStarted name='non streamable - with conv. op'] ##teamcity[testFinished name='non streamable - with conv. op' duration="{duration}"] ##teamcity[testStarted name='non-copyable objects'] @@ -811,7 +850,7 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( a == b )|nwith expan ##teamcity[testStarted name='not allowed'] ##teamcity[testFinished name='not allowed' duration="{duration}"] ##teamcity[testStarted name='not prints unscoped info from previous failures'] -Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='not prints unscoped info from previous failures' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='not prints unscoped info from previous failures' duration="{duration}"] ##teamcity[testStarted name='null strings'] ##teamcity[testFinished name='null strings' duration="{duration}"] @@ -826,10 +865,10 @@ Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD ##teamcity[testStarted name='print unscoped info if passing unscoped info is printed'] ##teamcity[testFinished name='print unscoped info if passing unscoped info is printed' duration="{duration}"] ##teamcity[testStarted name='prints unscoped info on failure'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "this SHOULD be seen"|n "this SHOULD also be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='prints unscoped info on failure' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "this SHOULD be seen"|n "this SHOULD also be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='prints unscoped info on failure' duration="{duration}"] ##teamcity[testStarted name='prints unscoped info only for the first assertion'] -Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen only ONCE"|n CHECK( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='prints unscoped info only for the first assertion' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen only ONCE"|n CHECK( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='prints unscoped info only for the first assertion' duration="{duration}"] ##teamcity[testStarted name='random SECTION tests'] ##teamcity[testFinished name='random SECTION tests' duration="{duration}"] @@ -845,19 +884,25 @@ Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD ##teamcity[testFinished name='run_for_at_least, int' duration="{duration}"] ##teamcity[testStarted name='second tag'] ##teamcity[testFinished name='second tag' duration="{duration}"] +##teamcity[testStarted name='sections can be skipped dynamically at runtime'] +##teamcity[testIgnored name='sections can be skipped dynamically at runtime' message='-------------------------------------------------------------------------------|nskipped|n-------------------------------------------------------------------------------|nSkip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='sections can be skipped dynamically at runtime' duration="{duration}"] ##teamcity[testStarted name='send a single char to INFO'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "3"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='send a single char to INFO' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed with message:|n "3"|n REQUIRE( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='send a single char to INFO' duration="{duration}"] ##teamcity[testStarted name='sends information to INFO'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "hi"|n "i := 7"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='sends information to INFO' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "hi"|n "i := 7"|n REQUIRE( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='sends information to INFO' duration="{duration}"] ##teamcity[testStarted name='shortened hide tags are split apart'] ##teamcity[testFinished name='shortened hide tags are split apart' duration="{duration}"] +##teamcity[testStarted name='skipped tests can optionally provide a reason'] +##teamcity[testIgnored name='skipped tests can optionally provide a reason' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip with message:|n "skipping because answer = 43"'] +##teamcity[testFinished name='skipped tests can optionally provide a reason' duration="{duration}"] ##teamcity[testStarted name='splitString'] ##teamcity[testFinished name='splitString' duration="{duration}"] ##teamcity[testStarted name='stacks unscoped info in loops'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 1 to 3..."|n "1"|n "2"|n "3"|n CHECK( false )|nwith expansion:|n false|n'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to 6..."|n "4"|n "5"|n "6"|n CHECK( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='stacks unscoped info in loops' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "Count 1 to 3..."|n "1"|n "2"|n "3"|n CHECK( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='stacks unscoped info in loops' message='Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to 6..."|n "4"|n "5"|n "6"|n CHECK( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='stacks unscoped info in loops' duration="{duration}"] ##teamcity[testStarted name='startsWith'] ##teamcity[testFinished name='startsWith' duration="{duration}"] @@ -897,8 +942,11 @@ Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to ##teamcity[testFinished name='tables' duration="{duration}"] ##teamcity[testStarted name='tags with dots in later positions are not parsed as hidden'] ##teamcity[testFinished name='tags with dots in later positions are not parsed as hidden' duration="{duration}"] +##teamcity[testStarted name='tests can be skipped dynamically at runtime'] +##teamcity[testIgnored name='tests can be skipped dynamically at runtime' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='tests can be skipped dynamically at runtime' duration="{duration}"] ##teamcity[testStarted name='thrown std::strings are translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "Why would you throw a std::string?"'] +##teamcity[testFailed name='thrown std::strings are translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "Why would you throw a std::string?"'] ##teamcity[testFinished name='thrown std::strings are translated' duration="{duration}"] ##teamcity[testStarted name='toString on const wchar_t const pointer returns the string contents'] ##teamcity[testFinished name='toString on const wchar_t const pointer returns the string contents' duration="{duration}"] diff --git a/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index 2b7914464be15e51fa64e35f56d695364bd3e772..861d64715b55a33c980cc2d135d069dcf9ad5459 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -18,7 +18,7 @@ ##teamcity[testStarted name='#1455 - INFO and WARN can start with a linebreak'] ##teamcity[testFinished name='#1455 - INFO and WARN can start with a linebreak' duration="{duration}"] ##teamcity[testStarted name='#1514: stderr/stdout is not captured in tests aborted by an exception'] -Tricky.tests.cpp:<line number>|nexplicit failure with message:|n "1514"'] +##teamcity[testFailed name='#1514: stderr/stdout is not captured in tests aborted by an exception' message='Tricky.tests.cpp:<line number>|n...............................................................................|n|nTricky.tests.cpp:<line number>|nexplicit failure with message:|n "1514"'] ##teamcity[testStdOut name='#1514: stderr/stdout is not captured in tests aborted by an exception' out='This would not be caught previously|n'] ##teamcity[testStdErr name='#1514: stderr/stdout is not captured in tests aborted by an exception' out='Nor would this|n'] ##teamcity[testFinished name='#1514: stderr/stdout is not captured in tests aborted by an exception' duration="{duration}"] @@ -52,30 +52,33 @@ Tricky.tests.cpp:<line number>|nexplicit failure with message:|n "1514"'] ##teamcity[testFinished name='#2152 - ULP checks between differently signed values were wrong - double' duration="{duration}"] ##teamcity[testStarted name='#2152 - ULP checks between differently signed values were wrong - float'] ##teamcity[testFinished name='#2152 - ULP checks between differently signed values were wrong - float' duration="{duration}"] +##teamcity[testStarted name='#2615 - Throwing in constructor generator fails test case but does not abort'] +##teamcity[testIgnored name='#2615 - Throwing in constructor generator fails test case but does not abort' message='Generators.tests.cpp:<line number>|n...............................................................................|n|nGenerators.tests.cpp:<line number>|nunexpected exception with message:|n "failure to init"- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='#2615 - Throwing in constructor generator fails test case but does not abort' duration="{duration}"] ##teamcity[testStarted name='#748 - captures with unexpected exceptions'] -Exception.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"- failure ignore as test marked as |'ok to fail|'|n'] -Exception.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|noutside assertions|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#748 - captures with unexpected exceptions' message='-------------------------------------------------------------------------------|ninside REQUIRE_NOTHROW|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='#748 - captures with unexpected exceptions' duration="{duration}"] ##teamcity[testStarted name='#809'] ##teamcity[testFinished name='#809' duration="{duration}"] ##teamcity[testStarted name='#833'] ##teamcity[testFinished name='#833' duration="{duration}"] ##teamcity[testStarted name='#835 -- errno should not be touched by Catch2'] -Misc.tests.cpp:<line number>|nexpression failed|n CHECK( f() == 0 )|nwith expansion:|n 1 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='#835 -- errno should not be touched by Catch2' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n CHECK( f() == 0 )|nwith expansion:|n 1 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='#835 -- errno should not be touched by Catch2' duration="{duration}"] ##teamcity[testStarted name='#872'] ##teamcity[testFinished name='#872' duration="{duration}"] ##teamcity[testStarted name='#961 -- Dynamically created sections should all be reported'] ##teamcity[testFinished name='#961 -- Dynamically created sections should all be reported' duration="{duration}"] ##teamcity[testStarted name='|'Not|' checks that should fail'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( false != false )|nwith expansion:|n false != false|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( true != true )|nwith expansion:|n true != true|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !true )|nwith expansion:|n false|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( true )|nwith expansion:|n !true|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !trueValue )|nwith expansion:|n false|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( trueValue )|nwith expansion:|n !true|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !(1 == 1) )|nwith expansion:|n false|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( 1 == 1 )|nwith expansion:|n !(1 == 1)|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexpression failed|n CHECK( false != false )|nwith expansion:|n false != false|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( true != true )|nwith expansion:|n true != true|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !true )|nwith expansion:|n false|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( true )|nwith expansion:|n !true|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !trueValue )|nwith expansion:|n false|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( trueValue )|nwith expansion:|n !true|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !(1 == 1) )|nwith expansion:|n false|n'] +##teamcity[testFailed name='|'Not|' checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( 1 == 1 )|nwith expansion:|n !(1 == 1)|n'] ##teamcity[testFinished name='|'Not|' checks that should fail' duration="{duration}"] ##teamcity[testStarted name='|'Not|' checks that should succeed'] ##teamcity[testFinished name='|'Not|' checks that should succeed' duration="{duration}"] @@ -84,21 +87,21 @@ Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( 1 == 1 )|nw ##teamcity[testStarted name='3x3x3 ints'] ##teamcity[testFinished name='3x3x3 ints' duration="{duration}"] ##teamcity[testStarted name='A METHOD_AS_TEST_CASE based test run that fails'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( s == "world" )|nwith expansion:|n "hello" == "world"|n'] +##teamcity[testFailed name='A METHOD_AS_TEST_CASE based test run that fails' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( s == "world" )|nwith expansion:|n "hello" == "world"|n'] ##teamcity[testFinished name='A METHOD_AS_TEST_CASE based test run that fails' duration="{duration}"] ##teamcity[testStarted name='A METHOD_AS_TEST_CASE based test run that succeeds'] ##teamcity[testFinished name='A METHOD_AS_TEST_CASE based test run that succeeds' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>' duration="{duration}"] @@ -109,16 +112,16 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2< ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] +##teamcity[testFailed name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>' duration="{duration}"] @@ -129,13 +132,13 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2< ##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>'] ##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - double'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0 == 2|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - double' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0 == 2|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - double' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - float'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0f == 2|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - float' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0f == 2|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - float' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - int'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - int' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - int' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double' duration="{duration}"] @@ -144,13 +147,13 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<Te ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 1 == 0|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 3 == 0|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 3 == 0|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 6 == 0|n'] +##teamcity[testFailed name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 6 == 0|n'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6' duration="{duration}"] ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1' duration="{duration}"] @@ -159,7 +162,7 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::va ##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6'] ##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that fails'] -Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFailed name='A TEST_CASE_METHOD based test run that fails' message='Class.tests.cpp:<line number>|n...............................................................................|n|nClass.tests.cpp:<line number>|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that fails' duration="{duration}"] ##teamcity[testStarted name='A TEST_CASE_METHOD based test run that succeeds'] ##teamcity[testFinished name='A TEST_CASE_METHOD based test run that succeeds' duration="{duration}"] @@ -182,11 +185,11 @@ Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( m_a == 2 )|nwith ex ##teamcity[testStarted name='A comparison that uses literals instead of the normal constructor'] ##teamcity[testFinished name='A comparison that uses literals instead of the normal constructor' duration="{duration}"] ##teamcity[testStarted name='A couple of nested sections followed by a failure'] -Misc.tests.cpp:<line number>|nexplicit failure with message:|n "to infinity and beyond"'] +##teamcity[testFailed name='A couple of nested sections followed by a failure' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexplicit failure with message:|n "to infinity and beyond"'] ##teamcity[testFinished name='A couple of nested sections followed by a failure' duration="{duration}"] ##teamcity[testStarted name='A failing expression with a non streamable type is still captured'] -Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( &o1 == &o2 )|nwith expansion:|n 0x<hex digits> == 0x<hex digits>|n'] -Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( o1 == o2 )|nwith expansion:|n {?} == {?}|n'] +##teamcity[testFailed name='A failing expression with a non streamable type is still captured' message='Tricky.tests.cpp:<line number>|n...............................................................................|n|nTricky.tests.cpp:<line number>|nexpression failed|n CHECK( &o1 == &o2 )|nwith expansion:|n 0x<hex digits> == 0x<hex digits>|n'] +##teamcity[testFailed name='A failing expression with a non streamable type is still captured' message='Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( o1 == o2 )|nwith expansion:|n {?} == {?}|n'] ##teamcity[testFinished name='A failing expression with a non streamable type is still captured' duration="{duration}"] ##teamcity[testStarted name='Absolute margin'] ##teamcity[testFinished name='Absolute margin' duration="{duration}"] @@ -195,7 +198,7 @@ Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( o1 == o2 )|nwith exp ##teamcity[testStarted name='An expression with side-effects should only be evaluated once'] ##teamcity[testFinished name='An expression with side-effects should only be evaluated once' duration="{duration}"] ##teamcity[testStarted name='An unchecked exception reports the line of the last assertion'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n'] +##teamcity[testFailed name='An unchecked exception reports the line of the last assertion' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n'] ##teamcity[testFinished name='An unchecked exception reports the line of the last assertion' duration="{duration}"] ##teamcity[testStarted name='Anonymous test case 1'] ##teamcity[testFinished name='Anonymous test case 1' duration="{duration}"] @@ -276,33 +279,34 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##teamcity[testStarted name='Composed matchers shortcircuit'] ##teamcity[testFinished name='Composed matchers shortcircuit' duration="{duration}"] ##teamcity[testStarted name='Contains string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "not there" (case insensitive)|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "STRING"|n'] +##teamcity[testFailed name='Contains string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "not there", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "not there" (case insensitive)|n'] +##teamcity[testFailed name='Contains string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ContainsSubstring( "STRING" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "STRING"|n'] ##teamcity[testFinished name='Contains string matcher' duration="{duration}"] ##teamcity[testStarted name='Copy and then generate a range'] ##teamcity[testFinished name='Copy and then generate a range' duration="{duration}"] ##teamcity[testStarted name='Cout stream properly declares it writes to stdout'] ##teamcity[testFinished name='Cout stream properly declares it writes to stdout' duration="{duration}"] ##teamcity[testStarted name='Custom exceptions can be translated when testing for nothrow'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_NOTHROW( throwCustom() )|nwith expansion:|n throwCustom()|n'] +##teamcity[testFailed name='Custom exceptions can be translated when testing for nothrow' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_NOTHROW( throwCustom() )|nwith expansion:|n throwCustom()|n'] ##teamcity[testFinished name='Custom exceptions can be translated when testing for nothrow' duration="{duration}"] ##teamcity[testStarted name='Custom exceptions can be translated when testing for throwing as something else'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_THROWS_AS( throwCustom(), std::exception )|nwith expansion:|n throwCustom(), std::exception|n'] +##teamcity[testFailed name='Custom exceptions can be translated when testing for throwing as something else' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_THROWS_AS( throwCustom(), std::exception )|nwith expansion:|n throwCustom(), std::exception|n'] ##teamcity[testFinished name='Custom exceptions can be translated when testing for throwing as something else' duration="{duration}"] ##teamcity[testStarted name='Custom std-exceptions can be custom translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom std exception"'] +##teamcity[testFailed name='Custom std-exceptions can be custom translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "custom std exception"'] ##teamcity[testFinished name='Custom std-exceptions can be custom translated' duration="{duration}"] ##teamcity[testStarted name='Default scale is invisible to comparison'] ##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"] ##teamcity[testStarted name='Directly creating an EnumInfo'] ##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"] +##teamcity[testStarted name='Empty generators can SKIP in constructor'] +##teamcity[testIgnored name='Empty generators can SKIP in constructor' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip with message:|n "This generator is empty"'] +##teamcity[testFinished name='Empty generators can SKIP in constructor' duration="{duration}"] ##teamcity[testStarted name='Empty stream name opens cout stream'] ##teamcity[testFinished name='Empty stream name opens cout stream' duration="{duration}"] -##teamcity[testStarted name='Empty tag is not allowed'] -##teamcity[testFinished name='Empty tag is not allowed' duration="{duration}"] ##teamcity[testStarted name='EndsWith string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n'] +##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n'] +##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n'] ##teamcity[testFinished name='EndsWith string matcher' duration="{duration}"] ##teamcity[testStarted name='Enums can quickly have stringification enabled using REGISTER_ENUM'] ##teamcity[testFinished name='Enums can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"] @@ -311,60 +315,64 @@ Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringFor ##teamcity[testStarted name='Epsilon only applies to Approx|'s value'] ##teamcity[testFinished name='Epsilon only applies to Approx|'s value' duration="{duration}"] ##teamcity[testStarted name='Equality checks that should fail'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 6 )|nwith expansion:|n 7 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 8 )|nwith expansion:|n 7 == 8|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 0 )|nwith expansion:|n 7 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.11f ) )|nwith expansion:|n 9.1f == Approx( 9.1099996567 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.0f ) )|nwith expansion:|n 9.1f == Approx( 9.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 1 ) )|nwith expansion:|n 9.1f == Approx( 1.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 0 ) )|nwith expansion:|n 9.1f == Approx( 0.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi == Approx( 3.1415 ) )|nwith expansion:|n 3.1415926535 == Approx( 3.1415 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "goodbye" )|nwith expansion:|n "hello" == "goodbye"|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hell" )|nwith expansion:|n "hello" == "hell"|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hello1" )|nwith expansion:|n "hello" == "hello1"|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() == 6 )|nwith expansion:|n 5 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( x == Approx( 1.301 ) )|nwith expansion:|n 1.3 == Approx( 1.301 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 6 )|nwith expansion:|n 7 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 8 )|nwith expansion:|n 7 == 8|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 0 )|nwith expansion:|n 7 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.11f ) )|nwith expansion:|n 9.1f == Approx( 9.1099996567 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.0f ) )|nwith expansion:|n 9.1f == Approx( 9.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 1 ) )|nwith expansion:|n 9.1f == Approx( 1.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 0 ) )|nwith expansion:|n 9.1f == Approx( 0.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi == Approx( 3.1415 ) )|nwith expansion:|n 3.1415926535 == Approx( 3.1415 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "goodbye" )|nwith expansion:|n "hello" == "goodbye"|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hell" )|nwith expansion:|n "hello" == "hell"|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hello1" )|nwith expansion:|n "hello" == "hello1"|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() == 6 )|nwith expansion:|n 5 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Equality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( x == Approx( 1.301 ) )|nwith expansion:|n 1.3 == Approx( 1.301 )|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Equality checks that should fail' duration="{duration}"] ##teamcity[testStarted name='Equality checks that should succeed'] ##teamcity[testFinished name='Equality checks that should succeed' duration="{duration}"] ##teamcity[testStarted name='Equals'] ##teamcity[testFinished name='Equals' duration="{duration}"] ##teamcity[testStarted name='Equals string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "this string contains |'ABC|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "this string contains |'ABC|' as a substring"|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "something else" (case insensitive)|n'] +##teamcity[testFailed name='Equals string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "this string contains |'ABC|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "this string contains |'ABC|' as a substring"|n'] +##teamcity[testFailed name='Equals string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals( "something else", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "something else" (case insensitive)|n'] ##teamcity[testFinished name='Equals string matcher' duration="{duration}"] ##teamcity[testStarted name='Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified'] ##teamcity[testFinished name='Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified' duration="{duration}"] ##teamcity[testStarted name='Exception matchers that fail'] -Matchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] -Matchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] -Matchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] -Matchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] +##teamcity[testFailed name='Exception matchers that fail' message='-------------------------------------------------------------------------------|nNo exception|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] +##teamcity[testFailed name='Exception matchers that fail' message='Matchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{ 1 }|n'] +##teamcity[testFailed name='Exception matchers that fail' message='-------------------------------------------------------------------------------|nType mismatch|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n CHECK_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] +##teamcity[testFailed name='Exception matchers that fail' message='Matchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n REQUIRE_THROWS_MATCHES( throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n throwsAsInt( 1 ), SpecialException, ExceptionMatcher{ 1 }|n'] +##teamcity[testFailed name='Exception matchers that fail' message='-------------------------------------------------------------------------------|nContents are wrong|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THROWS_MATCHES( throwsSpecialException( 3 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] +##teamcity[testFailed name='Exception matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_MATCHES( throwsSpecialException( 4 ), SpecialException, ExceptionMatcher{ 1 } )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] ##teamcity[testFinished name='Exception matchers that fail' duration="{duration}"] ##teamcity[testStarted name='Exception matchers that succeed'] ##teamcity[testFinished name='Exception matchers that succeed' duration="{duration}"] +##teamcity[testStarted name='Exception message can be matched'] +##teamcity[testFinished name='Exception message can be matched' duration="{duration}"] ##teamcity[testStarted name='Exception messages can be tested for'] ##teamcity[testFinished name='Exception messages can be tested for' duration="{duration}"] ##teamcity[testStarted name='Exceptions matchers'] ##teamcity[testFinished name='Exceptions matchers' duration="{duration}"] ##teamcity[testStarted name='Expected exceptions that don|'t throw or unexpected exceptions fail the test'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_THROWS_AS( thisThrows(), std::string )|nwith expansion:|n thisThrows(), std::string|n'] -Exception.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error )|nwith expansion:|n thisDoesntThrow(), std::domain_error|n'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n'] +##teamcity[testFailed name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_THROWS_AS( thisThrows(), std::string )|nwith expansion:|n thisThrows(), std::string|n'] +##teamcity[testFailed name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' message='Exception.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error )|nwith expansion:|n thisDoesntThrow(), std::domain_error|n'] +##teamcity[testFailed name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' message='Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n'] ##teamcity[testFinished name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' duration="{duration}"] ##teamcity[testStarted name='FAIL aborts the test'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] +##teamcity[testFailed name='FAIL aborts the test' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] ##teamcity[testFinished name='FAIL aborts the test' duration="{duration}"] ##teamcity[testStarted name='FAIL does not require an argument'] -Message.tests.cpp:<line number>|nexplicit failure'] +##teamcity[testFailed name='FAIL does not require an argument' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure'] ##teamcity[testFinished name='FAIL does not require an argument' duration="{duration}"] ##teamcity[testStarted name='FAIL_CHECK does not abort the test'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] +##teamcity[testFailed name='FAIL_CHECK does not abort the test' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] ##teamcity[testFinished name='FAIL_CHECK does not abort the test' duration="{duration}"] ##teamcity[testStarted name='Factorials are computed'] ##teamcity[testFinished name='Factorials are computed' duration="{duration}"] +##teamcity[testStarted name='Filter generator throws exception for empty generator'] +##teamcity[testFinished name='Filter generator throws exception for empty generator' duration="{duration}"] ##teamcity[testStarted name='Floating point matchers: double'] ##teamcity[testFinished name='Floating point matchers: double' duration="{duration}"] ##teamcity[testStarted name='Floating point matchers: float'] @@ -388,21 +396,21 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a fa ##teamcity[testStarted name='INFO and WARN do not abort tests'] ##teamcity[testFinished name='INFO and WARN do not abort tests' duration="{duration}"] ##teamcity[testStarted name='INFO gets logged on failure'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message should be logged"|n "so should this"|n REQUIRE( a == 1 )|nwith expansion:|n 2 == 1|n'] +##teamcity[testFailed name='INFO gets logged on failure' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "this message should be logged"|n "so should this"|n REQUIRE( a == 1 )|nwith expansion:|n 2 == 1|n'] ##teamcity[testFinished name='INFO gets logged on failure' duration="{duration}"] ##teamcity[testStarted name='INFO gets logged on failure, even if captured before successful assertions'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n CHECK( a == 1 )|nwith expansion:|n 2 == 1|n'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n "and this, but later"|n CHECK( a == 0 )|nwith expansion:|n 2 == 0|n'] +##teamcity[testFailed name='INFO gets logged on failure, even if captured before successful assertions' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n CHECK( a == 1 )|nwith expansion:|n 2 == 1|n'] +##teamcity[testFailed name='INFO gets logged on failure, even if captured before successful assertions' message='Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n "and this, but later"|n CHECK( a == 0 )|nwith expansion:|n 2 == 0|n'] ##teamcity[testFinished name='INFO gets logged on failure, even if captured before successful assertions' duration="{duration}"] ##teamcity[testStarted name='INFO is reset for each loop'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "current counter 10"|n "i := 10"|n REQUIRE( i < 10 )|nwith expansion:|n 10 < 10|n'] +##teamcity[testFailed name='INFO is reset for each loop' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "current counter 10"|n "i := 10"|n REQUIRE( i < 10 )|nwith expansion:|n 10 < 10|n'] ##teamcity[testFinished name='INFO is reset for each loop' duration="{duration}"] ##teamcity[testStarted name='Inequality checks that should fail'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven != 7 )|nwith expansion:|n 7 != 7|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one != Approx( 9.1f ) )|nwith expansion:|n 9.1f != Approx( 9.1000003815 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi != Approx( 3.1415926535 ) )|nwith expansion:|n 3.1415926535 != Approx( 3.1415926535 )|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello != "hello" )|nwith expansion:|n "hello" != "hello"|n- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() != 5 )|nwith expansion:|n 5 != 5|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven != 7 )|nwith expansion:|n 7 != 7|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one != Approx( 9.1f ) )|nwith expansion:|n 9.1f != Approx( 9.1000003815 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi != Approx( 3.1415926535 ) )|nwith expansion:|n 3.1415926535 != Approx( 3.1415926535 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello != "hello" )|nwith expansion:|n "hello" != "hello"|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Inequality checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() != 5 )|nwith expansion:|n 5 != 5|n- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Inequality checks that should fail' duration="{duration}"] ##teamcity[testStarted name='Inequality checks that should succeed'] ##teamcity[testFinished name='Inequality checks that should succeed' duration="{duration}"] @@ -419,21 +427,21 @@ Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.si ##teamcity[testStarted name='Matchers can be composed with both && and ||||'] ##teamcity[testFinished name='Matchers can be composed with both && and ||||' duration="{duration}"] ##teamcity[testStarted name='Matchers can be composed with both && and |||| - failing'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) |||| ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )|n'] +##teamcity[testFailed name='Matchers can be composed with both && and |||| - failing' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), ( ContainsSubstring( "string" ) |||| ContainsSubstring( "different" ) ) && ContainsSubstring( "random" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )|n'] ##teamcity[testFinished name='Matchers can be composed with both && and |||| - failing' duration="{duration}"] ##teamcity[testStarted name='Matchers can be negated (Not) with the ! operator'] ##teamcity[testFinished name='Matchers can be negated (Not) with the ! operator' duration="{duration}"] ##teamcity[testStarted name='Matchers can be negated (Not) with the ! operator - failing'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" not contains: "substring"|n'] +##teamcity[testFailed name='Matchers can be negated (Not) with the ! operator - failing' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), !ContainsSubstring( "substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" not contains: "substring"|n'] ##teamcity[testFinished name='Matchers can be negated (Not) with the ! operator - failing' duration="{duration}"] ##teamcity[testStarted name='Mayfail test case with nested sections'] -Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] -Condition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Mayfail test case with nested sections' message='-------------------------------------------------------------------------------|nA|n1|n-------------------------------------------------------------------------------|nCondition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Mayfail test case with nested sections' message='-------------------------------------------------------------------------------|nA|n2|n-------------------------------------------------------------------------------|nCondition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Mayfail test case with nested sections' message='-------------------------------------------------------------------------------|nB|n1|n-------------------------------------------------------------------------------|nCondition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Mayfail test case with nested sections' message='-------------------------------------------------------------------------------|nB|n2|n-------------------------------------------------------------------------------|nCondition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Mayfail test case with nested sections' duration="{duration}"] ##teamcity[testStarted name='Mismatching exception messages failing the test'] -Exception.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_WITH( thisThrows(), "should fail" )|nwith expansion:|n "expected exception" equals: "should fail"|n'] +##teamcity[testFailed name='Mismatching exception messages failing the test' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_WITH( thisThrows(), "should fail" )|nwith expansion:|n "expected exception" equals: "should fail"|n'] ##teamcity[testFinished name='Mismatching exception messages failing the test' duration="{duration}"] ##teamcity[testStarted name='Multireporter calls reporters and listeners in correct order'] ##teamcity[testFinished name='Multireporter calls reporters and listeners in correct order' duration="{duration}"] @@ -444,45 +452,45 @@ Exception.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_WITH( thi ##teamcity[testStarted name='Nice descriptive name'] ##teamcity[testFinished name='Nice descriptive name' duration="{duration}"] ##teamcity[testStarted name='Non-std exceptions can be translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception"'] +##teamcity[testFailed name='Non-std exceptions can be translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception"'] ##teamcity[testFinished name='Non-std exceptions can be translated' duration="{duration}"] ##teamcity[testStarted name='Objects that evaluated in boolean contexts can be checked'] ##teamcity[testFinished name='Objects that evaluated in boolean contexts can be checked' duration="{duration}"] ##teamcity[testStarted name='Optionally static assertions'] ##teamcity[testFinished name='Optionally static assertions' duration="{duration}"] ##teamcity[testStarted name='Ordering comparison checks that should fail'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 7 )|nwith expansion:|n 7 > 7|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 7 )|nwith expansion:|n 7 < 7|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 8 )|nwith expansion:|n 7 > 8|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 6 )|nwith expansion:|n 7 < 6|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 0 )|nwith expansion:|n 7 < 0|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < -1 )|nwith expansion:|n 7 < -1|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven >= 8 )|nwith expansion:|n 7 >= 8|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven <= 6 )|nwith expansion:|n 7 <= 6|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one < 9 )|nwith expansion:|n 9.1f < 9|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 10 )|nwith expansion:|n 9.1f > 10|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 9.2 )|nwith expansion:|n 9.1f > 9.2|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hello" )|nwith expansion:|n "hello" > "hello"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hello" )|nwith expansion:|n "hello" < "hello"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hellp" )|nwith expansion:|n "hello" > "hellp"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "z" )|nwith expansion:|n "hello" > "z"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hellm" )|nwith expansion:|n "hello" < "hellm"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "a" )|nwith expansion:|n "hello" < "a"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello >= "z" )|nwith expansion:|n "hello" >= "z"|n'] -Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello <= "a" )|nwith expansion:|n "hello" <= "a"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|n...............................................................................|n|nCondition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 7 )|nwith expansion:|n 7 > 7|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 7 )|nwith expansion:|n 7 < 7|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 8 )|nwith expansion:|n 7 > 8|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 6 )|nwith expansion:|n 7 < 6|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 0 )|nwith expansion:|n 7 < 0|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < -1 )|nwith expansion:|n 7 < -1|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven >= 8 )|nwith expansion:|n 7 >= 8|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven <= 6 )|nwith expansion:|n 7 <= 6|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one < 9 )|nwith expansion:|n 9.1f < 9|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 10 )|nwith expansion:|n 9.1f > 10|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 9.2 )|nwith expansion:|n 9.1f > 9.2|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hello" )|nwith expansion:|n "hello" > "hello"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hello" )|nwith expansion:|n "hello" < "hello"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hellp" )|nwith expansion:|n "hello" > "hellp"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "z" )|nwith expansion:|n "hello" > "z"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hellm" )|nwith expansion:|n "hello" < "hellm"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "a" )|nwith expansion:|n "hello" < "a"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello >= "z" )|nwith expansion:|n "hello" >= "z"|n'] +##teamcity[testFailed name='Ordering comparison checks that should fail' message='Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello <= "a" )|nwith expansion:|n "hello" <= "a"|n'] ##teamcity[testFinished name='Ordering comparison checks that should fail' duration="{duration}"] ##teamcity[testStarted name='Ordering comparison checks that should succeed'] ##teamcity[testFinished name='Ordering comparison checks that should succeed' duration="{duration}"] ##teamcity[testStarted name='Our PCG implementation provides expected results for known seeds'] ##teamcity[testFinished name='Our PCG implementation provides expected results for known seeds' duration="{duration}"] ##teamcity[testStarted name='Output from all sections is reported'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section one"'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section two"'] +##teamcity[testFailed name='Output from all sections is reported' message='-------------------------------------------------------------------------------|none|n-------------------------------------------------------------------------------|nMessage.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section one"'] +##teamcity[testFailed name='Output from all sections is reported' message='-------------------------------------------------------------------------------|ntwo|n-------------------------------------------------------------------------------|nMessage.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section two"'] ##teamcity[testFinished name='Output from all sections is reported' duration="{duration}"] ##teamcity[testStarted name='Overloaded comma or address-of operators are not used'] ##teamcity[testFinished name='Overloaded comma or address-of operators are not used' duration="{duration}"] -##teamcity[testStarted name='Parse test names and tags'] -##teamcity[testFinished name='Parse test names and tags' duration="{duration}"] +##teamcity[testStarted name='Parse uints'] +##teamcity[testFinished name='Parse uints' duration="{duration}"] ##teamcity[testStarted name='Parsed tags are matched case insensitive'] ##teamcity[testFinished name='Parsed tags are matched case insensitive' duration="{duration}"] ##teamcity[testStarted name='Parsing sharding-related cli flags'] @@ -512,12 +520,12 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from ##teamcity[testStarted name='Range type with sentinel'] ##teamcity[testFinished name='Range type with sentinel' duration="{duration}"] ##teamcity[testStarted name='Reconstruction should be based on stringification: #914'] -Decomposition.tests.cpp:<line number>|nexpression failed|n CHECK( truthy(false) )|nwith expansion:|n Hey, its truthy!|n'] +##teamcity[testFailed name='Reconstruction should be based on stringification: #914' message='Decomposition.tests.cpp:<line number>|n...............................................................................|n|nDecomposition.tests.cpp:<line number>|nexpression failed|n CHECK( truthy(false) )|nwith expansion:|n Hey, its truthy!|n'] ##teamcity[testFinished name='Reconstruction should be based on stringification: #914' duration="{duration}"] ##teamcity[testStarted name='Regex string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this STRING contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this STRING contains |'abc|' as a substring" case sensitively|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this string contains |'abc|' as a" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n'] +##teamcity[testFailed name='Regex string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this STRING contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this STRING contains |'abc|' as a substring" case sensitively|n'] +##teamcity[testFailed name='Regex string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "contains |'abc|' as a substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n'] +##teamcity[testFailed name='Regex string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches( "this string contains |'abc|' as a" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n'] ##teamcity[testFinished name='Regex string matcher' duration="{duration}"] ##teamcity[testStarted name='Registering reporter with |'::|' in name fails'] ##teamcity[testFinished name='Registering reporter with |'::|' in name fails' duration="{duration}"] @@ -549,8 +557,8 @@ Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringFor ##teamcity[testStdOut name='Standard output from all sections is reported' out='Message from section one|nMessage from section two|n'] ##teamcity[testFinished name='Standard output from all sections is reported' duration="{duration}"] ##teamcity[testStarted name='StartsWith string matcher'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "This String"|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "string" (case insensitive)|n'] +##teamcity[testFailed name='StartsWith string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "This String" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "This String"|n'] +##teamcity[testFailed name='StartsWith string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith( "string", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "string" (case insensitive)|n'] ##teamcity[testFinished name='StartsWith string matcher' duration="{duration}"] ##teamcity[testStarted name='Static arrays are convertible to string'] ##teamcity[testFinished name='Static arrays are convertible to string' duration="{duration}"] @@ -573,7 +581,7 @@ Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringFor ##teamcity[testStarted name='Stringifying std::chrono::time_point<system_clock>'] ##teamcity[testFinished name='Stringifying std::chrono::time_point<system_clock>' duration="{duration}"] ##teamcity[testStarted name='Tabs and newlines show in output'] -Misc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expansion:|n "if ($b == 10) {|n $a = 20;|n}"|n==|n"if ($b == 10) {|n $a = 20;|n}|n"|n'] +##teamcity[testFailed name='Tabs and newlines show in output' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expansion:|n "if ($b == 10) {|n $a = 20;|n}"|n==|n"if ($b == 10) {|n $a = 20;|n}|n"|n'] ##teamcity[testFinished name='Tabs and newlines show in output' duration="{duration}"] ##teamcity[testStarted name='Tag alias can be registered against tag patterns'] ##teamcity[testFinished name='Tag alias can be registered against tag patterns' duration="{duration}"] @@ -626,10 +634,10 @@ Misc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expan ##teamcity[testStarted name='Testing checked-if'] ##teamcity[testFinished name='Testing checked-if' duration="{duration}"] ##teamcity[testStarted name='Testing checked-if 2'] -Misc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Testing checked-if 2' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Testing checked-if 2' duration="{duration}"] ##teamcity[testStarted name='Testing checked-if 3'] -Misc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='Testing checked-if 3' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] ##teamcity[testFinished name='Testing checked-if 3' duration="{duration}"] ##teamcity[testStarted name='The NO_FAIL macro reports a failure but does not fail the test'] ##teamcity[testFinished name='The NO_FAIL macro reports a failure but does not fail the test' duration="{duration}"] @@ -638,14 +646,16 @@ Misc.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as ##teamcity[testStarted name='This test |'should|' fail but doesn|'t'] ##teamcity[testFinished name='This test |'should|' fail but doesn|'t' duration="{duration}"] ##teamcity[testStarted name='Thrown string literals are translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "For some reason someone is throwing a string literal!"'] +##teamcity[testFailed name='Thrown string literals are translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "For some reason someone is throwing a string literal!"'] ##teamcity[testFinished name='Thrown string literals are translated' duration="{duration}"] ##teamcity[testStarted name='Tracker'] ##teamcity[testFinished name='Tracker' duration="{duration}"] ##teamcity[testStarted name='Trim strings'] ##teamcity[testFinished name='Trim strings' duration="{duration}"] +##teamcity[testStarted name='Type conversions of RangeEquals and similar'] +##teamcity[testFinished name='Type conversions of RangeEquals and similar' duration="{duration}"] ##teamcity[testStarted name='Unexpected exceptions can be translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"'] +##teamcity[testFailed name='Unexpected exceptions can be translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"'] ##teamcity[testFinished name='Unexpected exceptions can be translated' duration="{duration}"] ##teamcity[testStarted name='Upcasting special member functions'] ##teamcity[testFinished name='Upcasting special member functions' duration="{duration}"] @@ -661,6 +671,10 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"' ##teamcity[testFinished name='Usage of NoneMatch range matcher' duration="{duration}"] ##teamcity[testStarted name='Usage of NoneTrue range matcher'] ##teamcity[testFinished name='Usage of NoneTrue range matcher' duration="{duration}"] +##teamcity[testStarted name='Usage of RangeEquals range matcher'] +##teamcity[testFinished name='Usage of RangeEquals range matcher' duration="{duration}"] +##teamcity[testStarted name='Usage of UnorderedRangeEquals range matcher'] +##teamcity[testFinished name='Usage of UnorderedRangeEquals range matcher' duration="{duration}"] ##teamcity[testStarted name='Usage of the SizeIs range matcher'] ##teamcity[testFinished name='Usage of the SizeIs range matcher' duration="{duration}"] ##teamcity[testStarted name='Use a custom approx'] @@ -670,41 +684,41 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"' ##teamcity[testStarted name='Vector Approx matcher'] ##teamcity[testFinished name='Vector Approx matcher' duration="{duration}"] ##teamcity[testStarted name='Vector Approx matcher -- failing'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Approx( t1 ) )|nwith expansion:|n { } is approx: { 1.0, 2.0 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v1, Approx( v2 ) )|nwith expansion:|n { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 }|n'] +##teamcity[testFailed name='Vector Approx matcher -- failing' message='-------------------------------------------------------------------------------|nEmpty and non empty vectors are not approx equal|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Approx( t1 ) )|nwith expansion:|n { } is approx: { 1.0, 2.0 }|n'] +##teamcity[testFailed name='Vector Approx matcher -- failing' message='-------------------------------------------------------------------------------|nJust different vectors|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v1, Approx( v2 ) )|nwith expansion:|n { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 }|n'] ##teamcity[testFinished name='Vector Approx matcher -- failing' duration="{duration}"] ##teamcity[testStarted name='Vector matchers'] ##teamcity[testFinished name='Vector matchers' duration="{duration}"] ##teamcity[testStarted name='Vector matchers that fail'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, VectorContains( -1 ) )|nwith expansion:|n { 1, 2, 3 } Contains: -1|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, VectorContains( 1 ) )|nwith expansion:|n { } Contains: 1|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Contains( v ) )|nwith expansion:|n { } Contains: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Contains( v2 ) )|nwith expansion:|n { 1, 2, 3 } Contains: { 1, 2, 4 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals( v2 ) )|nwith expansion:|n { 1, 2, 3 } Equals: { 1, 2 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v2, Equals( v ) )|nwith expansion:|n { 1, 2 } Equals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Equals( v ) )|nwith expansion:|n { } Equals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals( empty ) )|nwith expansion:|n { 1, 2, 3 } Equals: { }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, UnorderedEquals( empty ) )|nwith expansion:|n { 1, 2, 3 } UnorderedEquals: { }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, UnorderedEquals( v ) )|nwith expansion:|n { } UnorderedEquals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 1, 3 } UnorderedEquals: { 1, 2, 3 }|n'] -Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 3, 1 } UnorderedEquals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='-------------------------------------------------------------------------------|nContains (element)|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, VectorContains( -1 ) )|nwith expansion:|n { 1, 2, 3 } Contains: -1|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, VectorContains( 1 ) )|nwith expansion:|n { } Contains: 1|n'] +##teamcity[testFailed name='Vector matchers that fail' message='-------------------------------------------------------------------------------|nContains (vector)|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Contains( v ) )|nwith expansion:|n { } Contains: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Contains( v2 ) )|nwith expansion:|n { 1, 2, 3 } Contains: { 1, 2, 4 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='-------------------------------------------------------------------------------|nEquals|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals( v2 ) )|nwith expansion:|n { 1, 2, 3 } Equals: { 1, 2 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v2, Equals( v ) )|nwith expansion:|n { 1, 2 } Equals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Equals( v ) )|nwith expansion:|n { } Equals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals( empty ) )|nwith expansion:|n { 1, 2, 3 } Equals: { }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='-------------------------------------------------------------------------------|nUnorderedEquals|n-------------------------------------------------------------------------------|nMatchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, UnorderedEquals( empty ) )|nwith expansion:|n { 1, 2, 3 } UnorderedEquals: { }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, UnorderedEquals( v ) )|nwith expansion:|n { } UnorderedEquals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 1, 3 } UnorderedEquals: { 1, 2, 3 }|n'] +##teamcity[testFailed name='Vector matchers that fail' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals( v ) )|nwith expansion:|n { 3, 1 } UnorderedEquals: { 1, 2, 3 }|n'] ##teamcity[testFinished name='Vector matchers that fail' duration="{duration}"] ##teamcity[testStarted name='When checked exceptions are thrown they can be expected or unexpected'] ##teamcity[testFinished name='When checked exceptions are thrown they can be expected or unexpected' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown directly they are always failures'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] +##teamcity[testFailed name='When unchecked exceptions are thrown directly they are always failures' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] ##teamcity[testFinished name='When unchecked exceptions are thrown directly they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown during a CHECK the test should continue'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFailed name='When unchecked exceptions are thrown during a CHECK the test should continue' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown during a CHECK the test should continue' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown during a REQUIRE the test should abort fail'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n REQUIRE( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFailed name='When unchecked exceptions are thrown during a REQUIRE the test should abort fail' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n REQUIRE( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown during a REQUIRE the test should abort fail' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown from functions they are always failures'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFailed name='When unchecked exceptions are thrown from functions they are always failures' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] ##teamcity[testFinished name='When unchecked exceptions are thrown from functions they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown from sections they are always failures'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] +##teamcity[testFailed name='When unchecked exceptions are thrown from sections they are always failures' message='-------------------------------------------------------------------------------|nsection name|n-------------------------------------------------------------------------------|nException.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] ##teamcity[testFinished name='When unchecked exceptions are thrown from sections they are always failures' duration="{duration}"] ##teamcity[testStarted name='When unchecked exceptions are thrown, but caught, they do not affect the test'] ##teamcity[testFinished name='When unchecked exceptions are thrown, but caught, they do not affect the test' duration="{duration}"] @@ -720,6 +734,9 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##teamcity[testFinished name='XmlEncode' duration="{duration}"] ##teamcity[testStarted name='XmlWriter writes boolean attributes as true/false'] ##teamcity[testFinished name='XmlWriter writes boolean attributes as true/false' duration="{duration}"] +##teamcity[testStarted name='a succeeding test can still be skipped'] +##teamcity[testIgnored name='a succeeding test can still be skipped' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='a succeeding test can still be skipped' duration="{duration}"] ##teamcity[testStarted name='analyse no analysis'] ##teamcity[testFinished name='analyse no analysis' duration="{duration}"] ##teamcity[testStarted name='array<int, N> -> toString'] @@ -731,12 +748,12 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpe ##teamcity[testStarted name='checkedElse'] ##teamcity[testFinished name='checkedElse' duration="{duration}"] ##teamcity[testStarted name='checkedElse, failing'] -Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedElse( false ) )|nwith expansion:|n false|n'] +##teamcity[testFailed name='checkedElse, failing' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedElse( false ) )|nwith expansion:|n false|n'] ##teamcity[testFinished name='checkedElse, failing' duration="{duration}"] ##teamcity[testStarted name='checkedIf'] ##teamcity[testFinished name='checkedIf' duration="{duration}"] ##teamcity[testStarted name='checkedIf, failing'] -Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ) )|nwith expansion:|n false|n'] +##teamcity[testFailed name='checkedIf, failing' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ) )|nwith expansion:|n false|n'] ##teamcity[testFinished name='checkedIf, failing' duration="{duration}"] ##teamcity[testStarted name='classify_outliers'] ##teamcity[testFinished name='classify_outliers' duration="{duration}"] @@ -746,6 +763,10 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ##teamcity[testFinished name='comparisons between int variables' duration="{duration}"] ##teamcity[testStarted name='convertToBits'] ##teamcity[testFinished name='convertToBits' duration="{duration}"] +##teamcity[testStarted name='dynamic skipping works with generators'] +##teamcity[testIgnored name='dynamic skipping works with generators' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip with message:|n "skipping because answer = 41"'] +##teamcity[testIgnored name='dynamic skipping works with generators' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip with message:|n "skipping because answer = 43"'] +##teamcity[testFinished name='dynamic skipping works with generators' duration="{duration}"] ##teamcity[testStarted name='empty tags are not allowed'] ##teamcity[testFinished name='empty tags are not allowed' duration="{duration}"] ##teamcity[testStarted name='erfc_inv'] @@ -754,6 +775,20 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ##teamcity[testFinished name='estimate_clock_resolution' duration="{duration}"] ##teamcity[testStarted name='even more nested SECTION tests'] ##teamcity[testFinished name='even more nested SECTION tests' duration="{duration}"] +##teamcity[testStarted name='failed assertions before SKIP cause test case to fail'] +##teamcity[testIgnored name='failed assertions before SKIP cause test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexpression failed|n CHECK( 3 == 4 )|nwith expansion:|n 3 == 4|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='failed assertions before SKIP cause test case to fail' message='Skip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='failed assertions before SKIP cause test case to fail' duration="{duration}"] +##teamcity[testStarted name='failing for some generator values causes entire test case to fail'] +##teamcity[testIgnored name='failing for some generator values causes entire test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='failing for some generator values causes entire test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testIgnored name='failing for some generator values causes entire test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testIgnored name='failing for some generator values causes entire test case to fail' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='failing for some generator values causes entire test case to fail' duration="{duration}"] +##teamcity[testStarted name='failing in some unskipped sections causes entire test case to fail'] +##teamcity[testIgnored name='failing in some unskipped sections causes entire test case to fail' message='-------------------------------------------------------------------------------|nskipped|n-------------------------------------------------------------------------------|nSkip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testIgnored name='failing in some unskipped sections causes entire test case to fail' message='-------------------------------------------------------------------------------|nnot skipped|n-------------------------------------------------------------------------------|nSkip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit failure- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='failing in some unskipped sections causes entire test case to fail' duration="{duration}"] ##teamcity[testStarted name='first tag'] ##teamcity[testFinished name='first tag' duration="{duration}"] ##teamcity[testStarted name='has printf'] @@ -761,10 +796,10 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ##teamcity[testStarted name='is_unary_function'] ##teamcity[testFinished name='is_unary_function' duration="{duration}"] ##teamcity[testStarted name='just failure'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "Previous info should not be seen"'] +##teamcity[testFailed name='just failure' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "Previous info should not be seen"'] ##teamcity[testFinished name='just failure' duration="{duration}"] ##teamcity[testStarted name='just failure after unscoped info'] -Message.tests.cpp:<line number>|nexplicit failure with message:|n "previous unscoped info SHOULD not be seen"'] +##teamcity[testFailed name='just failure after unscoped info' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexplicit failure with message:|n "previous unscoped info SHOULD not be seen"'] ##teamcity[testFinished name='just failure after unscoped info' duration="{duration}"] ##teamcity[testStarted name='just info'] ##teamcity[testFinished name='just info' duration="{duration}"] @@ -773,16 +808,16 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "previous uns ##teamcity[testStarted name='long long'] ##teamcity[testFinished name='long long' duration="{duration}"] ##teamcity[testStarted name='looped SECTION tests'] -Misc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 0 > 1|n'] -Misc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 1 > 1|n'] +##teamcity[testFailed name='looped SECTION tests' message='-------------------------------------------------------------------------------|nb is currently: 0|n-------------------------------------------------------------------------------|nMisc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 0 > 1|n'] +##teamcity[testFailed name='looped SECTION tests' message='-------------------------------------------------------------------------------|nb is currently: 1|n-------------------------------------------------------------------------------|nMisc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 1 > 1|n'] ##teamcity[testFinished name='looped SECTION tests' duration="{duration}"] ##teamcity[testStarted name='looped tests'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[0|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[1|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[3|] (3) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[4|] (5) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[6|] (13) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[7|] (21) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[0|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[1|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[3|] (3) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[4|] (5) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[6|] (13) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFailed name='looped tests' message='Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[7|] (21) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] ##teamcity[testFinished name='looped tests' duration="{duration}"] ##teamcity[testStarted name='makeStream recognizes %debug stream name'] ##teamcity[testFinished name='makeStream recognizes %debug stream name' duration="{duration}"] @@ -795,10 +830,14 @@ Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib ##teamcity[testStarted name='mix info, unscoped info and warning'] ##teamcity[testFinished name='mix info, unscoped info and warning' duration="{duration}"] ##teamcity[testStarted name='more nested SECTION tests'] -Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( a == b )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFailed name='more nested SECTION tests' message='-------------------------------------------------------------------------------|ndoesn|'t equal|nequal|n-------------------------------------------------------------------------------|nMisc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed|n REQUIRE( a == b )|nwith expansion:|n 1 == 2|n'] ##teamcity[testFinished name='more nested SECTION tests' duration="{duration}"] ##teamcity[testStarted name='nested SECTION tests'] ##teamcity[testFinished name='nested SECTION tests' duration="{duration}"] +##teamcity[testStarted name='nested sections can be skipped dynamically at runtime'] +##teamcity[testIgnored name='nested sections can be skipped dynamically at runtime' message='-------------------------------------------------------------------------------|nB|nB2|n-------------------------------------------------------------------------------|nSkip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testStdOut name='nested sections can be skipped dynamically at runtime' out='a!|nb1!|n!|n'] +##teamcity[testFinished name='nested sections can be skipped dynamically at runtime' duration="{duration}"] ##teamcity[testStarted name='non streamable - with conv. op'] ##teamcity[testFinished name='non streamable - with conv. op' duration="{duration}"] ##teamcity[testStarted name='non-copyable objects'] @@ -810,7 +849,7 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( a == b )|nwith expan ##teamcity[testStarted name='not allowed'] ##teamcity[testFinished name='not allowed' duration="{duration}"] ##teamcity[testStarted name='not prints unscoped info from previous failures'] -Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='not prints unscoped info from previous failures' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='not prints unscoped info from previous failures' duration="{duration}"] ##teamcity[testStarted name='null strings'] ##teamcity[testFinished name='null strings' duration="{duration}"] @@ -825,10 +864,10 @@ Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD ##teamcity[testStarted name='print unscoped info if passing unscoped info is printed'] ##teamcity[testFinished name='print unscoped info if passing unscoped info is printed' duration="{duration}"] ##teamcity[testStarted name='prints unscoped info on failure'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "this SHOULD be seen"|n "this SHOULD also be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='prints unscoped info on failure' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "this SHOULD be seen"|n "this SHOULD also be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='prints unscoped info on failure' duration="{duration}"] ##teamcity[testStarted name='prints unscoped info only for the first assertion'] -Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen only ONCE"|n CHECK( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='prints unscoped info only for the first assertion' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen only ONCE"|n CHECK( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='prints unscoped info only for the first assertion' duration="{duration}"] ##teamcity[testStarted name='random SECTION tests'] ##teamcity[testFinished name='random SECTION tests' duration="{duration}"] @@ -844,19 +883,25 @@ Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD ##teamcity[testFinished name='run_for_at_least, int' duration="{duration}"] ##teamcity[testStarted name='second tag'] ##teamcity[testFinished name='second tag' duration="{duration}"] +##teamcity[testStarted name='sections can be skipped dynamically at runtime'] +##teamcity[testIgnored name='sections can be skipped dynamically at runtime' message='-------------------------------------------------------------------------------|nskipped|n-------------------------------------------------------------------------------|nSkip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='sections can be skipped dynamically at runtime' duration="{duration}"] ##teamcity[testStarted name='send a single char to INFO'] -Misc.tests.cpp:<line number>|nexpression failed with message:|n "3"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='send a single char to INFO' message='Misc.tests.cpp:<line number>|n...............................................................................|n|nMisc.tests.cpp:<line number>|nexpression failed with message:|n "3"|n REQUIRE( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='send a single char to INFO' duration="{duration}"] ##teamcity[testStarted name='sends information to INFO'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "hi"|n "i := 7"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='sends information to INFO' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "hi"|n "i := 7"|n REQUIRE( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='sends information to INFO' duration="{duration}"] ##teamcity[testStarted name='shortened hide tags are split apart'] ##teamcity[testFinished name='shortened hide tags are split apart' duration="{duration}"] +##teamcity[testStarted name='skipped tests can optionally provide a reason'] +##teamcity[testIgnored name='skipped tests can optionally provide a reason' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip with message:|n "skipping because answer = 43"'] +##teamcity[testFinished name='skipped tests can optionally provide a reason' duration="{duration}"] ##teamcity[testStarted name='splitString'] ##teamcity[testFinished name='splitString' duration="{duration}"] ##teamcity[testStarted name='stacks unscoped info in loops'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 1 to 3..."|n "1"|n "2"|n "3"|n CHECK( false )|nwith expansion:|n false|n'] -Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to 6..."|n "4"|n "5"|n "6"|n CHECK( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='stacks unscoped info in loops' message='Message.tests.cpp:<line number>|n...............................................................................|n|nMessage.tests.cpp:<line number>|nexpression failed with messages:|n "Count 1 to 3..."|n "1"|n "2"|n "3"|n CHECK( false )|nwith expansion:|n false|n'] +##teamcity[testFailed name='stacks unscoped info in loops' message='Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to 6..."|n "4"|n "5"|n "6"|n CHECK( false )|nwith expansion:|n false|n'] ##teamcity[testFinished name='stacks unscoped info in loops' duration="{duration}"] ##teamcity[testStarted name='startsWith'] ##teamcity[testFinished name='startsWith' duration="{duration}"] @@ -896,8 +941,11 @@ Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to ##teamcity[testFinished name='tables' duration="{duration}"] ##teamcity[testStarted name='tags with dots in later positions are not parsed as hidden'] ##teamcity[testFinished name='tags with dots in later positions are not parsed as hidden' duration="{duration}"] +##teamcity[testStarted name='tests can be skipped dynamically at runtime'] +##teamcity[testIgnored name='tests can be skipped dynamically at runtime' message='Skip.tests.cpp:<line number>|n...............................................................................|n|nSkip.tests.cpp:<line number>|nexplicit skip'] +##teamcity[testFinished name='tests can be skipped dynamically at runtime' duration="{duration}"] ##teamcity[testStarted name='thrown std::strings are translated'] -Exception.tests.cpp:<line number>|nunexpected exception with message:|n "Why would you throw a std::string?"'] +##teamcity[testFailed name='thrown std::strings are translated' message='Exception.tests.cpp:<line number>|n...............................................................................|n|nException.tests.cpp:<line number>|nunexpected exception with message:|n "Why would you throw a std::string?"'] ##teamcity[testFinished name='thrown std::strings are translated' duration="{duration}"] ##teamcity[testStarted name='toString on const wchar_t const pointer returns the string contents'] ##teamcity[testFinished name='toString on const wchar_t const pointer returns the string contents' duration="{duration}"] diff --git a/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt index 0167e59cf285122303ba0e3cd67122ba72d78594..bf9cf2053f7aaca5fe91b2cadcd3e8d5bb3ef82c 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<Catch2TestRun name="<exe-name>" rng-seed="1" catch2-version="<version>" filters="~[!nonportable]~[!benchmark]~[approvals] *"> +<Catch2TestRun name="<exe-name>" rng-seed="1" xml-format-version="3" catch2-version="<version>" filters=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"> <TestCase name="# A test name that starts with a #" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1027: Bitfields can be captured" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -20,7 +20,7 @@ 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1147" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -71,16 +71,16 @@ {?} >= {?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1175 - Hidden Test" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1238" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > uarr := "123" </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > sarr := "456" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -91,10 +91,10 @@ 0 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > uarr := "123" </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > sarr := "456" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -105,16 +105,16 @@ 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1245" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1319: Sections can have description (even if it is not saved" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Section name="SectionName" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1403" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -125,24 +125,24 @@ [1403 helper] == [1403 helper] </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1455 - INFO and WARN can start with a linebreak" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This info message starts with a linebreak </Info> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This warning message starts with a linebreak </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="#1514: stderr/stdout is not captured in tests aborted by an exception" tags="[.][output-capture][regression]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > 1514 </Failure> - <OverallResult success="false"> + <OverallResult success="false" skips="0"> <StdOut> This would not be caught previously </StdOut> @@ -160,10 +160,10 @@ Nor would this true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <TestCase name="#1905 -- test spec parser properly clears internal state between compound tests" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <TestCase name="#1905 -- test spec parser properly clears internal state between compound tests" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase("spec . char")) </Original> @@ -171,7 +171,7 @@ Nor would this true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase("spec , char")) </Original> @@ -179,7 +179,7 @@ Nor would this true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> !(spec.matches(*fakeTestCase(R"(spec \, char)"))) </Original> @@ -187,11 +187,11 @@ Nor would this !false </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <TestCase name="#1912 -- test spec parser handles escaping" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="Various parentheses" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <TestCase name="#1912 -- test spec parser handles escaping" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > + <Section name="Various parentheses" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase(R"(spec {a} char)")) </Original> @@ -199,7 +199,7 @@ Nor would this true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase(R"(spec [a] char)")) </Original> @@ -207,7 +207,7 @@ Nor would this true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) </Original> @@ -215,10 +215,10 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="backslash in test name" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="backslash in test name" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase(R"(spec \ char)")) </Original> @@ -226,9 +226,9 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1913 - GENERATE inside a for loop should not keep recreating the generator" tags="[generators][regression]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -247,7 +247,7 @@ Nor would this 6 < 7 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1913 - GENERATEs can share a line" tags="[generators][regression]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -282,11 +282,11 @@ Nor would this 2 != 4 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - GENERATE after a section" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -297,7 +297,7 @@ Nor would this 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -308,7 +308,7 @@ Nor would this 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -319,9 +319,9 @@ Nor would this 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - Section followed by flat generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -333,7 +333,7 @@ Nor would this 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -351,7 +351,7 @@ Nor would this 3 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - flat generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -378,100 +378,100 @@ Nor would this 3 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - mixed sections and generates" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 5 </Info> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 6 </Info> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 4 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 5 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 4 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 6 </Info> <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 5 </Info> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 6 </Info> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 4 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 5 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 4 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 6 </Info> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - nested generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -618,16 +618,16 @@ Nor would this 3 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#2152 - ULP checks between differently signed values were wrong - double" tags="[floating-point][matchers][ulp]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -646,7 +646,7 @@ Nor would this 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#2152 - ULP checks between differently signed values were wrong - float" tags="[floating-point][matchers][ulp]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -665,20 +665,26 @@ Nor would this 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="#2615 - Throwing in constructor generator fails test case but does not abort" tags="[!shouldfail]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Exception filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + failure to init + </Exception> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="outside assertions" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > answer := 42 </Info> <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > expected exception </Exception> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="inside REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > answer := 42 </Info> <Expression success="false" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -692,10 +698,10 @@ Nor would this expected exception </Exception> </Expression> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="inside REQUIRE_THROWS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > answer := 42 </Info> <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -706,9 +712,9 @@ Nor would this thisThrows() </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#809" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -719,7 +725,7 @@ Nor would this 42 == {?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#833" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -778,7 +784,7 @@ Nor would this true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#835 -- errno should not be touched by Catch2" tags="[!shouldfail][.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -797,10 +803,10 @@ Nor would this 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#872" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > dummy := 0 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -811,25 +817,25 @@ Nor would this {?} == 4 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#961 -- Dynamically created sections should all be reported" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Looped section 0" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Looped section 1" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Looped section 2" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Looped section 3" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Looped section 4" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="'Not' checks that should fail" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -896,7 +902,7 @@ Nor would this !(1 == 1) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="'Not' checks that should succeed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -963,7 +969,7 @@ Nor would this !(1 == 2) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="(unimplemented) static bools can be evaluated" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Section name="compare to true" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -983,7 +989,7 @@ Nor would this true == true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="compare to false" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -1002,7 +1008,7 @@ Nor would this false == false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="negation" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -1013,7 +1019,7 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="double negation" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -1024,7 +1030,7 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="direct" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -1043,9 +1049,9 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="3x3x3 ints" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -1696,7 +1702,7 @@ Nor would this 3 < 9 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A METHOD_AS_TEST_CASE based test run that fails" tags="[.][class][failing]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1707,7 +1713,7 @@ Nor would this "hello" == "world" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A METHOD_AS_TEST_CASE based test run that succeeds" tags="[class]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1718,7 +1724,7 @@ Nor would this "hello" == "hello" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1729,7 +1735,7 @@ Nor would this 0 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1740,7 +1746,7 @@ Nor would this 0 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1751,7 +1757,7 @@ Nor would this 0 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1762,7 +1768,7 @@ Nor would this 0 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1773,7 +1779,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1784,7 +1790,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1795,7 +1801,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1806,7 +1812,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1817,7 +1823,7 @@ Nor would this 6 < 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1828,7 +1834,7 @@ Nor would this 2 < 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1839,7 +1845,7 @@ Nor would this 6 < 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1850,7 +1856,7 @@ Nor would this 2 < 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1861,7 +1867,7 @@ Nor would this 6 >= 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1872,7 +1878,7 @@ Nor would this 2 >= 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1883,7 +1889,7 @@ Nor would this 6 >= 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1894,7 +1900,7 @@ Nor would this 2 >= 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1905,7 +1911,7 @@ Nor would this 1.0 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1916,7 +1922,7 @@ Nor would this 1.0f == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1927,7 +1933,7 @@ Nor would this 1 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1938,7 +1944,7 @@ Nor would this 1.0 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1949,7 +1955,7 @@ Nor would this 1.0f == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1960,7 +1966,7 @@ Nor would this 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1971,7 +1977,7 @@ Nor would this 1 == 0 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1982,7 +1988,7 @@ Nor would this 3 == 0 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1993,7 +1999,7 @@ Nor would this 6 == 0 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2004,7 +2010,7 @@ Nor would this 1 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2015,7 +2021,7 @@ Nor would this 3 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2026,7 +2032,7 @@ Nor would this 6 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[.][class][failing]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2037,7 +2043,7 @@ Nor would this 1 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEST_CASE_METHOD based test run that succeeds" tags="[class]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2048,7 +2054,7 @@ Nor would this 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case - Foo<float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2059,7 +2065,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case - Foo<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2070,7 +2076,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case - std::vector<float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2081,7 +2087,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case - std::vector<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2092,7 +2098,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case with array signature - Bar<float, 42>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2103,7 +2109,7 @@ Nor would this 42 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case with array signature - Bar<int, 9>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2114,7 +2120,7 @@ Nor would this 9 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case with array signature - std::array<float, 42>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2125,7 +2131,7 @@ Nor would this 42 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case with array signature - std::array<int, 9>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2136,7 +2142,7 @@ Nor would this 9 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A comparison that uses literals instead of the normal constructor" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2187,19 +2193,19 @@ Nor would this 1.23 == Approx( 1.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A couple of nested sections followed by a failure" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Outer" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Inner" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > to infinity and beyond </Failure> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A failing expression with a non streamable type is still captured" tags="[.][failing][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -2218,7 +2224,7 @@ Nor would this {?} == {?} </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Absolute margin" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2269,10 +2275,10 @@ Nor would this 100.3 == Approx( 100.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="An empty test with no assertions" tags="[empty]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="An expression with side-effects should only be evaluated once" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -2291,7 +2297,7 @@ Nor would this 8 == 8 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="An unchecked exception reports the line of the last assertion" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -2313,10 +2319,10 @@ Nor would this unexpected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Anonymous test case 1" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approx setters validate their arguments" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2375,7 +2381,7 @@ Nor would this Approx(0).epsilon(1.0001), std::domain_error </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approx with exactly-representable margin" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2418,7 +2424,7 @@ Nor would this 245.5f == Approx( 245.25 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate PI" tags="[Approx][PI]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2437,7 +2443,7 @@ Nor would this 3.1428571429 != Approx( 3.141 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate comparisons with different epsilons" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2456,7 +2462,7 @@ Nor would this 1.23 == Approx( 1.231 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate comparisons with floats" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2475,7 +2481,7 @@ Nor would this 0.0f == Approx( 0.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate comparisons with ints" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2494,7 +2500,7 @@ Nor would this 0 == Approx( 0.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate comparisons with mixed numeric types" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2537,7 +2543,7 @@ Nor would this 1.234 == Approx( 1.2339999676 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Arbitrary predicate matcher" tags="[generic][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Function pointer" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -2557,7 +2563,7 @@ Nor would this 1 not matches predicate: "always false" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Lambdas + different type" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -2576,9 +2582,9 @@ Nor would this "This wouldn't pass" not matches undescribed predicate </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Assertion macros support bit operators and bool conversions" tags="[bitops][compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -2621,7 +2627,7 @@ Nor would this !(Val: 1 ^ Val: 1) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Assertions then sections" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -2650,9 +2656,9 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Original> @@ -2680,11 +2686,11 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Basic use of the Contains range matcher" tags="[contains][matchers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Different argument ranges, same element type, default comparison" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2712,7 +2718,7 @@ Nor would this { 4, 5, 6 } not contains element 1 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Different argument ranges, same element type, custom comparison" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2739,7 +2745,7 @@ Nor would this { 4, 5, 6 } not contains element 0 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Different element type, custom comparisons" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2750,7 +2756,7 @@ Nor would this { "abc", "abcd", "abcde" } contains element 4 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Can handle type that requires ADL-found free function begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2769,7 +2775,7 @@ Nor would this { 1, 2, 3, 4, 5 } not contains element 8 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Initialization with move only types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2788,7 +2794,7 @@ Nor would this { 1, 2, 3 } not contains element 9 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Matching using matcher" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2799,9 +2805,9 @@ Nor would this { 1.0, 2.0, 3.0, 0.0 } contains element matching is within 0.5 of 0.5 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Basic use of the Empty range matcher" tags="[empty][matchers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Simple, std-provided containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2853,7 +2859,7 @@ Nor would this { } is empty </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type with empty" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2864,7 +2870,7 @@ Nor would this {?} not is empty </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type requires ADL found empty free function" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2875,97 +2881,97 @@ Nor would this {?} is empty </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CAPTURE can deal with complex expressions" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > a := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > b := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > c := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > a + b := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > a+b := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > c > b := true </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > a == 1 := true </Info> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CAPTURE can deal with complex expressions involving commas" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > std::vector<int>{1, 2, 3}[0, 1, 2] := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > std::vector<int>{1, 2, 3}[(0, 1)] := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > std::vector<int>{1, 2, 3}[0] := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > (helper_1436<int, int>{12, -12}) := { 12, -12 } </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > (helper_1436<int, int>(-12, 12)) := { -12, 12 } </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > (1, 2) := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > (2, 3) := 3 </Info> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CAPTURE parses string and character constants" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > ("comma, in string", "escaped, \", ") := "escaped, ", " </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > "single quote in string,'," := "single quote in string,'," </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > "some escapes, \\,\\\\" := "some escapes, \,\\" </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > "some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<" </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '"' := '"' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '\'' := ''' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > ',' := ',' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '}' := '}' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > ')' := ')' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '(' := '(' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '{' := '{' </Info> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Capture and info messages" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="Capture should stringify like assertions" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > i := 2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -2976,10 +2982,10 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Info should NOT stringify the way assertions do" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > 3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -2990,9 +2996,9 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CaseInsensitiveEqualsTo is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > <Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > @@ -3012,7 +3018,7 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > @@ -3063,9 +3069,9 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CaseInsensitiveLess is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > <Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > @@ -3093,7 +3099,7 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > @@ -3128,9 +3134,9 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Character pretty printing" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="Specifically escaped" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -3166,7 +3172,7 @@ Nor would this '\f' == '\f' </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="General chars" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -3209,7 +3215,7 @@ Nor would this 'Z' == 'Z' </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Low ASCII" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -3252,9 +3258,9 @@ Nor would this 5 == 5 </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Clara::Arg supports single-arg parse the way Opt does" tags="[arg][clara][compilation]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > @@ -3273,7 +3279,7 @@ Nor would this "foo" == "foo" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Clara::Opt supports accept-many lambdas" tags="[clara][opt]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > <Section name="Parsing fails on multiple options without accept_many" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > @@ -3285,7 +3291,7 @@ Nor would this !{?} </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Parsing succeeds on multiple options with accept_many" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > @@ -3304,9 +3310,9 @@ Nor would this { "aaa", "bbb" } == { "aaa", "bbb" } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="ColourGuard behaviour" tags="[console-colours]" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > <Section name="ColourGuard is disengaged by default" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > @@ -3318,7 +3324,7 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="ColourGuard is engaged by op<<" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > @@ -3341,7 +3347,7 @@ Using code: 0 " </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="ColourGuard can be engaged explicitly" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > @@ -3364,9 +3370,9 @@ C " </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining MatchAllOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3393,7 +3399,7 @@ C 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining MatchAnyOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3420,7 +3426,7 @@ C 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining MatchNotOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3455,10 +3461,10 @@ C 1 equals: (int) 1 or (string) "1" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining concrete matchers does not use templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining only templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3485,7 +3491,7 @@ C 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining templated and concrete matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3544,7 +3550,7 @@ C "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3555,7 +3561,7 @@ C { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Commas in various macros are allowed" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -3654,7 +3660,7 @@ C { 1, 2 } == { 1, 2 } </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparing function pointers" tags="[function pointer][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -3673,7 +3679,7 @@ C 0x<hex digits> == 0x<hex digits> </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparison ops" tags="[rng]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -3708,7 +3714,7 @@ C !({?} != {?}) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparison with explicitly convertible types" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -3807,7 +3813,7 @@ C Approx( 11.0 ) >= StrongDoubleTypedef(10) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparisons between ints where one side is computed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -3818,7 +3824,7 @@ C 54 == 54 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -3869,7 +3875,7 @@ C -2147483648 > 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparisons with int literals don't warn when mixing signed/ unsigned" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -3976,7 +3982,7 @@ C 4294967295 (0x<hex digits>) > 4 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Composed generic matchers shortcircuit" tags="[composed][generic][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="MatchAllOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4004,7 +4010,7 @@ C true </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="MatchAnyOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4031,9 +4037,9 @@ C true </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Composed matchers shortcircuit" tags="[composed][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="MatchAllOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4061,7 +4067,7 @@ C true </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="MatchAnyOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4088,9 +4094,9 @@ C true </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Contains string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4109,7 +4115,7 @@ C "this string contains 'abc' as a substring" contains: "STRING" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Copy and then generate a range" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4121,7 +4127,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4132,7 +4138,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4143,7 +4149,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4154,7 +4160,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4165,7 +4171,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4176,7 +4182,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4187,7 +4193,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4198,7 +4204,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4209,7 +4215,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4220,7 +4226,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4231,7 +4237,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4242,7 +4248,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Final validation" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4261,9 +4267,9 @@ C 6 == 6 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Cout stream properly declares it writes to stdout" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -4274,7 +4280,7 @@ C true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4288,7 +4294,7 @@ C custom exception - not std </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Custom exceptions can be translated when testing for throwing as something else" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4302,13 +4308,13 @@ C custom exception - not std </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Custom std-exceptions can be custom translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > custom std exception </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Default scale is invisible to comparison" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -4327,7 +4333,7 @@ C 0.00001 != Approx( 0.0000001 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Directly creating an EnumInfo" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -4356,7 +4362,13 @@ C "{** unexpected enum value **}" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Empty generators can SKIP in constructor" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + This generator is empty + </Skip> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="Empty stream name opens cout stream" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -4367,18 +4379,7 @@ C true </Expanded> </Expression> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Empty tag is not allowed" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > - <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > - <Original> - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) - </Original> - <Expanded> - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) - </Expanded> - </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="EndsWith string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4397,7 +4398,7 @@ C "this string contains 'abc' as a substring" ends with: "this" (case insensitive) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Enums can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -4442,7 +4443,7 @@ C "Value2" == "Value2" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -4461,7 +4462,7 @@ C "Blue" == "Blue" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Epsilon only applies to Approx's value" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -4472,7 +4473,7 @@ C 101.01 != Approx( 100.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Equality checks that should fail" tags="[!mayfail][.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -4579,7 +4580,7 @@ C 1.3 == Approx( 1.301 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Equality checks that should succeed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -4638,7 +4639,7 @@ C 1.3 == Approx( 1.3 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Equals" tags="[matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4657,7 +4658,7 @@ C "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Equals string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4676,7 +4677,7 @@ C "this string contains 'abc' as a substring" equals: "something else" (case insensitive) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" tags="[exception][toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -4707,7 +4708,7 @@ C "StringMakerException" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Exception matchers that fail" tags="[!throws][.][exceptions][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="No exception" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4727,7 +4728,7 @@ C doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } </Expanded> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> <Section name="Type mismatch" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4752,7 +4753,7 @@ C Unknown exception </Exception> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> <Section name="Contents are wrong" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4771,9 +4772,9 @@ C SpecialException::what special exception has value of 1 </Expanded> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Exception matchers that succeed" tags="[!throws][exceptions][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4792,7 +4793,42 @@ C SpecialException::what special exception has value of 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Exception message can be matched" tags="[!throws][exceptions][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) + </Original> + <Expanded> + DerivedException::what matches "starts with: "Derived"" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) + </Original> + <Expanded> + DerivedException::what matches "ends with: "::what"" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) + </Original> + <Expanded> + DerivedException::what matches "not starts with: "::what"" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) + </Original> + <Expanded> + SpecialException::what matches "starts with: "Special"" + </Expanded> + </Expression> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Exception messages can be tested for" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="exact match" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4804,7 +4840,7 @@ C "expected exception" equals: "expected exception" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="different case" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4815,7 +4851,7 @@ C "expected exception" equals: "expected exception" (case insensitive) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="wildcarded" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4850,9 +4886,9 @@ C "expected exception" contains: "except" (case insensitive) </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Exceptions matchers" tags="[!throws][exceptions][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4887,7 +4923,7 @@ C SpecialException::what exception message matches "SpecialException::what" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK_THROWS_AS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4920,26 +4956,26 @@ C expected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="FAIL aborts the test" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This is a failure </Failure> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="FAIL does not require an argument" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" /> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="FAIL_CHECK does not abort the test" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This is a failure </Failure> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This message appears in the output </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Factorials are computed" tags="[factorial]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -4982,7 +5018,18 @@ C 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Filter generator throws exception for empty generator" tags="[generators]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException + </Original> + <Expanded> + filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException + </Expanded> + </Expression> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Floating point matchers: double" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Relative" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5027,9 +5074,9 @@ C 0.0 and 2.22507e-308 are within 2.22045e-12% of each other </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Margin" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5096,7 +5143,7 @@ C -10.0 is within 0.5 of -9.6 </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="ULPs" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5155,7 +5202,7 @@ C -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5182,7 +5229,7 @@ C 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Constructor validation" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5233,9 +5280,20 @@ C WithinRel( 1., 1. ), std::domain_error </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="IsNaN" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !IsNaN() + </Original> + <Expanded> + 1.0 not is NaN + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Floating point matchers: float" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Relative" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5280,9 +5338,9 @@ C 0.0f and 1.17549e-38 are within 0.00119209% of each other </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Margin" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5357,7 +5415,7 @@ C -10.0f is within 0.5 of -9.6000003815 </Expanded> </Expression> - <OverallResults successes="9" failures="0" expectedFailures="0"/> + <OverallResults successes="9" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="ULPs" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5424,7 +5482,7 @@ C -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5451,7 +5509,7 @@ C 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Constructor validation" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5510,9 +5568,20 @@ C WithinRel( 1.f, 1.f ), std::domain_error </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="IsNaN" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !IsNaN() + </Original> + <Expanded> + 1.0 not is NaN + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Generators -- adapters" tags="[generators][generic]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5525,9 +5594,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5539,9 +5608,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5553,9 +5622,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Throws if there are no matching values" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5567,9 +5636,9 @@ C filter([] (int) {return false; }, value(1)), Catch::GeneratorException </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5580,7 +5649,7 @@ C 1 < 4 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5591,7 +5660,7 @@ C 2 < 4 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5602,7 +5671,7 @@ C 3 < 4 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5614,9 +5683,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5628,9 +5697,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5642,9 +5711,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5656,9 +5725,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5670,9 +5739,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5684,9 +5753,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5698,9 +5767,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5712,9 +5781,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5726,9 +5795,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5739,7 +5808,7 @@ C 1 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5750,7 +5819,7 @@ C 2 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5761,7 +5830,7 @@ C 3 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5772,7 +5841,7 @@ C 1 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5783,7 +5852,7 @@ C 2 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5794,7 +5863,7 @@ C 3 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5814,9 +5883,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5836,9 +5905,9 @@ C 2 == 2 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5858,9 +5927,9 @@ C 3 == 3 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is not divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5888,9 +5957,9 @@ C 1 < 3 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is not divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5918,9 +5987,9 @@ C 2 < 3 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5932,9 +6001,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5946,9 +6015,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5960,9 +6029,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Throws on too small generators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5974,11 +6043,11 @@ C chunk(2, value(1)), Catch::GeneratorException </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Generators -- simple" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5990,7 +6059,7 @@ C -3 < 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6001,7 +6070,7 @@ C -2 < 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6012,7 +6081,7 @@ C -1 < 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6023,7 +6092,7 @@ C 4 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6034,7 +6103,7 @@ C 4 > 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6045,7 +6114,7 @@ C 4 > 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6056,7 +6125,7 @@ C -3 < 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6067,7 +6136,7 @@ C -2 < 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6078,7 +6147,7 @@ C -1 < 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6089,7 +6158,7 @@ C 8 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6100,7 +6169,7 @@ C 8 > 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6111,7 +6180,7 @@ C 8 > 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6122,7 +6191,7 @@ C -3 < 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6133,7 +6202,7 @@ C -2 < 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6144,7 +6213,7 @@ C -1 < 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6155,7 +6224,7 @@ C 12 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6166,7 +6235,7 @@ C 12 > 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6177,9 +6246,9 @@ C 12 > 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Generators internals" tags="[generators][internals]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Single value" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6199,7 +6268,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Preset values" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6250,7 +6319,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Generator combinator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6333,7 +6402,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Explicitly typed generator sequence" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6392,7 +6461,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Simple filtering" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6428,9 +6497,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Filter out multiple elements at the start and end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6466,9 +6535,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Throws on construction if it can't get initial element" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6488,9 +6557,9 @@ C filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Take generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Take less" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6526,9 +6595,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Take generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Take more" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6548,9 +6617,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Map with explicit return type" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6601,7 +6670,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Map with deduced return type" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6652,7 +6721,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Singular repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6672,9 +6741,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Actual repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6774,9 +6843,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="12" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="12" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive auto step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6845,11 +6914,11 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Negative auto step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6918,11 +6987,11 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6992,13 +7061,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7068,13 +7137,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7160,19 +7229,19 @@ C !false </Expanded> </Expression> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Exact" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7183,7 +7252,7 @@ C -1.0 == Approx( -1.0 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7194,7 +7263,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7205,7 +7274,7 @@ C -0.9 == Approx( -0.9 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7216,7 +7285,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7227,7 +7296,7 @@ C -0.8 == Approx( -0.8 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7238,7 +7307,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7249,7 +7318,7 @@ C -0.7 == Approx( -0.7 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7260,7 +7329,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7271,7 +7340,7 @@ C -0.6 == Approx( -0.6 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7282,7 +7351,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7293,7 +7362,7 @@ C -0.5 == Approx( -0.5 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7304,7 +7373,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7315,7 +7384,7 @@ C -0.4 == Approx( -0.4 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7326,7 +7395,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7337,7 +7406,7 @@ C -0.3 == Approx( -0.3 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7348,7 +7417,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7359,7 +7428,7 @@ C -0.2 == Approx( -0.2 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7370,7 +7439,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7381,7 +7450,7 @@ C -0.1 == Approx( -0.1 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7392,7 +7461,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1.38778e-16 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7403,7 +7472,7 @@ C -0.0 == Approx( -0.0 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1.38778e-16 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7414,7 +7483,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7425,7 +7494,7 @@ C 0.1 == Approx( 0.1 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7436,7 +7505,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7447,7 +7516,7 @@ C 0.2 == Approx( 0.2 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7458,7 +7527,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7469,7 +7538,7 @@ C 0.3 == Approx( 0.3 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7480,7 +7549,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7491,7 +7560,7 @@ C 0.4 == Approx( 0.4 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7502,7 +7571,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7513,7 +7582,7 @@ C 0.5 == Approx( 0.5 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7524,7 +7593,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7535,7 +7604,7 @@ C 0.6 == Approx( 0.6 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7546,7 +7615,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7557,7 +7626,7 @@ C 0.7 == Approx( 0.7 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7568,7 +7637,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7579,7 +7648,7 @@ C 0.8 == Approx( 0.8 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7590,7 +7659,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7601,7 +7670,7 @@ C 0.9 == Approx( 0.9 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7628,19 +7697,19 @@ C !false </Expanded> </Expression> - <OverallResults successes="42" failures="0" expectedFailures="0"/> + <OverallResults successes="42" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="42" failures="0" expectedFailures="0"/> + <OverallResults successes="42" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="42" failures="0" expectedFailures="0"/> + <OverallResults successes="42" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="42" failures="0" expectedFailures="0"/> + <OverallResults successes="42" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Slightly over end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7651,7 +7720,7 @@ C -1.0 == Approx( -1.0 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7662,7 +7731,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7673,7 +7742,7 @@ C -0.7 == Approx( -0.7 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7684,7 +7753,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7695,7 +7764,7 @@ C -0.4 == Approx( -0.4 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7706,7 +7775,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7717,7 +7786,7 @@ C -0.1 == Approx( -0.1 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7728,7 +7797,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7739,7 +7808,7 @@ C 0.2 == Approx( 0.2 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7750,7 +7819,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7761,7 +7830,7 @@ C 0.5 == Approx( 0.5 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7780,19 +7849,19 @@ C !false </Expanded> </Expression> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Slightly under end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7803,7 +7872,7 @@ C -1.0 == Approx( -1.0 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7814,7 +7883,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7825,7 +7894,7 @@ C -0.7 == Approx( -0.7 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7836,7 +7905,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7847,7 +7916,7 @@ C -0.4 == Approx( -0.4 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7858,7 +7927,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7869,7 +7938,7 @@ C -0.1 == Approx( -0.1 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7880,7 +7949,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7891,7 +7960,7 @@ C 0.2 == Approx( 0.2 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7902,7 +7971,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7913,7 +7982,7 @@ C 0.5 == Approx( 0.5 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7932,13 +8001,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -8008,13 +8077,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -8084,13 +8153,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -8176,15 +8245,15 @@ C !false </Expanded> </Expression> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Greater-than inequalities with different epsilons" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -8219,7 +8288,7 @@ C 1.23 >= Approx( 1.24 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Hashers with different seed produce different hash with same test case" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8232,7 +8301,7 @@ C 130711275 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Hashers with same seed produce same hash" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8245,7 +8314,7 @@ C 3422778688 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Hashing different test cases produces different result" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Section name="Different test name" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8259,7 +8328,7 @@ C 2668622104 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Different classname" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8272,7 +8341,7 @@ C 3916075712 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Different tags" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8285,9 +8354,9 @@ C 3429949824 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Hashing test case produces same hash across multiple calls" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8300,22 +8369,22 @@ C 3422778688 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="INFO and WARN do not abort tests" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this is a message </Info> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this is a warning </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="INFO gets logged on failure" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message should be logged </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > so should this </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8326,10 +8395,10 @@ C 2 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message may be logged later </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8340,10 +8409,10 @@ C 2 == 2 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message may be logged later </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message should be logged </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8354,13 +8423,13 @@ C 2 == 1 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message may be logged later </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message should be logged </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > and this, but later </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8371,16 +8440,16 @@ C 2 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message may be logged later </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message should be logged </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > and this, but later </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > but not this </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8391,13 +8460,13 @@ C 2 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="INFO is reset for each loop" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 0 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 0 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8408,10 +8477,10 @@ C 0 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 1 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8422,10 +8491,10 @@ C 1 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8436,10 +8505,10 @@ C 2 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8450,10 +8519,10 @@ C 3 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 4 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8464,10 +8533,10 @@ C 4 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 5 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8478,10 +8547,10 @@ C 5 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 6 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8492,10 +8561,10 @@ C 6 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 7 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8506,10 +8575,10 @@ C 7 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 8 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8520,10 +8589,10 @@ C 8 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 9 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8534,10 +8603,10 @@ C 9 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 10 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 10 </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8548,7 +8617,7 @@ C 10 < 10 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Inequality checks that should fail" tags="[!shouldfail][.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -8591,7 +8660,7 @@ C 5 != 5 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Inequality checks that should succeed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -8682,7 +8751,7 @@ C 5 != 6 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Lambdas in assertions" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -8693,7 +8762,7 @@ C true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Less-than inequalities with different epsilons" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -8728,10 +8797,10 @@ C 1.23 <= Approx( 1.22 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="ManuallyRegistered" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be (AllOf) composed with the && operator" tags="[matchers][operator&&][operators]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8742,7 +8811,7 @@ C "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be (AnyOf) composed with the || operator" tags="[matchers][operators][operator||]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8761,7 +8830,7 @@ C "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be composed with both && and ||" tags="[matchers][operator&&][operators][operator||]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8772,7 +8841,7 @@ C "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be composed with both && and || - failing" tags="[.][failing][matchers][operator&&][operators][operator||]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8783,7 +8852,7 @@ C "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Matchers can be negated (Not) with the ! operator" tags="[matchers][not][operators]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8794,7 +8863,7 @@ C "this string contains 'abc' as a substring" not contains: "different" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be negated (Not) with the ! operator - failing" tags="[.][failing][matchers][not][operators]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8805,44 +8874,44 @@ C "this string contains 'abc' as a substring" not contains: "substring" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Mayfail test case with nested sections" tags="[!mayfail]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="1" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="2" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > - <OverallResults successes="0" failures="0" expectedFailures="0"/> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="1" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="2" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > - <OverallResults successes="0" failures="0" expectedFailures="0"/> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Mismatching exception messages failing the test" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -8861,7 +8930,7 @@ C "expected exception" equals: "should fail" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Multireporter calls reporters and listeners in correct order" tags="[multi-reporter][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -8874,7 +8943,7 @@ C { "Hello", "world", "Goodbye", "world" } </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Multireporter updates ReporterPreferences properly" tags="[multi-reporter][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -8942,7 +9011,7 @@ C true == true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -9009,9 +9078,9 @@ C true == true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Nested generators and captured variables" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -9142,19 +9211,19 @@ C 99 > -6 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Nice descriptive name" tags="[.][tag1][tag2][tag3]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > This one ran </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Non-std exceptions can be translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > custom exception </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Objects that evaluated in boolean contexts can be checked" tags="[SafeBool][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -9181,10 +9250,10 @@ C !{?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Optionally static assertions" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Ordering comparison checks that should fail" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -9339,7 +9408,7 @@ C "hello" <= "a" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Ordering comparison checks that should succeed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -9478,7 +9547,7 @@ C "hello" > "a" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Our PCG implementation provides expected results for known seeds" tags="[rng]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Section name="Default seeded" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -9532,7 +9601,7 @@ C 1827115164 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Specific seed" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -9635,24 +9704,24 @@ C 4261393167 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Output from all sections is reported" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Section name="one" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Message from section one </Failure> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Message from section two </Failure> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Overloaded comma or address-of operators are not used" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -9687,1548 +9756,329 @@ C ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <TestCase name="Parse test names and tags" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="Empty test spec should have no filters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <TestCase name="Parse uints" tags="[parse-numbers]" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > + <Section name="proper inputs" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.hasFilters() == false + parseUInt( "0" ) == Optional<unsigned int>{ 0 } </Original> <Expanded> - false == false + {?} == {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcA ) == false + parseUInt( "100" ) == Optional<unsigned int>{ 100 } </Original> <Expanded> - false == false + {?} == {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcB ) == false + parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } </Original> <Expanded> - false == false + {?} == {?} </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Test spec from empty string should have no filters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.hasFilters() == false + parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } </Original> <Expanded> - false == false + {?} == {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Bad inputs" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcA ) == false + !(parseUInt( "" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcB ) == false + !(parseUInt( "!!KJHF*#" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Test spec from just a comma should have no filters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.hasFilters() == false + !(parseUInt( "-1" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcA ) == false + !(parseUInt( "4294967296" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcB ) == false + !(parseUInt( "42949672964294967296429496729642949672964294967296" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Test spec from name should have one filter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.hasFilters() == true + !(parseUInt( "2 4" )) </Original> <Expanded> - true == true + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcA ) == false + !(parseUInt( "0x<hex digits>", 10 )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Parsed tags are matched case insensitive" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Parsing sharding-related cli flags" tags="[sharding]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="shard-count" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcB ) == true + cli.parse({ "test", "--shard-count=8" }) </Original> <Expanded> - true == true + {?} </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Test spec from quoted name should have one filter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.hasFilters() == true + config.shardCount == 8 </Original> <Expanded> - true == true + 8 == 8 </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Negative shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcA ) == false + !(result) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcB ) == true + result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) </Original> <Expanded> - true == true + "Could not parse '-1' as shard count" contains: "Could not parse '-1' as shard count" </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Test spec from name should have one filter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Zero shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.hasFilters() == true + !(result) </Original> <Expanded> - true == true + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcA ) == false + result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) </Original> <Expanded> - false == false + "Shard count must be positive" contains: "Shard count must be positive" </Expanded> </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="shard-index" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcB ) == true + cli.parse({ "test", "--shard-index=2" }) </Original> <Expanded> - true == true + {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcC ) == false + config.shardIndex == 2 </Original> <Expanded> - false == false + 2 == 2 </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Wildcard at the start" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Negative shard index reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.hasFilters() == true + !(result) </Original> <Expanded> - true == true + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcA ) == false + result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) </Original> <Expanded> - false == false + "Could not parse '-12' as shard index" contains: "Could not parse '-12' as shard index" </Expanded> </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Shard index 0 is accepted" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcB ) == false + cli.parse({ "test", "--shard-index=0" }) </Original> <Expanded> - false == false + {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcC ) == true + config.shardIndex == 0 </Original> <Expanded> - true == true + 0 == 0 </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Parsing tags with non-alphabetical characters is pass-through" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Parsing warnings" tags="[cli][warnings]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="NoAssertions" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcD ) == false + cli.parse( { "test", "-w", "NoAssertions" } ) </Original> <Expanded> - false == false + {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - parseTestSpec( "*a" ).matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> - </Section> - <Section name="Wildcard at the end" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - parseTestSpec( "a*" ).matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> - </Section> - <Section name="Wildcard at both ends" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - parseTestSpec( "*a*" ).matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> - </Section> - <Section name="Redundant wildcard at the start" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Redundant wildcard at the end" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Redundant wildcard at both ends" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Wildcard at both ends, redundant at start" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Just wildcard" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Single tag" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="Single tag, two matches" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="Two tags" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="Two tags, spare separated" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="Wildcarded name and tag" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Single tag exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="One tag exclusion and one tag inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="One tag exclusion and one wldcarded name inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="One tag exclusion, using exclude:, and one wldcarded name inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="name exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="wildcarded name exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="wildcarded name exclusion with tag inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="wildcarded name exclusion, using exclude:, with tag inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="two wildcarded names" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="empty tag" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="empty quoted name" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="quoted string followed by tag exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Leading and trailing spaces in test spec" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark" ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( "aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( "aardvark" ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Leading and trailing spaces in test name" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark" ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( "aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( "aardvark" ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Shortened hide tags are split apart when parsing" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Shortened hide tags also properly handle exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(spec.matches(*fakeTestCase("only hidden", "[.]"))) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Parsed tags are matched case insensitive" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.hasFilters() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.getInvalidSpecs().empty() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.matches( testCase ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Parsing sharding-related cli flags" tags="[sharding]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="shard-count" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - cli.parse({ "test", "--shard-count=8" }) - </Original> - <Expanded> - {?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - config.shardCount == 8 - </Original> - <Expanded> - 8 == 8 - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Negative shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(result) - </Original> - <Expanded> - !{?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") - </Original> - <Expanded> - "Shard count must be a positive number" contains: "Shard count must be a positive number" - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Zero shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(result) - </Original> - <Expanded> - !{?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") - </Original> - <Expanded> - "Shard count must be a positive number" contains: "Shard count must be a positive number" - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="shard-index" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - cli.parse({ "test", "--shard-index=2" }) - </Original> - <Expanded> - {?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - config.shardIndex == 2 - </Original> - <Expanded> - 2 == 2 - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Negative shard index reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(result) - </Original> - <Expanded> - !{?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") - </Original> - <Expanded> - "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Shard index 0 is accepted" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - cli.parse({ "test", "--shard-index=0" }) - </Original> - <Expanded> - {?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - config.shardIndex == 0 - </Original> - <Expanded> - 0 == 0 - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Parsing tags with non-alphabetical characters is pass-through" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Info> - tagString := "[tag with spaces]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.hasFilters() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[tag with spaces]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.getInvalidSpecs().empty() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[tag with spaces]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.matches( testCase ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[I said "good day" sir!]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.hasFilters() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[I said "good day" sir!]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.getInvalidSpecs().empty() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[I said "good day" sir!]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.matches( testCase ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Parsing warnings" tags="[cli][warnings]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="NoAssertions" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - cli.parse( { "test", "-w", "NoAssertions" } ) - </Original> - <Expanded> - {?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> config.warnings == WarnAbout::NoAssertions </Original> @@ -11236,7 +10086,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="NoTests is no longer supported" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11247,7 +10097,7 @@ C !{?} </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Combining multiple warnings" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11266,9 +10116,9 @@ C 3 == 3 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Pointers can be compared to null" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -11335,7 +10185,7 @@ C 0 != 0x<hex digits> </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Precision of floating point stringification can be set" tags="[floatingPoint][toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="Floats" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -11355,7 +10205,7 @@ C 13 == 13 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Double" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -11374,9 +10224,9 @@ C 17 == 17 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Predicate matcher can accept const char*" tags="[compilation][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -11387,7 +10237,7 @@ C "foo" matches undescribed predicate </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="empty args don't cause a crash" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11407,7 +10257,7 @@ C "" == "" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="default - no arguments" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11498,7 +10348,7 @@ C {?} == {?} </Expanded> </Expression> - <OverallResults successes="11" failures="0" expectedFailures="0"/> + <OverallResults successes="11" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Specify one test case using" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11534,9 +10384,9 @@ C true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Specify one test case exclusion using exclude:" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11572,9 +10422,9 @@ C true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Specify one test case exclusion using ~" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11610,13 +10460,13 @@ C true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-r/console" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11627,7 +10477,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11638,13 +10488,13 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-r/xml" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11655,7 +10505,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11666,13 +10516,13 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--reporter/junit" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11683,7 +10533,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11694,9 +10544,9 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="must match one of the available ones" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11716,13 +10566,13 @@ C "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="With output file" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11733,7 +10583,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11744,13 +10594,13 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="With Windows-like absolute path as output file" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11761,7 +10611,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11772,9 +10622,9 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11795,11 +10645,11 @@ C { {?}, {?} } == { {?}, {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11820,11 +10670,11 @@ C { {?}, {?} } == { {?}, {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11845,11 +10695,11 @@ C "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="debugger" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-b" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11869,9 +10719,9 @@ C true == true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="debugger" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--break" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11891,9 +10741,9 @@ C true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-a aborts after first failure" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11913,9 +10763,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-x 2 aborts after two failures" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11935,9 +10785,9 @@ C 2 == 2 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-x must be numeric" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11957,9 +10807,9 @@ C "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11980,11 +10830,11 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12005,11 +10855,11 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12030,11 +10880,11 @@ C 2 == 2 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12055,11 +10905,11 @@ C 3 == 3 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12080,11 +10930,11 @@ C "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="nothrow" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-e" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12104,9 +10954,9 @@ C true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="nothrow" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--nothrow" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12126,9 +10976,9 @@ C true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="output filename" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-o filename" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12148,9 +10998,9 @@ C "filename.ext" == "filename.ext" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="output filename" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--out" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12170,9 +11020,9 @@ C "filename.ext" == "filename.ext" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="combinations" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Single character flags can be combined" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12208,9 +11058,9 @@ C true == true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="without option" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12230,9 +11080,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="auto" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12252,9 +11102,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="yes" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12274,9 +11124,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="no" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12296,9 +11146,9 @@ C 3 == 3 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12318,9 +11168,9 @@ C "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not recognised" contains: "colour mode must be one of" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="samples" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12340,9 +11190,9 @@ C 200 == 200 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="resamples" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12362,9 +11212,9 @@ C 20000 (0x<hex digits>) == 20000 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="confidence-interval" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12384,9 +11234,9 @@ C 0.99 == Approx( 0.99 ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="no-analysis" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12406,9 +11256,9 @@ C true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="warmup-time" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12428,11 +11278,11 @@ C 10 == 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Product with differing arities - std::tuple<int, double, float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -12443,7 +11293,7 @@ C 3 >= 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Product with differing arities - std::tuple<int, double>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -12454,7 +11304,7 @@ C 2 >= 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Product with differing arities - std::tuple<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -12465,7 +11315,7 @@ C 1 >= 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Random seed generation accepts known methods" tags="[rng][seed]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -12492,7 +11342,7 @@ C Catch::generateRandomSeed(method) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Random seed generation reports unknown methods" tags="[rng][seed]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -12503,7 +11353,7 @@ C Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Range type with sentinel" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -12514,7 +11364,7 @@ C "{ }" == "{ }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing]" filename="tests/<exe-name>/UsageTests/Decomposition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Decomposition.tests.cpp" > @@ -12525,7 +11375,7 @@ C Hey, its truthy! </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Regex string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -12552,7 +11402,7 @@ C "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Registering reporter with '::' in name fails" tags="[registration][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12563,7 +11413,7 @@ C "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Regression test #1" tags="[matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -12574,7 +11424,7 @@ C { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Reporter's write listings to provided stream" tags="[reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12586,7 +11436,7 @@ C </Expanded> </Expression> <Section name="Automake reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: Automake </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12601,7 +11451,7 @@ C " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12612,7 +11462,7 @@ C </Expanded> </Expression> <Section name="Automake reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: Automake </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12626,7 +11476,7 @@ C " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12637,7 +11487,7 @@ C </Expanded> </Expression> <Section name="Automake reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: Automake </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12653,7 +11503,7 @@ C " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12664,7 +11514,7 @@ C </Expanded> </Expression> <Section name="compact reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: compact </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12679,7 +11529,7 @@ C " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12690,7 +11540,7 @@ C </Expanded> </Expression> <Section name="compact reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: compact </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12704,7 +11554,7 @@ C " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12715,7 +11565,7 @@ C </Expanded> </Expression> <Section name="compact reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: compact </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12731,7 +11581,7 @@ C " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12742,7 +11592,7 @@ C </Expanded> </Expression> <Section name="console reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: console </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12757,7 +11607,7 @@ C " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12768,7 +11618,7 @@ C </Expanded> </Expression> <Section name="console reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: console </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12782,7 +11632,7 @@ C " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12793,7 +11643,7 @@ C </Expanded> </Expression> <Section name="console reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: console </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12809,7 +11659,7 @@ C " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12820,7 +11670,7 @@ C </Expanded> </Expression> <Section name="JUnit reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: JUnit </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12836,7 +11686,7 @@ All available tags: " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12847,7 +11697,7 @@ All available tags: </Expanded> </Expression> <Section name="JUnit reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: JUnit </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12862,7 +11712,7 @@ Available reporters: " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12873,7 +11723,7 @@ Available reporters: </Expanded> </Expression> <Section name="JUnit reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: JUnit </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12890,7 +11740,7 @@ All available test cases: " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12901,7 +11751,7 @@ All available test cases: </Expanded> </Expression> <Section name="SonarQube reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: SonarQube </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12917,7 +11767,7 @@ All available tags: " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12928,7 +11778,7 @@ All available tags: </Expanded> </Expression> <Section name="SonarQube reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: SonarQube </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12943,7 +11793,7 @@ Available reporters: " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12954,7 +11804,7 @@ Available reporters: </Expanded> </Expression> <Section name="SonarQube reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: SonarQube </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12971,7 +11821,7 @@ All available test cases: " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12982,7 +11832,7 @@ All available test cases: </Expanded> </Expression> <Section name="TAP reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TAP </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12997,7 +11847,7 @@ All available test cases: " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13008,7 +11858,7 @@ All available test cases: </Expanded> </Expression> <Section name="TAP reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TAP </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13022,7 +11872,7 @@ All available test cases: " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13033,7 +11883,7 @@ All available test cases: </Expanded> </Expression> <Section name="TAP reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TAP </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13049,7 +11899,7 @@ All available test cases: " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13060,7 +11910,7 @@ All available test cases: </Expanded> </Expression> <Section name="TeamCity reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TeamCity </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13075,7 +11925,7 @@ All available test cases: " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13086,7 +11936,7 @@ All available test cases: </Expanded> </Expression> <Section name="TeamCity reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TeamCity </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13100,7 +11950,7 @@ All available test cases: " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13111,7 +11961,7 @@ All available test cases: </Expanded> </Expression> <Section name="TeamCity reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TeamCity </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13127,7 +11977,7 @@ All available test cases: " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13138,7 +11988,7 @@ All available test cases: </Expanded> </Expression> <Section name="XML reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: XML </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13157,7 +12007,7 @@ All available test cases: </TagsFromMatchingTests>" contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13168,7 +12018,7 @@ All available test cases: </Expanded> </Expression> <Section name="XML reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: XML </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13185,7 +12035,7 @@ All available test cases: </AvailableReporters>" contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13196,7 +12046,7 @@ All available test cases: </Expanded> </Expression> <Section name="XML reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: XML </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13218,18 +12068,18 @@ All available test cases: </MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" tags="[console-reporter]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="SUCCEED counts as a test pass" tags="[messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="SUCCEED does not require an argument" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods" tags="[bdd][fixtures]" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: No operations precede me" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -13251,13 +12101,13 @@ All available test cases: 1 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Scenario: Do that thing with the thing" tags="[Tags]" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: This stuff exists" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -13281,29 +12131,29 @@ All available test cases: true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Scenario: This is a really long scenario name to see how the list command deals with wrapping" tags="[anotherReallyLongTagNameButThisOneHasNoObviousWrapPointsSoShouldSplitWithinAWordUsingADashCharacter][long][lots][one very long tag name that should cause line wrapping writing out using the list command][tags][verbose][very long tags]" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: A section name that is so long that it cannot fit in a single console width" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="When: The test headers are printed as part of the normal running of the scenario" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Scenario: Vector resizing affects size and capacity" tags="[bdd][capacity][size][vector]" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: an empty vector" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -13351,15 +12201,15 @@ All available test cases: 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Given: an empty vector" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -13388,16 +12238,16 @@ All available test cases: 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Sends stuff to stdout and stderr" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"> + <OverallResult success="false" skips="0"> <StdOut> A string sent directly to stdout </StdOut> @@ -13472,16 +12322,16 @@ A string sent to stderr via clog Approx( 1.23 ) != 1.24 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Standard output from all sections is reported" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Section name="one" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"> + <OverallResult success="false" skips="0"> <StdOut> Message from section one Message from section two @@ -13505,7 +12355,7 @@ Message from section two "this string contains 'abc' as a substring" starts with: "string" (case insensitive) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Static arrays are convertible to string" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="Single item" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -13517,7 +12367,7 @@ Message from section two "{ 1 }" == "{ 1 }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Multiple" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -13528,7 +12378,7 @@ Message from section two "{ 3, 2, 1 }" == "{ 3, 2, 1 }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Non-trivial inner items" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -13541,9 +12391,9 @@ Message from section two "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="String matchers" tags="[matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -13610,7 +12460,7 @@ Message from section two "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="StringRef" tags="[StringRef][Strings]" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Empty string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13638,7 +12488,7 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From string literal" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13673,7 +12523,7 @@ Message from section two "hello" == "hello" </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From sub-string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13692,7 +12542,7 @@ Message from section two original.data() </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Copy construction is shallow" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13703,7 +12553,7 @@ Message from section two "original string" == "original string" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Copy assignment is shallow" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13714,7 +12564,7 @@ Message from section two "original string" == "original string" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="zero-based substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13750,9 +12600,9 @@ Message from section two hello == "hello" </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="non-zero-based substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13772,9 +12622,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Pointer values of full refs should match" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13786,9 +12636,9 @@ Message from section two "hello world!" == "hello world!" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Pointer values of substring refs should also match" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13800,9 +12650,9 @@ Message from section two "hello world!" == "hello world!" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Past the end substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13814,9 +12664,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Substring off the end are trimmed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13828,9 +12678,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="substring start after the end is empty" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13842,9 +12692,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Comparisons are deep" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13871,7 +12721,7 @@ Message from section two Hello != Hel </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="implicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13891,9 +12741,9 @@ Message from section two 17 == 17 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="explicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13913,9 +12763,9 @@ Message from section two 17 == 17 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="assigned" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13935,9 +12785,9 @@ Message from section two 17 == 17 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="to std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="explicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13957,9 +12807,9 @@ Message from section two 11 == 11 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="to std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="assigned" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13979,9 +12829,9 @@ Message from section two 11 == 11 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="std::string += StringRef" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13994,7 +12844,7 @@ Message from section two "some string += the stringref contents" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="StringRef + StringRef" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -14005,18 +12855,18 @@ Message from section two "abrakadabra" == "abrakadabra" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="StringRef at compilation time" tags="[constexpr][StringRef][Strings]" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Simple constructors" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <OverallResults successes="12" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying char arrays with statically known sizes - char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -14035,7 +12885,7 @@ Message from section two ""abc"" == ""abc"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying char arrays with statically known sizes - signed char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -14054,7 +12904,7 @@ Message from section two ""abc"" == ""abc"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying char arrays with statically known sizes - unsigned char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -14073,7 +12923,7 @@ Message from section two ""abc"" == ""abc"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying std::chrono::duration helpers" tags="[chrono][toString]" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > @@ -14108,7 +12958,7 @@ Message from section two 1 ns != 1 us </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying std::chrono::duration with weird ratios" tags="[chrono][toString]" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > @@ -14127,7 +12977,7 @@ Message from section two 1 ps != 1 as </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying std::chrono::time_point<system_clock>" tags="[chrono][toString]" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > @@ -14140,7 +12990,7 @@ Message from section two {iso8601-timestamp} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Tabs and newlines show in output" tags="[.][failing][whitespace]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14158,7 +13008,7 @@ Message from section two " </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Tag alias can be registered against tag patterns" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Section name="The same tag alias can only be registered once" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -14202,7 +13052,7 @@ Message from section two Redefined at: file:10" contains: "10" </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Tag aliases must be of the form [@name]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="CHECK_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -14237,9 +13087,9 @@ Message from section two registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Tags with spaces and non-alphanumerical characters are accepted" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -14258,7 +13108,7 @@ Message from section two { {?}, {?} } ( Contains: {?} and Contains: {?} ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 0" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -14269,7 +13119,7 @@ Message from section two 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 1" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -14280,7 +13130,7 @@ Message from section two 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 2" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -14291,7 +13141,7 @@ Message from section two 1.0 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14302,7 +13152,7 @@ Message from section two 1 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14313,7 +13163,7 @@ Message from section two 4 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14324,7 +13174,7 @@ Message from section two 1 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14335,7 +13185,7 @@ Message from section two 4 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14346,7 +13196,7 @@ Message from section two 4 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14357,7 +13207,7 @@ Message from section two 1 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 2" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14368,7 +13218,7 @@ Message from section two 4 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTest: vectors can be sized and resized - float" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14404,7 +13254,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14448,9 +13298,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14485,7 +13335,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14520,9 +13370,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTest: vectors can be sized and resized - int" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14558,7 +13408,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14602,9 +13452,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14639,7 +13489,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14674,9 +13524,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTest: vectors can be sized and resized - std::string" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14712,7 +13562,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14756,9 +13606,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14793,7 +13643,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14828,9 +13678,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14866,7 +13716,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14910,9 +13760,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14947,7 +13797,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14982,9 +13832,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15020,7 +13870,7 @@ Message from section two 12 >= 12 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15064,9 +13914,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15101,7 +13951,7 @@ Message from section two 12 >= 12 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15136,9 +13986,9 @@ Message from section two 6 >= 6 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTestSig: vectors can be sized and resized - float,4" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15174,7 +14024,7 @@ Message from section two 8 >= 8 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15218,9 +14068,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15255,7 +14105,7 @@ Message from section two 8 >= 8 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15290,9 +14140,9 @@ Message from section two 4 >= 4 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTestSig: vectors can be sized and resized - int,5" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15328,7 +14178,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15372,9 +14222,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15409,7 +14259,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15444,9 +14294,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTestSig: vectors can be sized and resized - std::string,15" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15482,7 +14332,7 @@ Message from section two 30 >= 30 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15526,9 +14376,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15563,7 +14413,7 @@ Message from section two 30 >= 30 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15598,9 +14448,9 @@ Message from section two 15 >= 15 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Test case with identical tags keeps just one" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -15619,10 +14469,10 @@ Message from section two {?} == {?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Test case with one argument" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Test enum bit values" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -15633,10 +14483,10 @@ Message from section two 3221225472 (0x<hex digits>) == 3221225472 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Test with special, characters "in name" tags="[cli][regression]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Testing checked-if" tags="[checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15671,7 +14521,7 @@ Message from section two false </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Testing checked-if 2" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15683,7 +14533,7 @@ Message from section two </Expanded> </Expression> <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" /> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Testing checked-if 3" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15695,7 +14545,7 @@ Message from section two </Expanded> </Expression> <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" /> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="The NO_FAIL macro reports a failure but does not fail the test" tags="[messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Expression success="false" type="CHECK_NOFAIL" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -15706,7 +14556,7 @@ Message from section two 1 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="The default listing implementation write to provided stream" tags="[reporter-helpers][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Section name="Listing tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -15722,7 +14572,7 @@ Message from section two " contains: "[fakeTag]" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Listing reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -15736,7 +14586,7 @@ Message from section two " ( contains: "fake reporter" and contains: "fake description" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Listing tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -15752,7 +14602,7 @@ Message from section two " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Listing listeners" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -15766,18 +14616,18 @@ Message from section two " ( contains: "fakeListener" and contains: "fake description" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="This test 'should' fail but doesn't" tags="[!shouldfail][.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Thrown string literals are translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > For some reason someone is throwing a string literal! </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Tracker" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -15829,7 +14679,7 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -15929,9 +14779,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -16039,9 +14889,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="11" failures="0" expectedFailures="0"/> + <OverallResults successes="11" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -16142,11 +14992,11 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -16279,11 +15129,11 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="12" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="14" failures="0" expectedFailures="0"/> + <OverallResults successes="14" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -16350,9 +15200,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Trim strings" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -16435,13 +15285,189 @@ There is no extra whitespace here There is no extra whitespace here </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Type conversions of RangeEquals and similar" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Container conversions" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers of different container types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, RangeEquals( c_array ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, UnorderedRangeEquals( c_array ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Container conversions" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers of different container types (differ in array N)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_3, !RangeEquals( array_int_4 ) + </Original> + <Expanded> + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_3, !UnorderedRangeEquals( array_int_4 ) + </Original> + <Expanded> + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Container conversions" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers of different container types and value types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, RangeEquals( vector_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, UnorderedRangeEquals( vector_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Container conversions" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers, one random access, one not" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, RangeEquals( list_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, UnorderedRangeEquals( list_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Value type" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers of different value types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_int_a, RangeEquals( vector_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_int_a, UnorderedRangeEquals( vector_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Value type" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal containers of different value types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_int_a, !RangeEquals( vector_char_b ) + </Original> + <Expanded> + { 1, 2, 3 } not elements are { 1, 2, 2 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_int_a, !UnorderedRangeEquals( vector_char_b ) + </Original> + <Expanded> + { 1, 2, 3 } not unordered elements are { 1, 2, 2 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Ranges with begin that needs ADL" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + a, !RangeEquals( b ) + </Original> + <Expanded> + { 1, 2, 3 } not elements are { 3, 2, 1 } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + a, UnorderedRangeEquals( b ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 3, 2, 1 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, RangeEquals( array_a_plus_1, close_enough ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 2, 3, 4 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 2, 3, 4 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > 3.14 </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Upcasting special member functions" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Section name="Move constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -16453,7 +15479,7 @@ There is no extra whitespace here 3 == 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="move assignment" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -16464,9 +15490,9 @@ There is no extra whitespace here 3 == 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of AllMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16486,7 +15512,7 @@ There is no extra whitespace here { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains element 1 ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16497,7 +15523,7 @@ There is no extra whitespace here { 1, 2, 3, 4, 5 } all match matches undescribed predicate </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16549,9 +15575,9 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16603,11 +15629,11 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of AllTrue range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16620,9 +15646,9 @@ There is no extra whitespace here { true, true, true, true, true } contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16634,12 +15660,12 @@ There is no extra whitespace here { } contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One false evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> data, !AllTrue() @@ -16648,9 +15674,9 @@ There is no extra whitespace here { true, true, false, true, true } not contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16662,9 +15688,9 @@ There is no extra whitespace here { false, false, false, false, false } not contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16676,12 +15702,12 @@ There is no extra whitespace here { true, true, true, true, true } contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One false evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> data, !AllTrue() @@ -16690,9 +15716,9 @@ There is no extra whitespace here { true, true, false, true, true } not contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16704,9 +15730,9 @@ There is no extra whitespace here { false, false, false, false, false } not contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16758,9 +15784,9 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16812,11 +15838,11 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of AnyMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16836,7 +15862,7 @@ There is no extra whitespace here { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains element 10 ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16847,7 +15873,7 @@ There is no extra whitespace here { 1, 2, 3, 4, 5 } any match matches undescribed predicate </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16899,9 +15925,9 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16953,11 +15979,11 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of AnyTrue range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16970,9 +15996,9 @@ There is no extra whitespace here { true, true, true, true, true } contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Empty evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16984,12 +16010,12 @@ There is no extra whitespace here { } not contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One true evalutes to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> data, AnyTrue() @@ -16998,9 +16024,9 @@ There is no extra whitespace here { false, false, true, false, false } contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17012,9 +16038,9 @@ There is no extra whitespace here { false, false, false, false, false } not contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17026,12 +16052,12 @@ There is no extra whitespace here { true, true, true, true, true } contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One true evalutes to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> data, AnyTrue() @@ -17040,9 +16066,9 @@ There is no extra whitespace here { false, false, true, false, false } contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17054,9 +16080,9 @@ There is no extra whitespace here { false, false, false, false, false } not contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17108,9 +16134,9 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17146,67 +16172,276 @@ There is no extra whitespace here true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[4]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Usage of NoneMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneMatch(SizeIs(6)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneMatch(Contains(0) && Contains(1)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, noneMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[4] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, !noneMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[1]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[2]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[4]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Usage of NoneTrue range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { true, true, true, true, true } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { false, false, true, false, false } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { false, false, false, false, false } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { true, true, true, true, true } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[3]) + data, !NoneTrue() </Original> <Expanded> - !false + { false, false, true, false, false } not contains no true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[4]) + data, NoneTrue() </Original> <Expanded> - !false + { false, false, false, false, false } contains no true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> - </Section> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Usage of NoneMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Original> - data, NoneMatch(SizeIs(6)) - </Original> - <Expanded> - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Original> - data, !NoneMatch(Contains(0) && Contains(1)) - </Original> - <Expanded> - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Original> - needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) - </Original> - <Expanded> - { 1, 2, 3, 4, 5 } none match matches undescribed predicate - </Expanded> - </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked, noneMatch + mocked, NoneTrue() </Original> <Expanded> - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { false, false, false, false, false } contains no true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17249,18 +16484,18 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked, !noneMatch + mocked, !NoneTrue() </Original> <Expanded> - { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + { false, false, true, true, true } not contains no true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17271,20 +16506,20 @@ There is no extra whitespace here true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[1]) + mocked.m_derefed[1] </Original> <Expanded> - !false + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[2]) + mocked.m_derefed[2] </Original> <Expanded> - !false + true </Expanded> </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17303,132 +16538,173 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <TestCase name="Usage of NoneTrue range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <TestCase name="Usage of RangeEquals range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty container matches empty container" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, !NoneTrue() + empty_vector, RangeEquals( empty_vector ) </Original> <Expanded> - { true, true, true, true, true } not contains no true + { } elements are { } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty container does not match non-empty container" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, NoneTrue() + empty_vector, !RangeEquals( non_empty_vector ) </Original> <Expanded> - { } contains no true + { } not elements are { 1 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + non_empty_vector, !RangeEquals( empty_vector ) + </Original> + <Expanded> + { 1 } not elements are { } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One true evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal 1-length non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, !NoneTrue() + non_empty_array, RangeEquals( non_empty_array ) </Original> <Expanded> - { false, false, true, false, false } not contains no true + { 1 } elements are { 1 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal-sized, equal, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, NoneTrue() + array_a, RangeEquals( array_a ) </Original> <Expanded> - { false, false, false, false, false } contains no true + { 1, 2, 3 } elements are { 1, 2, 3 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal-sized, non-equal, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, !NoneTrue() + array_a, !RangeEquals( array_b ) </Original> <Expanded> - { true, true, true, true, true } not contains no true + { 1, 2, 3 } not elements are { 2, 2, 3 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_a, !RangeEquals( array_c ) + </Original> + <Expanded> + { 1, 2, 3 } not elements are { 1, 2, 2 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One true evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal-sized, non-empty containers (with same first elements)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, !NoneTrue() + vector_a, !RangeEquals( vector_b ) </Original> <Expanded> - { false, false, true, false, false } not contains no true + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, NoneTrue() + vector_a, RangeEquals( vector_a_plus_1, close_enough ) </Original> <Expanded> - { false, false, false, false, false } contains no true + { 1, 2, 3 } elements are { 2, 3, 4 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked, NoneTrue() + vector_a, !RangeEquals( vector_b, close_enough ) </Original> <Expanded> - { false, false, false, false, false } contains no true + { 1, 2, 3 } not elements are { 3, 3, 4 } </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Ranges that need ADL begin/end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl1, RangeEquals( needs_adl2 ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Check short-circuiting behaviour" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Check short-circuits on failure" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[0] + mocked1, !RangeEquals( arr ) </Original> <Expanded> - true + { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[1] + mocked1.m_derefed[0] </Original> <Expanded> true @@ -17436,7 +16712,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[2] + mocked1.m_derefed[1] </Original> <Expanded> true @@ -17444,37 +16720,37 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[3] + mocked1.m_derefed[2] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[4] + !(mocked1.m_derefed[3]) </Original> <Expanded> - true + !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Check short-circuiting behaviour" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All elements are checked on success" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked, !NoneTrue() + mocked1, RangeEquals( arr ) </Original> <Expanded> - { false, false, true, true, true } not contains no true + { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[0] + mocked1.m_derefed[0] </Original> <Expanded> true @@ -17482,7 +16758,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[1] + mocked1.m_derefed[1] </Original> <Expanded> true @@ -17490,33 +16766,159 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[2] + mocked1.m_derefed[2] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[3]) + mocked1.m_derefed[3] </Original> <Expanded> - !false + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Usage of UnorderedRangeEquals range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty container matches empty container" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[4]) + empty_vector, UnorderedRangeEquals( empty_vector ) </Original> <Expanded> - !false + { } unordered elements are { } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty container does not match non-empty container" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + empty_vector, !UnorderedRangeEquals( non_empty_vector ) + </Original> + <Expanded> + { } not unordered elements are { 1 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + non_empty_vector, !UnorderedRangeEquals( empty_vector ) + </Original> + <Expanded> + { 1 } not unordered elements are { } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal 1-length non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + non_empty_array, UnorderedRangeEquals( non_empty_array ) + </Original> + <Expanded> + { 1 } unordered elements are { 1 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal-sized, equal, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_a, UnorderedRangeEquals( array_a ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal-sized, non-equal, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_a, !UnorderedRangeEquals( array_b ) + </Original> + <Expanded> + { 1, 2, 3 } not unordered elements are { 2, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal-sized, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, !UnorderedRangeEquals( vector_b ) + </Original> + <Expanded> + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) + </Original> + <Expanded> + { 1, 10, 20 } unordered elements are { 11, 21, 2 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, !UnorderedRangeEquals( vector_b, close_enough ) + </Original> + <Expanded> + { 1, 10, 21 } not unordered elements are { 11, 21, 3 } </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Ranges that need ADL begin/end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl1, UnorderedRangeEquals( needs_adl2 ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of the SizeIs range matcher" tags="[matchers][size][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Some with stdlib containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17576,7 +16978,7 @@ There is no extra whitespace here { {?}, {?}, {?} } has size == 3 </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type requires ADL found size free function" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17587,7 +16989,7 @@ There is no extra whitespace here {?} has size == 12 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type has size member" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17598,9 +17000,9 @@ There is no extra whitespace here {?} has size == 13 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Use a custom approx" tags="[Approx][custom]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -17667,13 +17069,13 @@ There is no extra whitespace here Approx( 1.23 ) != 1.25 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Variadic macros" tags="[sections][variadic]" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > <Section name="Section with one argument" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Vector Approx matcher" tags="[approx][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Empty vector is roughly equal to an empty vector" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17685,7 +17087,7 @@ There is no extra whitespace here { } is approx: { } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="A vector is approx equal to itself" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17705,9 +17107,9 @@ There is no extra whitespace here { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Different length" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17719,9 +17121,9 @@ There is no extra whitespace here { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Same length, different elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17757,11 +17159,11 @@ There is no extra whitespace here { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Vector Approx matcher -- failing" tags="[.][approx][failing][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Empty and non empty vectors are not approx equal" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17773,7 +17175,7 @@ There is no extra whitespace here { } is approx: { 1.0, 2.0 } </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="Just different vectors" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17784,9 +17186,9 @@ There is no extra whitespace here { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Vector matchers" tags="[matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Contains (element)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17814,7 +17216,7 @@ There is no extra whitespace here { 1, 2, 3 } Contains: 2 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contains (vector)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17881,7 +17283,7 @@ There is no extra whitespace here { 1, 2, 3 } Contains: { 1, 2 } </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contains (element), composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17892,7 +17294,7 @@ There is no extra whitespace here { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Equals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17943,7 +17345,7 @@ There is no extra whitespace here { 1, 2, 3 } Equals: { 1, 2, 3 } </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="UnorderedEquals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18002,9 +17404,9 @@ There is no extra whitespace here { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Vector matchers that fail" tags="[.][failing][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Contains (element)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18024,7 +17426,7 @@ There is no extra whitespace here { } Contains: 1 </Expanded> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> <Section name="Contains (vector)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18043,7 +17445,7 @@ There is no extra whitespace here { 1, 2, 3 } Contains: { 1, 2, 4 } </Expanded> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> <Section name="Equals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18078,7 +17480,7 @@ There is no extra whitespace here { 1, 2, 3 } Equals: { } </Expanded> </Expression> - <OverallResults successes="0" failures="4" expectedFailures="0"/> + <OverallResults successes="0" failures="4" expectedFailures="0" skipped="false"/> </Section> <Section name="UnorderedEquals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18113,9 +17515,9 @@ There is no extra whitespace here { 3, 1 } UnorderedEquals: { 1, 2, 3 } </Expanded> </Expression> - <OverallResults successes="0" failures="4" expectedFailures="0"/> + <OverallResults successes="0" failures="4" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When checked exceptions are thrown they can be expected or unexpected" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -18142,13 +17544,13 @@ There is no extra whitespace here thisThrows() </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > unexpected exception </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -18162,7 +17564,7 @@ There is no extra whitespace here expected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -18176,7 +17578,7 @@ There is no extra whitespace here expected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown from functions they are always failures" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -18190,31 +17592,31 @@ There is no extra whitespace here expected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="section name" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > unexpected exception </Exception> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="X/level/0/a" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="X/level/0/b" tags="[fizz][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="X/level/1/a" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="X/level/1/b" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="XmlEncode" tags="[XML]" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Section name="normal string" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18226,7 +17628,7 @@ There is no extra whitespace here "normal string" == "normal string" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="empty string" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18237,7 +17639,7 @@ There is no extra whitespace here "" == "" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with ampersand" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18248,7 +17650,7 @@ There is no extra whitespace here "smith &amp; jones" == "smith &amp; jones" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with less-than" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18259,7 +17661,7 @@ There is no extra whitespace here "smith &lt; jones" == "smith &lt; jones" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with greater-than" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18280,7 +17682,7 @@ There is no extra whitespace here "smith ]]&gt; jones" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with quotes" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18303,7 +17705,7 @@ There is no extra whitespace here "don't &quot;quote&quot; me on that" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with control char (1)" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18314,7 +17716,7 @@ There is no extra whitespace here "[\x01]" == "[\x01]" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with control char (x7F)" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18325,9 +17727,9 @@ There is no extra whitespace here "[\x7F]" == "[\x7F]" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="XmlWriter writes boolean attributes as true/false" tags="[XML][XmlWriter]" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18340,7 +17742,11 @@ There is no extra whitespace here " ( contains: "attr1="true"" and contains: "attr2="false"" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="a succeeding test can still be skipped" tags="[!shouldfail][skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="analyse no analysis" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18447,7 +17853,7 @@ There is no extra whitespace here 0.0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="array<int, N> -> toString" tags="[array][containers][toString]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -18474,7 +17880,7 @@ There is no extra whitespace here "{ 42, 250 }" == "{ 42, 250 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="benchmark function call" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Section name="without chronometer" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18518,7 +17924,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="with chronometer" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18561,9 +17967,9 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="boolean member" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -18574,7 +17980,7 @@ There is no extra whitespace here 0x<hex digits> != 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="checkedElse" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -18593,7 +17999,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="checkedElse, failing" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -18612,7 +18018,7 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="checkedIf" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -18631,7 +18037,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="checkedIf, failing" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -18650,7 +18056,7 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="classify_outliers" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Section name="none" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18702,7 +18108,7 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="low severe" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18753,7 +18159,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="low mild" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18804,7 +18210,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="high mild" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18855,7 +18261,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="high severe" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18906,7 +18312,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="mixed" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18957,9 +18363,9 @@ There is no extra whitespace here 2 == 2 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="comparisons between const int variables" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -18994,7 +18400,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="comparisons between int variables" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -19029,7 +18435,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="convertToBits" tags="[conversion][floating-point]" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > @@ -19084,7 +18490,16 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="dynamic skipping works with generators" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + skipping because answer = 41 + </Skip> + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + skipping because answer = 43 + </Skip> + <OverallResult success="true" skips="2"/> </TestCase> <TestCase name="empty tags are not allowed" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -19095,7 +18510,7 @@ There is no extra whitespace here Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="erfc_inv" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19122,7 +18537,7 @@ There is no extra whitespace here 1.3859038243 == Approx( 1.3859038243 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="estimate_clock_resolution" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19141,53 +18556,83 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="even more nested SECTION tests" tags="[sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="c" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="d (leaf)" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="c" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="e (leaf)" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="f (leaf)" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="failed assertions before SKIP cause test case to fail" tags="[!shouldfail][skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Original> + 3 == 4 + </Original> + <Expanded> + 3 == 4 + </Expanded> + </Expression> + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResult success="true" skips="1"/> + </TestCase> + <TestCase name="failing for some generator values causes entire test case to fail" tags="[!shouldfail][skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <Failure filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResult success="true" skips="2"/> + </TestCase> + <TestCase name="failing in some unskipped sections causes entire test case to fail" tags="[!shouldfail][skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="true"/> + </Section> + <Section name="not skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="first tag" tags="[tag1]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="has printf" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > loose text artifact - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="is_unary_function" tags="[clara][compilation]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="just failure" tags="[.][fail][isolated info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Previous info should not be seen </Failure> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="just failure after unscoped info" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > previous unscoped info SHOULD not be seen </Failure> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="just info" tags="[info][isolated info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="just unscoped info" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="long long" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19200,7 +18645,7 @@ loose text artifact 9223372036854775807 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="looped SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="b is currently: 0" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19212,7 +18657,7 @@ loose text artifact 0 > 1 </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 1" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19223,7 +18668,7 @@ loose text artifact 1 > 1 </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 2" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19234,7 +18679,7 @@ loose text artifact 2 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 3" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19245,7 +18690,7 @@ loose text artifact 3 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 4" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19256,7 +18701,7 @@ loose text artifact 4 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 5" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19267,7 +18712,7 @@ loose text artifact 5 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 6" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19278,7 +18723,7 @@ loose text artifact 6 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 7" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19289,7 +18734,7 @@ loose text artifact 7 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 8" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19300,7 +18745,7 @@ loose text artifact 8 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 9" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19311,12 +18756,12 @@ loose text artifact 9 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="looped tests" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[0] (1) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19327,7 +18772,7 @@ loose text artifact 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[1] (1) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19338,7 +18783,7 @@ loose text artifact 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[2] (2) is even </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19349,7 +18794,7 @@ loose text artifact 0 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[3] (3) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19360,7 +18805,7 @@ loose text artifact 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[4] (5) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19371,7 +18816,7 @@ loose text artifact 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[5] (8) is even </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19382,7 +18827,7 @@ loose text artifact 0 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[6] (13) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19393,7 +18838,7 @@ loose text artifact 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[7] (21) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19404,7 +18849,7 @@ loose text artifact 1 == 0 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="makeStream recognizes %debug stream name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -19415,7 +18860,7 @@ loose text artifact Catch::makeStream( "%debug" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="make_unique reimplementation" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Section name="From lvalue copies" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -19427,7 +18872,7 @@ loose text artifact !false </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From rvalue moves" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -19438,7 +18883,7 @@ loose text artifact true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Variadic constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -19449,9 +18894,9 @@ loose text artifact {?} == {?} </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="mean" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19462,7 +18907,7 @@ loose text artifact 19.0 == 19.0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="measure" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19529,28 +18974,28 @@ loose text artifact 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="mix info, unscoped info and warning" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > info </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > unscoped info </Info> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > and warn may mix </Warning> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > info </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > unscoped info </Info> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > they are not cleared after warnings </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19563,9 +19008,9 @@ loose text artifact 1 == 2 </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="not equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19577,9 +19022,9 @@ loose text artifact 1 != 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="less than" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19591,11 +19036,11 @@ loose text artifact 1 < 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="nested SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19624,11 +19069,39 @@ loose text artifact 1 != 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="nested sections can be skipped dynamically at runtime" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="A" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="B1" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="B2" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="true"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="true"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="false" skips="1"> + <StdOut> +a! +b1! +! + </StdOut> + </OverallResult> </TestCase> <TestCase name="non streamable - with conv. op" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -19639,7 +19112,7 @@ loose text artifact "7" == "7" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="non-copyable objects" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -19650,7 +19123,7 @@ loose text artifact {?} == {?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="normal_cdf" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19693,7 +19166,7 @@ loose text artifact 0.088096521 == Approx( 0.088096521 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="normal_quantile" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19720,13 +19193,13 @@ loose text artifact -1.9599639845 == Approx( -1.9599639845 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="not allowed" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="not prints unscoped info from previous failures" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this MAY be seen only for the FIRST assertion IF info is printed for passing assertions </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19737,7 +19210,7 @@ loose text artifact true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this MAY be seen only for the SECOND assertion IF info is printed for passing assertions </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19748,7 +19221,7 @@ loose text artifact true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this SHOULD be seen </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19759,7 +19232,7 @@ loose text artifact false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="null strings" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19778,7 +19251,7 @@ loose text artifact {null string} == {null string} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="null_ptr" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -19789,7 +19262,7 @@ loose text artifact 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="pair<pair<int,const char *,pair<std::string,int> > -> toString" tags="[pair][toString]" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > @@ -19802,7 +19275,7 @@ loose text artifact "{ { 42, "Arthur" }, { "Ford", 24 } }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="parseEnums" tags="[enums][Strings]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Section name="No enums" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -19814,7 +19287,7 @@ loose text artifact { } Equals: { } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="One enum value" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -19841,7 +19314,7 @@ loose text artifact { Value1 } Equals: { Value1 } </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Multiple enum values" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -19868,9 +19341,9 @@ loose text artifact { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="pointer to class" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -19881,10 +19354,10 @@ loose text artifact 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="print unscoped info if passing unscoped info is printed" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this MAY be seen IF info is printed for passing assertions </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19895,13 +19368,13 @@ loose text artifact true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="prints unscoped info on failure" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this SHOULD be seen </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this SHOULD also be seen </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19912,10 +19385,10 @@ loose text artifact false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="prints unscoped info only for the first assertion" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this SHOULD be seen only ONCE </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19934,7 +19407,7 @@ loose text artifact true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this MAY also be seen only ONCE IF info is printed for passing assertions </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19953,7 +19426,7 @@ loose text artifact true </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19973,7 +19446,7 @@ loose text artifact 2 != 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="not equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19984,9 +19457,9 @@ loose text artifact 1 != 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="replaceInPlace" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Section name="replace single char" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20006,7 +19479,7 @@ loose text artifact "azcdefcg" == "azcdefcg" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace two chars" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20025,7 +19498,7 @@ loose text artifact "abzdefzg" == "abzdefzg" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace first char" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20044,7 +19517,7 @@ loose text artifact "zbcdefcg" == "zbcdefcg" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace last char" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20063,7 +19536,7 @@ loose text artifact "abcdefcz" == "abcdefcz" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace all chars" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20082,7 +19555,7 @@ loose text artifact "replaced" == "replaced" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace no chars" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20101,7 +19574,7 @@ loose text artifact "abcdefcg" == "abcdefcg" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="escape '" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20120,9 +19593,9 @@ loose text artifact "didn|'t" == "didn|'t" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="request an unknown %-starting stream fails" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -20133,7 +19606,7 @@ loose text artifact Catch::makeStream( "%somestream" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="resolution" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -20216,7 +19689,7 @@ loose text artifact 1000.0 == 1000 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="run_for_at_least, chronometer" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -20307,7 +19780,7 @@ loose text artifact 128 >= 100 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="run_for_at_least, int" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -20398,13 +19871,26 @@ loose text artifact 128 >= 100 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="second tag" tags="[tag2]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> + </TestCase> + <TestCase name="sections can be skipped dynamically at runtime" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="not skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="true"/> + </Section> + <Section name="also not skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="send a single char to INFO" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > 3 </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20415,13 +19901,13 @@ loose text artifact false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="sends information to INFO" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > hi </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 7 </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -20432,7 +19918,7 @@ loose text artifact false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="shortened hide tags are split apart" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -20443,7 +19929,13 @@ loose text artifact { {?}, {?} } ( Contains: {?} and Contains: {?} ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="skipped tests can optionally provide a reason" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + skipping because answer = 43 + </Skip> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="splitString" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20470,19 +19962,19 @@ loose text artifact { abc, def } Equals: { abc, def } </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stacks unscoped info in loops" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Count 1 to 3... </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 1 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 3 </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -20493,16 +19985,16 @@ loose text artifact false </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Count 4 to 6... </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 4 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 5 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 6 </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -20513,7 +20005,7 @@ loose text artifact false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="startsWith" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20540,7 +20032,7 @@ loose text artifact true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::map is convertible string" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="empty" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20552,7 +20044,7 @@ loose text artifact "{ }" == "{ }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="single item" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20563,7 +20055,7 @@ loose text artifact "{ { "one", 1 } }" == "{ { "one", 1 } }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="several items" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20576,9 +20068,9 @@ loose text artifact "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::pair<int,const std::string> -> toString" tags="[pair][toString]" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > @@ -20589,7 +20081,7 @@ loose text artifact "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::pair<int,std::string> -> toString" tags="[pair][toString]" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > @@ -20600,7 +20092,7 @@ loose text artifact "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::set is convertible string" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="empty" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20612,7 +20104,7 @@ loose text artifact "{ }" == "{ }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="single item" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20623,7 +20115,7 @@ loose text artifact "{ "one" }" == "{ "one" }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="several items" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20636,9 +20128,9 @@ loose text artifact "{ "abc", "def", "ghi" }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::vector<std::pair<std::string,int> > -> toString" tags="[pair][toString]" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > @@ -20651,7 +20143,7 @@ loose text artifact "{ { "green", 55 } }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stdout and stderr streams have %-starting name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -20670,7 +20162,7 @@ loose text artifact true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify ranges" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20709,7 +20201,7 @@ loose text artifact "{?}" == "{?}" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_maker )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20722,7 +20214,7 @@ loose text artifact "StringMaker<has_maker>" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_maker_and_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20735,7 +20227,7 @@ loose text artifact "StringMaker<has_maker_and_operator>" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_neither )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20746,7 +20238,7 @@ loose text artifact "{?}" == "{?}" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20759,7 +20251,7 @@ loose text artifact "operator<<( has_operator )" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_template_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20772,7 +20264,7 @@ loose text artifact "operator<<( has_template_operator )" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( vectors<has_maker> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20785,7 +20277,7 @@ loose text artifact "{ StringMaker<has_maker> }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( vectors<has_maker_and_operator> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20798,7 +20290,7 @@ loose text artifact "{ StringMaker<has_maker_and_operator> }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( vectors<has_operator> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20811,7 +20303,7 @@ loose text artifact "{ operator<<( has_operator ) }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="strlen3" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -20846,7 +20338,7 @@ loose text artifact 4 == 4 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tables" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -20881,7 +20373,7 @@ loose text artifact 6 == 6 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tags with dots in later positions are not parsed as hidden" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -20900,13 +20392,17 @@ loose text artifact magic.tag == magic.tag </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="tests can be skipped dynamically at runtime" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="thrown std::strings are translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > Why would you throw a std::string? </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="toString on const wchar_t const pointer returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20917,7 +20413,7 @@ loose text artifact ""wide load"" == ""wide load"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString on const wchar_t pointer returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20928,7 +20424,7 @@ loose text artifact ""wide load"" == ""wide load"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString on wchar_t const pointer returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20939,7 +20435,7 @@ loose text artifact ""wide load"" == ""wide load"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString on wchar_t returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20950,7 +20446,7 @@ loose text artifact ""wide load"" == ""wide load"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString(enum class w/operator<<)" tags="[enum][enumClass][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -20979,7 +20475,7 @@ loose text artifact "Unknown enum value 10" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString(enum class)" tags="[enum][enumClass][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -20998,7 +20494,7 @@ loose text artifact "1" == "1" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString(enum w/operator<<)" tags="[enum][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -21017,7 +20513,7 @@ loose text artifact "E2{1}" == "E2{1}" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString(enum)" tags="[enum][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -21036,7 +20532,7 @@ loose text artifact "1" == "1" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21055,7 +20551,7 @@ loose text artifact "{ }" == "{ }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<float,int>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21074,7 +20570,7 @@ loose text artifact "{ 1.2f, 0 }" == "{ 1.2f, 0 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<int>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21085,7 +20581,7 @@ loose text artifact "{ 0 }" == "{ 0 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<string,string>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21098,7 +20594,7 @@ loose text artifact "{ "hello", "world" }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<tuple<int>,tuple<>,float>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21111,7 +20607,7 @@ loose text artifact "{ { 42 }, { }, 1.2f }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="uniform samples" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -21146,7 +20642,7 @@ loose text artifact 0.95 == 0.95 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="unique_ptr reimplementation: basic functionality" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Section name="Default constructed unique_ptr is empty" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21166,7 +20662,7 @@ loose text artifact 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Take ownership of allocation" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21210,9 +20706,9 @@ loose text artifact 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Take ownership of allocation" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21264,9 +20760,9 @@ loose text artifact 2 == 2 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Release releases ownership" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21285,7 +20781,7 @@ loose text artifact 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Move constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21312,7 +20808,7 @@ loose text artifact 1 == 1 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Move assignment" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21339,7 +20835,7 @@ loose text artifact 2 == 2 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="free swap" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21358,9 +20854,9 @@ loose text artifact 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vec<vec<string,alloc>> -> toString" tags="[toString][vector,allocator]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21381,7 +20877,7 @@ loose text artifact "{ { "hello" }, { "world" } }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vector<bool> -> toString" tags="[containers][toString][vector]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21408,7 +20904,7 @@ loose text artifact "{ true, false }" == "{ true, false }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vector<int,allocator> -> toString" tags="[toString][vector,allocator]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21435,7 +20931,7 @@ loose text artifact "{ 42, 250 }" == "{ 42, 250 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vector<int> -> toString" tags="[toString][vector]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21462,7 +20958,7 @@ loose text artifact "{ 42, 250 }" == "{ 42, 250 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vector<string> -> toString" tags="[toString][vector]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21491,7 +20987,7 @@ loose text artifact "{ "hello", "world" }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vectors can be sized and resized" tags="[vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -21527,7 +21023,7 @@ loose text artifact 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -21571,9 +21067,9 @@ loose text artifact 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -21608,7 +21104,7 @@ loose text artifact 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -21643,9 +21139,9 @@ loose text artifact 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="warmup" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -21664,7 +21160,7 @@ loose text artifact 310016000 ns > 100 ms </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="weighted_average_quantile" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -21691,17 +21187,17 @@ loose text artifact 23.0 == 23.0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="xmlentitycheck" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="encoded chars: these should all be encoded: &&&"""<<<&"<<&"" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <OverallResults successes="2129" failures="143" expectedFailures="27"/> - <OverallResultsCases successes="304" failures="83" expectedFailures="7"/> + <OverallResults successes="2048" failures="145" expectedFailures="32" skips="12"/> + <OverallResultsCases successes="308" failures="84" expectedFailures="11" skips="6"/> </Catch2TestRun> diff --git a/packages/Catch2/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 7a88f7de7f811b51093b4fdfa0ca12ece47a82fc..41dc8cb31522471f771534ff2fb0a878a870dcad 100644 --- a/packages/Catch2/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<Catch2TestRun name="<exe-name>" rng-seed="1" catch2-version="<version>" filters="~[!nonportable]~[!benchmark]~[approvals] *"> +<Catch2TestRun name="<exe-name>" rng-seed="1" xml-format-version="3" catch2-version="<version>" filters=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"> <TestCase name="# A test name that starts with a #" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1027: Bitfields can be captured" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -20,7 +20,7 @@ 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1147" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -71,16 +71,16 @@ {?} >= {?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1175 - Hidden Test" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1238" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > uarr := "123" </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > sarr := "456" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -91,10 +91,10 @@ 0 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > uarr := "123" </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > sarr := "456" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -105,16 +105,16 @@ 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1245" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1319: Sections can have description (even if it is not saved" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Section name="SectionName" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1403" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -125,24 +125,24 @@ [1403 helper] == [1403 helper] </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1455 - INFO and WARN can start with a linebreak" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This info message starts with a linebreak </Info> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This warning message starts with a linebreak </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="#1514: stderr/stdout is not captured in tests aborted by an exception" tags="[.][output-capture][regression]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > 1514 </Failure> - <OverallResult success="false"> + <OverallResult success="false" skips="0"> <StdOut> This would not be caught previously </StdOut> @@ -160,10 +160,10 @@ Nor would this true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <TestCase name="#1905 -- test spec parser properly clears internal state between compound tests" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <TestCase name="#1905 -- test spec parser properly clears internal state between compound tests" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase("spec . char")) </Original> @@ -171,7 +171,7 @@ Nor would this true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase("spec , char")) </Original> @@ -179,7 +179,7 @@ Nor would this true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> !(spec.matches(*fakeTestCase(R"(spec \, char)"))) </Original> @@ -187,11 +187,11 @@ Nor would this !false </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <TestCase name="#1912 -- test spec parser handles escaping" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="Various parentheses" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <TestCase name="#1912 -- test spec parser handles escaping" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > + <Section name="Various parentheses" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase(R"(spec {a} char)")) </Original> @@ -199,7 +199,7 @@ Nor would this true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase(R"(spec [a] char)")) </Original> @@ -207,7 +207,7 @@ Nor would this true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) </Original> @@ -215,10 +215,10 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="backslash in test name" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="backslash in test name" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpec.tests.cpp" > <Original> spec.matches(*fakeTestCase(R"(spec \ char)")) </Original> @@ -226,9 +226,9 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1913 - GENERATE inside a for loop should not keep recreating the generator" tags="[generators][regression]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -247,7 +247,7 @@ Nor would this 6 < 7 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1913 - GENERATEs can share a line" tags="[generators][regression]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -282,11 +282,11 @@ Nor would this 2 != 4 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - GENERATE after a section" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -297,7 +297,7 @@ Nor would this 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -308,7 +308,7 @@ Nor would this 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -319,9 +319,9 @@ Nor would this 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - Section followed by flat generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -333,7 +333,7 @@ Nor would this 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -351,7 +351,7 @@ Nor would this 3 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - flat generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -378,100 +378,100 @@ Nor would this 3 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - mixed sections and generates" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 5 </Info> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 6 </Info> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 4 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 5 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 4 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 6 </Info> <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 5 </Info> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 6 </Info> <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 4 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 5 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > i := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > j := 4 </Info> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > k := 6 </Info> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1938 - nested generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -618,16 +618,16 @@ Nor would this 3 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#2152 - ULP checks between differently signed values were wrong - double" tags="[floating-point][matchers][ulp]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -646,7 +646,7 @@ Nor would this 0.0 not is within 1 ULPs of -4.9406564584124654e-324 ([-9.8813129168249309e-324, -0.0000000000000000e+00]) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#2152 - ULP checks between differently signed values were wrong - float" tags="[floating-point][matchers][ulp]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -665,20 +665,26 @@ Nor would this 0.0f not is within 1 ULPs of -1.40129846e-45f ([-2.80259693e-45, -0.00000000e+00]) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="#2615 - Throwing in constructor generator fails test case but does not abort" tags="[!shouldfail]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Exception filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + failure to init + </Exception> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="outside assertions" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > answer := 42 </Info> <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > expected exception </Exception> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="inside REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > answer := 42 </Info> <Expression success="false" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -692,10 +698,10 @@ Nor would this expected exception </Exception> </Expression> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="inside REQUIRE_THROWS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > answer := 42 </Info> <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -706,9 +712,9 @@ Nor would this thisThrows() </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#809" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -719,7 +725,7 @@ Nor would this 42 == {?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#833" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -778,7 +784,7 @@ Nor would this true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#835 -- errno should not be touched by Catch2" tags="[!shouldfail][.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -797,10 +803,10 @@ Nor would this 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#872" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > dummy := 0 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -811,25 +817,25 @@ Nor would this {?} == 4 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="#961 -- Dynamically created sections should all be reported" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Looped section 0" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Looped section 1" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Looped section 2" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Looped section 3" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Looped section 4" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="'Not' checks that should fail" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -896,7 +902,7 @@ Nor would this !(1 == 1) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="'Not' checks that should succeed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -963,7 +969,7 @@ Nor would this !(1 == 2) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="(unimplemented) static bools can be evaluated" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Section name="compare to true" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -983,7 +989,7 @@ Nor would this true == true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="compare to false" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -1002,7 +1008,7 @@ Nor would this false == false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="negation" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -1013,7 +1019,7 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="double negation" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -1024,7 +1030,7 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="direct" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -1043,9 +1049,9 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="3x3x3 ints" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -1696,7 +1702,7 @@ Nor would this 3 < 9 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A METHOD_AS_TEST_CASE based test run that fails" tags="[.][class][failing]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1707,7 +1713,7 @@ Nor would this "hello" == "world" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A METHOD_AS_TEST_CASE based test run that succeeds" tags="[class]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1718,7 +1724,7 @@ Nor would this "hello" == "hello" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1729,7 +1735,7 @@ Nor would this 0 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1740,7 +1746,7 @@ Nor would this 0 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1751,7 +1757,7 @@ Nor would this 0 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1762,7 +1768,7 @@ Nor would this 0 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1773,7 +1779,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1784,7 +1790,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1795,7 +1801,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1806,7 +1812,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1817,7 +1823,7 @@ Nor would this 6 < 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1828,7 +1834,7 @@ Nor would this 2 < 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1839,7 +1845,7 @@ Nor would this 6 < 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1850,7 +1856,7 @@ Nor would this 2 < 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1861,7 +1867,7 @@ Nor would this 6 >= 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1872,7 +1878,7 @@ Nor would this 2 >= 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1883,7 +1889,7 @@ Nor would this 6 >= 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1894,7 +1900,7 @@ Nor would this 2 >= 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1905,7 +1911,7 @@ Nor would this 1.0 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1916,7 +1922,7 @@ Nor would this 1.0f == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1927,7 +1933,7 @@ Nor would this 1 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1938,7 +1944,7 @@ Nor would this 1.0 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1949,7 +1955,7 @@ Nor would this 1.0f == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1960,7 +1966,7 @@ Nor would this 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1971,7 +1977,7 @@ Nor would this 1 == 0 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1982,7 +1988,7 @@ Nor would this 3 == 0 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -1993,7 +1999,7 @@ Nor would this 6 == 0 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2004,7 +2010,7 @@ Nor would this 1 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2015,7 +2021,7 @@ Nor would this 3 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2026,7 +2032,7 @@ Nor would this 6 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[.][class][failing]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2037,7 +2043,7 @@ Nor would this 1 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A TEST_CASE_METHOD based test run that succeeds" tags="[class]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -2048,7 +2054,7 @@ Nor would this 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case - Foo<float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2059,7 +2065,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case - Foo<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2070,7 +2076,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case - std::vector<float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2081,7 +2087,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case - std::vector<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2092,7 +2098,7 @@ Nor would this 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case with array signature - Bar<float, 42>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2103,7 +2109,7 @@ Nor would this 42 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case with array signature - Bar<int, 9>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2114,7 +2120,7 @@ Nor would this 9 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case with array signature - std::array<float, 42>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2125,7 +2131,7 @@ Nor would this 42 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A Template product test case with array signature - std::array<int, 9>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -2136,7 +2142,7 @@ Nor would this 9 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A comparison that uses literals instead of the normal constructor" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2187,19 +2193,19 @@ Nor would this 1.23 == Approx( 1.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="A couple of nested sections followed by a failure" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Outer" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Inner" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > to infinity and beyond </Failure> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="A failing expression with a non streamable type is still captured" tags="[.][failing][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -2218,7 +2224,7 @@ Nor would this {?} == {?} </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Absolute margin" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2269,10 +2275,10 @@ Nor would this 100.3 == Approx( 100.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="An empty test with no assertions" tags="[empty]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="An expression with side-effects should only be evaluated once" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -2291,7 +2297,7 @@ Nor would this 8 == 8 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="An unchecked exception reports the line of the last assertion" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -2313,10 +2319,10 @@ Nor would this unexpected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Anonymous test case 1" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approx setters validate their arguments" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2375,7 +2381,7 @@ Nor would this Approx(0).epsilon(1.0001), std::domain_error </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approx with exactly-representable margin" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2418,7 +2424,7 @@ Nor would this 245.5f == Approx( 245.25 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate PI" tags="[Approx][PI]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2437,7 +2443,7 @@ Nor would this 3.1428571429 != Approx( 3.141 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate comparisons with different epsilons" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2456,7 +2462,7 @@ Nor would this 1.23 == Approx( 1.231 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate comparisons with floats" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2475,7 +2481,7 @@ Nor would this 0.0f == Approx( 0.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate comparisons with ints" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2494,7 +2500,7 @@ Nor would this 0 == Approx( 0.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Approximate comparisons with mixed numeric types" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -2537,7 +2543,7 @@ Nor would this 1.234 == Approx( 1.2339999676 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Arbitrary predicate matcher" tags="[generic][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Function pointer" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -2557,7 +2563,7 @@ Nor would this 1 not matches predicate: "always false" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Lambdas + different type" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -2576,9 +2582,9 @@ Nor would this "This wouldn't pass" not matches undescribed predicate </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Assertion macros support bit operators and bool conversions" tags="[bitops][compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -2621,7 +2627,7 @@ Nor would this !(Val: 1 ^ Val: 1) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Assertions then sections" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -2650,9 +2656,9 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Original> @@ -2680,11 +2686,11 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Basic use of the Contains range matcher" tags="[contains][matchers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Different argument ranges, same element type, default comparison" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2712,7 +2718,7 @@ Nor would this { 4, 5, 6 } not contains element 1 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Different argument ranges, same element type, custom comparison" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2739,7 +2745,7 @@ Nor would this { 4, 5, 6 } not contains element 0 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Different element type, custom comparisons" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2750,7 +2756,7 @@ Nor would this { "abc", "abcd", "abcde" } contains element 4 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Can handle type that requires ADL-found free function begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2769,7 +2775,7 @@ Nor would this { 1, 2, 3, 4, 5 } not contains element 8 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Initialization with move only types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2788,7 +2794,7 @@ Nor would this { 1, 2, 3 } not contains element 9 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Matching using matcher" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2799,9 +2805,9 @@ Nor would this { 1.0, 2.0, 3.0, 0.0 } contains element matching is within 0.5 of 0.5 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Basic use of the Empty range matcher" tags="[empty][matchers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Simple, std-provided containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2853,7 +2859,7 @@ Nor would this { } is empty </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type with empty" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2864,7 +2870,7 @@ Nor would this {?} not is empty </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type requires ADL found empty free function" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -2875,97 +2881,97 @@ Nor would this {?} is empty </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CAPTURE can deal with complex expressions" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > a := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > b := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > c := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > a + b := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > a+b := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > c > b := true </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > a == 1 := true </Info> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CAPTURE can deal with complex expressions involving commas" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > std::vector<int>{1, 2, 3}[0, 1, 2] := 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > std::vector<int>{1, 2, 3}[(0, 1)] := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > std::vector<int>{1, 2, 3}[0] := 1 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > (helper_1436<int, int>{12, -12}) := { 12, -12 } </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > (helper_1436<int, int>(-12, 12)) := { -12, 12 } </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > (1, 2) := 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > (2, 3) := 3 </Info> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CAPTURE parses string and character constants" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > ("comma, in string", "escaped, \", ") := "escaped, ", " </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > "single quote in string,'," := "single quote in string,'," </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > "some escapes, \\,\\\\" := "some escapes, \,\\" </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > "some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<" </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '"' := '"' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '\'' := ''' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > ',' := ',' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '}' := '}' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > ')' := ')' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '(' := '(' </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > '{' := '{' </Info> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Capture and info messages" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="Capture should stringify like assertions" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > i := 2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -2976,10 +2982,10 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Info should NOT stringify the way assertions do" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > 3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -2990,9 +2996,9 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CaseInsensitiveEqualsTo is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > <Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > @@ -3012,7 +3018,7 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > @@ -3063,9 +3069,9 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="CaseInsensitiveLess is case insensitive" tags="[comparisons][string-case]" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > <Section name="Degenerate cases" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > @@ -3093,7 +3099,7 @@ Nor would this !false </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Plain comparisons" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Details.tests.cpp" > @@ -3128,9 +3134,9 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Character pretty printing" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="Specifically escaped" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -3166,7 +3172,7 @@ Nor would this '\f' == '\f' </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="General chars" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -3209,7 +3215,7 @@ Nor would this 'Z' == 'Z' </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Low ASCII" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -3252,9 +3258,9 @@ Nor would this 5 == 5 </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Clara::Arg supports single-arg parse the way Opt does" tags="[arg][clara][compilation]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > @@ -3273,7 +3279,7 @@ Nor would this "foo" == "foo" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Clara::Opt supports accept-many lambdas" tags="[clara][opt]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > <Section name="Parsing fails on multiple options without accept_many" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > @@ -3285,7 +3291,7 @@ Nor would this !{?} </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Parsing succeeds on multiple options with accept_many" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > @@ -3304,9 +3310,9 @@ Nor would this { "aaa", "bbb" } == { "aaa", "bbb" } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="ColourGuard behaviour" tags="[console-colours]" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > <Section name="ColourGuard is disengaged by default" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > @@ -3318,7 +3324,7 @@ Nor would this true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="ColourGuard is engaged by op<<" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > @@ -3341,7 +3347,7 @@ Using code: 0 " </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="ColourGuard can be engaged explicitly" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/ColourImpl.tests.cpp" > @@ -3364,9 +3370,9 @@ C " </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining MatchAllOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3393,7 +3399,7 @@ C 1 ( equals: (int) 1 or (string) "1" and equals: (long long) 1 and equals: (T) 1 and equals: true ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining MatchAnyOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3420,7 +3426,7 @@ C 1 ( equals: (int) 1 or (string) "1" or equals: (long long) 1 or equals: (T) 1 or equals: true ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining MatchNotOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3455,10 +3461,10 @@ C 1 equals: (int) 1 or (string) "1" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining concrete matchers does not use templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining only templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3485,7 +3491,7 @@ C 1 ( equals: (int) 1 or (string) "1" or not equals: (long long) 1 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining templated and concrete matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3544,7 +3550,7 @@ C "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Combining templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -3555,7 +3561,7 @@ C { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Commas in various macros are allowed" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -3654,7 +3660,7 @@ C { 1, 2 } == { 1, 2 } </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparing function pointers" tags="[function pointer][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -3673,7 +3679,7 @@ C 0x<hex digits> == 0x<hex digits> </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparison ops" tags="[rng]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -3708,7 +3714,7 @@ C !({?} != {?}) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparison with explicitly convertible types" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -3807,7 +3813,7 @@ C Approx( 11.0 ) >= StrongDoubleTypedef(10) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparisons between ints where one side is computed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -3818,7 +3824,7 @@ C 54 == 54 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -3869,7 +3875,7 @@ C -2147483648 > 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Comparisons with int literals don't warn when mixing signed/ unsigned" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -3976,7 +3982,7 @@ C 4294967295 (0x<hex digits>) > 4 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Composed generic matchers shortcircuit" tags="[composed][generic][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="MatchAllOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4004,7 +4010,7 @@ C true </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="MatchAnyOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4031,9 +4037,9 @@ C true </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Composed matchers shortcircuit" tags="[composed][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="MatchAllOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4061,7 +4067,7 @@ C true </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="MatchAnyOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4088,9 +4094,9 @@ C true </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Contains string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4109,7 +4115,7 @@ C "this string contains 'abc' as a substring" contains: "STRING" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Copy and then generate a range" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4121,7 +4127,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4132,7 +4138,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4143,7 +4149,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4154,7 +4160,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4165,7 +4171,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4176,7 +4182,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4187,7 +4193,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4198,7 +4204,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4209,7 +4215,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4220,7 +4226,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4231,7 +4237,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4242,7 +4248,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Final validation" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -4261,9 +4267,9 @@ C 6 == 6 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Cout stream properly declares it writes to stdout" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -4274,7 +4280,7 @@ C true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4288,7 +4294,7 @@ C custom exception - not std </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Custom exceptions can be translated when testing for throwing as something else" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4302,13 +4308,13 @@ C custom exception - not std </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Custom std-exceptions can be custom translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > custom std exception </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Default scale is invisible to comparison" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -4327,7 +4333,7 @@ C 0.00001 != Approx( 0.0000001 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Directly creating an EnumInfo" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -4356,7 +4362,13 @@ C "{** unexpected enum value **}" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Empty generators can SKIP in constructor" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + This generator is empty + </Skip> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="Empty stream name opens cout stream" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -4367,18 +4379,7 @@ C true </Expanded> </Expression> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Empty tag is not allowed" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > - <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > - <Original> - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) - </Original> - <Expanded> - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo ) - </Expanded> - </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="EndsWith string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4397,7 +4398,7 @@ C "this string contains 'abc' as a substring" ends with: "this" (case insensitive) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Enums can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -4442,7 +4443,7 @@ C "Value2" == "Value2" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -4461,7 +4462,7 @@ C "Blue" == "Blue" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Epsilon only applies to Approx's value" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -4472,7 +4473,7 @@ C 101.01 != Approx( 100.0 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Equality checks that should fail" tags="[!mayfail][.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -4579,7 +4580,7 @@ C 1.3 == Approx( 1.301 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Equality checks that should succeed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -4638,7 +4639,7 @@ C 1.3 == Approx( 1.3 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Equals" tags="[matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4657,7 +4658,7 @@ C "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Equals string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4676,7 +4677,7 @@ C "this string contains 'abc' as a substring" equals: "something else" (case insensitive) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" tags="[exception][toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -4707,7 +4708,7 @@ C "StringMakerException" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Exception matchers that fail" tags="[!throws][.][exceptions][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="No exception" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4727,7 +4728,7 @@ C doesNotThrow(), SpecialException, ExceptionMatcher{ 1 } </Expanded> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> <Section name="Type mismatch" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4752,7 +4753,7 @@ C Unknown exception </Exception> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> <Section name="Contents are wrong" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4771,9 +4772,9 @@ C SpecialException::what special exception has value of 1 </Expanded> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Exception matchers that succeed" tags="[!throws][exceptions][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4792,7 +4793,42 @@ C SpecialException::what special exception has value of 2 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Exception message can be matched" tags="[!throws][exceptions][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsDerivedException(), DerivedException, MessageMatches( StartsWith( "Derived" ) ) + </Original> + <Expanded> + DerivedException::what matches "starts with: "Derived"" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsDerivedException(), DerivedException, MessageMatches( EndsWith( "::what" ) ) + </Original> + <Expanded> + DerivedException::what matches "ends with: "::what"" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsDerivedException(), DerivedException, MessageMatches( !StartsWith( "::what" ) ) + </Original> + <Expanded> + DerivedException::what matches "not starts with: "::what"" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsSpecialException( 2 ), SpecialException, MessageMatches( StartsWith( "Special" ) ) + </Original> + <Expanded> + SpecialException::what matches "starts with: "Special"" + </Expanded> + </Expression> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Exception messages can be tested for" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="exact match" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4804,7 +4840,7 @@ C "expected exception" equals: "expected exception" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="different case" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4815,7 +4851,7 @@ C "expected exception" equals: "expected exception" (case insensitive) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="wildcarded" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4850,9 +4886,9 @@ C "expected exception" contains: "except" (case insensitive) </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Exceptions matchers" tags="[!throws][exceptions][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -4887,7 +4923,7 @@ C SpecialException::what exception message matches "SpecialException::what" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK_THROWS_AS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -4920,26 +4956,26 @@ C expected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="FAIL aborts the test" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This is a failure </Failure> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="FAIL does not require an argument" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" /> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="FAIL_CHECK does not abort the test" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This is a failure </Failure> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > This message appears in the output </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Factorials are computed" tags="[factorial]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -4982,7 +5018,18 @@ C 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Filter generator throws exception for empty generator" tags="[generators]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException + </Original> + <Expanded> + filter( []( int ) { return false; }, value( 3 ) ), Catch::GeneratorException + </Expanded> + </Expression> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Floating point matchers: double" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Relative" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5027,9 +5074,9 @@ C 0.0 and 2.22507e-308 are within 2.22045e-12% of each other </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Margin" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5096,7 +5143,7 @@ C -10.0 is within 0.5 of -9.6 </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="ULPs" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5155,7 +5202,7 @@ C -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5182,7 +5229,7 @@ C 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Constructor validation" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5233,9 +5280,20 @@ C WithinRel( 1., 1. ), std::domain_error </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="IsNaN" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !IsNaN() + </Original> + <Expanded> + 1.0 not is NaN + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Floating point matchers: float" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Relative" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5280,9 +5338,9 @@ C 0.0f and 1.17549e-38 are within 0.00119209% of each other </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Margin" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5357,7 +5415,7 @@ C -10.0f is within 0.5 of -9.6000003815 </Expanded> </Expression> - <OverallResults successes="9" failures="0" expectedFailures="0"/> + <OverallResults successes="9" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="ULPs" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5424,7 +5482,7 @@ C -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5451,7 +5509,7 @@ C 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Constructor validation" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -5510,9 +5568,20 @@ C WithinRel( 1.f, 1.f ), std::domain_error </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="IsNaN" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !IsNaN() + </Original> + <Expanded> + 1.0 not is NaN + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Generators -- adapters" tags="[generators][generic]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5525,9 +5594,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5539,9 +5608,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5553,9 +5622,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Throws if there are no matching values" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5567,9 +5636,9 @@ C filter([] (int) {return false; }, value(1)), Catch::GeneratorException </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5580,7 +5649,7 @@ C 1 < 4 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5591,7 +5660,7 @@ C 2 < 4 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5602,7 +5671,7 @@ C 3 < 4 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5614,9 +5683,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5628,9 +5697,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5642,9 +5711,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5656,9 +5725,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5670,9 +5739,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5684,9 +5753,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5698,9 +5767,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5712,9 +5781,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5726,9 +5795,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5739,7 +5808,7 @@ C 1 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5750,7 +5819,7 @@ C 2 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5761,7 +5830,7 @@ C 3 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5772,7 +5841,7 @@ C 1 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5783,7 +5852,7 @@ C 2 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5794,7 +5863,7 @@ C 3 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5814,9 +5883,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5836,9 +5905,9 @@ C 2 == 2 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5858,9 +5927,9 @@ C 3 == 3 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is not divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5888,9 +5957,9 @@ C 1 < 3 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Number of elements in source is not divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5918,9 +5987,9 @@ C 2 < 3 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5932,9 +6001,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5946,9 +6015,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5960,9 +6029,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="Throws on too small generators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5974,11 +6043,11 @@ C chunk(2, value(1)), Catch::GeneratorException </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Generators -- simple" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -5990,7 +6059,7 @@ C -3 < 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6001,7 +6070,7 @@ C -2 < 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6012,7 +6081,7 @@ C -1 < 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6023,7 +6092,7 @@ C 4 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6034,7 +6103,7 @@ C 4 > 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6045,7 +6114,7 @@ C 4 > 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6056,7 +6125,7 @@ C -3 < 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6067,7 +6136,7 @@ C -2 < 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6078,7 +6147,7 @@ C -1 < 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6089,7 +6158,7 @@ C 8 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6100,7 +6169,7 @@ C 8 > 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6111,7 +6180,7 @@ C 8 > 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6122,7 +6191,7 @@ C -3 < 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6133,7 +6202,7 @@ C -2 < 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6144,7 +6213,7 @@ C -1 < 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6155,7 +6224,7 @@ C 12 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6166,7 +6235,7 @@ C 12 > 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -6177,9 +6246,9 @@ C 12 > 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Generators internals" tags="[generators][internals]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Single value" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6199,7 +6268,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Preset values" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6250,7 +6319,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Generator combinator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6333,7 +6402,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Explicitly typed generator sequence" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6392,7 +6461,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Simple filtering" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6428,9 +6497,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Filter out multiple elements at the start and end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6466,9 +6535,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Throws on construction if it can't get initial element" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6488,9 +6557,9 @@ C filter([](int) { return false; }, values({ 1, 2, 3 })), Catch::GeneratorException </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Take generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Take less" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6526,9 +6595,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Take generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Take more" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6548,9 +6617,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Map with explicit return type" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6601,7 +6670,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Map with deduced return type" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6652,7 +6721,7 @@ C !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Singular repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6672,9 +6741,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Actual repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6774,9 +6843,9 @@ C !false </Expanded> </Expression> - <OverallResults successes="12" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="12" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive auto step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6845,11 +6914,11 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Negative auto step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6918,11 +6987,11 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -6992,13 +7061,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7068,13 +7137,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7160,19 +7229,19 @@ C !false </Expanded> </Expression> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Exact" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7183,7 +7252,7 @@ C -1.0 == Approx( -1.0 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7194,7 +7263,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7205,7 +7274,7 @@ C -0.9 == Approx( -0.9 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7216,7 +7285,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7227,7 +7296,7 @@ C -0.8 == Approx( -0.8 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7238,7 +7307,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7249,7 +7318,7 @@ C -0.7 == Approx( -0.7 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7260,7 +7329,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7271,7 +7340,7 @@ C -0.6 == Approx( -0.6 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7282,7 +7351,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7293,7 +7362,7 @@ C -0.5 == Approx( -0.5 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7304,7 +7373,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7315,7 +7384,7 @@ C -0.4 == Approx( -0.4 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7326,7 +7395,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7337,7 +7406,7 @@ C -0.3 == Approx( -0.3 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7348,7 +7417,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7359,7 +7428,7 @@ C -0.2 == Approx( -0.2 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7370,7 +7439,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7381,7 +7450,7 @@ C -0.1 == Approx( -0.1 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7392,7 +7461,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1.38778e-16 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7403,7 +7472,7 @@ C -0.0 == Approx( -0.0 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1.38778e-16 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7414,7 +7483,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7425,7 +7494,7 @@ C 0.1 == Approx( 0.1 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7436,7 +7505,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7447,7 +7516,7 @@ C 0.2 == Approx( 0.2 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7458,7 +7527,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7469,7 +7538,7 @@ C 0.3 == Approx( 0.3 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7480,7 +7549,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7491,7 +7560,7 @@ C 0.4 == Approx( 0.4 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7502,7 +7571,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7513,7 +7582,7 @@ C 0.5 == Approx( 0.5 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7524,7 +7593,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7535,7 +7604,7 @@ C 0.6 == Approx( 0.6 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7546,7 +7615,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7557,7 +7626,7 @@ C 0.7 == Approx( 0.7 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7568,7 +7637,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7579,7 +7648,7 @@ C 0.8 == Approx( 0.8 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7590,7 +7659,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7601,7 +7670,7 @@ C 0.9 == Approx( 0.9 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7628,19 +7697,19 @@ C !false </Expanded> </Expression> - <OverallResults successes="42" failures="0" expectedFailures="0"/> + <OverallResults successes="42" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="42" failures="0" expectedFailures="0"/> + <OverallResults successes="42" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="42" failures="0" expectedFailures="0"/> + <OverallResults successes="42" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="42" failures="0" expectedFailures="0"/> + <OverallResults successes="42" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Slightly over end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7651,7 +7720,7 @@ C -1.0 == Approx( -1.0 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7662,7 +7731,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7673,7 +7742,7 @@ C -0.7 == Approx( -0.7 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7684,7 +7753,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7695,7 +7764,7 @@ C -0.4 == Approx( -0.4 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7706,7 +7775,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7717,7 +7786,7 @@ C -0.1 == Approx( -0.1 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7728,7 +7797,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7739,7 +7808,7 @@ C 0.2 == Approx( 0.2 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7750,7 +7819,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7761,7 +7830,7 @@ C 0.5 == Approx( 0.5 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7780,19 +7849,19 @@ C !false </Expanded> </Expression> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Slightly under end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7803,7 +7872,7 @@ C -1.0 == Approx( -1.0 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7814,7 +7883,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7825,7 +7894,7 @@ C -0.7 == Approx( -0.7 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7836,7 +7905,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7847,7 +7916,7 @@ C -0.4 == Approx( -0.4 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7858,7 +7927,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7869,7 +7938,7 @@ C -0.1 == Approx( -0.1 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is -0.1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7880,7 +7949,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7891,7 +7960,7 @@ C 0.2 == Approx( 0.2 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7902,7 +7971,7 @@ C true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7913,7 +7982,7 @@ C 0.5 == Approx( 0.5 ) </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > Current expected value is 0.5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -7932,13 +8001,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="13" failures="0" expectedFailures="0"/> + <OverallResults successes="13" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -8008,13 +8077,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -8084,13 +8153,13 @@ C !false </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > @@ -8176,15 +8245,15 @@ C !false </Expanded> </Expression> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Greater-than inequalities with different epsilons" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -8219,7 +8288,7 @@ C 1.23 >= Approx( 1.24 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Hashers with different seed produce different hash with same test case" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8232,7 +8301,7 @@ C 130711275 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Hashers with same seed produce same hash" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8245,7 +8314,7 @@ C 3422778688 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Hashing different test cases produces different result" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Section name="Different test name" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8259,7 +8328,7 @@ C 2668622104 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Different classname" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8272,7 +8341,7 @@ C 3916075712 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Different tags" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8285,9 +8354,9 @@ C 3429949824 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Hashing test case produces same hash across multiple calls" tags="[test-case-hash]" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestCaseInfoHasher.tests.cpp" > @@ -8300,22 +8369,22 @@ C 3422778688 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="INFO and WARN do not abort tests" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this is a message </Info> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this is a warning </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="INFO gets logged on failure" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message should be logged </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > so should this </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8326,10 +8395,10 @@ C 2 == 1 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message may be logged later </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8340,10 +8409,10 @@ C 2 == 2 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message may be logged later </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message should be logged </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8354,13 +8423,13 @@ C 2 == 1 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message may be logged later </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message should be logged </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > and this, but later </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8371,16 +8440,16 @@ C 2 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message may be logged later </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this message should be logged </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > and this, but later </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > but not this </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8391,13 +8460,13 @@ C 2 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="INFO is reset for each loop" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 0 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 0 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8408,10 +8477,10 @@ C 0 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 1 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 1 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8422,10 +8491,10 @@ C 1 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 2 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8436,10 +8505,10 @@ C 2 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 3 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 3 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8450,10 +8519,10 @@ C 3 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 4 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 4 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8464,10 +8533,10 @@ C 4 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 5 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 5 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8478,10 +8547,10 @@ C 5 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 6 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 6 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8492,10 +8561,10 @@ C 6 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 7 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 7 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8506,10 +8575,10 @@ C 7 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 8 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 8 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8520,10 +8589,10 @@ C 8 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 9 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 9 </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8534,10 +8603,10 @@ C 9 < 10 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > current counter 10 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 10 </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -8548,7 +8617,7 @@ C 10 < 10 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Inequality checks that should fail" tags="[!shouldfail][.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -8591,7 +8660,7 @@ C 5 != 5 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Inequality checks that should succeed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -8682,7 +8751,7 @@ C 5 != 6 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Lambdas in assertions" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -8693,7 +8762,7 @@ C true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Less-than inequalities with different epsilons" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -8728,10 +8797,10 @@ C 1.23 <= Approx( 1.22 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="ManuallyRegistered" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be (AllOf) composed with the && operator" tags="[matchers][operator&&][operators]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8742,7 +8811,7 @@ C "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be (AnyOf) composed with the || operator" tags="[matchers][operators][operator||]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8761,7 +8830,7 @@ C "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be composed with both && and ||" tags="[matchers][operator&&][operators][operator||]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8772,7 +8841,7 @@ C "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be composed with both && and || - failing" tags="[.][failing][matchers][operator&&][operators][operator||]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8783,7 +8852,7 @@ C "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Matchers can be negated (Not) with the ! operator" tags="[matchers][not][operators]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8794,7 +8863,7 @@ C "this string contains 'abc' as a substring" not contains: "different" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Matchers can be negated (Not) with the ! operator - failing" tags="[.][failing][matchers][not][operators]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -8805,44 +8874,44 @@ C "this string contains 'abc' as a substring" not contains: "substring" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Mayfail test case with nested sections" tags="[!mayfail]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="1" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="2" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="A" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > - <OverallResults successes="0" failures="0" expectedFailures="0"/> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="1" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Section name="2" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" /> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResults successes="0" failures="0" expectedFailures="1"/> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> <Section name="B" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > - <OverallResults successes="0" failures="0" expectedFailures="0"/> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Mismatching exception messages failing the test" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -8861,7 +8930,7 @@ C "expected exception" equals: "should fail" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Multireporter calls reporters and listeners in correct order" tags="[multi-reporter][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -8874,7 +8943,7 @@ C { "Hello", "world", "Goodbye", "world" } </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Multireporter updates ReporterPreferences properly" tags="[multi-reporter][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -8942,7 +9011,7 @@ C true == true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -9009,9 +9078,9 @@ C true == true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Nested generators and captured variables" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -9142,19 +9211,19 @@ C 99 > -6 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Nice descriptive name" tags="[.][tag1][tag2][tag3]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > This one ran </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Non-std exceptions can be translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > custom exception </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Objects that evaluated in boolean contexts can be checked" tags="[SafeBool][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -9181,10 +9250,10 @@ C !{?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Optionally static assertions" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Ordering comparison checks that should fail" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -9339,7 +9408,7 @@ C "hello" <= "a" </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Ordering comparison checks that should succeed" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -9478,7 +9547,7 @@ C "hello" > "a" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Our PCG implementation provides expected results for known seeds" tags="[rng]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Section name="Default seeded" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -9532,7 +9601,7 @@ C 1827115164 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Specific seed" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -9635,24 +9704,24 @@ C 4261393167 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Output from all sections is reported" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Section name="one" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Message from section one </Failure> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Message from section two </Failure> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Overloaded comma or address-of operators are not used" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -9687,1548 +9756,329 @@ C ( EvilMatcher() && EvilMatcher() ) || !EvilMatcher() </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <TestCase name="Parse test names and tags" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="Empty test spec should have no filters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <TestCase name="Parse uints" tags="[parse-numbers]" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > + <Section name="proper inputs" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.hasFilters() == false + parseUInt( "0" ) == Optional<unsigned int>{ 0 } </Original> <Expanded> - false == false + {?} == {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcA ) == false + parseUInt( "100" ) == Optional<unsigned int>{ 100 } </Original> <Expanded> - false == false + {?} == {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcB ) == false + parseUInt( "4294967295" ) == Optional<unsigned int>{ 4294967295 } </Original> <Expanded> - false == false + {?} == {?} </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Test spec from empty string should have no filters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.hasFilters() == false + parseUInt( "0x<hex digits>", 16 ) == Optional<unsigned int>{ 255 } </Original> <Expanded> - false == false + {?} == {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Bad inputs" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcA ) == false + !(parseUInt( "" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcB ) == false + !(parseUInt( "!!KJHF*#" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Test spec from just a comma should have no filters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.hasFilters() == false + !(parseUInt( "-1" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcA ) == false + !(parseUInt( "4294967296" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcB ) == false + !(parseUInt( "42949672964294967296429496729642949672964294967296" )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Test spec from name should have one filter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.hasFilters() == true + !(parseUInt( "2 4" )) </Original> <Expanded> - true == true + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Parse.tests.cpp" > <Original> - spec.matches( *tcA ) == false + !(parseUInt( "0x<hex digits>", 10 )) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Parsed tags are matched case insensitive" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Parsing sharding-related cli flags" tags="[sharding]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="shard-count" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcB ) == true + cli.parse({ "test", "--shard-count=8" }) </Original> <Expanded> - true == true + {?} </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Test spec from quoted name should have one filter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.hasFilters() == true + config.shardCount == 8 </Original> <Expanded> - true == true + 8 == 8 </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Negative shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcA ) == false + !(result) </Original> <Expanded> - false == false + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcB ) == true + result.errorMessage(), ContainsSubstring( "Could not parse '-1' as shard count" ) </Original> <Expanded> - true == true + "Could not parse '-1' as shard count" contains: "Could not parse '-1' as shard count" </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Test spec from name should have one filter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Zero shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.hasFilters() == true + !(result) </Original> <Expanded> - true == true + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcA ) == false + result.errorMessage(), ContainsSubstring( "Shard count must be positive" ) </Original> <Expanded> - false == false + "Shard count must be positive" contains: "Shard count must be positive" </Expanded> </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="shard-index" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcB ) == true + cli.parse({ "test", "--shard-index=2" }) </Original> <Expanded> - true == true + {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcC ) == false + config.shardIndex == 2 </Original> <Expanded> - false == false + 2 == 2 </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Wildcard at the start" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Negative shard index reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.hasFilters() == true + !(result) </Original> <Expanded> - true == true + !{?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcA ) == false + result.errorMessage(), ContainsSubstring( "Could not parse '-12' as shard index" ) </Original> <Expanded> - false == false + "Could not parse '-12' as shard index" contains: "Could not parse '-12' as shard index" </Expanded> </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Shard index 0 is accepted" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcB ) == false + cli.parse({ "test", "--shard-index=0" }) </Original> <Expanded> - false == false + {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcC ) == true + config.shardIndex == 0 </Original> <Expanded> - true == true + 0 == 0 </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Parsing tags with non-alphabetical characters is pass-through" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[tag with spaces]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.hasFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.getInvalidSpecs().empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + tagString := "[I said "good day" sir!]" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > + <Original> + spec.matches( testCase ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Parsing warnings" tags="[cli][warnings]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="NoAssertions" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> - spec.matches( *tcD ) == false + cli.parse( { "test", "-w", "NoAssertions" } ) </Original> <Expanded> - false == false + {?} </Expanded> </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - parseTestSpec( "*a" ).matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> - </Section> - <Section name="Wildcard at the end" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - parseTestSpec( "a*" ).matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> - </Section> - <Section name="Wildcard at both ends" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - parseTestSpec( "*a*" ).matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> - </Section> - <Section name="Redundant wildcard at the start" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Redundant wildcard at the end" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Redundant wildcard at both ends" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> - </Section> - <Section name="Wildcard at both ends, redundant at start" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Just wildcard" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Single tag" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="Single tag, two matches" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="Two tags" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="Two tags, spare separated" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="Wildcarded name and tag" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Single tag exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="One tag exclusion and one tag inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <Section name="One tag exclusion and one wldcarded name inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="One tag exclusion, using exclude:, and one wldcarded name inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="name exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="wildcarded name exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="wildcarded name exclusion with tag inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="wildcarded name exclusion, using exclude:, with tag inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="two wildcarded names" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="empty tag" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="empty quoted name" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="quoted string followed by tag exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.hasFilters() == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcA ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcB ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcC ) == false - </Original> - <Expanded> - false == false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *tcD ) == true - </Original> - <Expanded> - true == true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Leading and trailing spaces in test spec" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark" ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( "aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( "aardvark" ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Leading and trailing spaces in test name" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark" ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( " aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( "aardvark " ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches( *fakeTestCase( "aardvark" ) ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> - </Section> - <Section name="Shortened hide tags are split apart when parsing" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Shortened hide tags also properly handle exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(spec.matches(*fakeTestCase("only hidden", "[.]"))) - </Original> - <Expanded> - !false - </Expanded> - </Expression> - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> - </Section> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Parsed tags are matched case insensitive" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.hasFilters() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.getInvalidSpecs().empty() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.matches( testCase ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Parsing sharding-related cli flags" tags="[sharding]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="shard-count" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - cli.parse({ "test", "--shard-count=8" }) - </Original> - <Expanded> - {?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - config.shardCount == 8 - </Original> - <Expanded> - 8 == 8 - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Negative shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(result) - </Original> - <Expanded> - !{?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") - </Original> - <Expanded> - "Shard count must be a positive number" contains: "Shard count must be a positive number" - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Zero shard count reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(result) - </Original> - <Expanded> - !{?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - result.errorMessage(), ContainsSubstring("Shard count must be a positive number") - </Original> - <Expanded> - "Shard count must be a positive number" contains: "Shard count must be a positive number" - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="shard-index" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - cli.parse({ "test", "--shard-index=2" }) - </Original> - <Expanded> - {?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - config.shardIndex == 2 - </Original> - <Expanded> - 2 == 2 - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Negative shard index reports error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - !(result) - </Original> - <Expanded> - !{?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") - </Original> - <Expanded> - "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Shard index 0 is accepted" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - cli.parse({ "test", "--shard-index=0" }) - </Original> - <Expanded> - {?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - config.shardIndex == 0 - </Original> - <Expanded> - 0 == 0 - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Parsing tags with non-alphabetical characters is pass-through" tags="[test-spec][test-spec-parser]" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Info> - tagString := "[tag with spaces]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.hasFilters() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[tag with spaces]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.getInvalidSpecs().empty() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[tag with spaces]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.matches( testCase ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[I said "good day" sir!]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.hasFilters() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[I said "good day" sir!]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.getInvalidSpecs().empty() - </Original> - <Expanded> - true - </Expanded> - </Expression> - <Info> - tagString := "[I said "good day" sir!]" - </Info> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/TestSpecParser.tests.cpp" > - <Original> - spec.matches( testCase ) - </Original> - <Expanded> - true - </Expanded> - </Expression> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Parsing warnings" tags="[cli][warnings]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="NoAssertions" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Original> - cli.parse( { "test", "-w", "NoAssertions" } ) - </Original> - <Expanded> - {?} - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> config.warnings == WarnAbout::NoAssertions </Original> @@ -11236,7 +10086,7 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="NoTests is no longer supported" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11247,7 +10097,7 @@ C !{?} </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Combining multiple warnings" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11266,9 +10116,9 @@ C 3 == 3 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Pointers can be compared to null" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -11335,7 +10185,7 @@ C 0 != 0x<hex digits> </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Precision of floating point stringification can be set" tags="[floatingPoint][toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="Floats" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -11355,7 +10205,7 @@ C 13 == 13 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Double" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -11374,9 +10224,9 @@ C 17 == 17 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Predicate matcher can accept const char*" tags="[compilation][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -11387,7 +10237,7 @@ C "foo" matches undescribed predicate </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="empty args don't cause a crash" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11407,7 +10257,7 @@ C "" == "" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="default - no arguments" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11498,7 +10348,7 @@ C {?} == {?} </Expanded> </Expression> - <OverallResults successes="11" failures="0" expectedFailures="0"/> + <OverallResults successes="11" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Specify one test case using" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11534,9 +10384,9 @@ C true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Specify one test case exclusion using exclude:" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11572,9 +10422,9 @@ C true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Specify one test case exclusion using ~" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11610,13 +10460,13 @@ C true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-r/console" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11627,7 +10477,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11638,13 +10488,13 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-r/xml" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11655,7 +10505,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11666,13 +10516,13 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--reporter/junit" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11683,7 +10533,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11694,9 +10544,9 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="must match one of the available ones" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11716,13 +10566,13 @@ C "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="With output file" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11733,7 +10583,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11744,13 +10594,13 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="With Windows-like absolute path as output file" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11761,7 +10611,7 @@ C {?} </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > result.errorMessage() := "" </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11772,9 +10622,9 @@ C { {?} } == { {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11795,11 +10645,11 @@ C { {?}, {?} } == { {?}, {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11820,11 +10670,11 @@ C { {?}, {?} } == { {?}, {?} } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Multiple reporters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11845,11 +10695,11 @@ C "Only one reporter may have unspecified output file." contains: "Only one reporter may have unspecified output file." </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="debugger" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-b" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11869,9 +10719,9 @@ C true == true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="debugger" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--break" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11891,9 +10741,9 @@ C true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-a aborts after first failure" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11913,9 +10763,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-x 2 aborts after two failures" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11935,9 +10785,9 @@ C 2 == 2 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-x must be numeric" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11957,9 +10807,9 @@ C "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -11980,11 +10830,11 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12005,11 +10855,11 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12030,11 +10880,11 @@ C 2 == 2 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12055,11 +10905,11 @@ C 3 == 3 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12080,11 +10930,11 @@ C "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="nothrow" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-e" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12104,9 +10954,9 @@ C true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="nothrow" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--nothrow" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12126,9 +10976,9 @@ C true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="output filename" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-o filename" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12148,9 +10998,9 @@ C "filename.ext" == "filename.ext" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="output filename" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="--out" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12170,9 +11020,9 @@ C "filename.ext" == "filename.ext" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="combinations" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="Single character flags can be combined" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12208,9 +11058,9 @@ C true == true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="without option" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12230,9 +11080,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="auto" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12252,9 +11102,9 @@ C 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="yes" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12274,9 +11124,9 @@ C 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="no" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12296,9 +11146,9 @@ C 3 == 3 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="use-colour" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12318,9 +11168,9 @@ C "colour mode must be one of: default, ansi, win32, or none. 'wrong' is not recognised" contains: "colour mode must be one of" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="samples" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12340,9 +11190,9 @@ C 200 == 200 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="resamples" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12362,9 +11212,9 @@ C 20000 (0x<hex digits>) == 20000 (0x<hex digits>) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="confidence-interval" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12384,9 +11234,9 @@ C 0.99 == Approx( 0.99 ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="no-analysis" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12406,9 +11256,9 @@ C true </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="warmup-time" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -12428,11 +11278,11 @@ C 10 == 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Product with differing arities - std::tuple<int, double, float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -12443,7 +11293,7 @@ C 3 >= 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Product with differing arities - std::tuple<int, double>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -12454,7 +11304,7 @@ C 2 >= 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Product with differing arities - std::tuple<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -12465,7 +11315,7 @@ C 1 >= 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Random seed generation accepts known methods" tags="[rng][seed]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -12492,7 +11342,7 @@ C Catch::generateRandomSeed(method) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Random seed generation reports unknown methods" tags="[rng][seed]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > @@ -12503,7 +11353,7 @@ C Catch::generateRandomSeed(static_cast<Catch::GenerateFrom>(77)) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Range type with sentinel" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -12514,7 +11364,7 @@ C "{ }" == "{ }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing]" filename="tests/<exe-name>/UsageTests/Decomposition.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Decomposition.tests.cpp" > @@ -12525,7 +11375,7 @@ C Hey, its truthy! </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Regex string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -12552,7 +11402,7 @@ C "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Registering reporter with '::' in name fails" tags="[registration][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12563,7 +11413,7 @@ C "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Regression test #1" tags="[matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -12574,7 +11424,7 @@ C { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Reporter's write listings to provided stream" tags="[reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12586,7 +11436,7 @@ C </Expanded> </Expression> <Section name="Automake reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: Automake </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12601,7 +11451,7 @@ C " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12612,7 +11462,7 @@ C </Expanded> </Expression> <Section name="Automake reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: Automake </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12626,7 +11476,7 @@ C " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12637,7 +11487,7 @@ C </Expanded> </Expression> <Section name="Automake reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: Automake </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12653,7 +11503,7 @@ C " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12664,7 +11514,7 @@ C </Expanded> </Expression> <Section name="compact reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: compact </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12679,7 +11529,7 @@ C " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12690,7 +11540,7 @@ C </Expanded> </Expression> <Section name="compact reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: compact </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12704,7 +11554,7 @@ C " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12715,7 +11565,7 @@ C </Expanded> </Expression> <Section name="compact reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: compact </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12731,7 +11581,7 @@ C " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12742,7 +11592,7 @@ C </Expanded> </Expression> <Section name="console reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: console </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12757,7 +11607,7 @@ C " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12768,7 +11618,7 @@ C </Expanded> </Expression> <Section name="console reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: console </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12782,7 +11632,7 @@ C " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12793,7 +11643,7 @@ C </Expanded> </Expression> <Section name="console reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: console </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12809,7 +11659,7 @@ C " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12820,7 +11670,7 @@ C </Expanded> </Expression> <Section name="JUnit reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: JUnit </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12836,7 +11686,7 @@ All available tags: " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12847,7 +11697,7 @@ All available tags: </Expanded> </Expression> <Section name="JUnit reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: JUnit </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12862,7 +11712,7 @@ Available reporters: " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12873,7 +11723,7 @@ Available reporters: </Expanded> </Expression> <Section name="JUnit reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: JUnit </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12890,7 +11740,7 @@ All available test cases: " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12901,7 +11751,7 @@ All available test cases: </Expanded> </Expression> <Section name="SonarQube reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: SonarQube </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12917,7 +11767,7 @@ All available tags: " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12928,7 +11778,7 @@ All available tags: </Expanded> </Expression> <Section name="SonarQube reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: SonarQube </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12943,7 +11793,7 @@ Available reporters: " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12954,7 +11804,7 @@ Available reporters: </Expanded> </Expression> <Section name="SonarQube reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: SonarQube </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12971,7 +11821,7 @@ All available test cases: " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -12982,7 +11832,7 @@ All available test cases: </Expanded> </Expression> <Section name="TAP reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TAP </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -12997,7 +11847,7 @@ All available test cases: " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13008,7 +11858,7 @@ All available test cases: </Expanded> </Expression> <Section name="TAP reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TAP </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13022,7 +11872,7 @@ All available test cases: " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13033,7 +11883,7 @@ All available test cases: </Expanded> </Expression> <Section name="TAP reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TAP </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13049,7 +11899,7 @@ All available test cases: " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13060,7 +11910,7 @@ All available test cases: </Expanded> </Expression> <Section name="TeamCity reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TeamCity </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13075,7 +11925,7 @@ All available test cases: " contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13086,7 +11936,7 @@ All available test cases: </Expanded> </Expression> <Section name="TeamCity reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TeamCity </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13100,7 +11950,7 @@ All available test cases: " contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13111,7 +11961,7 @@ All available test cases: </Expanded> </Expression> <Section name="TeamCity reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: TeamCity </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13127,7 +11977,7 @@ All available test cases: " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13138,7 +11988,7 @@ All available test cases: </Expanded> </Expression> <Section name="XML reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: XML </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13157,7 +12007,7 @@ All available test cases: </TagsFromMatchingTests>" contains: "fakeTag" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13168,7 +12018,7 @@ All available test cases: </Expanded> </Expression> <Section name="XML reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: XML </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13185,7 +12035,7 @@ All available test cases: </AvailableReporters>" contains: "fake reporter" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Original> @@ -13196,7 +12046,7 @@ All available test cases: </Expanded> </Expression> <Section name="XML reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > Tested reporter: XML </Info> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -13218,18 +12068,18 @@ All available test cases: </MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla" tags="[console-reporter]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="SUCCEED counts as a test pass" tags="[messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="SUCCEED does not require an argument" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods" tags="[bdd][fixtures]" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: No operations precede me" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -13251,13 +12101,13 @@ All available test cases: 1 > 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Scenario: Do that thing with the thing" tags="[Tags]" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: This stuff exists" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -13281,29 +12131,29 @@ All available test cases: true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Scenario: This is a really long scenario name to see how the list command deals with wrapping" tags="[anotherReallyLongTagNameButThisOneHasNoObviousWrapPointsSoShouldSplitWithinAWordUsingADashCharacter][long][lots][one very long tag name that should cause line wrapping writing out using the list command][tags][verbose][very long tags]" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: A section name that is so long that it cannot fit in a single console width" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="When: The test headers are printed as part of the normal running of the scenario" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Scenario: Vector resizing affects size and capacity" tags="[bdd][capacity][size][vector]" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: an empty vector" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -13351,15 +12201,15 @@ All available test cases: 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Given: an empty vector" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -13388,16 +12238,16 @@ All available test cases: 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Sends stuff to stdout and stderr" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"> + <OverallResult success="false" skips="0"> <StdOut> A string sent directly to stdout </StdOut> @@ -13472,16 +12322,16 @@ A string sent to stderr via clog Approx( 1.23 ) != 1.24 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Standard output from all sections is reported" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Section name="one" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="two" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"> + <OverallResult success="false" skips="0"> <StdOut> Message from section one Message from section two @@ -13505,7 +12355,7 @@ Message from section two "this string contains 'abc' as a substring" starts with: "string" (case insensitive) </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Static arrays are convertible to string" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="Single item" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -13517,7 +12367,7 @@ Message from section two "{ 1 }" == "{ 1 }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Multiple" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -13528,7 +12378,7 @@ Message from section two "{ 3, 2, 1 }" == "{ 3, 2, 1 }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Non-trivial inner items" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -13541,9 +12391,9 @@ Message from section two "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="String matchers" tags="[matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -13610,7 +12460,7 @@ Message from section two "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="StringRef" tags="[StringRef][Strings]" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Empty string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13638,7 +12488,7 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From string literal" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13673,7 +12523,7 @@ Message from section two "hello" == "hello" </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From sub-string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13692,7 +12542,7 @@ Message from section two original.data() </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Copy construction is shallow" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13703,7 +12553,7 @@ Message from section two "original string" == "original string" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Copy assignment is shallow" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13714,7 +12564,7 @@ Message from section two "original string" == "original string" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="zero-based substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13750,9 +12600,9 @@ Message from section two hello == "hello" </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="non-zero-based substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13772,9 +12622,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Pointer values of full refs should match" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13786,9 +12636,9 @@ Message from section two "hello world!" == "hello world!" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Pointer values of substring refs should also match" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13800,9 +12650,9 @@ Message from section two "hello world!" == "hello world!" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Past the end substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13814,9 +12664,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Substring off the end are trimmed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13828,9 +12678,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="substring start after the end is empty" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13842,9 +12692,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Comparisons are deep" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13871,7 +12721,7 @@ Message from section two Hello != Hel </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="implicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13891,9 +12741,9 @@ Message from section two 17 == 17 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="explicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13913,9 +12763,9 @@ Message from section two 17 == 17 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="from std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="assigned" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13935,9 +12785,9 @@ Message from section two 17 == 17 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="to std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="explicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13957,9 +12807,9 @@ Message from section two 11 == 11 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="to std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="assigned" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13979,9 +12829,9 @@ Message from section two 11 == 11 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="std::string += StringRef" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -13994,7 +12844,7 @@ Message from section two "some string += the stringref contents" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="StringRef + StringRef" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > @@ -14005,18 +12855,18 @@ Message from section two "abrakadabra" == "abrakadabra" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="StringRef at compilation time" tags="[constexpr][StringRef][Strings]" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > <Section name="Simple constructors" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <OverallResults successes="12" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying char arrays with statically known sizes - char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -14035,7 +12885,7 @@ Message from section two ""abc"" == ""abc"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying char arrays with statically known sizes - signed char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -14054,7 +12904,7 @@ Message from section two ""abc"" == ""abc"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying char arrays with statically known sizes - unsigned char" tags="[toString]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -14073,7 +12923,7 @@ Message from section two ""abc"" == ""abc"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying std::chrono::duration helpers" tags="[chrono][toString]" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > @@ -14108,7 +12958,7 @@ Message from section two 1 ns != 1 us </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying std::chrono::duration with weird ratios" tags="[chrono][toString]" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > @@ -14127,7 +12977,7 @@ Message from section two 1 ps != 1 as </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Stringifying std::chrono::time_point<system_clock>" tags="[chrono][toString]" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > @@ -14140,7 +12990,7 @@ Message from section two {iso8601-timestamp} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Tabs and newlines show in output" tags="[.][failing][whitespace]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14158,7 +13008,7 @@ Message from section two " </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Tag alias can be registered against tag patterns" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Section name="The same tag alias can only be registered once" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -14202,7 +13052,7 @@ Message from section two Redefined at: file:10" contains: "10" </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Tag aliases must be of the form [@name]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="CHECK_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -14237,9 +13087,9 @@ Message from section two registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Tags with spaces and non-alphanumerical characters are accepted" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -14258,7 +13108,7 @@ Message from section two { {?}, {?} } ( Contains: {?} and Contains: {?} ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 0" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -14269,7 +13119,7 @@ Message from section two 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 1" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -14280,7 +13130,7 @@ Message from section two 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 2" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > @@ -14291,7 +13141,7 @@ Message from section two 1.0 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14302,7 +13152,7 @@ Message from section two 1 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14313,7 +13163,7 @@ Message from section two 4 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14324,7 +13174,7 @@ Message from section two 1 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14335,7 +13185,7 @@ Message from section two 4 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14346,7 +13196,7 @@ Message from section two 4 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14357,7 +13207,7 @@ Message from section two 1 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 2" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14368,7 +13218,7 @@ Message from section two 4 > 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTest: vectors can be sized and resized - float" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14404,7 +13254,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14448,9 +13298,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14485,7 +13335,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14520,9 +13370,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTest: vectors can be sized and resized - int" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14558,7 +13408,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14602,9 +13452,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14639,7 +13489,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14674,9 +13524,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTest: vectors can be sized and resized - std::string" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14712,7 +13562,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14756,9 +13606,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14793,7 +13643,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14828,9 +13678,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14866,7 +13716,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14910,9 +13760,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14947,7 +13797,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14982,9 +13832,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15020,7 +13870,7 @@ Message from section two 12 >= 12 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15064,9 +13914,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15101,7 +13951,7 @@ Message from section two 12 >= 12 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15136,9 +13986,9 @@ Message from section two 6 >= 6 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTestSig: vectors can be sized and resized - float,4" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15174,7 +14024,7 @@ Message from section two 8 >= 8 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15218,9 +14068,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15255,7 +14105,7 @@ Message from section two 8 >= 8 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15290,9 +14140,9 @@ Message from section two 4 >= 4 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTestSig: vectors can be sized and resized - int,5" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15328,7 +14178,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15372,9 +14222,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15409,7 +14259,7 @@ Message from section two 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15444,9 +14294,9 @@ Message from section two 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="TemplateTestSig: vectors can be sized and resized - std::string,15" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15482,7 +14332,7 @@ Message from section two 30 >= 30 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15526,9 +14376,9 @@ Message from section two 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15563,7 +14413,7 @@ Message from section two 30 >= 30 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -15598,9 +14448,9 @@ Message from section two 15 >= 15 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Test case with identical tags keeps just one" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -15619,10 +14469,10 @@ Message from section two {?} == {?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Test case with one argument" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Test enum bit values" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -15633,10 +14483,10 @@ Message from section two 3221225472 (0x<hex digits>) == 3221225472 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Test with special, characters "in name" tags="[cli][regression]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Testing checked-if" tags="[checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15671,7 +14521,7 @@ Message from section two false </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Testing checked-if 2" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15683,7 +14533,7 @@ Message from section two </Expanded> </Expression> <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" /> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Testing checked-if 3" tags="[!shouldfail][checked-if]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -15695,7 +14545,7 @@ Message from section two </Expanded> </Expression> <Failure filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" /> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="The NO_FAIL macro reports a failure but does not fail the test" tags="[messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Expression success="false" type="CHECK_NOFAIL" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -15706,7 +14556,7 @@ Message from section two 1 == 2 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="The default listing implementation write to provided stream" tags="[reporter-helpers][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Section name="Listing tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -15722,7 +14572,7 @@ Message from section two " contains: "[fakeTag]" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Listing reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -15736,7 +14586,7 @@ Message from section two " ( contains: "fake reporter" and contains: "fake description" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Listing tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -15752,7 +14602,7 @@ Message from section two " ( contains: "fake test name" and contains: "fakeTestTag" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Listing listeners" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > @@ -15766,18 +14616,18 @@ Message from section two " ( contains: "fakeListener" and contains: "fake description" ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="This test 'should' fail but doesn't" tags="[!shouldfail][.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Thrown string literals are translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > For some reason someone is throwing a string literal! </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Tracker" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > @@ -15829,7 +14679,7 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -15929,9 +14779,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -16039,9 +14889,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="11" failures="0" expectedFailures="0"/> + <OverallResults successes="11" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -16142,11 +14992,11 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="10" failures="0" expectedFailures="0"/> + <OverallResults successes="10" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -16279,11 +15129,11 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="12" failures="0" expectedFailures="0"/> + <OverallResults successes="12" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="14" failures="0" expectedFailures="0"/> + <OverallResults successes="14" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -16350,9 +15200,9 @@ Message from section two true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Trim strings" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -16435,13 +15285,189 @@ There is no extra whitespace here There is no extra whitespace here </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Type conversions of RangeEquals and similar" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Container conversions" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers of different container types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, RangeEquals( c_array ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, UnorderedRangeEquals( c_array ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Container conversions" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers of different container types (differ in array N)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_3, !RangeEquals( array_int_4 ) + </Original> + <Expanded> + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_3, !UnorderedRangeEquals( array_int_4 ) + </Original> + <Expanded> + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Container conversions" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers of different container types and value types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, RangeEquals( vector_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, UnorderedRangeEquals( vector_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Container conversions" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers, one random access, one not" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, RangeEquals( list_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_int_a, UnorderedRangeEquals( list_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Value type" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal containers of different value types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_int_a, RangeEquals( vector_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_int_a, UnorderedRangeEquals( vector_char_a ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Value type" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal containers of different value types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_int_a, !RangeEquals( vector_char_b ) + </Original> + <Expanded> + { 1, 2, 3 } not elements are { 1, 2, 2 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_int_a, !UnorderedRangeEquals( vector_char_b ) + </Original> + <Expanded> + { 1, 2, 3 } not unordered elements are { 1, 2, 2 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Ranges with begin that needs ADL" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + a, !RangeEquals( b ) + </Original> + <Expanded> + { 1, 2, 3 } not elements are { 3, 2, 1 } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + a, UnorderedRangeEquals( b ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 3, 2, 1 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, RangeEquals( array_a_plus_1, close_enough ) + </Original> + <Expanded> + { 1, 2, 3 } elements are { 2, 3, 4 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, UnorderedRangeEquals( array_a_plus_1, close_enough ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 2, 3, 4 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > 3.14 </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Upcasting special member functions" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Section name="Move constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -16453,7 +15479,7 @@ There is no extra whitespace here 3 == 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="move assignment" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -16464,9 +15490,9 @@ There is no extra whitespace here 3 == 3 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of AllMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16486,7 +15512,7 @@ There is no extra whitespace here { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains element 1 ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16497,7 +15523,7 @@ There is no extra whitespace here { 1, 2, 3, 4, 5 } all match matches undescribed predicate </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16549,9 +15575,9 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16603,11 +15629,11 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of AllTrue range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16620,9 +15646,9 @@ There is no extra whitespace here { true, true, true, true, true } contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16634,12 +15660,12 @@ There is no extra whitespace here { } contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One false evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> data, !AllTrue() @@ -16648,9 +15674,9 @@ There is no extra whitespace here { true, true, false, true, true } not contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16662,9 +15688,9 @@ There is no extra whitespace here { false, false, false, false, false } not contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16676,12 +15702,12 @@ There is no extra whitespace here { true, true, true, true, true } contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One false evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> data, !AllTrue() @@ -16690,9 +15716,9 @@ There is no extra whitespace here { true, true, false, true, true } not contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16704,9 +15730,9 @@ There is no extra whitespace here { false, false, false, false, false } not contains only true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16758,9 +15784,9 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16812,11 +15838,11 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of AnyMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16836,7 +15862,7 @@ There is no extra whitespace here { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains element 10 ) </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16847,7 +15873,7 @@ There is no extra whitespace here { 1, 2, 3, 4, 5 } any match matches undescribed predicate </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16899,9 +15925,9 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16953,11 +15979,11 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of AnyTrue range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16970,9 +15996,9 @@ There is no extra whitespace here { true, true, true, true, true } contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Empty evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -16984,12 +16010,12 @@ There is no extra whitespace here { } not contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One true evalutes to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> data, AnyTrue() @@ -16998,9 +16024,9 @@ There is no extra whitespace here { false, false, true, false, false } contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17012,9 +16038,9 @@ There is no extra whitespace here { false, false, false, false, false } not contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17026,12 +16052,12 @@ There is no extra whitespace here { true, true, true, true, true } contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One true evalutes to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> data, AnyTrue() @@ -17040,9 +16066,9 @@ There is no extra whitespace here { false, false, true, false, false } contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All false evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17054,9 +16080,9 @@ There is no extra whitespace here { false, false, false, false, false } not contains at least one true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17108,9 +16134,9 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17146,67 +16172,276 @@ There is no extra whitespace here true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[4]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Usage of NoneMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneMatch(SizeIs(6)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneMatch(Contains(0) && Contains(1)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, noneMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[4] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, !noneMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.m_derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[1]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[2]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.m_derefed[4]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Usage of NoneTrue range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { true, true, true, true, true } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { false, false, true, false, false } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneTrue() + </Original> + <Expanded> + { false, false, false, false, false } contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneTrue() + </Original> + <Expanded> + { true, true, true, true, true } not contains no true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="One true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[3]) + data, !NoneTrue() </Original> <Expanded> - !false + { false, false, true, false, false } not contains no true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[4]) + data, NoneTrue() </Original> <Expanded> - !false + { false, false, false, false, false } contains no true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> - </Section> - <OverallResult success="true"/> - </TestCase> - <TestCase name="Usage of NoneMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Original> - data, NoneMatch(SizeIs(6)) - </Original> - <Expanded> - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Original> - data, !NoneMatch(Contains(0) && Contains(1)) - </Original> - <Expanded> - { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) - </Expanded> - </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> - </Section> - <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Original> - needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) - </Original> - <Expanded> - { 1, 2, 3, 4, 5 } none match matches undescribed predicate - </Expanded> - </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked, noneMatch + mocked, NoneTrue() </Original> <Expanded> - { 1, 2, 3, 4, 5 } none match matches undescribed predicate + { false, false, false, false, false } contains no true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17249,18 +16484,18 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked, !noneMatch + mocked, !NoneTrue() </Original> <Expanded> - { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + { false, false, true, true, true } not contains no true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17271,20 +16506,20 @@ There is no extra whitespace here true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[1]) + mocked.m_derefed[1] </Original> <Expanded> - !false + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[2]) + mocked.m_derefed[2] </Original> <Expanded> - !false + true </Expanded> </Expression> <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17303,132 +16538,173 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <TestCase name="Usage of NoneTrue range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <TestCase name="Usage of RangeEquals range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty container matches empty container" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, !NoneTrue() + empty_vector, RangeEquals( empty_vector ) </Original> <Expanded> - { true, true, true, true, true } not contains no true + { } elements are { } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="Empty evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty container does not match non-empty container" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, NoneTrue() + empty_vector, !RangeEquals( non_empty_vector ) </Original> <Expanded> - { } contains no true + { } not elements are { 1 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + non_empty_vector, !RangeEquals( empty_vector ) + </Original> + <Expanded> + { 1 } not elements are { } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One true evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal 1-length non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, !NoneTrue() + non_empty_array, RangeEquals( non_empty_array ) </Original> <Expanded> - { false, false, true, false, false } not contains no true + { 1 } elements are { 1 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal-sized, equal, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, NoneTrue() + array_a, RangeEquals( array_a ) </Original> <Expanded> - { false, false, false, false, false } contains no true + { 1, 2, 3 } elements are { 1, 2, 3 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All true evaluates to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal-sized, non-equal, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, !NoneTrue() + array_a, !RangeEquals( array_b ) </Original> <Expanded> - { true, true, true, true, true } not contains no true + { 1, 2, 3 } not elements are { 2, 2, 3 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_a, !RangeEquals( array_c ) + </Original> + <Expanded> + { 1, 2, 3 } not elements are { 1, 2, 2 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="One true evalutes to false" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal-sized, non-empty containers (with same first elements)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, !NoneTrue() + vector_a, !RangeEquals( vector_b ) </Original> <Expanded> - { false, false, true, false, false } not contains no true + { 1, 2, 3 } not elements are { 1, 2, 3, 4 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Contained type is convertible to bool" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All false evaluates to true" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - data, NoneTrue() + vector_a, RangeEquals( vector_a_plus_1, close_enough ) </Original> <Expanded> - { false, false, false, false, false } contains no true + { 1, 2, 3 } elements are { 2, 3, 4 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked, NoneTrue() + vector_a, !RangeEquals( vector_b, close_enough ) </Original> <Expanded> - { false, false, false, false, false } contains no true + { 1, 2, 3 } not elements are { 3, 3, 4 } </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Ranges that need ADL begin/end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl1, RangeEquals( needs_adl2 ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } elements are { 1, 2, 3, 4, 5 } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { return l + 1 == r; } ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } elements are { 2, 3, 4, 5, 6 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Check short-circuiting behaviour" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Check short-circuits on failure" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[0] + mocked1, !RangeEquals( arr ) </Original> <Expanded> - true + { 1, 2, 3, 4 } not elements are { 1, 2, 4, 4 } </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[1] + mocked1.m_derefed[0] </Original> <Expanded> true @@ -17436,7 +16712,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[2] + mocked1.m_derefed[1] </Original> <Expanded> true @@ -17444,37 +16720,37 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[3] + mocked1.m_derefed[2] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[4] + !(mocked1.m_derefed[3]) </Original> <Expanded> - true + !false </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > - <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Check short-circuiting behaviour" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All elements are checked on success" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked, !NoneTrue() + mocked1, RangeEquals( arr ) </Original> <Expanded> - { false, false, true, true, true } not contains no true + { 1, 2, 3, 4 } elements are { 1, 2, 3, 4 } </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[0] + mocked1.m_derefed[0] </Original> <Expanded> true @@ -17482,7 +16758,7 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[1] + mocked1.m_derefed[1] </Original> <Expanded> true @@ -17490,33 +16766,159 @@ There is no extra whitespace here </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - mocked.m_derefed[2] + mocked1.m_derefed[2] </Original> <Expanded> true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[3]) + mocked1.m_derefed[3] </Original> <Expanded> - !false + true </Expanded> </Expression> - <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="Usage of UnorderedRangeEquals range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty container matches empty container" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Original> - !(mocked.m_derefed[4]) + empty_vector, UnorderedRangeEquals( empty_vector ) </Original> <Expanded> - !false + { } unordered elements are { } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Empty container does not match non-empty container" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + empty_vector, !UnorderedRangeEquals( non_empty_vector ) + </Original> + <Expanded> + { } not unordered elements are { 1 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + non_empty_vector, !UnorderedRangeEquals( empty_vector ) + </Original> + <Expanded> + { 1 } not unordered elements are { } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal 1-length non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + non_empty_array, UnorderedRangeEquals( non_empty_array ) + </Original> + <Expanded> + { 1 } unordered elements are { 1 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal-sized, equal, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_a, UnorderedRangeEquals( array_a ) + </Original> + <Expanded> + { 1, 2, 3 } unordered elements are { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal-sized, non-equal, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + array_a, !UnorderedRangeEquals( array_b ) + </Original> + <Expanded> + { 1, 2, 3 } not unordered elements are { 2, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal-sized, non-empty containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, !UnorderedRangeEquals( vector_b ) + </Original> + <Expanded> + { 1, 2, 3 } not unordered elements are { 1, 2, 3, 4 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, UnorderedRangeEquals( vector_a_plus_1, close_enough ) + </Original> + <Expanded> + { 1, 10, 20 } unordered elements are { 11, 21, 2 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Custom predicate" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Two non-equal non-empty containers (close enough)" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + vector_a, !UnorderedRangeEquals( vector_b, close_enough ) + </Original> + <Expanded> + { 1, 10, 21 } not unordered elements are { 11, 21, 3 } </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="Ranges that need ADL begin/end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl1, UnorderedRangeEquals( needs_adl2 ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } unordered elements are { 1, 2, 3, 4, 5 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Usage of the SizeIs range matcher" tags="[matchers][size][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Section name="Some with stdlib containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17576,7 +16978,7 @@ There is no extra whitespace here { {?}, {?}, {?} } has size == 3 </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type requires ADL found size free function" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17587,7 +16989,7 @@ There is no extra whitespace here {?} has size == 12 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Type has size member" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > @@ -17598,9 +17000,9 @@ There is no extra whitespace here {?} has size == 13 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Use a custom approx" tags="[Approx][custom]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > @@ -17667,13 +17069,13 @@ There is no extra whitespace here Approx( 1.23 ) != 1.25 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Variadic macros" tags="[sections][variadic]" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > <Section name="Section with one argument" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Vector Approx matcher" tags="[approx][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Empty vector is roughly equal to an empty vector" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17685,7 +17087,7 @@ There is no extra whitespace here { } is approx: { } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="A vector is approx equal to itself" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17705,9 +17107,9 @@ There is no extra whitespace here { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Different length" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17719,9 +17121,9 @@ There is no extra whitespace here { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Same length, different elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17757,11 +17159,11 @@ There is no extra whitespace here { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } </Expanded> </Expression> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="4" failures="0" expectedFailures="0"/> + <OverallResults successes="4" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Vector Approx matcher -- failing" tags="[.][approx][failing][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Empty and non empty vectors are not approx equal" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17773,7 +17175,7 @@ There is no extra whitespace here { } is approx: { 1.0, 2.0 } </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="Just different vectors" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17784,9 +17186,9 @@ There is no extra whitespace here { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="Vector matchers" tags="[matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Contains (element)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17814,7 +17216,7 @@ There is no extra whitespace here { 1, 2, 3 } Contains: 2 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contains (vector)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17881,7 +17283,7 @@ There is no extra whitespace here { 1, 2, 3 } Contains: { 1, 2 } </Expanded> </Expression> - <OverallResults successes="8" failures="0" expectedFailures="0"/> + <OverallResults successes="8" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Contains (element), composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17892,7 +17294,7 @@ There is no extra whitespace here { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Equals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -17943,7 +17345,7 @@ There is no extra whitespace here { 1, 2, 3 } Equals: { 1, 2, 3 } </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="UnorderedEquals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18002,9 +17404,9 @@ There is no extra whitespace here { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } </Expanded> </Expression> - <OverallResults successes="7" failures="0" expectedFailures="0"/> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="Vector matchers that fail" tags="[.][failing][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Contains (element)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18024,7 +17426,7 @@ There is no extra whitespace here { } Contains: 1 </Expanded> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> <Section name="Contains (vector)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18043,7 +17445,7 @@ There is no extra whitespace here { 1, 2, 3 } Contains: { 1, 2, 4 } </Expanded> </Expression> - <OverallResults successes="0" failures="2" expectedFailures="0"/> + <OverallResults successes="0" failures="2" expectedFailures="0" skipped="false"/> </Section> <Section name="Equals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18078,7 +17480,7 @@ There is no extra whitespace here { 1, 2, 3 } Equals: { } </Expanded> </Expression> - <OverallResults successes="0" failures="4" expectedFailures="0"/> + <OverallResults successes="0" failures="4" expectedFailures="0" skipped="false"/> </Section> <Section name="UnorderedEquals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -18113,9 +17515,9 @@ There is no extra whitespace here { 3, 1 } UnorderedEquals: { 1, 2, 3 } </Expanded> </Expression> - <OverallResults successes="0" failures="4" expectedFailures="0"/> + <OverallResults successes="0" failures="4" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When checked exceptions are thrown they can be expected or unexpected" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -18142,13 +17544,13 @@ There is no extra whitespace here thisThrows() </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > unexpected exception </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -18162,7 +17564,7 @@ There is no extra whitespace here expected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -18176,7 +17578,7 @@ There is no extra whitespace here expected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown from functions they are always failures" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > @@ -18190,31 +17592,31 @@ There is no extra whitespace here expected exception </Exception> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="section name" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > unexpected exception </Exception> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="X/level/0/a" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="X/level/0/b" tags="[fizz][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="X/level/1/a" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="X/level/1/b" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="XmlEncode" tags="[XML]" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Section name="normal string" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18226,7 +17628,7 @@ There is no extra whitespace here "normal string" == "normal string" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="empty string" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18237,7 +17639,7 @@ There is no extra whitespace here "" == "" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with ampersand" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18248,7 +17650,7 @@ There is no extra whitespace here "smith &amp; jones" == "smith &amp; jones" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with less-than" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18259,7 +17661,7 @@ There is no extra whitespace here "smith &lt; jones" == "smith &lt; jones" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with greater-than" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18280,7 +17682,7 @@ There is no extra whitespace here "smith ]]&gt; jones" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with quotes" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18303,7 +17705,7 @@ There is no extra whitespace here "don't &quot;quote&quot; me on that" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with control char (1)" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18314,7 +17716,7 @@ There is no extra whitespace here "[\x01]" == "[\x01]" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="string with control char (x7F)" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18325,9 +17727,9 @@ There is no extra whitespace here "[\x7F]" == "[\x7F]" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="XmlWriter writes boolean attributes as true/false" tags="[XML][XmlWriter]" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > @@ -18340,7 +17742,11 @@ There is no extra whitespace here " ( contains: "attr1="true"" and contains: "attr2="false"" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="a succeeding test can still be skipped" tags="[!shouldfail][skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="analyse no analysis" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18447,7 +17853,7 @@ There is no extra whitespace here 0.0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="array<int, N> -> toString" tags="[array][containers][toString]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -18474,7 +17880,7 @@ There is no extra whitespace here "{ 42, 250 }" == "{ 42, 250 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="benchmark function call" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Section name="without chronometer" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18518,7 +17924,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="with chronometer" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18561,9 +17967,9 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="boolean member" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -18574,7 +17980,7 @@ There is no extra whitespace here 0x<hex digits> != 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="checkedElse" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -18593,7 +17999,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="checkedElse, failing" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -18612,7 +18018,7 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="checkedIf" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -18631,7 +18037,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="checkedIf, failing" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -18650,7 +18056,7 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="classify_outliers" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Section name="none" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18702,7 +18108,7 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="low severe" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18753,7 +18159,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="low mild" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18804,7 +18210,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="high mild" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18855,7 +18261,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="high severe" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18906,7 +18312,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="mixed" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -18957,9 +18363,9 @@ There is no extra whitespace here 2 == 2 </Expanded> </Expression> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="comparisons between const int variables" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -18994,7 +18400,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="comparisons between int variables" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > @@ -19029,7 +18435,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="convertToBits" tags="[conversion][floating-point]" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/FloatingPoint.tests.cpp" > @@ -19084,7 +18490,16 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="dynamic skipping works with generators" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + skipping because answer = 41 + </Skip> + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + skipping because answer = 43 + </Skip> + <OverallResult success="true" skips="2"/> </TestCase> <TestCase name="empty tags are not allowed" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -19095,7 +18510,7 @@ There is no extra whitespace here Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="erfc_inv" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19122,7 +18537,7 @@ There is no extra whitespace here 1.3859038243 == Approx( 1.3859038243 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="estimate_clock_resolution" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19141,52 +18556,82 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="even more nested SECTION tests" tags="[sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="c" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="d (leaf)" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="c" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="e (leaf)" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="f (leaf)" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="failed assertions before SKIP cause test case to fail" tags="[!shouldfail][skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Original> + 3 == 4 + </Original> + <Expanded> + 3 == 4 + </Expanded> + </Expression> + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResult success="true" skips="1"/> + </TestCase> + <TestCase name="failing for some generator values causes entire test case to fail" tags="[!shouldfail][skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <Failure filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResult success="true" skips="2"/> + </TestCase> + <TestCase name="failing in some unskipped sections causes entire test case to fail" tags="[!shouldfail][skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="true"/> + </Section> + <Section name="not skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="1" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="first tag" tags="[tag1]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="has printf" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="is_unary_function" tags="[clara][compilation]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="just failure" tags="[.][fail][isolated info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Previous info should not be seen </Failure> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="just failure after unscoped info" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > previous unscoped info SHOULD not be seen </Failure> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="just info" tags="[info][isolated info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="just unscoped info" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="long long" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19199,7 +18644,7 @@ There is no extra whitespace here 9223372036854775807 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="looped SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="b is currently: 0" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19211,7 +18656,7 @@ There is no extra whitespace here 0 > 1 </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 1" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19222,7 +18667,7 @@ There is no extra whitespace here 1 > 1 </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 2" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19233,7 +18678,7 @@ There is no extra whitespace here 2 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 3" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19244,7 +18689,7 @@ There is no extra whitespace here 3 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 4" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19255,7 +18700,7 @@ There is no extra whitespace here 4 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 5" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19266,7 +18711,7 @@ There is no extra whitespace here 5 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 6" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19277,7 +18722,7 @@ There is no extra whitespace here 6 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 7" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19288,7 +18733,7 @@ There is no extra whitespace here 7 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 8" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19299,7 +18744,7 @@ There is no extra whitespace here 8 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="b is currently: 9" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19310,12 +18755,12 @@ There is no extra whitespace here 9 > 1 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="looped tests" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[0] (1) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19326,7 +18771,7 @@ There is no extra whitespace here 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[1] (1) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19337,7 +18782,7 @@ There is no extra whitespace here 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[2] (2) is even </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19348,7 +18793,7 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[3] (3) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19359,7 +18804,7 @@ There is no extra whitespace here 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[4] (5) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19370,7 +18815,7 @@ There is no extra whitespace here 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[5] (8) is even </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19381,7 +18826,7 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[6] (13) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19392,7 +18837,7 @@ There is no extra whitespace here 1 == 0 </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > Testing if fib[7] (21) is even </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19403,7 +18848,7 @@ There is no extra whitespace here 1 == 0 </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="makeStream recognizes %debug stream name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -19414,7 +18859,7 @@ There is no extra whitespace here Catch::makeStream( "%debug" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="make_unique reimplementation" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Section name="From lvalue copies" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -19426,7 +18871,7 @@ There is no extra whitespace here !false </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="From rvalue moves" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -19437,7 +18882,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Variadic constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -19448,9 +18893,9 @@ There is no extra whitespace here {?} == {?} </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="mean" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19461,7 +18906,7 @@ There is no extra whitespace here 19.0 == 19.0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="measure" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19528,28 +18973,28 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="mix info, unscoped info and warning" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > info </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > unscoped info </Info> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > and warn may mix </Warning> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > info </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > unscoped info </Info> - <Warning> + <Warning filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > they are not cleared after warnings </Warning> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19562,9 +19007,9 @@ There is no extra whitespace here 1 == 2 </Expanded> </Expression> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="0" failures="1" expectedFailures="0"/> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> </Section> <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="not equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19576,9 +19021,9 @@ There is no extra whitespace here 1 != 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="less than" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19590,11 +19035,11 @@ There is no extra whitespace here 1 < 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="nested SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19623,11 +19068,39 @@ There is no extra whitespace here 1 != 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="nested sections can be skipped dynamically at runtime" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="A" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="B1" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> + </Section> + <OverallResults successes="0" failures="1" expectedFailures="0" skipped="false"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="B2" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="true"/> + </Section> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="true"/> + </Section> + <Section name="B" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="false" skips="1"> + <StdOut> +a! +b1! +! + </StdOut> + </OverallResult> </TestCase> <TestCase name="non streamable - with conv. op" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -19638,7 +19111,7 @@ There is no extra whitespace here "7" == "7" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="non-copyable objects" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -19649,7 +19122,7 @@ There is no extra whitespace here {?} == {?} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="normal_cdf" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19692,7 +19165,7 @@ There is no extra whitespace here 0.088096521 == Approx( 0.088096521 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="normal_quantile" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -19719,13 +19192,13 @@ There is no extra whitespace here -1.9599639845 == Approx( -1.9599639845 ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="not allowed" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="not prints unscoped info from previous failures" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this MAY be seen only for the FIRST assertion IF info is printed for passing assertions </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19736,7 +19209,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this MAY be seen only for the SECOND assertion IF info is printed for passing assertions </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19747,7 +19220,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this SHOULD be seen </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19758,7 +19231,7 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="null strings" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19777,7 +19250,7 @@ There is no extra whitespace here {null string} == {null string} </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="null_ptr" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -19788,7 +19261,7 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="pair<pair<int,const char *,pair<std::string,int> > -> toString" tags="[pair][toString]" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > @@ -19801,7 +19274,7 @@ There is no extra whitespace here "{ { 42, "Arthur" }, { "Ford", 24 } }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="parseEnums" tags="[enums][Strings]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Section name="No enums" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -19813,7 +19286,7 @@ There is no extra whitespace here { } Equals: { } </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="One enum value" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -19840,7 +19313,7 @@ There is no extra whitespace here { Value1 } Equals: { Value1 } </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Multiple enum values" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > @@ -19867,9 +19340,9 @@ There is no extra whitespace here { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="pointer to class" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > @@ -19880,10 +19353,10 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="print unscoped info if passing unscoped info is printed" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this MAY be seen IF info is printed for passing assertions </Info> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19894,13 +19367,13 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="prints unscoped info on failure" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this SHOULD be seen </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this SHOULD also be seen </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19911,10 +19384,10 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="prints unscoped info only for the first assertion" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this SHOULD be seen only ONCE </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19933,7 +19406,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > this MAY also be seen only ONCE IF info is printed for passing assertions </Info> <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -19952,7 +19425,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19972,7 +19445,7 @@ There is no extra whitespace here 2 != 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="not equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -19983,9 +19456,9 @@ There is no extra whitespace here 1 != 2 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="replaceInPlace" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Section name="replace single char" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20005,7 +19478,7 @@ There is no extra whitespace here "azcdefcg" == "azcdefcg" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace two chars" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20024,7 +19497,7 @@ There is no extra whitespace here "abzdefzg" == "abzdefzg" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace first char" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20043,7 +19516,7 @@ There is no extra whitespace here "zbcdefcg" == "zbcdefcg" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace last char" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20062,7 +19535,7 @@ There is no extra whitespace here "abcdefcz" == "abcdefcz" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace all chars" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20081,7 +19554,7 @@ There is no extra whitespace here "replaced" == "replaced" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="replace no chars" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20100,7 +19573,7 @@ There is no extra whitespace here "abcdefcg" == "abcdefcg" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="escape '" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20119,9 +19592,9 @@ There is no extra whitespace here "didn|'t" == "didn|'t" </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="request an unknown %-starting stream fails" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -20132,7 +19605,7 @@ There is no extra whitespace here Catch::makeStream( "%somestream" ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="resolution" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -20215,7 +19688,7 @@ There is no extra whitespace here 1000.0 == 1000 (0x<hex digits>) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="run_for_at_least, chronometer" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -20306,7 +19779,7 @@ There is no extra whitespace here 128 >= 100 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="run_for_at_least, int" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -20397,13 +19870,26 @@ There is no extra whitespace here 128 >= 100 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="second tag" tags="[tag2]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> + </TestCase> + <TestCase name="sections can be skipped dynamically at runtime" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Section name="not skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResults successes="0" failures="0" expectedFailures="0" skipped="true"/> + </Section> + <Section name="also not skipped" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="send a single char to INFO" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > 3 </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20414,13 +19900,13 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="sends information to INFO" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > hi </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > i := 7 </Info> <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -20431,7 +19917,7 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="shortened hide tags are split apart" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -20442,7 +19928,13 @@ There is no extra whitespace here { {?}, {?} } ( Contains: {?} and Contains: {?} ) </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="skipped tests can optionally provide a reason" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + skipping because answer = 43 + </Skip> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="splitString" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20469,19 +19961,19 @@ There is no extra whitespace here { abc, def } Equals: { abc, def } </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stacks unscoped info in loops" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Count 1 to 3... </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 1 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 2 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 3 </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -20492,16 +19984,16 @@ There is no extra whitespace here false </Expanded> </Expression> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > Count 4 to 6... </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 4 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 5 </Info> - <Info> + <Info filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > 6 </Info> <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > @@ -20512,7 +20004,7 @@ There is no extra whitespace here false </Expanded> </Expression> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="startsWith" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > @@ -20539,7 +20031,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::map is convertible string" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="empty" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20551,7 +20043,7 @@ There is no extra whitespace here "{ }" == "{ }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="single item" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20562,7 +20054,7 @@ There is no extra whitespace here "{ { "one", 1 } }" == "{ { "one", 1 } }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="several items" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20575,9 +20067,9 @@ There is no extra whitespace here "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::pair<int,const std::string> -> toString" tags="[pair][toString]" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > @@ -20588,7 +20080,7 @@ There is no extra whitespace here "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::pair<int,std::string> -> toString" tags="[pair][toString]" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > @@ -20599,7 +20091,7 @@ There is no extra whitespace here "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::set is convertible string" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Section name="empty" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20611,7 +20103,7 @@ There is no extra whitespace here "{ }" == "{ }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="single item" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20622,7 +20114,7 @@ There is no extra whitespace here "{ "one" }" == "{ "one" }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="several items" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > @@ -20635,9 +20127,9 @@ There is no extra whitespace here "{ "abc", "def", "ghi" }" </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="std::vector<std::pair<std::string,int> > -> toString" tags="[pair][toString]" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > @@ -20650,7 +20142,7 @@ There is no extra whitespace here "{ { "green", 55 } }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stdout and stderr streams have %-starting name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" > @@ -20669,7 +20161,7 @@ There is no extra whitespace here true </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify ranges" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20708,7 +20200,7 @@ There is no extra whitespace here "{?}" == "{?}" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_maker )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20721,7 +20213,7 @@ There is no extra whitespace here "StringMaker<has_maker>" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_maker_and_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20734,7 +20226,7 @@ There is no extra whitespace here "StringMaker<has_maker_and_operator>" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_neither )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20745,7 +20237,7 @@ There is no extra whitespace here "{?}" == "{?}" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20758,7 +20250,7 @@ There is no extra whitespace here "operator<<( has_operator )" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( has_template_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20771,7 +20263,7 @@ There is no extra whitespace here "operator<<( has_template_operator )" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( vectors<has_maker> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20784,7 +20276,7 @@ There is no extra whitespace here "{ StringMaker<has_maker> }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( vectors<has_maker_and_operator> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20797,7 +20289,7 @@ There is no extra whitespace here "{ StringMaker<has_maker_and_operator> }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="stringify( vectors<has_operator> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > @@ -20810,7 +20302,7 @@ There is no extra whitespace here "{ operator<<( has_operator ) }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="strlen3" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -20845,7 +20337,7 @@ There is no extra whitespace here 4 == 4 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tables" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > @@ -20880,7 +20372,7 @@ There is no extra whitespace here 6 == 6 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tags with dots in later positions are not parsed as hidden" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > @@ -20899,13 +20391,17 @@ There is no extra whitespace here magic.tag == magic.tag </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="tests can be skipped dynamically at runtime" tags="[skipping]" filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" > + <Skip filename="tests/<exe-name>/UsageTests/Skip.tests.cpp" /> + <OverallResult success="true" skips="1"/> </TestCase> <TestCase name="thrown std::strings are translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > Why would you throw a std::string? </Exception> - <OverallResult success="false"/> + <OverallResult success="false" skips="0"/> </TestCase> <TestCase name="toString on const wchar_t const pointer returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20916,7 +20412,7 @@ There is no extra whitespace here ""wide load"" == ""wide load"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString on const wchar_t pointer returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20927,7 +20423,7 @@ There is no extra whitespace here ""wide load"" == ""wide load"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString on wchar_t const pointer returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20938,7 +20434,7 @@ There is no extra whitespace here ""wide load"" == ""wide load"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString on wchar_t returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -20949,7 +20445,7 @@ There is no extra whitespace here ""wide load"" == ""wide load"" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString(enum class w/operator<<)" tags="[enum][enumClass][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -20978,7 +20474,7 @@ There is no extra whitespace here "Unknown enum value 10" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString(enum class)" tags="[enum][enumClass][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -20997,7 +20493,7 @@ There is no extra whitespace here "1" == "1" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString(enum w/operator<<)" tags="[enum][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -21016,7 +20512,7 @@ There is no extra whitespace here "E2{1}" == "E2{1}" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="toString(enum)" tags="[enum][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > @@ -21035,7 +20531,7 @@ There is no extra whitespace here "1" == "1" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21054,7 +20550,7 @@ There is no extra whitespace here "{ }" == "{ }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<float,int>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21073,7 +20569,7 @@ There is no extra whitespace here "{ 1.2f, 0 }" == "{ 1.2f, 0 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<int>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21084,7 +20580,7 @@ There is no extra whitespace here "{ 0 }" == "{ 0 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<string,string>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21097,7 +20593,7 @@ There is no extra whitespace here "{ "hello", "world" }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="tuple<tuple<int>,tuple<>,float>" tags="[toString][tuple]" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > @@ -21110,7 +20606,7 @@ There is no extra whitespace here "{ { 42 }, { }, 1.2f }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="uniform samples" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -21145,7 +20641,7 @@ There is no extra whitespace here 0.95 == 0.95 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="unique_ptr reimplementation: basic functionality" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Section name="Default constructed unique_ptr is empty" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21165,7 +20661,7 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Take ownership of allocation" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21209,9 +20705,9 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="5" failures="0" expectedFailures="0"/> + <OverallResults successes="5" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Take ownership of allocation" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21263,9 +20759,9 @@ There is no extra whitespace here 2 == 2 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="6" failures="0" expectedFailures="0"/> + <OverallResults successes="6" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Release releases ownership" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21284,7 +20780,7 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Move constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21311,7 +20807,7 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="Move assignment" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21338,7 +20834,7 @@ There is no extra whitespace here 2 == 2 </Expanded> </Expression> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="free swap" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > @@ -21357,9 +20853,9 @@ There is no extra whitespace here 1 == 1 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vec<vec<string,alloc>> -> toString" tags="[toString][vector,allocator]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21380,7 +20876,7 @@ There is no extra whitespace here "{ { "hello" }, { "world" } }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vector<bool> -> toString" tags="[containers][toString][vector]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21407,7 +20903,7 @@ There is no extra whitespace here "{ true, false }" == "{ true, false }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vector<int,allocator> -> toString" tags="[toString][vector,allocator]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21434,7 +20930,7 @@ There is no extra whitespace here "{ 42, 250 }" == "{ 42, 250 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vector<int> -> toString" tags="[toString][vector]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21461,7 +20957,7 @@ There is no extra whitespace here "{ 42, 250 }" == "{ 42, 250 }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vector<string> -> toString" tags="[toString][vector]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > @@ -21490,7 +20986,7 @@ There is no extra whitespace here "{ "hello", "world" }" </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="vectors can be sized and resized" tags="[vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -21526,7 +21022,7 @@ There is no extra whitespace here 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -21570,9 +21066,9 @@ There is no extra whitespace here 0 == 0 </Expanded> </Expression> - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResults successes="3" failures="0" expectedFailures="0"/> + <OverallResults successes="3" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -21607,7 +21103,7 @@ There is no extra whitespace here 10 >= 10 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -21642,9 +21138,9 @@ There is no extra whitespace here 5 >= 5 </Expanded> </Expression> - <OverallResults successes="2" failures="0" expectedFailures="0"/> + <OverallResults successes="2" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="warmup" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -21663,7 +21159,7 @@ There is no extra whitespace here 310016000 ns > 100 ms </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="weighted_average_quantile" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > @@ -21690,17 +21186,17 @@ There is no extra whitespace here 23.0 == 23.0 </Expanded> </Expression> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="xmlentitycheck" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> <Section name="encoded chars: these should all be encoded: &&&"""<<<&"<<&"" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > - <OverallResults successes="1" failures="0" expectedFailures="0"/> + <OverallResults successes="1" failures="0" expectedFailures="0" skipped="false"/> </Section> - <OverallResult success="true"/> + <OverallResult success="true" skips="0"/> </TestCase> - <OverallResults successes="2129" failures="143" expectedFailures="27"/> - <OverallResultsCases successes="304" failures="83" expectedFailures="7"/> + <OverallResults successes="2048" failures="145" expectedFailures="32" skips="12"/> + <OverallResultsCases successes="308" failures="84" expectedFailures="11" skips="6"/> </Catch2TestRun> diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Algorithms.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Algorithms.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fa17cf82da5af402b6acabb137b2419dcc822085 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Algorithms.tests.cpp @@ -0,0 +1,94 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_is_permutation.hpp> + +#include <helpers/range_test_helpers.hpp> + +#include <array> + +namespace { + template <typename Range1, typename Range2> + static bool is_permutation(Range1 const& r1, Range2 const& r2) { + using std::begin; using std::end; + return Catch::Detail::is_permutation( + begin( r1 ), end( r1 ), begin( r2 ), end( r2 ), std::equal_to<>{} ); + } +} + +TEST_CASE("is_permutation", "[algorithms][approvals]") { + SECTION( "Handle empty ranges" ) { + std::array<int, 0> empty; + std::array<int, 2> non_empty{ { 2, 3 } }; + REQUIRE( is_permutation( empty, empty ) ); + REQUIRE_FALSE( is_permutation( empty, non_empty ) ); + REQUIRE_FALSE( is_permutation( non_empty, empty ) ); + } + SECTION( "Different length ranges" ) { + std::array<int, 6> arr1{ { 1, 3, 5, 7, 8, 9 } }; + // arr2 is prefix of arr1 + std::array<int, 4> arr2{ { 1, 3, 5, 7 } }; + // arr3 shares prefix with arr1 and arr2, but is not a permutation + std::array<int, 5> arr3{ { 1, 3, 5, 9, 8 } }; + REQUIRE_FALSE( is_permutation( arr1, arr2 ) ); + REQUIRE_FALSE( is_permutation( arr1, arr3 ) ); + REQUIRE_FALSE( is_permutation( arr2, arr3 ) ); + } + SECTION( "Same length ranges" ) { + SECTION( "Shared elements, but different counts" ) { + const std::array<int, 6> + arr1{ { 1, 1, 1, 1, 2, 2 } }, + arr2{ { 1, 1, 2, 2, 2, 2 } }; + REQUIRE_FALSE( is_permutation( arr1, arr2 ) ); + } + SECTION( "Identical ranges" ) { + const std::array<int, 6> + arr1{ { 1, 1, 1, 1, 2, 2 } }, + arr2{ { 1, 1, 2, 2, 2, 2 } }; + REQUIRE( is_permutation( arr1, arr1 ) ); + REQUIRE( is_permutation( arr2, arr2 ) ); + } + SECTION( "Completely distinct elements" ) { + // Completely distinct elements + const std::array<int, 4> + arr1{ { 1, 2, 3, 4 } }, + arr2{ { 10, 20, 30, 40 } }; + REQUIRE_FALSE( is_permutation( arr1, arr2 ) ); + } + SECTION( "Reverse ranges" ) { + const std::array<int, 5> + arr1{ { 1, 2, 3, 4, 5 } }, + arr2{ { 5, 4, 3, 2, 1 } }; + REQUIRE( is_permutation( arr1, arr2 ) ); + } + SECTION( "Shared prefix & permuted elements" ) { + const std::array<int, 5> + arr1{ { 1, 1, 2, 3, 4 } }, + arr2{ { 1, 1, 4, 2, 3 } }; + REQUIRE( is_permutation( arr1, arr2 ) ); + } + SECTION( "Permutations with element count > 1" ) { + const std::array<int, 7> + arr1{ { 2, 2, 3, 3, 3, 1, 1 } }, + arr2{ { 3, 2, 1, 3, 2, 1, 3 } }; + REQUIRE( is_permutation( arr1, arr2 ) ); + } + } +} + +TEST_CASE("is_permutation supports iterator + sentinel pairs", + "[algorithms][is-permutation][approvals]") { + const has_different_begin_end_types<int> + range_1{ 1, 2, 3, 4 }, + range_2{ 4, 3, 2, 1 }; + REQUIRE( is_permutation( range_1, range_2 ) ); + + const has_different_begin_end_types<int> range_3{ 3, 3, 2, 1 }; + REQUIRE_FALSE( is_permutation( range_1, range_3 ) ); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp index 2cbf05b8ea300c1d2e153286a04e45eac9b1bba9..14ba433dad17806bdc943aca60020d979a55d10b 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp index e7b0c9c1634f94a2734882cac7f44ea8d5ae23d0..404bad278c5eba65f380e69cd5131a8bf517170b 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -22,311 +22,6 @@ namespace { auto fakeTestCase(const char* name, const char* desc = "") { return Catch::makeTestCaseInfo("", { name, desc }, CATCH_INTERNAL_LINEINFO); } } -TEST_CASE( "Parse test names and tags", "[command-line][test-spec]" ) { - - using Catch::parseTestSpec; - using Catch::TestSpec; - - auto tcA = fakeTestCase( "a" ); - auto tcB = fakeTestCase( "b", "[one][x]" ); - auto tcC = fakeTestCase( "longer name with spaces", "[two][three][.][x]" ); - auto tcD = fakeTestCase( "zlonger name with spacesz" ); - - SECTION( "Empty test spec should have no filters" ) { - TestSpec spec; - CHECK( spec.hasFilters() == false ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - } - - SECTION( "Test spec from empty string should have no filters" ) { - TestSpec spec = parseTestSpec( "" ); - CHECK( spec.hasFilters() == false ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - } - - SECTION( "Test spec from just a comma should have no filters" ) { - TestSpec spec = parseTestSpec( "," ); - CHECK( spec.hasFilters() == false ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - } - - SECTION( "Test spec from name should have one filter" ) { - TestSpec spec = parseTestSpec( "b" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == true ); - } - - SECTION( "Test spec from quoted name should have one filter" ) { - TestSpec spec = parseTestSpec( "\"b\"" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == true ); - } - - SECTION( "Test spec from name should have one filter" ) { - TestSpec spec = parseTestSpec( "b" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == true ); - CHECK( spec.matches( *tcC ) == false ); - } - - SECTION( "Wildcard at the start" ) { - TestSpec spec = parseTestSpec( "*spaces" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == false ); - CHECK( parseTestSpec( "*a" ).matches( *tcA ) == true ); - } - SECTION( "Wildcard at the end" ) { - TestSpec spec = parseTestSpec( "long*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == false ); - CHECK( parseTestSpec( "a*" ).matches( *tcA ) == true ); - } - SECTION( "Wildcard at both ends" ) { - TestSpec spec = parseTestSpec( "*name*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == true ); - CHECK( parseTestSpec( "*a*" ).matches( *tcA ) == true ); - } - SECTION( "Redundant wildcard at the start" ) { - TestSpec spec = parseTestSpec( "*a" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == false ); - } - SECTION( "Redundant wildcard at the end" ) { - TestSpec spec = parseTestSpec( "a*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == false ); - } - SECTION( "Redundant wildcard at both ends" ) { - TestSpec spec = parseTestSpec( "*a*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == false ); - } - SECTION( "Wildcard at both ends, redundant at start" ) { - TestSpec spec = parseTestSpec( "*longer*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == true ); - } - SECTION( "Just wildcard" ) { - TestSpec spec = parseTestSpec( "*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == true ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == true ); - } - - SECTION( "Single tag" ) { - TestSpec spec = parseTestSpec( "[one]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == true ); - CHECK( spec.matches( *tcC ) == false ); - } - SECTION( "Single tag, two matches" ) { - TestSpec spec = parseTestSpec( "[x]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == true ); - CHECK( spec.matches( *tcC ) == true ); - } - SECTION( "Two tags" ) { - TestSpec spec = parseTestSpec( "[two][x]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == true ); - } - SECTION( "Two tags, spare separated" ) { - TestSpec spec = parseTestSpec( "[two] [x]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == true ); - } - SECTION( "Wildcarded name and tag" ) { - TestSpec spec = parseTestSpec( "*name*[x]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == false ); - } - SECTION( "Single tag exclusion" ) { - TestSpec spec = parseTestSpec( "~[one]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == false ); - } - SECTION( "One tag exclusion and one tag inclusion" ) { - TestSpec spec = parseTestSpec( "~[two][x]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == true ); - CHECK( spec.matches( *tcC ) == false ); - } - SECTION( "One tag exclusion and one wldcarded name inclusion" ) { - TestSpec spec = parseTestSpec( "~[two]*name*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == false ); - CHECK( spec.matches( *tcD ) == true ); - } - SECTION( "One tag exclusion, using exclude:, and one wldcarded name inclusion" ) { - TestSpec spec = parseTestSpec( "exclude:[two]*name*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == false ); - CHECK( spec.matches( *tcD ) == true ); - } - SECTION( "name exclusion" ) { - TestSpec spec = parseTestSpec( "~b" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == false ); - CHECK( spec.matches( *tcD ) == true ); - } - SECTION( "wildcarded name exclusion" ) { - TestSpec spec = parseTestSpec( "~*name*" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == true ); - CHECK( spec.matches( *tcC ) == false ); - CHECK( spec.matches( *tcD ) == false ); - } - SECTION( "wildcarded name exclusion with tag inclusion" ) { - TestSpec spec = parseTestSpec( "~*name*,[three]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == true ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == false ); - } - SECTION( "wildcarded name exclusion, using exclude:, with tag inclusion" ) { - TestSpec spec = parseTestSpec( "exclude:*name*,[three]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == true ); - CHECK( spec.matches( *tcB ) == true ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == false ); - } - SECTION( "two wildcarded names" ) { - TestSpec spec = parseTestSpec( "\"longer*\"\"*spaces\"" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == true ); - CHECK( spec.matches( *tcD ) == false ); - } - SECTION( "empty tag" ) { - TestSpec spec = parseTestSpec( "[]" ); - CHECK( spec.hasFilters() == false ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == false ); - CHECK( spec.matches( *tcD ) == false ); - } - SECTION( "empty quoted name" ) { - TestSpec spec = parseTestSpec( "\"\"" ); - CHECK( spec.hasFilters() == false ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == false ); - CHECK( spec.matches( *tcD ) == false ); - } - SECTION( "quoted string followed by tag exclusion" ) { - TestSpec spec = parseTestSpec( "\"*name*\"~[.]" ); - CHECK( spec.hasFilters() == true ); - CHECK( spec.matches( *tcA ) == false ); - CHECK( spec.matches( *tcB ) == false ); - CHECK( spec.matches( *tcC ) == false ); - CHECK( spec.matches( *tcD ) == true ); - } - SECTION( "Leading and trailing spaces in test spec" ) { - TestSpec spec = parseTestSpec( "\" aardvark \"" ); - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); - CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ); - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); - CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ); - CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ); - - } - SECTION( "Leading and trailing spaces in test name" ) { - TestSpec spec = parseTestSpec( "aardvark" ); - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); - CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ); - CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); - CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ); - CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ); - } - SECTION("Shortened hide tags are split apart when parsing") { - TestSpec spec = parseTestSpec("[.foo]"); - CHECK(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))); - CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]"))); - } - SECTION("Shortened hide tags also properly handle exclusion") { - TestSpec spec = parseTestSpec("~[.foo]"); - CHECK_FALSE(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))); - CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]"))); - CHECK_FALSE(spec.matches(*fakeTestCase("only hidden", "[.]"))); - CHECK(spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]"))); - } -} - -TEST_CASE("#1905 -- test spec parser properly clears internal state between compound tests", "[command-line][test-spec]") { - using Catch::parseTestSpec; - using Catch::TestSpec; - // We ask for one of 2 different tests and the latter one of them has a , in name that needs escaping - TestSpec spec = parseTestSpec(R"("spec . char","spec \, char")"); - - REQUIRE(spec.matches(*fakeTestCase("spec . char"))); - REQUIRE(spec.matches(*fakeTestCase("spec , char"))); - REQUIRE_FALSE(spec.matches(*fakeTestCase(R"(spec \, char)"))); -} - -TEST_CASE("#1912 -- test spec parser handles escaping", "[command-line][test-spec]") { - using Catch::parseTestSpec; - using Catch::TestSpec; - - SECTION("Various parentheses") { - TestSpec spec = parseTestSpec(R"(spec {a} char,spec \[a] char)"); - - REQUIRE(spec.matches(*fakeTestCase(R"(spec {a} char)"))); - REQUIRE(spec.matches(*fakeTestCase(R"(spec [a] char)"))); - REQUIRE_FALSE(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))); - } - SECTION("backslash in test name") { - TestSpec spec = parseTestSpec(R"(spec \\ char)"); - - REQUIRE(spec.matches(*fakeTestCase(R"(spec \ char)"))); - } -} - TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) { using namespace Catch::Matchers; @@ -649,14 +344,18 @@ TEST_CASE("Parsing sharding-related cli flags", "[sharding]") { auto result = cli.parse({ "test", "--shard-count=-1" }); CHECK_FALSE(result); - REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard count must be a positive number")); + REQUIRE_THAT( + result.errorMessage(), + ContainsSubstring( "Could not parse '-1' as shard count" ) ); } SECTION("Zero shard count reports error") { auto result = cli.parse({ "test", "--shard-count=0" }); CHECK_FALSE(result); - REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard count must be a positive number")); + REQUIRE_THAT( + result.errorMessage(), + ContainsSubstring( "Shard count must be positive" ) ); } SECTION("shard-index") { @@ -669,7 +368,9 @@ TEST_CASE("Parsing sharding-related cli flags", "[sharding]") { auto result = cli.parse({ "test", "--shard-index=-12" }); CHECK_FALSE(result); - REQUIRE_THAT(result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number")); + REQUIRE_THAT( + result.errorMessage(), + ContainsSubstring( "Could not parse '-12' as shard index" ) ); } SECTION("Shard index 0 is accepted") { @@ -677,7 +378,6 @@ TEST_CASE("Parsing sharding-related cli flags", "[sharding]") { REQUIRE(config.shardIndex == 0); } - } TEST_CASE( "Parsing warnings", "[cli][warnings]" ) { @@ -737,3 +437,31 @@ TEST_CASE("Win32 colour implementation is compile-time optional", REQUIRE_FALSE( result ); #endif } + +TEST_CASE( "Parse rng seed in different formats", "[approvals][cli][rng-seed]" ) { + Catch::ConfigData config; + auto cli = Catch::makeCommandLineParser( config ); + + SECTION("well formed cases") { + char const* seed_string; + uint32_t seed_value; + // GCC-5 workaround + using gen_type = std::tuple<char const*, uint32_t>; + std::tie( seed_string, seed_value ) = GENERATE( table<char const*, uint32_t>({ + gen_type{ "0xBEEF", 0xBEEF }, + gen_type{ "12345678", 12345678 } + } ) ); + CAPTURE( seed_string ); + + auto result = cli.parse( { "tests", "--rng-seed", seed_string } ); + + REQUIRE( result ); + REQUIRE( config.rngSeed == seed_value ); + } + SECTION( "Error cases" ) { + auto seed_string = + GENERATE( "0xSEED", "999999999999", "08888", "BEEF", "123 456" ); + CAPTURE( seed_string ); + REQUIRE_FALSE( cli.parse( { "tests", "--rng-seed", seed_string } ) ); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp index b8a543903748b580796c59222855fc1f96f6c0ec..4df8ecf9e8d76e248ba832974cf575a4554bfcae 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/ColourImpl.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ColourImpl.tests.cpp index 83501cae51f155a0a5e7630ee84ebe1395eefdc4..615fda1d910f44d37968614bbe6759d33ca77861 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/ColourImpl.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ColourImpl.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp index 987910a948abe74947e07279b4b4bdf940988c11..d7175756b5c6b212ebdacf43afbdc19ed137f8ea 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -11,6 +11,8 @@ #include <catch2/internal/catch_case_insensitive_comparisons.hpp> #include <catch2/internal/catch_optional.hpp> +#include <helpers/type_with_lit_0_comparisons.hpp> + #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable:4702) // unreachable code in the macro expansions @@ -86,3 +88,85 @@ TEST_CASE("Optional comparison ops", "[optional][approvals]") { REQUIRE_FALSE( a != b ); } } + +namespace { + struct MoveChecker { + bool has_moved = false; + MoveChecker() = default; + MoveChecker( MoveChecker const& rhs ) = default; + MoveChecker& operator=( MoveChecker const& rhs ) = default; + MoveChecker( MoveChecker&& rhs ) noexcept { rhs.has_moved = true; } + MoveChecker& operator=( MoveChecker&& rhs ) noexcept { + rhs.has_moved = true; + return *this; + } + }; +} + +TEST_CASE( "Optional supports move ops", "[optional][approvals]" ) { + using Catch::Optional; + MoveChecker a; + Optional<MoveChecker> opt_A( a ); + REQUIRE_FALSE( a.has_moved ); + REQUIRE_FALSE( opt_A->has_moved ); + + SECTION( "Move construction from element" ) { + Optional<MoveChecker> opt_B( CATCH_MOVE( a ) ); + REQUIRE( a.has_moved ); + } + SECTION( "Move assignment from element" ) { + opt_A = CATCH_MOVE( a ); + REQUIRE( a.has_moved ); + } + SECTION( "Move construction from optional" ) { + Optional<MoveChecker> opt_B( CATCH_MOVE( opt_A ) ); + REQUIRE( opt_A->has_moved ); + } + SECTION( "Move assignment from optional" ) { + Optional<MoveChecker> opt_B( opt_A ); + REQUIRE_FALSE( opt_A->has_moved ); + opt_B = CATCH_MOVE( opt_A ); + REQUIRE( opt_A->has_moved ); + } +} + +TEST_CASE( "Decomposer checks that the argument is 0 when handling " + "only-0-comparable types", + "[decomposition][approvals]" ) { + TypeWithLit0Comparisons t{}; + + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS + + REQUIRE_THROWS( Catch::Decomposer{} <= t == 42 ); + REQUIRE_THROWS( Catch::Decomposer{} <= 42 == t ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= t == 0 ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= 0 == t ); + + REQUIRE_THROWS( Catch::Decomposer{} <= t != 42 ); + REQUIRE_THROWS( Catch::Decomposer{} <= 42 != t ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= t != 0 ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= 0 != t ); + + REQUIRE_THROWS( Catch::Decomposer{} <= t < 42 ); + REQUIRE_THROWS( Catch::Decomposer{} <= 42 < t ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= t < 0 ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= 0 < t ); + + REQUIRE_THROWS( Catch::Decomposer{} <= t <= 42 ); + REQUIRE_THROWS( Catch::Decomposer{} <= 42 <= t ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= t <= 0 ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= 0 <= t ); + + REQUIRE_THROWS( Catch::Decomposer{} <= t > 42 ); + REQUIRE_THROWS( Catch::Decomposer{} <= 42 > t ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= t > 0 ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= 0 > t ); + + REQUIRE_THROWS( Catch::Decomposer{} <= t >= 42 ); + REQUIRE_THROWS( Catch::Decomposer{} <= 42 >= t ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= t >= 0 ); + REQUIRE_NOTHROW( Catch::Decomposer{} <= 0 >= t ); + + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp index 242a89670d2126d82fcead01c05f006212e3c51a..08a579c9dc5c0aa2dcfbbb602bc56c34dfab164d 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index 3ad20453c59ca1b15f4a6d0fd80732dfb430b656..f7b7c57cc354f5bd10ba48c8e08c3bf94cdaf6b7 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -16,6 +16,7 @@ #include <catch2/generators/catch_generators_adapters.hpp> #include <catch2/generators/catch_generators_random.hpp> #include <catch2/generators/catch_generators_range.hpp> +#include <catch2/generators/catch_generator_exception.hpp> // Tests of generator implementation details TEST_CASE("Generators internals", "[generators][internals]") { @@ -411,6 +412,7 @@ TEST_CASE("GENERATE handles function (pointers)", "[generators][compilation][app TEST_CASE("GENERATE decays arrays", "[generators][compilation][approvals]") { auto str = GENERATE("abc", "def", "gh"); + (void)str; STATIC_REQUIRE(std::is_same<decltype(str), const char*>::value); } @@ -534,3 +536,12 @@ TEST_CASE( "Random generators can be seeded", "[generators][approvals]" ) { } } } + +TEST_CASE("Filter generator throws exception for empty generator", + "[generators]") { + using namespace Catch::Generators; + + REQUIRE_THROWS_AS( + filter( []( int ) { return false; }, value( 3 ) ), + Catch::GeneratorException ); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp index f51f7bd9d4dd5d4d24747ba6b9443a6faeb45f82..24bfe68cd6dea8eb2bbdfe18fa677335c98d613e 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -22,6 +22,8 @@ #include <catch2/benchmark/detail/catch_benchmark_function.hpp> #include <catch2/benchmark/detail/catch_estimate_clock.hpp> +#include <numeric> + namespace { struct manual_clock { public: @@ -442,6 +444,6 @@ TEST_CASE("Failing benchmarks", "[!benchmark][.approvals]") { } TEST_CASE( "Failing benchmark respects should-fail", - "[!shouldfail][!benchmark][.approvals]" ) { + "[!shouldfail][!benchmark][approvals]" ) { BENCHMARK( "Asserting benchmark" ) { REQUIRE( 1 == 2 ); }; } diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Parse.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Parse.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7791355f58b34ece7a697153dc8be23aace0d186 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Parse.tests.cpp @@ -0,0 +1,38 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_test_macros.hpp> + +#include <catch2/internal/catch_parse_numbers.hpp> + +TEST_CASE("Parse uints", "[parse-numbers]") { + using Catch::parseUInt; + using Catch::Optional; + + SECTION("proper inputs") { + REQUIRE( parseUInt( "0" ) == Optional<unsigned int>{ 0 } ); + REQUIRE( parseUInt( "100" ) == Optional<unsigned int>{ 100 } ); + REQUIRE( parseUInt( "4294967295" ) == + Optional<unsigned int>{ 4294967295 } ); + REQUIRE( parseUInt( "0xFF", 16 ) == Optional<unsigned int>{ 255 } ); + } + SECTION( "Bad inputs" ) { + // empty + REQUIRE_FALSE( parseUInt( "" ) ); + // random noise + REQUIRE_FALSE( parseUInt( "!!KJHF*#" ) ); + // negative + REQUIRE_FALSE( parseUInt( "-1" ) ); + // too large + REQUIRE_FALSE( parseUInt( "4294967296" ) ); + REQUIRE_FALSE( parseUInt( "42949672964294967296429496729642949672964294967296" ) ); + REQUIRE_FALSE( parseUInt( "2 4" ) ); + // hex with base 10 + REQUIRE_FALSE( parseUInt( "0xFF", 10 ) ); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp index 025a286043a5b98e04d2c169bfd81b5205ac87f5..c13ec573e63561aad106e7ba5ff247fdf85bfb5d 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -14,8 +14,8 @@ using namespace Catch; namespace { -Catch::TestCaseTracking::NameAndLocation makeNAL( std::string const& name ) { - return Catch::TestCaseTracking::NameAndLocation( name, Catch::SourceLineInfo("",0) ); +Catch::TestCaseTracking::NameAndLocationRef makeNAL( StringRef name ) { + return Catch::TestCaseTracking::NameAndLocationRef( name, Catch::SourceLineInfo("",0) ); } } diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp index b79b372e977150cb266df29e462f2293c558a337..8018b7eb0d8660cf517ffb82f2dc81c3ae7ea275 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp index 97d1ad25307f6762eb0326cd39939f4fed82345d..1568c951692fba61bf3f00171ab689418ed5b547 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -12,7 +12,6 @@ #include <catch2/catch_config.hpp> #include <catch2/interfaces/catch_interfaces_reporter.hpp> #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> -#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> #include <catch2/internal/catch_console_colour.hpp> #include <catch2/internal/catch_enforce.hpp> #include <catch2/internal/catch_list.hpp> @@ -164,7 +163,7 @@ namespace { std::vector<std::string>& recorder, Catch::IConfig const* config ): EventListenerBase( config ), - m_witness( witness ), + m_witness( CATCH_MOVE(witness) ), m_recorder( recorder ) {} @@ -182,7 +181,7 @@ namespace { std::vector<std::string>& recorder, Catch::ReporterConfig&& config ): StreamingReporterBase( CATCH_MOVE(config) ), - m_witness( witness ), + m_witness( CATCH_MOVE(witness) ), m_recorder( recorder ) {} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Sharding.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Sharding.tests.cpp index 78e4858a0297b8609c7667bc9ecfb94f742c970b..8e6009dd581864c6d8801674a872b737e69d5b20 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Sharding.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Sharding.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp index 6b1d377c854776c6b314610b650d8f6342686e48..738cb529c9b954b79961cfd35c5c3b489b678a3b 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp index 08f7dc2c6ace98eb78edf56b270bf0cbeda30a9e..7a0b3b4ab445ec3b9fd96cc47652e671a5ed3f4e 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp index 8cd995cce9c80391f1b3598ea3c653f945079289..36554ddc3b422ee9ae169cd8928d0e905b4c9aab 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp index d87f966bde4960354b04bdf703543a6d3b4ce99b..43723758d0ea11f21c5a01a4f4ec6eb1c986137a 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -98,7 +98,20 @@ TEST_CASE( "Test case with identical tags keeps just one", "[tags]" ) { REQUIRE( testCase.tags[0] == Tag( "tag1" ) ); } -TEST_CASE( "Empty tag is not allowed" ) { - REQUIRE_THROWS( Catch::TestCaseInfo( - "", { "fake test name", "[]" }, dummySourceLineInfo ) ); +TEST_CASE("Mismatched square brackets in tags are caught and reported", + "[tags][approvals]") { + using Catch::TestCaseInfo; + using Catch::Matchers::ContainsSubstring; + REQUIRE_THROWS_WITH( TestCaseInfo( "", + { "test with unclosed tag", "[abc" }, + dummySourceLineInfo ), + ContainsSubstring("registering test case 'test with unclosed tag'") ); + REQUIRE_THROWS_WITH( TestCaseInfo( "", + { "test with nested tags", "[abc[def]]" }, + dummySourceLineInfo ), + ContainsSubstring("registering test case 'test with nested tags'") ); + REQUIRE_THROWS_WITH( TestCaseInfo( "", + { "test with superfluous close tags", "[abc][def]]" }, + dummySourceLineInfo ), + ContainsSubstring("registering test case 'test with superfluous close tags'") ); } diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp index 93cb70b14a51f065e0731c90c92475769b1bfe43..03cb3f0e2aeea3bc92d646ca7ea1e74a2a42a1ee 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpec.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpec.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9c4eb03b1a7b82f4208d8278c4d48296e543a77a --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpec.tests.cpp @@ -0,0 +1,365 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_config.hpp> +#include <catch2/catch_approx.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> +#include <catch2/internal/catch_test_spec_parser.hpp> +#include <catch2/catch_user_config.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_commandline.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> + +#include <helpers/parse_test_spec.hpp> + +namespace { + auto fakeTestCase(const char* name, const char* desc = "") { return Catch::makeTestCaseInfo("", { name, desc }, CATCH_INTERNAL_LINEINFO); } +} + +TEST_CASE( "Parse test names and tags", "[command-line][test-spec][approvals]" ) { + using Catch::parseTestSpec; + using Catch::TestSpec; + + auto tcA = fakeTestCase( "a" ); + auto tcB = fakeTestCase( "b", "[one][x]" ); + auto tcC = fakeTestCase( "longer name with spaces", "[two][three][.][x]" ); + auto tcD = fakeTestCase( "zlonger name with spacesz" ); + + SECTION( "Empty test spec should have no filters" ) { + TestSpec spec; + CHECK( spec.hasFilters() == false ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + } + + SECTION( "Test spec from empty string should have no filters" ) { + TestSpec spec = parseTestSpec( "" ); + CHECK( spec.hasFilters() == false ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + } + + SECTION( "Test spec from just a comma should have no filters" ) { + TestSpec spec = parseTestSpec( "," ); + CHECK( spec.hasFilters() == false ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + } + + SECTION( "Test spec from name should have one filter" ) { + TestSpec spec = parseTestSpec( "b" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == true ); + } + + SECTION( "Test spec from quoted name should have one filter" ) { + TestSpec spec = parseTestSpec( "\"b\"" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == true ); + } + + SECTION( "Test spec from name should have one filter" ) { + TestSpec spec = parseTestSpec( "b" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == true ); + CHECK( spec.matches( *tcC ) == false ); + } + + SECTION( "Wildcard at the start" ) { + TestSpec spec = parseTestSpec( "*spaces" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == false ); + CHECK( parseTestSpec( "*a" ).matches( *tcA ) == true ); + } + SECTION( "Wildcard at the end" ) { + TestSpec spec = parseTestSpec( "long*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == false ); + CHECK( parseTestSpec( "a*" ).matches( *tcA ) == true ); + } + SECTION( "Wildcard at both ends" ) { + TestSpec spec = parseTestSpec( "*name*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == true ); + CHECK( parseTestSpec( "*a*" ).matches( *tcA ) == true ); + } + SECTION( "Redundant wildcard at the start" ) { + TestSpec spec = parseTestSpec( "*a" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == false ); + } + SECTION( "Redundant wildcard at the end" ) { + TestSpec spec = parseTestSpec( "a*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == false ); + } + SECTION( "Redundant wildcard at both ends" ) { + TestSpec spec = parseTestSpec( "*a*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == false ); + } + SECTION( "Wildcard at both ends, redundant at start" ) { + TestSpec spec = parseTestSpec( "*longer*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == true ); + } + SECTION( "Just wildcard" ) { + TestSpec spec = parseTestSpec( "*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == true ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == true ); + } + + SECTION( "Single tag" ) { + TestSpec spec = parseTestSpec( "[one]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == true ); + CHECK( spec.matches( *tcC ) == false ); + } + SECTION( "Single tag, two matches" ) { + TestSpec spec = parseTestSpec( "[x]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == true ); + CHECK( spec.matches( *tcC ) == true ); + } + SECTION( "Two tags" ) { + TestSpec spec = parseTestSpec( "[two][x]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == true ); + } + SECTION( "Two tags, spare separated" ) { + TestSpec spec = parseTestSpec( "[two] [x]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == true ); + } + SECTION( "Wildcarded name and tag" ) { + TestSpec spec = parseTestSpec( "*name*[x]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == false ); + } + SECTION( "Single tag exclusion" ) { + TestSpec spec = parseTestSpec( "~[one]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == false ); + } + SECTION( "One tag exclusion and one tag inclusion" ) { + TestSpec spec = parseTestSpec( "~[two][x]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == true ); + CHECK( spec.matches( *tcC ) == false ); + } + SECTION( "One tag exclusion and one wldcarded name inclusion" ) { + TestSpec spec = parseTestSpec( "~[two]*name*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == false ); + CHECK( spec.matches( *tcD ) == true ); + } + SECTION( "One tag exclusion, using exclude:, and one wldcarded name inclusion" ) { + TestSpec spec = parseTestSpec( "exclude:[two]*name*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == false ); + CHECK( spec.matches( *tcD ) == true ); + } + SECTION( "name exclusion" ) { + TestSpec spec = parseTestSpec( "~b" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == false ); + CHECK( spec.matches( *tcD ) == true ); + } + SECTION( "wildcarded name exclusion" ) { + TestSpec spec = parseTestSpec( "~*name*" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == true ); + CHECK( spec.matches( *tcC ) == false ); + CHECK( spec.matches( *tcD ) == false ); + } + SECTION( "wildcarded name exclusion with tag inclusion" ) { + TestSpec spec = parseTestSpec( "~*name*,[three]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == true ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == false ); + } + SECTION( "wildcarded name exclusion, using exclude:, with tag inclusion" ) { + TestSpec spec = parseTestSpec( "exclude:*name*,[three]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == true ); + CHECK( spec.matches( *tcB ) == true ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == false ); + } + SECTION( "two wildcarded names" ) { + TestSpec spec = parseTestSpec( "\"longer*\"\"*spaces\"" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == true ); + CHECK( spec.matches( *tcD ) == false ); + } + SECTION( "empty tag" ) { + TestSpec spec = parseTestSpec( "[]" ); + CHECK( spec.hasFilters() == false ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == false ); + CHECK( spec.matches( *tcD ) == false ); + } + SECTION( "empty quoted name" ) { + TestSpec spec = parseTestSpec( "\"\"" ); + CHECK( spec.hasFilters() == false ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == false ); + CHECK( spec.matches( *tcD ) == false ); + } + SECTION( "quoted string followed by tag exclusion" ) { + TestSpec spec = parseTestSpec( "\"*name*\"~[.]" ); + CHECK( spec.hasFilters() == true ); + CHECK( spec.matches( *tcA ) == false ); + CHECK( spec.matches( *tcB ) == false ); + CHECK( spec.matches( *tcC ) == false ); + CHECK( spec.matches( *tcD ) == true ); + } + SECTION( "Leading and trailing spaces in test spec" ) { + TestSpec spec = parseTestSpec( "\" aardvark \"" ); + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ); + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ); + + } + SECTION( "Leading and trailing spaces in test name" ) { + TestSpec spec = parseTestSpec( "aardvark" ); + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ); + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ); + } + SECTION("Shortened hide tags are split apart when parsing") { + TestSpec spec = parseTestSpec("[.foo]"); + CHECK(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))); + CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]"))); + } + SECTION("Shortened hide tags also properly handle exclusion") { + TestSpec spec = parseTestSpec("~[.foo]"); + CHECK_FALSE(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))); + CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]"))); + CHECK_FALSE(spec.matches(*fakeTestCase("only hidden", "[.]"))); + CHECK(spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]"))); + } +} + +TEST_CASE("#1905 -- test spec parser properly clears internal state between compound tests", "[command-line][test-spec]") { + using Catch::parseTestSpec; + using Catch::TestSpec; + // We ask for one of 2 different tests and the latter one of them has a , in name that needs escaping + TestSpec spec = parseTestSpec(R"("spec . char","spec \, char")"); + + REQUIRE(spec.matches(*fakeTestCase("spec . char"))); + REQUIRE(spec.matches(*fakeTestCase("spec , char"))); + REQUIRE_FALSE(spec.matches(*fakeTestCase(R"(spec \, char)"))); +} + +TEST_CASE("#1912 -- test spec parser handles escaping", "[command-line][test-spec]") { + using Catch::parseTestSpec; + using Catch::TestSpec; + + SECTION("Various parentheses") { + TestSpec spec = parseTestSpec(R"(spec {a} char,spec \[a] char)"); + + REQUIRE(spec.matches(*fakeTestCase(R"(spec {a} char)"))); + REQUIRE(spec.matches(*fakeTestCase(R"(spec [a] char)"))); + REQUIRE_FALSE(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))); + } + SECTION("backslash in test name") { + TestSpec spec = parseTestSpec(R"(spec \\ char)"); + + REQUIRE(spec.matches(*fakeTestCase(R"(spec \ char)"))); + } +} + +TEST_CASE("Test spec serialization is round-trippable", "[test-spec][serialization][approvals]") { + using Catch::parseTestSpec; + using Catch::TestSpec; + + auto serializedTestSpec = []( std::string const& spec ) { + Catch::ReusableStringStream sstr; + sstr << parseTestSpec( spec ); + return sstr.str(); + }; + + SECTION("Spaces are normalized") { + CHECK( serializedTestSpec( "[abc][def]" ) == "[abc] [def]" ); + CHECK( serializedTestSpec( "[def] [abc]" ) == "[def] [abc]" ); + CHECK( serializedTestSpec( "[def] [abc]" ) == "[def] [abc]" ); + } + SECTION("Output is order dependent") { + CHECK( serializedTestSpec( "[abc][def]" ) == "[abc] [def]" ); + CHECK( serializedTestSpec( "[def][abc]" ) == "[def] [abc]" ); + } + SECTION("Multiple disjunct filters") { + CHECK( serializedTestSpec( "[abc],[def]" ) == "[abc],[def]" ); + CHECK( serializedTestSpec( "[def],[abc],[idkfa]" ) == "[def],[abc],[idkfa]" ); + } + SECTION("Test names are enclosed in string") { + CHECK( serializedTestSpec( "Some test" ) == "\"Some test\"" ); + CHECK( serializedTestSpec( "*Some test" ) == "\"*Some test\"" ); + CHECK( serializedTestSpec( "* Some test" ) == "\"* Some test\"" ); + CHECK( serializedTestSpec( "* Some test *" ) == "\"* Some test *\"" ); + } + SECTION( "Mixing test names and tags" ) { + CHECK( serializedTestSpec( "some test[abcd]" ) == + "\"some test\" [abcd]" ); + CHECK( serializedTestSpec( "[ab]some test[cd]" ) == + "[ab] \"some test\" [cd]" ); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpecParser.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpecParser.tests.cpp index c8ac77b293aaa0ec230fcef7b701ec8d71be7c46..ae27b40668ae5dd20ff77de61bc3720956d53e8b 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpecParser.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TestSpecParser.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TextFlow.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TextFlow.tests.cpp index 379dc624dace6ce1f188220107c809f6598f2af7..82de5a27f5c936df9dfae3186563ea96c5d766ec 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/TextFlow.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/TextFlow.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp index 63f072dd9940c5489938b6ddb8fdddcd40dd688a..e50e4c5e717c40bbab10f064894f3aa412a1a7ae 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Traits.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Traits.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..459e0d4857a07c06ebabfa68def8a893a15b3b88 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Traits.tests.cpp @@ -0,0 +1,45 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_compare_traits.hpp> +#include <helpers/type_with_lit_0_comparisons.hpp> + + +#define ADD_TRAIT_TEST_CASE( op ) \ + TEST_CASE( "is_" #op "_comparable", \ + "[traits][is_comparable][approvals]" ) { \ + using Catch::Detail::is_##op##_0_comparable; \ + using Catch::Detail::is_##op##_comparable; \ + \ + STATIC_REQUIRE( is_##op##_comparable<int, int>::value ); \ + STATIC_REQUIRE( \ + is_##op##_comparable<std::string, std::string>::value ); \ + STATIC_REQUIRE( !is_##op##_comparable<int, std::string>::value ); \ + STATIC_REQUIRE( \ + !is_##op##_comparable<TypeWithLit0Comparisons, int>::value ); \ + STATIC_REQUIRE( \ + !is_##op##_comparable<int, TypeWithLit0Comparisons>::value ); \ + \ + STATIC_REQUIRE( is_##op##_0_comparable<int>::value ); \ + STATIC_REQUIRE( \ + is_##op##_0_comparable<TypeWithLit0Comparisons>::value ); \ + STATIC_REQUIRE( !is_##op##_0_comparable<std::string>::value ); \ + \ + /* This test fails with MSVC in permissive mode, because of course it does */ \ + /* STATIC_REQUIRE( !is_##op##_0_comparable<int*>::value ); */ \ +} + +ADD_TRAIT_TEST_CASE(lt) +ADD_TRAIT_TEST_CASE(gt) +ADD_TRAIT_TEST_CASE(le) +ADD_TRAIT_TEST_CASE(ge) +ADD_TRAIT_TEST_CASE(eq) +ADD_TRAIT_TEST_CASE(ne) + +#undef ADD_TRAIT_TEST_CASE diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp index 40c9886c32cadd680265923ed518d68164295a9d..420bf1b34fdbc49145777b6cea2470b0cbd64352 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp index 9fe9416a121485918ba5835313482972df68cbf3..b5982b8551763f5a8f3564aff28c0a1b4c002e6f 100644 --- a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/TestRegistrations.cpp b/packages/Catch2/tests/SelfTest/TestRegistrations.cpp index f24c913f5d0ca575796b7b3b966b45f2d78c3ffa..6476773529c798ccb68853faab27f4622eabdcbb 100644 --- a/packages/Catch2/tests/SelfTest/TestRegistrations.cpp +++ b/packages/Catch2/tests/SelfTest/TestRegistrations.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp b/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp index bfb222d037c078225c171f747256065c2813a876..4e9e385b23176d5a5ca527bbedf105cc8345a50a 100644 --- a/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp +++ b/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp index 853227a2783db138362fca899e3a340323971fe0..c3d41cb4463c86e5d3d2b791b6c1e9fd9f9b0061 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp index b128196c3e4da62ed3d7a7970de1b332e014920a..5ac860553b47a7f0f03444c3d0abc5451ac0bf41 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp index ffedc9a2f65cfe11ef4384119bb455725d2406d6..557b2131c6285acea373acc18850027fcbc47d55 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -16,21 +16,23 @@ namespace { std::uint64_t Fibonacci(std::uint64_t number) { - return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); + return number < 2 ? number : Fibonacci(number - 1) + Fibonacci(number - 2); } } TEST_CASE("Benchmark Fibonacci", "[!benchmark]") { - CHECK(Fibonacci(0) == 1); + CHECK(Fibonacci(0) == 0); // some more asserts.. - CHECK(Fibonacci(5) == 8); + CHECK(Fibonacci(5) == 5); // some more asserts.. - BENCHMARK("Fibonacci 20") { + REQUIRE( Fibonacci( 20 ) == 6'765 ); + BENCHMARK( "Fibonacci 20" ) { return Fibonacci(20); }; - BENCHMARK("Fibonacci 25") { + REQUIRE( Fibonacci( 25 ) == 75'025 ); + BENCHMARK( "Fibonacci 25" ) { return Fibonacci(25); }; diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp index 6b2ba4cfe6559ff6f9f794130d912cc8725a6ee2..bab7a684379330e43a85a38404616195e1c34430 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp index 5d9ab3f05975113d7b132c4ab6b9ca4e3bba9804..1cdcfb788ec1a8a82c0ff8e5d3a6121b7e2f9cfd 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp @@ -1,11 +1,13 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 +#include <helpers/type_with_lit_0_comparisons.hpp> + #include <type_traits> // Setup for #1403 -- look for global overloads of operator << for classes @@ -310,3 +312,44 @@ TEST_CASE("ADL universal operators don't hijack expression deconstruction", "[co REQUIRE(0 & adl::always_true{}); REQUIRE(0 ^ adl::always_true{}); } + +TEST_CASE( "#2555 - types that can only be compared with 0 literal (not int/long) are supported", "[compilation][approvals]" ) { + REQUIRE( TypeWithLit0Comparisons{} < 0 ); + REQUIRE_FALSE( 0 < TypeWithLit0Comparisons{} ); + REQUIRE( TypeWithLit0Comparisons{} <= 0 ); + REQUIRE_FALSE( 0 > TypeWithLit0Comparisons{} ); + + REQUIRE( TypeWithLit0Comparisons{} > 0 ); + REQUIRE_FALSE( 0 > TypeWithLit0Comparisons{} ); + REQUIRE( TypeWithLit0Comparisons{} >= 0 ); + REQUIRE_FALSE( 0 >= TypeWithLit0Comparisons{} ); + + REQUIRE( TypeWithLit0Comparisons{} == 0 ); + REQUIRE_FALSE( 0 == TypeWithLit0Comparisons{} ); + REQUIRE( TypeWithLit0Comparisons{} != 0 ); + REQUIRE_FALSE( 0 != TypeWithLit0Comparisons{} ); +} + +namespace { + struct MultipleImplicitConstructors { + MultipleImplicitConstructors( double ) {} + MultipleImplicitConstructors( int64_t ) {} + bool operator==( MultipleImplicitConstructors ) const { return true; } + bool operator!=( MultipleImplicitConstructors ) const { return true; } + bool operator<( MultipleImplicitConstructors ) const { return true; } + bool operator<=( MultipleImplicitConstructors ) const { return true; } + bool operator>( MultipleImplicitConstructors ) const { return true; } + bool operator>=( MultipleImplicitConstructors ) const { return true; } + }; +} +TEST_CASE("#2571 - tests compile types that have multiple implicit constructors from lit 0", + "[compilation][approvals]") { + MultipleImplicitConstructors mic1( 0.0 ); + MultipleImplicitConstructors mic2( 0.0 ); + REQUIRE( mic1 == mic2 ); + REQUIRE( mic1 != mic2 ); + REQUIRE( mic1 < mic2 ); + REQUIRE( mic1 <= mic2 ); + REQUIRE( mic1 > mic2 ); + REQUIRE( mic1 >= mic2 ); +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp index 2e3b624e1d21db24eaa9ef38c0aa6fb3f8974b6d..211dd3b9152905b1e6ec7d10abaad617b9903be6 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp index 0a169831729d27e26982ef9b9fb79ad3a26df9c8..e92f740606095d9f48b18c074853a4e6bb3b5bae 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -34,6 +34,8 @@ TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decompo TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition][approvals]") { FILE* fptr = nullptr; - REQUIRE(fptr == 0); - REQUIRE(fptr == 0l); + REQUIRE( fptr == 0 ); + REQUIRE_FALSE( fptr != 0 ); + REQUIRE( fptr == 0l ); + REQUIRE_FALSE( fptr != 0l ); } diff --git a/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp index 7cf6213733259437232251918aaa5fc91ccec784..362cf8046d2deeaf56b2ad69df359fe47314c837 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp index e93cf91930ea79131cdd0885215d48f95bf2ac4c..4f91a30c47fb26cd90454e37423b8811b49c59da 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -20,7 +20,7 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wweak-vtables" #pragma clang diagnostic ignored "-Wmissing-noreturn" -#pragma clang diagnostic ignored "-Wunreachable-code" +#pragma clang diagnostic ignored "-Wunreachable-code-return" #endif namespace { diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp index 5b205c85c773125ef9179dc80795c8e389e4fd79..8e2c387a304e6838e48ac648a93bbeb9a8af3e15 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -261,6 +261,10 @@ TEST_CASE("Copy and then generate a range", "[generators]") { } } +#if defined( __clang__ ) +# pragma clang diagnostic pop +#endif + TEST_CASE("#1913 - GENERATE inside a for loop should not keep recreating the generator", "[regression][generators]") { static int counter = 0; for (int i = 0; i < 3; ++i) { @@ -277,6 +281,33 @@ TEST_CASE("#1913 - GENERATEs can share a line", "[regression][generators]") { REQUIRE(i != j); } -#if defined(__clang__) -#pragma clang diagnostic pop -#endif +namespace { + class test_generator : public Catch::Generators::IGenerator<int> { + public: + [[noreturn]] explicit test_generator() { + // removing the following line will cause the program to terminate + // gracefully. + throw Catch::GeneratorException( "failure to init" ); + } + + auto get() const -> int const& override { + static constexpr int value = 1; + return value; + } + + auto next() -> bool override { return false; } + }; + + static auto make_test_generator() + -> Catch::Generators::GeneratorWrapper<int> { + return { new test_generator() }; + } + +} // namespace + +TEST_CASE( "#2615 - Throwing in constructor generator fails test case but does not abort", "[!shouldfail]" ) { + // this should fail the test case, but not abort the application + auto sample = GENERATE( make_test_generator() ); + // this assertion shouldn't trigger + REQUIRE( sample == 0 ); +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp index 5b4e9e033ff2214fd4b3f2fc356ab9316174e921..74bedf5ea97b05b931cd3282ea6aa4cdffc32f38 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -406,6 +406,25 @@ TEST_CASE( "Vector matchers that fail", "[matchers][vector][.][failing]" ) { } } +namespace { + struct SomeType { + int i; + friend bool operator==( SomeType lhs, SomeType rhs ) { + return lhs.i == rhs.i; + } + }; +} // end anonymous namespace + +TEST_CASE( "Vector matcher with elements without !=", "[matchers][vector][approvals]" ) { + std::vector<SomeType> lhs, rhs; + lhs.push_back( { 1 } ); + lhs.push_back( { 2 } ); + rhs.push_back( { 1 } ); + rhs.push_back( { 1 } ); + + REQUIRE_THAT( lhs, !Equals(rhs) ); +} + TEST_CASE( "Exception matchers that succeed", "[matchers][exceptions][!throws]" ) { CHECK_THROWS_MATCHES( @@ -497,6 +516,9 @@ TEST_CASE( "Floating point matchers: float", "[matchers][floating-point]" ) { REQUIRE_THROWS_AS( WithinRel( 1.f, -0.2f ), std::domain_error ); REQUIRE_THROWS_AS( WithinRel( 1.f, 1.f ), std::domain_error ); } + SECTION( "IsNaN" ) { + REQUIRE_THAT( 1., !IsNaN() ); + } } TEST_CASE( "Floating point matchers: double", "[matchers][floating-point]" ) { @@ -552,6 +574,9 @@ TEST_CASE( "Floating point matchers: double", "[matchers][floating-point]" ) { REQUIRE_THROWS_AS( WithinRel( 1., -0.2 ), std::domain_error ); REQUIRE_THROWS_AS( WithinRel( 1., 1. ), std::domain_error ); } + SECTION("IsNaN") { + REQUIRE_THAT( 1., !IsNaN() ); + } } TEST_CASE( "Floating point matchers that are problematic in approvals", @@ -566,6 +591,8 @@ TEST_CASE( "Floating point matchers that are problematic in approvals", REQUIRE_THAT( NAN, !WithinRel( NAN ) ); REQUIRE_THAT( 1., !WithinRel( NAN ) ); REQUIRE_THAT( NAN, !WithinRel( 1. ) ); + REQUIRE_THAT( NAN, IsNaN() ); + REQUIRE_THAT( static_cast<double>(NAN), IsNaN() ); } TEST_CASE( "Arbitrary predicate matcher", "[matchers][generic]" ) { @@ -660,6 +687,21 @@ TEST_CASE( "Exceptions matchers", "[matchers][exceptions][!throws]" ) { Message( "SpecialException::what" ) ); } +TEST_CASE( "Exception message can be matched", "[matchers][exceptions][!throws]" ) { + REQUIRE_THROWS_MATCHES( throwsDerivedException(), + DerivedException, + MessageMatches( StartsWith( "Derived" ) ) ); + REQUIRE_THROWS_MATCHES( throwsDerivedException(), + DerivedException, + MessageMatches( EndsWith( "::what" ) ) ); + REQUIRE_THROWS_MATCHES( throwsDerivedException(), + DerivedException, + MessageMatches( !StartsWith( "::what" ) ) ); + REQUIRE_THROWS_MATCHES( throwsSpecialException( 2 ), + SpecialException, + MessageMatches( StartsWith( "Special" ) ) ); +} + struct CheckedTestingMatcher : Catch::Matchers::MatcherBase<int> { mutable bool matchCalled = false; bool matchSucceeds = false; @@ -848,7 +890,7 @@ struct MatcherA : Catch::Matchers::MatcherGenericBase { return "equals: (int) 1 or (string) \"1\""; } bool match( int i ) const { return i == 1; } - bool match( std::string s ) const { return s == "1"; } + bool match( std::string const& s ) const { return s == "1"; } }; struct MatcherB : Catch::Matchers::MatcherGenericBase { diff --git a/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp index 1201581cf1a5006e747d4041d891f8f094d2daf4..cc8c54f8bf0bcdc0f031955d67bfa46f98ea6e54 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -9,200 +9,21 @@ #include <catch2/catch_test_macros.hpp> #include <catch2/matchers/catch_matchers_container_properties.hpp> #include <catch2/matchers/catch_matchers_contains.hpp> +#include <catch2/matchers/catch_matchers_range_equals.hpp> #include <catch2/matchers/catch_matchers_floating_point.hpp> #include <catch2/matchers/catch_matchers_quantifiers.hpp> #include <catch2/matchers/catch_matchers_predicate.hpp> #include <catch2/matchers/catch_matchers_string.hpp> +#include <helpers/range_test_helpers.hpp> + #include <cmath> -#include <initializer_list> #include <list> #include <map> #include <type_traits> #include <vector> #include <memory> -namespace { - -namespace unrelated { - template <typename T> - class needs_ADL_begin { - std::vector<T> m_elements; - public: - using iterator = typename std::vector<T>::iterator; - using const_iterator = typename std::vector<T>::const_iterator; - - needs_ADL_begin(std::initializer_list<T> init) : m_elements(init) {} - - const_iterator Begin() const { return m_elements.begin(); } - const_iterator End() const { return m_elements.end(); } - - friend const_iterator begin(needs_ADL_begin const& lhs) { - return lhs.Begin(); - } - friend const_iterator end(needs_ADL_begin const& rhs) { - return rhs.End(); - } - }; -} // end unrelated namespace - -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunused-function" -#endif - -template <typename T> -class has_different_begin_end_types { - // Using std::vector<T> leads to annoying issues when T is bool - // so we just use list because the perf is not critical and ugh. - std::list<T> m_elements; - - // Different type for the "end" iterator - struct iterator_end {}; - // Fake-ish forward iterator that only compares to a different type - class iterator { - using underlying_iter = typename std::list<T>::const_iterator; - underlying_iter m_start; - underlying_iter m_end; - - public: - iterator( underlying_iter start, underlying_iter end ): - m_start( start ), m_end( end ) {} - - using iterator_category = std::forward_iterator_tag; - using difference_type = std::ptrdiff_t; - using value_type = T; - using const_reference = T const&; - using pointer = T const*; - - - friend bool operator==( iterator iter, iterator_end ) { - return iter.m_start == iter.m_end; - } - friend bool operator!=( iterator iter, iterator_end ) { - return iter.m_start != iter.m_end; - } - iterator& operator++() { - ++m_start; - return *this; - } - iterator operator++(int) { - auto tmp(*this); - ++m_start; - return tmp; - } - const_reference operator*() const { - return *m_start; - } - pointer operator->() const { - return m_start; - } - }; - - -public: - explicit has_different_begin_end_types( std::initializer_list<T> init ): - m_elements( init ) {} - - iterator begin() const { - return { m_elements.begin(), m_elements.end() }; - } - - iterator_end end() const { - return {}; - } -}; - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - -template <typename T> struct with_mocked_iterator_access { - std::vector<T> m_elements; - - // use plain arrays to have nicer printouts with CHECK(...) - mutable std::unique_ptr<bool[]> m_derefed; - - // We want to check which elements were dereferenced when iterating, so - // we can check whether iterator-using code traverses range correctly - template <bool is_const> class basic_iterator { - template <typename U> - using constify_t = std::conditional_t<is_const, std::add_const_t<U>, U>; - - constify_t<with_mocked_iterator_access>* m_origin; - size_t m_origin_idx; - - public: - using iterator_category = std::forward_iterator_tag; - using difference_type = std::ptrdiff_t; - using value_type = constify_t<T>; - using const_reference = typename std::vector<T>::const_reference; - using reference = typename std::vector<T>::reference; - using pointer = typename std::vector<T>::pointer; - - basic_iterator( constify_t<with_mocked_iterator_access>* origin, - std::size_t origin_idx ): - m_origin{ origin }, m_origin_idx{ origin_idx } {} - - friend bool operator==( basic_iterator lhs, basic_iterator rhs ) { - return lhs.m_origin == rhs.m_origin && - lhs.m_origin_idx == rhs.m_origin_idx; - } - friend bool operator!=( basic_iterator lhs, basic_iterator rhs ) { - return !( lhs == rhs ); - } - basic_iterator& operator++() { - ++m_origin_idx; - return *this; - } - basic_iterator operator++( int ) { - auto tmp( *this ); - ++( *this ); - return tmp; - } - const_reference operator*() const { - assert( m_origin_idx < m_origin->m_elements.size() && "Attempted to deref invalid position" ); - m_origin->m_derefed[m_origin_idx] = true; - return m_origin->m_elements[m_origin_idx]; - } - pointer operator->() const { - assert( m_origin_idx < m_origin->m_elements.size() && "Attempted to deref invalid position" ); - return &m_origin->m_elements[m_origin_idx]; - } - }; - - using iterator = basic_iterator<false>; - using const_iterator = basic_iterator<true>; - - with_mocked_iterator_access( std::initializer_list<T> init ): - m_elements( init ), - m_derefed( std::make_unique<bool[]>( m_elements.size() ) ) {} - - const_iterator begin() const { return { this, 0 }; } - const_iterator end() const { return { this, m_elements.size() }; } - iterator begin() { return { this, 0 }; } - iterator end() { return { this, m_elements.size() }; } -}; - -} // end anon namespace - -namespace Catch { - // make sure with_mocked_iterator_access is not considered a range by Catch, - // so that below StringMaker is used instead of the default one for ranges - template <typename T> - struct is_range<with_mocked_iterator_access<T>> : std::false_type {}; - - template <typename T> - struct StringMaker<with_mocked_iterator_access<T>> { - static std::string - convert( with_mocked_iterator_access<T> const& access ) { - // We have to avoid the type's iterators, because we check - // their use in tests - return ::Catch::Detail::stringify( access.m_elements ); - } - }; -} // namespace Catch - struct MoveOnlyTestElement { int num = 0; MoveOnlyTestElement(int n) :num(n) {} @@ -286,16 +107,6 @@ namespace { bool empty() const { return false; } }; -namespace unrelated { - struct ADL_empty { - bool Empty() const { return true; } - - friend bool empty(ADL_empty e) { - return e.Empty(); - } - }; - -} // end namespace unrelated } // end unnamed namespace TEST_CASE("Basic use of the Empty range matcher", "[matchers][templated][empty]") { @@ -345,17 +156,6 @@ namespace { return LessThanMatcher{ sz }; } - namespace unrelated { - struct ADL_size { - size_t sz() const { - return 12; - } - friend size_t size(ADL_size s) { - return s.sz(); - } - }; - } // end namespace unrelated - struct has_size { size_t size() const { return 13; @@ -581,7 +381,7 @@ TEST_CASE("Usage of AllTrue range matcher", "[matchers][templated][quantifiers]" std::array<bool, 0> const data{}; REQUIRE_THAT( data, AllTrue() ); } - SECTION( "One false evalutes to false" ) { + SECTION( "One false evaluates to false" ) { std::array<bool, 5> const data{ { true, true, false, true, true } }; REQUIRE_THAT( data, !AllTrue() ); } @@ -598,7 +398,7 @@ TEST_CASE("Usage of AllTrue range matcher", "[matchers][templated][quantifiers]" { { true }, { true }, { true }, { true }, { true } } }; REQUIRE_THAT( data, AllTrue() ); } - SECTION( "One false evalutes to false" ) { + SECTION( "One false evaluates to false" ) { std::array<ConvertibleToBool, 5> const data{ { { true }, { true }, { false }, { true }, { true } } }; REQUIRE_THAT( data, !AllTrue() ); @@ -646,7 +446,7 @@ TEST_CASE( "Usage of NoneTrue range matcher", "[matchers][templated][quantifiers std::array<bool, 0> const data{}; REQUIRE_THAT( data, NoneTrue() ); } - SECTION( "One true evalutes to false" ) { + SECTION( "One true evaluates to false" ) { std::array<bool, 5> const data{ { false, false, true, false, false } }; REQUIRE_THAT( data, !NoneTrue() ); @@ -664,7 +464,7 @@ TEST_CASE( "Usage of NoneTrue range matcher", "[matchers][templated][quantifiers { { true }, { true }, { true }, { true }, { true } } }; REQUIRE_THAT( data, !NoneTrue() ); } - SECTION( "One true evalutes to false" ) { + SECTION( "One true evaluates to false" ) { std::array<ConvertibleToBool, 5> const data{ { { false }, { false }, { true }, { false }, { false } } }; REQUIRE_THAT( data, !NoneTrue() ); @@ -712,7 +512,7 @@ TEST_CASE( "Usage of AnyTrue range matcher", "[matchers][templated][quantifiers] std::array<bool, 0> const data{}; REQUIRE_THAT( data, !AnyTrue() ); } - SECTION( "One true evalutes to true" ) { + SECTION( "One true evaluates to true" ) { std::array<bool, 5> const data{ { false, false, true, false, false } }; REQUIRE_THAT( data, AnyTrue() ); @@ -730,7 +530,7 @@ TEST_CASE( "Usage of AnyTrue range matcher", "[matchers][templated][quantifiers] { { true }, { true }, { true }, { true }, { true } } }; REQUIRE_THAT( data, AnyTrue() ); } - SECTION( "One true evalutes to true" ) { + SECTION( "One true evaluates to true" ) { std::array<ConvertibleToBool, 5> const data{ { { false }, { false }, { true }, { false }, { false } } }; REQUIRE_THAT( data, AnyTrue() ); @@ -831,4 +631,287 @@ TEST_CASE( "The quantifier range matchers support types with different types ret } } +TEST_CASE( "RangeEquals supports ranges with different types returned from begin and end", + "[matchers][templated][range][approvals] ") { + using Catch::Matchers::RangeEquals; + using Catch::Matchers::UnorderedRangeEquals; + + has_different_begin_end_types<int> diff_types{ 1, 2, 3, 4, 5 }; + std::array<int, 5> arr1{ { 1, 2, 3, 4, 5 } }, arr2{ { 2, 3, 4, 5, 6 } }; + + REQUIRE_THAT( diff_types, RangeEquals( arr1 ) ); + REQUIRE_THAT( diff_types, RangeEquals( arr2, []( int l, int r ) { + return l + 1 == r; + } ) ); + REQUIRE_THAT( diff_types, UnorderedRangeEquals( diff_types ) ); +} + +TEST_CASE( "RangeContains supports ranges with different types returned from " + "begin and end", + "[matchers][templated][range][approvals]" ) { + using Catch::Matchers::Contains; + + has_different_begin_end_types<size_t> diff_types{ 1, 2, 3, 4, 5 }; + REQUIRE_THAT( diff_types, Contains( size_t( 3 ) ) ); + REQUIRE_THAT( diff_types, Contains( LessThanMatcher( size_t( 4 ) ) ) ); +} + #endif + +TEST_CASE( "Usage of RangeEquals range matcher", "[matchers][templated][quantifiers]" ) { + using Catch::Matchers::RangeEquals; + + // In these tests, the types are always the same - type conversion is in the next section + SECTION( "Basic usage" ) { + SECTION( "Empty container matches empty container" ) { + const std::vector<int> empty_vector; + CHECK_THAT( empty_vector, RangeEquals( empty_vector ) ); + } + SECTION( "Empty container does not match non-empty container" ) { + const std::vector<int> empty_vector; + const std::vector<int> non_empty_vector{ 1 }; + CHECK_THAT( empty_vector, !RangeEquals( non_empty_vector ) ); + // ...and in reverse + CHECK_THAT( non_empty_vector, !RangeEquals( empty_vector ) ); + } + SECTION( "Two equal 1-length non-empty containers" ) { + const std::array<int, 1> non_empty_array{ { 1 } }; + CHECK_THAT( non_empty_array, RangeEquals( non_empty_array ) ); + } + SECTION( "Two equal-sized, equal, non-empty containers" ) { + const std::array<int, 3> array_a{ { 1, 2, 3 } }; + CHECK_THAT( array_a, RangeEquals( array_a ) ); + } + SECTION( "Two equal-sized, non-equal, non-empty containers" ) { + const std::array<int, 3> array_a{ { 1, 2, 3 } }; + const std::array<int, 3> array_b{ { 2, 2, 3 } }; + const std::array<int, 3> array_c{ { 1, 2, 2 } }; + CHECK_THAT( array_a, !RangeEquals( array_b ) ); + CHECK_THAT( array_a, !RangeEquals( array_c ) ); + } + SECTION( "Two non-equal-sized, non-empty containers (with same first " + "elements)" ) { + const std::vector<int> vector_a{ 1, 2, 3 }; + const std::vector<int> vector_b{ 1, 2, 3, 4 }; + CHECK_THAT( vector_a, !RangeEquals( vector_b ) ); + } + } + + SECTION( "Custom predicate" ) { + + auto close_enough = []( int lhs, int rhs ) { + return std::abs( lhs - rhs ) <= 1; + }; + + SECTION( "Two equal non-empty containers (close enough)" ) { + const std::vector<int> vector_a{ { 1, 2, 3 } }; + const std::vector<int> vector_a_plus_1{ { 2, 3, 4 } }; + CHECK_THAT( vector_a, RangeEquals( vector_a_plus_1, close_enough ) ); + } + SECTION( "Two non-equal non-empty containers (close enough)" ) { + const std::vector<int> vector_a{ { 1, 2, 3 } }; + const std::vector<int> vector_b{ { 3, 3, 4 } }; + CHECK_THAT( vector_a, !RangeEquals( vector_b, close_enough ) ); + } + } + + SECTION( "Ranges that need ADL begin/end" ) { + unrelated::needs_ADL_begin<int> const + needs_adl1{ 1, 2, 3, 4, 5 }, + needs_adl2{ 1, 2, 3, 4, 5 }, + needs_adl3{ 2, 3, 4, 5, 6 }; + + REQUIRE_THAT( needs_adl1, RangeEquals( needs_adl2 ) ); + REQUIRE_THAT( needs_adl1, RangeEquals( needs_adl3, []( int l, int r ) { + return l + 1 == r; + } ) ); + } + + SECTION("Check short-circuiting behaviour") { + with_mocked_iterator_access<int> const mocked1{ 1, 2, 3, 4 }; + + SECTION( "Check short-circuits on failure" ) { + std::array<int, 4> arr{ { 1, 2, 4, 4 } }; + + REQUIRE_THAT( mocked1, !RangeEquals( arr ) ); + REQUIRE( mocked1.m_derefed[0] ); + REQUIRE( mocked1.m_derefed[1] ); + REQUIRE( mocked1.m_derefed[2] ); + REQUIRE_FALSE( mocked1.m_derefed[3] ); + } + SECTION("All elements are checked on success") { + std::array<int, 4> arr{ { 1, 2, 3, 4 } }; + + REQUIRE_THAT( mocked1, RangeEquals( arr ) ); + REQUIRE( mocked1.m_derefed[0] ); + REQUIRE( mocked1.m_derefed[1] ); + REQUIRE( mocked1.m_derefed[2] ); + REQUIRE( mocked1.m_derefed[3] ); + } + } +} + +TEST_CASE( "Usage of UnorderedRangeEquals range matcher", + "[matchers][templated][quantifiers]" ) { + using Catch::Matchers::UnorderedRangeEquals; + + // In these tests, the types are always the same - type conversion is in the + // next section + SECTION( "Basic usage" ) { + SECTION( "Empty container matches empty container" ) { + const std::vector<int> empty_vector; + CHECK_THAT( empty_vector, UnorderedRangeEquals( empty_vector ) ); + } + SECTION( "Empty container does not match non-empty container" ) { + const std::vector<int> empty_vector; + const std::vector<int> non_empty_vector{ 1 }; + CHECK_THAT( empty_vector, + !UnorderedRangeEquals( non_empty_vector ) ); + // ...and in reverse + CHECK_THAT( non_empty_vector, + !UnorderedRangeEquals( empty_vector ) ); + } + SECTION( "Two equal 1-length non-empty containers" ) { + const std::array<int, 1> non_empty_array{ { 1 } }; + CHECK_THAT( non_empty_array, + UnorderedRangeEquals( non_empty_array ) ); + } + SECTION( "Two equal-sized, equal, non-empty containers" ) { + const std::array<int, 3> array_a{ { 1, 2, 3 } }; + CHECK_THAT( array_a, UnorderedRangeEquals( array_a ) ); + } + SECTION( "Two equal-sized, non-equal, non-empty containers" ) { + const std::array<int, 3> array_a{ { 1, 2, 3 } }; + const std::array<int, 3> array_b{ { 2, 2, 3 } }; + CHECK_THAT( array_a, !UnorderedRangeEquals( array_b ) ); + } + SECTION( "Two non-equal-sized, non-empty containers" ) { + const std::vector<int> vector_a{ 1, 2, 3 }; + const std::vector<int> vector_b{ 1, 2, 3, 4 }; + CHECK_THAT( vector_a, !UnorderedRangeEquals( vector_b ) ); + } + } + + SECTION( "Custom predicate" ) { + + auto close_enough = []( int lhs, int rhs ) { + return std::abs( lhs - rhs ) <= 1; + }; + + SECTION( "Two equal non-empty containers (close enough)" ) { + const std::vector<int> vector_a{ { 1, 10, 20 } }; + const std::vector<int> vector_a_plus_1{ { 11, 21, 2 } }; + CHECK_THAT( vector_a, + UnorderedRangeEquals( vector_a_plus_1, close_enough ) ); + } + SECTION( "Two non-equal non-empty containers (close enough)" ) { + const std::vector<int> vector_a{ { 1, 10, 21 } }; + const std::vector<int> vector_b{ { 11, 21, 3 } }; + CHECK_THAT( vector_a, + !UnorderedRangeEquals( vector_b, close_enough ) ); + } + } + + + SECTION( "Ranges that need ADL begin/end" ) { + unrelated::needs_ADL_begin<int> const + needs_adl1{ 1, 2, 3, 4, 5 }, + needs_adl2{ 1, 2, 3, 4, 5 }; + + REQUIRE_THAT( needs_adl1, UnorderedRangeEquals( needs_adl2 ) ); + } +} + +/** + * Return true if the type given has a random access iterator type. + */ +template <typename Container> +static constexpr bool ContainerIsRandomAccess( const Container& ) { + using array_iter_category = typename std::iterator_traits< + typename Container::iterator>::iterator_category; + + return std::is_base_of<std::random_access_iterator_tag, + array_iter_category>::value; +} + +TEST_CASE( "Type conversions of RangeEquals and similar", + "[matchers][templated][quantifiers]" ) { + using Catch::Matchers::RangeEquals; + using Catch::Matchers::UnorderedRangeEquals; + + // In these test, we can always test RangeEquals and + // UnorderedRangeEquals in the same way, since we're mostly + // testing the template type deductions (and RangeEquals + // implies UnorderedRangeEquals) + + SECTION( "Container conversions" ) { + SECTION( "Two equal containers of different container types" ) { + const std::array<int, 3> array_int_a{ { 1, 2, 3 } }; + const int c_array[3] = { 1, 2, 3 }; + CHECK_THAT( array_int_a, RangeEquals( c_array ) ); + CHECK_THAT( array_int_a, UnorderedRangeEquals( c_array ) ); + } + SECTION( "Two equal containers of different container types " + "(differ in array N)" ) { + const std::array<int, 3> array_int_3{ { 1, 2, 3 } }; + const std::array<int, 4> array_int_4{ { 1, 2, 3, 4 } }; + CHECK_THAT( array_int_3, !RangeEquals( array_int_4 ) ); + CHECK_THAT( array_int_3, !UnorderedRangeEquals( array_int_4 ) ); + } + SECTION( "Two equal containers of different container types and value " + "types" ) { + const std::array<int, 3> array_int_a{ { 1, 2, 3 } }; + const std::vector<int> vector_char_a{ 1, 2, 3 }; + CHECK_THAT( array_int_a, RangeEquals( vector_char_a ) ); + CHECK_THAT( array_int_a, UnorderedRangeEquals( vector_char_a ) ); + } + SECTION( "Two equal containers, one random access, one not" ) { + const std::array<int, 3> array_int_a{ { 1, 2, 3 } }; + const std::list<int> list_char_a{ 1, 2, 3 }; + + // Verify these types really are different in random access nature + STATIC_REQUIRE( ContainerIsRandomAccess( array_int_a ) != + ContainerIsRandomAccess( list_char_a ) ); + + CHECK_THAT( array_int_a, RangeEquals( list_char_a ) ); + CHECK_THAT( array_int_a, UnorderedRangeEquals( list_char_a ) ); + } + } + + SECTION( "Value type" ) { + SECTION( "Two equal containers of different value types" ) { + const std::vector<int> vector_int_a{ 1, 2, 3 }; + const std::vector<char> vector_char_a{ 1, 2, 3 }; + CHECK_THAT( vector_int_a, RangeEquals( vector_char_a ) ); + CHECK_THAT( vector_int_a, UnorderedRangeEquals( vector_char_a ) ); + } + SECTION( "Two non-equal containers of different value types" ) { + const std::vector<int> vector_int_a{ 1, 2, 3 }; + const std::vector<char> vector_char_b{ 1, 2, 2 }; + CHECK_THAT( vector_int_a, !RangeEquals( vector_char_b ) ); + CHECK_THAT( vector_int_a, !UnorderedRangeEquals( vector_char_b ) ); + } + } + + SECTION( "Ranges with begin that needs ADL" ) { + unrelated::needs_ADL_begin<int> a{ 1, 2, 3 }, b{ 3, 2, 1 }; + REQUIRE_THAT( a, !RangeEquals( b ) ); + REQUIRE_THAT( a, UnorderedRangeEquals( b ) ); + } + + SECTION( "Custom predicate" ) { + + auto close_enough = []( int lhs, int rhs ) { + return std::abs( lhs - rhs ) <= 1; + }; + + SECTION( "Two equal non-empty containers (close enough)" ) { + const std::vector<int> vector_a{ { 1, 2, 3 } }; + const std::array<char, 3> array_a_plus_1{ { 2, 3, 4 } }; + CHECK_THAT( vector_a, + RangeEquals( array_a_plus_1, close_enough ) ); + CHECK_THAT( vector_a, + UnorderedRangeEquals( array_a_plus_1, close_enough ) ); + } + } +} \ No newline at end of file diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp index 2ec71b4965e82684cc6298d59764e41ea8f53a02..a5e695825797877b42da1badb0e259fd267715ce 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp index 93b5ff1ec5ca0606f8569f4acf954556b8fdb16a..6c1fd68f44ad728f1a861747ade1346274031fea 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Skip.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Skip.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..661795e119e898d6a1ff10a5b7f6e1b7f4b3ed94 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Skip.tests.cpp @@ -0,0 +1,100 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators_range.hpp> + +#include <iostream> + +TEST_CASE( "tests can be skipped dynamically at runtime", "[skipping]" ) { + SKIP(); + FAIL( "this is not reached" ); +} + +TEST_CASE( "skipped tests can optionally provide a reason", "[skipping]" ) { + const int answer = 43; + SKIP( "skipping because answer = " << answer ); + FAIL( "this is not reached" ); +} + +TEST_CASE( "sections can be skipped dynamically at runtime", "[skipping]" ) { + SECTION( "not skipped" ) { SUCCEED(); } + SECTION( "skipped" ) { SKIP(); } + SECTION( "also not skipped" ) { SUCCEED(); } +} + +TEST_CASE( "nested sections can be skipped dynamically at runtime", + "[skipping]" ) { + SECTION( "A" ) { std::cout << "a"; } + SECTION( "B" ) { + SECTION( "B1" ) { std::cout << "b1"; } + SECTION( "B2" ) { SKIP(); } + } + std::cout << "!\n"; +} + +TEST_CASE( "dynamic skipping works with generators", "[skipping]" ) { + const int answer = GENERATE( 41, 42, 43 ); + if ( answer != 42 ) { SKIP( "skipping because answer = " << answer ); } + SUCCEED(); +} + +TEST_CASE( "failed assertions before SKIP cause test case to fail", + "[skipping][!shouldfail]" ) { + CHECK( 3 == 4 ); + SKIP(); +} + +TEST_CASE( "a succeeding test can still be skipped", + "[skipping][!shouldfail]" ) { + SUCCEED(); + SKIP(); +} + +TEST_CASE( "failing in some unskipped sections causes entire test case to fail", + "[skipping][!shouldfail]" ) { + SECTION( "skipped" ) { SKIP(); } + SECTION( "not skipped" ) { FAIL(); } +} + +TEST_CASE( "failing for some generator values causes entire test case to fail", + "[skipping][!shouldfail]" ) { + int i = GENERATE( 1, 2, 3, 4 ); + if ( i % 2 == 0 ) { + SKIP(); + } else { + FAIL(); + } +} + +namespace { + class test_skip_generator : public Catch::Generators::IGenerator<int> { + public: + explicit test_skip_generator() { SKIP( "This generator is empty" ); } + + auto get() const -> int const& override { + static constexpr int value = 1; + return value; + } + + auto next() -> bool override { return false; } + }; + + static auto make_test_skip_generator() + -> Catch::Generators::GeneratorWrapper<int> { + return { new test_skip_generator() }; + } + +} // namespace + +TEST_CASE( "Empty generators can SKIP in constructor", "[skipping]" ) { + // The generator signals emptiness with `SKIP` + auto sample = GENERATE( make_test_skip_generator() ); + // This assertion would fail, but shouldn't trigger + REQUIRE( sample == 0 ); +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp index e5e12468daf74c550f7853ebe33a5465832f170c..624abbf1ee1dd6e445ad6d6cf2306e36037566b8 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp index 22c31c6870100dfc26a1f961c6d6f07c4e965628..744b899be5f9a37c5d8ff1288714e7315293e9fb 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp index b8f383b159dadb21fc7b7a4bf61e8022de938cb6..28d60196cb7644dec95f4641710183169b4c2efb 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp index bc2d2561cc64a0dff71643379ad51665fa8da274..9fd9d6b45300a41444962568a571df7f670aa1ae 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp index 4bf592a4ca286b598224f8c04aa9b72cf1c1431c..f5cb239c9684a1d503e2f0693bba98e5a6db2eb6 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp index 415cbf8384f90cfbdcbb9b5e1164da4515d0c06c..b2813a81789933cf3d06b359eb6a80cc7a1d5113 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp index e67a7a2cf063449d972b407eca50a2b4a484d9d7..197ba557a9f1e309ad14fc0dcca55353f832f886 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp index a5ccbfa70af8e96518cdbf07d5eae83f3470775a..c04274485a2ad59d8914c5ce508c07ab14c35ecc 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp index 7069734f458cb081b3710bebc055c91efa413f6a..ec7a49ea97fa8e30b03f550528f2211857fb26b5 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp index bcfa7e699d8deda0f298486031e72592da905717..25770340a02de6378d69fc95716a7d0275e59701 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp index 7bc3920ecc3cee0c31bdfd42b10e630bb8724008..92048a0651f7281cb550d08bccae885009fbe6d5 100644 --- a/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp +++ b/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp @@ -1,7 +1,7 @@ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/SelfTest/helpers/parse_test_spec.cpp b/packages/Catch2/tests/SelfTest/helpers/parse_test_spec.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa64404aeb50f060405e07b52126d77691692faa --- /dev/null +++ b/packages/Catch2/tests/SelfTest/helpers/parse_test_spec.cpp @@ -0,0 +1,22 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <helpers/parse_test_spec.hpp> + +#include <catch2/internal/catch_test_spec_parser.hpp> +#include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp> + +namespace Catch { + + TestSpec parseTestSpec( std::string const& arg ) { + return TestSpecParser( ITagAliasRegistry::get() ) + .parse( arg ) + .testSpec(); + } + +} // namespace Catch diff --git a/packages/Catch2/tests/SelfTest/helpers/parse_test_spec.hpp b/packages/Catch2/tests/SelfTest/helpers/parse_test_spec.hpp new file mode 100644 index 0000000000000000000000000000000000000000..39ee0713e1856ff5a9faab0be1ca266990a4c22e --- /dev/null +++ b/packages/Catch2/tests/SelfTest/helpers/parse_test_spec.hpp @@ -0,0 +1,20 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#ifndef CATCH_TEST_HELPERS_PARSE_TEST_SPEC_HPP_INCLUDED +#define CATCH_TEST_HELPERS_PARSE_TEST_SPEC_HPP_INCLUDED + +#include <catch2/catch_test_spec.hpp> + +#include <string> + +namespace Catch { + TestSpec parseTestSpec( std::string const& arg ); +} + +#endif // CATCH_TEST_HELPERS_PARSE_TEST_SPEC_HPP_INCLUDED diff --git a/packages/Catch2/tests/SelfTest/helpers/range_test_helpers.hpp b/packages/Catch2/tests/SelfTest/helpers/range_test_helpers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..22c2c3cddf2f6069b6dd0d358eabfdd250dceadd --- /dev/null +++ b/packages/Catch2/tests/SelfTest/helpers/range_test_helpers.hpp @@ -0,0 +1,210 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#ifndef CATCH_TEST_HELPERS_RANGE_TEST_HELPERS_HPP_INCLUDED +#define CATCH_TEST_HELPERS_RANGE_TEST_HELPERS_HPP_INCLUDED + +#include <catch2/catch_tostring.hpp> + +#include <initializer_list> +#include <list> +#include <memory> +#include <vector> + +namespace unrelated { + template <typename T> + class needs_ADL_begin { + std::vector<T> m_elements; + + public: + using iterator = typename std::vector<T>::iterator; + using const_iterator = typename std::vector<T>::const_iterator; + + needs_ADL_begin( std::initializer_list<T> init ): m_elements( init ) {} + + const_iterator Begin() const { return m_elements.begin(); } + const_iterator End() const { return m_elements.end(); } + + friend const_iterator begin( needs_ADL_begin const& lhs ) { + return lhs.Begin(); + } + friend const_iterator end( needs_ADL_begin const& rhs ) { + return rhs.End(); + } + }; + + struct ADL_empty { + bool Empty() const { return true; } + + friend bool empty( ADL_empty e ) { return e.Empty(); } + }; + + struct ADL_size { + size_t sz() const { return 12; } + friend size_t size( ADL_size s ) { return s.sz(); } + }; + +} // namespace unrelated + +#if defined( __clang__ ) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunused-function" +#endif + +template <typename T> +class has_different_begin_end_types { + // Using std::vector<T> leads to annoying issues when T is bool + // so we just use list because the perf is not critical and ugh. + std::list<T> m_elements; + + // Different type for the "end" iterator + struct iterator_end {}; + // Fake-ish forward iterator that only compares to a different type + class iterator { + using underlying_iter = typename std::list<T>::const_iterator; + underlying_iter m_start; + underlying_iter m_end; + + public: + iterator( underlying_iter start, underlying_iter end ): + m_start( start ), m_end( end ) {} + + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = T; + using const_reference = T const&; + using pointer = T const*; + + friend bool operator==( iterator iter, iterator_end ) { + return iter.m_start == iter.m_end; + } + friend bool operator==(iterator lhs, iterator rhs) { + return lhs.m_start == rhs.m_start && lhs.m_end == rhs.m_end; + } + friend bool operator!=( iterator iter, iterator_end ) { + return iter.m_start != iter.m_end; + } + friend bool operator!=( iterator lhs, iterator rhs ) { + return !( lhs == rhs ); + } + iterator& operator++() { + ++m_start; + return *this; + } + iterator operator++( int ) { + auto tmp( *this ); + ++m_start; + return tmp; + } + const_reference operator*() const { return *m_start; } + pointer operator->() const { return m_start; } + }; + +public: + explicit has_different_begin_end_types( std::initializer_list<T> init ): + m_elements( init ) {} + + iterator begin() const { return { m_elements.begin(), m_elements.end() }; } + + iterator_end end() const { return {}; } +}; + +#if defined( __clang__ ) +# pragma clang diagnostic pop +#endif + +template <typename T> +struct with_mocked_iterator_access { + std::vector<T> m_elements; + + // use plain arrays to have nicer printouts with CHECK(...) + mutable std::unique_ptr<bool[]> m_derefed; + + // We want to check which elements were dereferenced when iterating, so + // we can check whether iterator-using code traverses range correctly + template <bool is_const> + class basic_iterator { + template <typename U> + using constify_t = std::conditional_t<is_const, std::add_const_t<U>, U>; + + constify_t<with_mocked_iterator_access>* m_origin; + size_t m_origin_idx; + + public: + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = constify_t<T>; + using const_reference = typename std::vector<T>::const_reference; + using reference = typename std::vector<T>::reference; + using pointer = typename std::vector<T>::pointer; + + basic_iterator( constify_t<with_mocked_iterator_access>* origin, + std::size_t origin_idx ): + m_origin{ origin }, m_origin_idx{ origin_idx } {} + + friend bool operator==( basic_iterator lhs, basic_iterator rhs ) { + return lhs.m_origin == rhs.m_origin && + lhs.m_origin_idx == rhs.m_origin_idx; + } + friend bool operator!=( basic_iterator lhs, basic_iterator rhs ) { + return !( lhs == rhs ); + } + basic_iterator& operator++() { + ++m_origin_idx; + return *this; + } + basic_iterator operator++( int ) { + auto tmp( *this ); + ++( *this ); + return tmp; + } + const_reference operator*() const { + assert( m_origin_idx < m_origin->m_elements.size() && + "Attempted to deref invalid position" ); + m_origin->m_derefed[m_origin_idx] = true; + return m_origin->m_elements[m_origin_idx]; + } + pointer operator->() const { + assert( m_origin_idx < m_origin->m_elements.size() && + "Attempted to deref invalid position" ); + return &m_origin->m_elements[m_origin_idx]; + } + }; + + using iterator = basic_iterator<false>; + using const_iterator = basic_iterator<true>; + + with_mocked_iterator_access( std::initializer_list<T> init ): + m_elements( init ), + m_derefed( std::make_unique<bool[]>( m_elements.size() ) ) {} + + const_iterator begin() const { return { this, 0 }; } + const_iterator end() const { return { this, m_elements.size() }; } + iterator begin() { return { this, 0 }; } + iterator end() { return { this, m_elements.size() }; } +}; + + +namespace Catch { + // make sure with_mocked_iterator_access is not considered a range by Catch, + // so that below StringMaker is used instead of the default one for ranges + template <typename T> + struct is_range<with_mocked_iterator_access<T>> : std::false_type {}; + + template <typename T> + struct StringMaker<with_mocked_iterator_access<T>> { + static std::string + convert( with_mocked_iterator_access<T> const& access ) { + // We have to avoid the type's iterators, because we check + // their use in tests + return ::Catch::Detail::stringify( access.m_elements ); + } + }; +} // namespace Catch + +#endif // CATCH_TEST_HELPERS_RANGE_TEST_HELPERS_HPP_INCLUDED diff --git a/packages/Catch2/tests/SelfTest/helpers/type_with_lit_0_comparisons.hpp b/packages/Catch2/tests/SelfTest/helpers/type_with_lit_0_comparisons.hpp new file mode 100644 index 0000000000000000000000000000000000000000..202c3af4d9a0f8b78bb538290d5f0718260cef0a --- /dev/null +++ b/packages/Catch2/tests/SelfTest/helpers/type_with_lit_0_comparisons.hpp @@ -0,0 +1,44 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#ifndef CATCH_TEST_HELPERS_TYPE_WITH_LIT_0_COMPARISONS_HPP_INCLUDED +#define CATCH_TEST_HELPERS_TYPE_WITH_LIT_0_COMPARISONS_HPP_INCLUDED + +#include <type_traits> + +// Should only be constructible from literal 0. +// Used by `TypeWithLit0Comparisons` for testing comparison +// ops that only work with literal zero, the way std::*orderings do +struct ZeroLiteralDetector { + constexpr ZeroLiteralDetector( ZeroLiteralDetector* ) noexcept {} + + template <typename T, + typename = std::enable_if_t<!std::is_same<T, int>::value>> + constexpr ZeroLiteralDetector( T ) = delete; +}; + +struct TypeWithLit0Comparisons { +#define DEFINE_COMP_OP( op ) \ + friend bool operator op( TypeWithLit0Comparisons, ZeroLiteralDetector ) { \ + return true; \ + } \ + friend bool operator op( ZeroLiteralDetector, TypeWithLit0Comparisons ) { \ + return false; \ + } + + DEFINE_COMP_OP( < ) + DEFINE_COMP_OP( <= ) + DEFINE_COMP_OP( > ) + DEFINE_COMP_OP( >= ) + DEFINE_COMP_OP( == ) + DEFINE_COMP_OP( != ) + +#undef DEFINE_COMP_OP +}; + +#endif // CATCH_TEST_HELPERS_TYPE_WITH_LIT_0_COMPARISONS_HPP_INCLUDED diff --git a/packages/Catch2/tests/TestScripts/ConfigureTestsCommon.py b/packages/Catch2/tests/TestScripts/ConfigureTestsCommon.py index ad5b358be0358d8b4b43a2accd252a4286e71b34..13b1d927ff6fa58779484bb2996e0a0816fef7d6 100644 --- a/packages/Catch2/tests/TestScripts/ConfigureTestsCommon.py +++ b/packages/Catch2/tests/TestScripts/ConfigureTestsCommon.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/TestScripts/testBazelReporter.py b/packages/Catch2/tests/TestScripts/testBazelReporter.py index 71014ee26eef59e49d86f8906b776f599e3d4c5d..d0893f81604da46704a8109dea93c3bc9bfa0f1d 100644 --- a/packages/Catch2/tests/TestScripts/testBazelReporter.py +++ b/packages/Catch2/tests/TestScripts/testBazelReporter.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 @@ -57,10 +57,10 @@ except subprocess.SubprocessError as ex: test_passing = False stdout = ex.stdout else: - print('Could not run "{}"'.format(args)) + print('Could not run "{}"'.format(bin_path)) print("Return code: {}".format(ex.returncode)) print("stdout: {}".format(ex.stdout)) - print("stderr: {}".format(ex.stdout)) + print("stderr: {}".format(ex.stderr)) raise # Check for valid XML output diff --git a/packages/Catch2/tests/TestScripts/testBazelSharding.py b/packages/Catch2/tests/TestScripts/testBazelSharding.py new file mode 100755 index 0000000000000000000000000000000000000000..d4a9aeee89463e252cd90956afe70ef6a6c1b4a1 --- /dev/null +++ b/packages/Catch2/tests/TestScripts/testBazelSharding.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 + +# Copyright Catch2 Authors +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + +# SPDX-License-Identifier: BSL-1.0 + +import os +import re +import sys +import subprocess + +""" +Test that Catch2 recognizes the three sharding-related environment variables +and responds accordingly (running only the selected shard, creating the +response file, etc). + +Requires 2 arguments, path to Catch2 binary to run and the output directory +for the output file. +""" +if len(sys.argv) != 3: + print("Wrong number of arguments: {}".format(len(sys.argv))) + print("Usage: {} test-bin-path output-dir".format(sys.argv[0])) + exit(1) + + +bin_path = os.path.abspath(sys.argv[1]) +output_dir = os.path.abspath(sys.argv[2]) +info_file_path = os.path.join(output_dir, '{}.shard-support'.format(os.path.basename(bin_path))) + +# Ensure no file exists from previous test runs +if os.path.isfile(info_file_path): + os.remove(info_file_path) + +print('bin path:', bin_path) +print('shard confirmation path:', info_file_path) + +env = os.environ.copy() +# We will run only one shard, and it should have the passing test. +# This simplifies our work a bit, and if we have any regression in this +# functionality we can make more complex tests later. +env["BAZEL_TEST"] = "1" +env["TEST_SHARD_INDEX"] = "0" +env["TEST_TOTAL_SHARDS"] = "2" +env["TEST_SHARD_STATUS_FILE"] = info_file_path + + +try: + ret = subprocess.run( + bin_path, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + check=True, + universal_newlines=True, + env=env + ) + stdout = ret.stdout +except subprocess.SubprocessError as ex: + print('Could not run "{}"'.format(bin_path)) + print("Return code: {}".format(ex.returncode)) + print("stdout: {}".format(ex.stdout)) + print("stderr: {}".format(ex.stderr)) + raise + + +if not "All tests passed (1 assertion in 1 test case)" in stdout: + print("Did not find expected output in stdout.") + print("stdout:\n{}".format(stdout)) + exit(1) + +if not os.path.isfile(info_file_path): + print("Catch2 did not create expected file at path '{}'".format(info_file_path)) + exit(2) diff --git a/packages/Catch2/tests/TestScripts/testConfigureDefaultReporter.py b/packages/Catch2/tests/TestScripts/testConfigureDefaultReporter.py index 66c88da02eeecb745030d79052f8aff8924c2d9e..5bf9787122e700f2a6ccb1a838d45ea11a068414 100644 --- a/packages/Catch2/tests/TestScripts/testConfigureDefaultReporter.py +++ b/packages/Catch2/tests/TestScripts/testConfigureDefaultReporter.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 @@ -30,15 +30,12 @@ build_dir_path = os.path.join(os.path.abspath(sys.argv[2]), 'CMakeConfigTests', configure_and_build(catch2_source_path, build_dir_path, - [("CATCH_CONFIG_DEFAULT_REPORTER", "compact")]) + [("CATCH_CONFIG_DEFAULT_REPORTER", "xml")]) stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), 'SelfTest', ['[approx][custom]']) - -# This matches the summary line made by compact reporter, console reporter's -# summary line does not match the regex. -summary_regex = 'Passed \d+ test case with \d+ assertions.' -if not re.search(summary_regex, stdout): - print("Could not find '{}' in the stdout".format(summary_regex)) +xml_tag = '</Catch2TestRun>' +if xml_tag not in stdout: + print("Could not find '{}' in the stdout".format(xml_tag)) print('stdout: "{}"'.format(stdout)) exit(2) diff --git a/packages/Catch2/tests/TestScripts/testConfigureDisable.py b/packages/Catch2/tests/TestScripts/testConfigureDisable.py index 92946d8d839cf10a23473640c52b39d653738fdd..b0247700c01b6d4e371f2c67077108a2e5b570fc 100644 --- a/packages/Catch2/tests/TestScripts/testConfigureDisable.py +++ b/packages/Catch2/tests/TestScripts/testConfigureDisable.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/TestScripts/testConfigureDisableStringification.py b/packages/Catch2/tests/TestScripts/testConfigureDisableStringification.py index a8a53e4f55cdafe50ca728e66256144caa64e96b..33f7853e552409f53845f31be9b44f77cc49d5b5 100644 --- a/packages/Catch2/tests/TestScripts/testConfigureDisableStringification.py +++ b/packages/Catch2/tests/TestScripts/testConfigureDisableStringification.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/TestScripts/testConfigureExperimentalRedirect.py b/packages/Catch2/tests/TestScripts/testConfigureExperimentalRedirect.py index b5313fe92b8531840385ec85a700e6b0e7a6746e..09ff51e2de18c4bf6f2a4a417634f22f749ebaa8 100644 --- a/packages/Catch2/tests/TestScripts/testConfigureExperimentalRedirect.py +++ b/packages/Catch2/tests/TestScripts/testConfigureExperimentalRedirect.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/TestScripts/testPartialTestCaseEvent.py b/packages/Catch2/tests/TestScripts/testPartialTestCaseEvent.py index 8259d211c67b749a0d82f33f9bc7b5dd93f968c2..55c6e299d2133a5b12eb4c9be3b7afc287c07350 100755 --- a/packages/Catch2/tests/TestScripts/testPartialTestCaseEvent.py +++ b/packages/Catch2/tests/TestScripts/testPartialTestCaseEvent.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/TestScripts/testRandomOrder.py b/packages/Catch2/tests/TestScripts/testRandomOrder.py index afab231de37297d5bf0eead007cc0a32466f9ae3..2368423e1ee364b3ea838f902082922e0a6ffc5e 100755 --- a/packages/Catch2/tests/TestScripts/testRandomOrder.py +++ b/packages/Catch2/tests/TestScripts/testRandomOrder.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/TestScripts/testSharding.py b/packages/Catch2/tests/TestScripts/testSharding.py index 6902f83c4a4a0be9354acdd90e7a933d2c5d9219..fa6f94d323f0e72afd3d5ab154e24aa89d5bc84f 100755 --- a/packages/Catch2/tests/TestScripts/testSharding.py +++ b/packages/Catch2/tests/TestScripts/testSharding.py @@ -2,7 +2,7 @@ # Copyright Catch2 Authors # Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at +# (See accompanying file LICENSE.txt or copy at # https://www.boost.org/LICENSE_1_0.txt) # SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tests/meson.build b/packages/Catch2/tests/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..f525f0412a2f66a78fc4983ec7b5618add36d974 --- /dev/null +++ b/packages/Catch2/tests/meson.build @@ -0,0 +1,76 @@ +# Copyright Catch2 Authors +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + +# SPDX-License-Identifier: BSL-1.0 + +# define the sources of the self test +# Please keep these ordered alphabetically +self_test_sources = files( + 'SelfTest/helpers/parse_test_spec.cpp', + 'SelfTest/IntrospectiveTests/Algorithms.tests.cpp', + 'SelfTest/IntrospectiveTests/Clara.tests.cpp', + 'SelfTest/IntrospectiveTests/CmdLine.tests.cpp', + 'SelfTest/IntrospectiveTests/CmdLineHelpers.tests.cpp', + 'SelfTest/IntrospectiveTests/ColourImpl.tests.cpp', + 'SelfTest/IntrospectiveTests/Details.tests.cpp', + 'SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp', + 'SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp', + 'SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp', + 'SelfTest/IntrospectiveTests/Parse.tests.cpp', + 'SelfTest/IntrospectiveTests/PartTracker.tests.cpp', + 'SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp', + 'SelfTest/IntrospectiveTests/Reporters.tests.cpp', + 'SelfTest/IntrospectiveTests/Sharding.tests.cpp', + 'SelfTest/IntrospectiveTests/Stream.tests.cpp', + 'SelfTest/IntrospectiveTests/String.tests.cpp', + 'SelfTest/IntrospectiveTests/StringManip.tests.cpp', + 'SelfTest/IntrospectiveTests/Tag.tests.cpp', + 'SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp', + 'SelfTest/IntrospectiveTests/TestSpec.tests.cpp', + 'SelfTest/IntrospectiveTests/TestSpecParser.tests.cpp', + 'SelfTest/IntrospectiveTests/TextFlow.tests.cpp', + 'SelfTest/IntrospectiveTests/ToString.tests.cpp', + 'SelfTest/IntrospectiveTests/Traits.tests.cpp', + 'SelfTest/IntrospectiveTests/UniquePtr.tests.cpp', + 'SelfTest/IntrospectiveTests/Xml.tests.cpp', + 'SelfTest/TestRegistrations.cpp', + 'SelfTest/TimingTests/Sleep.tests.cpp', + 'SelfTest/UsageTests/Approx.tests.cpp', + 'SelfTest/UsageTests/BDD.tests.cpp', + 'SelfTest/UsageTests/Benchmark.tests.cpp', + 'SelfTest/UsageTests/Class.tests.cpp', + 'SelfTest/UsageTests/Compilation.tests.cpp', + 'SelfTest/UsageTests/Condition.tests.cpp', + 'SelfTest/UsageTests/Decomposition.tests.cpp', + 'SelfTest/UsageTests/EnumToString.tests.cpp', + 'SelfTest/UsageTests/Exception.tests.cpp', + 'SelfTest/UsageTests/Generators.tests.cpp', + 'SelfTest/UsageTests/Matchers.tests.cpp', + 'SelfTest/UsageTests/MatchersRanges.tests.cpp', + 'SelfTest/UsageTests/Message.tests.cpp', + 'SelfTest/UsageTests/Misc.tests.cpp', + 'SelfTest/UsageTests/ToStringByte.tests.cpp', + 'SelfTest/UsageTests/ToStringChrono.tests.cpp', + 'SelfTest/UsageTests/ToStringGeneral.tests.cpp', + 'SelfTest/UsageTests/ToStringOptional.tests.cpp', + 'SelfTest/UsageTests/ToStringPair.tests.cpp', + 'SelfTest/UsageTests/ToStringTuple.tests.cpp', + 'SelfTest/UsageTests/ToStringVariant.tests.cpp', + 'SelfTest/UsageTests/ToStringVector.tests.cpp', + 'SelfTest/UsageTests/ToStringWhich.tests.cpp', + 'SelfTest/UsageTests/Tricky.tests.cpp', + 'SelfTest/UsageTests/VariadicMacros.tests.cpp', +) + +# This isn't as good as the CMake tests, but it proves that we've +# actually put something in the library files. +self_test = executable( + 'SelfTest', + self_test_sources, + include_directories: ['../src', './SelfTest'], + link_with: [catch2_with_main, catch2], +) + +test('SelfTest', self_test) diff --git a/packages/Catch2/tools/misc/appveyorMergeCoverageScript.py b/packages/Catch2/tools/misc/appveyorMergeCoverageScript.py index 7cf408d24ec2b9ebd2bd61258d28d523c3392da9..5b71f6e1291e9e64af1e060145b5d7b61f29eec7 100644 --- a/packages/Catch2/tools/misc/appveyorMergeCoverageScript.py +++ b/packages/Catch2/tools/misc/appveyorMergeCoverageScript.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 import glob import subprocess diff --git a/packages/Catch2/tools/scripts/approvalTests.py b/packages/Catch2/tools/scripts/approvalTests.py index 098f40e35bb61f776dab8810dcc03c8a8f2ec8d2..4146b646febc20861148b2bc5de5ed9910cca237 100755 --- a/packages/Catch2/tools/scripts/approvalTests.py +++ b/packages/Catch2/tools/scripts/approvalTests.py @@ -1,13 +1,12 @@ #!/usr/bin/env python3 -from __future__ import print_function - import io import os import sys import subprocess import re import difflib +import shutil import scriptCommon from scriptCommon import catchPath @@ -17,14 +16,43 @@ if os.name == 'nt': os.system('') rootPath = os.path.join(catchPath, 'tests/SelfTest/Baselines') +# Init so it is guaranteed to fail loudly if the scoping gets messed up +outputDirPath = None + +if len(sys.argv) == 3: + cmdPath = sys.argv[1] + outputDirBasePath = sys.argv[2] + outputDirPath = os.path.join(outputDirBasePath, 'ApprovalTests') + if not os.path.isdir(outputDirPath): + os.mkdir(outputDirPath) +else: + print('Usage: {} path-to-SelfTest-executable path-to-temp-output-dir'.format(sys.argv[0])) + exit(1) + + + +def get_rawResultsPath(baseName): + return os.path.join(outputDirPath, '_{0}.tmp'.format(baseName)) + +def get_baselinesPath(baseName): + return os.path.join(rootPath, '{0}.approved.txt'.format(baseName)) + +def _get_unapprovedPath(path, baseName): + return os.path.join(path, '{0}.unapproved.txt'.format(baseName)) + +def get_filteredResultsPath(baseName): + return _get_unapprovedPath(outputDirPath, baseName) + +def get_unapprovedResultsPath(baseName): + return _get_unapprovedPath(rootPath, baseName) langFilenameParser = re.compile(r'(.+\.[ch]pp)') filelocParser = re.compile(r''' - .*/ - (.+\.[ch]pp) # filename - (?::|\() # : is starting separator between filename and line number on Linux, ( on Windows - ([0-9]*) # line number - \)? # Windows also has an ending separator, ) + (?P<path_prefix>tests/SelfTest/(?:\w+/)*) # We separate prefix and fname, so that + (?P<filename>\w+\.tests\.[ch]pp) # we can keep only filename + (?::|\() # Linux has : as separator between fname and line number, Windows uses ( + (\d*) # line number + \)? # Windows also uses an ending separator, ) ''', re.VERBOSE) lineNumberParser = re.compile(r' line="[0-9]*"') hexParser = re.compile(r'\b(0[xX][0-9a-fA-F]+)\b') @@ -50,14 +78,8 @@ sinceEpochParser = re.compile(r'\d+ .+ since epoch') # The weird OR is there to always have at least empty string for group 1 tapTestNumParser = re.compile(r'^((?:not ok)|(?:ok)|(?:warning)|(?:info)) (\d+) -') -if len(sys.argv) == 2: - cmdPath = sys.argv[1] -else: - cmdPath = os.path.join(catchPath, scriptCommon.getBuildExecutable()) - overallResult = 0 - def diffFiles(fileA, fileB): with io.open(fileA, 'r', encoding='utf-8', errors='surrogateescape') as file: aLines = [line.rstrip() for line in file.readlines()] @@ -97,14 +119,11 @@ def filterLine(line, isCompact): line = normalizeFilepath(line) # strip source line numbers - m = filelocParser.match(line) - if m: - # note that this also strips directories, leaving only the filename - filename, lnum = m.groups() - lnum = ":<line number>" if lnum else "" - line = filename + lnum + line[m.end():] - else: - line = lineNumberParser.sub(" ", line) + # Note that this parser assumes an already normalized filepath from above, + # and might break terribly if it is moved around before the normalization. + line = filelocParser.sub('\g<filename>:<line number>', line) + + line = lineNumberParser.sub(" ", line) if isCompact: line = line.replace(': FAILED', ': failed') @@ -134,18 +153,6 @@ def filterLine(line, isCompact): return line -def get_rawResultsPath(baseName): - return os.path.join(rootPath, '_{0}.tmp'.format(baseName)) - - -def get_baselinesPath(baseName): - return os.path.join(rootPath, '{0}.approved.txt'.format(baseName)) - - -def get_filteredResultsPath(baseName): - return os.path.join(rootPath, '{0}.unapproved.txt'.format(baseName)) - - def run_test(baseName, args): args[0:0] = [cmdPath] if not os.path.exists(cmdPath): @@ -174,21 +181,20 @@ def check_outputs(baseName): os.remove(rawResultsPath) print() print(baseName + ":") - if os.path.exists(baselinesPath): - diffResult = diffFiles(baselinesPath, filteredResultsPath) - if diffResult: - print('\n'.join(diffResult)) - print(" \n****************************\n \033[91mResults differed") - if len(diffResult) > overallResult: - overallResult = len(diffResult) - else: - os.remove(filteredResultsPath) - print(" \033[92mResults matched") - print("\033[0m") + if not os.path.exists(baselinesPath): + print( 'first approval') + overallResult += 1 + return + + diffResult = diffFiles(baselinesPath, filteredResultsPath) + if diffResult: + print('\n'.join(diffResult)) + print(" \n****************************\n \033[91mResults differed\033[0m") + overallResult += 1 + shutil.move(filteredResultsPath, get_unapprovedResultsPath(baseName)) else: - print(" first approval") - if overallResult == 0: - overallResult = 1 + os.remove(filteredResultsPath) + print(" \033[92mResults matched\033[0m") def approve(baseName, args): @@ -205,6 +211,7 @@ base_args = ["--order", "lex", "--rng-seed", "1", "--colour-mode", "none"] ## special cases first: # Standard console reporter approve("console.std", ["~[!nonportable]~[!benchmark]~[approvals] *"] + base_args) + # console reporter, include passes, warn about No Assertions, limit failures to first 4 approve("console.swa4", ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "-x", "4"] + base_args) @@ -216,8 +223,8 @@ for reporter in reporters: reporter_args = ['-r', reporter] approve(filename, common_args + reporter_args) -## All reporters at the same time +## All reporters at the same time common_args = ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions"] + base_args filenames = ['{}.sw.multi'.format(reporter) for reporter in reporters] reporter_args = [] @@ -225,6 +232,7 @@ for reporter, filename in zip(reporters, filenames): reporter_args += ['-r', '{}::out={}'.format(reporter, get_rawResultsPath(filename))] run_test("default.sw.multi", common_args + reporter_args) + check_outputs("default.sw.multi") for reporter, filename in zip(reporters, filenames): check_outputs(filename) @@ -232,4 +240,4 @@ for reporter, filename in zip(reporters, filenames): if overallResult != 0: print("If these differences are expected, run approve.py to approve new baselines.") -exit(overallResult) + exit(2) diff --git a/packages/Catch2/tools/scripts/approve.py b/packages/Catch2/tools/scripts/approve.py index 997b8c710b4739e11aca30ef812f15461492b01a..6d73be5c8bedb6865c84e1b52ce32b9818f3ea5c 100755 --- a/packages/Catch2/tools/scripts/approve.py +++ b/packages/Catch2/tools/scripts/approve.py @@ -1,7 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function - import os import sys import shutil diff --git a/packages/Catch2/tools/scripts/buildAndTest.cmd b/packages/Catch2/tools/scripts/buildAndTest.cmd index e5222a01c20445d6941e87507fbc1d0ebbaceb56..7c10e564f0dcfb719fd163d14b2e3a0a90e3aec1 100644 --- a/packages/Catch2/tools/scripts/buildAndTest.cmd +++ b/packages/Catch2/tools/scripts/buildAndTest.cmd @@ -6,7 +6,7 @@ rem 1. Regenerate the amalgamated distribution python tools\scripts\generateAmalgamatedFiles.py rem 2. Configure the full test build -cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_ENABLE_CONFIGURE_TESTS=ON +cmake -B debug-build -S . -DCMAKE_BUILD_TYPE=Debug --preset all-tests rem 3. Run the actual build cmake --build debug-build diff --git a/packages/Catch2/tools/scripts/buildAndTest.sh b/packages/Catch2/tools/scripts/buildAndTest.sh index 4a741598b014a0c78196fc8e6d31957459ae5e1f..01a82837a3927c97241452341172aaa4478bec0b 100755 --- a/packages/Catch2/tools/scripts/buildAndTest.sh +++ b/packages/Catch2/tools/scripts/buildAndTest.sh @@ -8,7 +8,7 @@ ./tools/scripts/generateAmalgamatedFiles.py # 2. Configure the full test build -cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_ENABLE_CONFIGURE_TESTS=ON +cmake -B debug-build -S . -DCMAKE_BUILD_TYPE=Debug --preset all-tests # 3. Run the actual build cmake --build debug-build diff --git a/packages/Catch2/tools/scripts/checkConvenienceHeaders.py b/packages/Catch2/tools/scripts/checkConvenienceHeaders.py index 054d3bd97840024a76360bb5a9bf055972875296..41b52cedc39d340691a8e89c11d8db5a1539a3d5 100755 --- a/packages/Catch2/tools/scripts/checkConvenienceHeaders.py +++ b/packages/Catch2/tools/scripts/checkConvenienceHeaders.py @@ -120,7 +120,8 @@ def verify_convenience_header(folder): # 4) Are all required headers present? file_incs_set = set(file_incs) for include in target_includes: - if include not in file_incs_set: + if (include not in file_incs_set and + include != 'catch2/internal/catch_windows_h_proxy.hpp'): errors_found = True print("'{}': missing include '{}'".format(header_name, include)) diff --git a/packages/Catch2/tools/scripts/checkLicense.py b/packages/Catch2/tools/scripts/checkLicense.py index 634b0bfa95fbd16d3f6da7ddc6788aeb744e8491..9a9497692e79e328b42bdebbb1527be4c30495ac 100755 --- a/packages/Catch2/tools/scripts/checkLicense.py +++ b/packages/Catch2/tools/scripts/checkLicense.py @@ -7,7 +7,7 @@ correct_licence = """\ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 diff --git a/packages/Catch2/tools/scripts/developBuild.py b/packages/Catch2/tools/scripts/developBuild.py index 9252c7d63860c3cf2de341c0d029dfaf18d63efe..8837770cadb6f41ceafc61767b37ce211bd331fb 100755 --- a/packages/Catch2/tools/scripts/developBuild.py +++ b/packages/Catch2/tools/scripts/developBuild.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3 -from __future__ import print_function import releaseCommon v = releaseCommon.Version() v.incrementBuildNumber() releaseCommon.performUpdates(v) -print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) +print( "Updated files to v{0}".format( v.getVersionString() ) ) diff --git a/packages/Catch2/tools/scripts/extractFeaturesFromReleaseNotes.py b/packages/Catch2/tools/scripts/extractFeaturesFromReleaseNotes.py index 11f4955c0b4be262460e83f0a138684883eb9512..d8be04376d6a0fe1381d3017b8575b15becb6420 100644 --- a/packages/Catch2/tools/scripts/extractFeaturesFromReleaseNotes.py +++ b/packages/Catch2/tools/scripts/extractFeaturesFromReleaseNotes.py @@ -21,8 +21,6 @@ # to add the 'Introduced in Catch ...' snippets to the relevant pages. # -from __future__ import print_function - import re diff --git a/packages/Catch2/tools/scripts/fixWhitespace.py b/packages/Catch2/tools/scripts/fixWhitespace.py index 4591c1c444f5352c330cfcc12e34c0db9ccb91d0..5840e79047e16d78dfb65c0bf1c1688457a621f8 100755 --- a/packages/Catch2/tools/scripts/fixWhitespace.py +++ b/packages/Catch2/tools/scripts/fixWhitespace.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function import os from scriptCommon import catchPath diff --git a/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py b/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py index 812712a3a7c22bab5275419b720c9de0f85bf7f0..99fc446bf96e8dccbfb927a183fdac1670477e67 100755 --- a/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py +++ b/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py @@ -16,7 +16,7 @@ output_cpp = os.path.join(catchPath, 'extras', 'catch_amalgamated.cpp') copyright_lines = [ '// Copyright Catch2 Authors\n', '// Distributed under the Boost Software License, Version 1.0.\n', -'// (See accompanying file LICENSE_1_0.txt or copy at\n', +'// (See accompanying file LICENSE.txt or copy at\n', '// https://www.boost.org/LICENSE_1_0.txt)\n', '// SPDX-License-Identifier: BSL-1.0\n', ] @@ -26,7 +26,7 @@ copyright_lines = [ file_header = '''\ // Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 @@ -108,6 +108,7 @@ def generate_cpp(): with open(output_cpp, mode='w', encoding='utf-8') as cpp: cpp.write(formatted_file_header(Version())) cpp.write('\n#include "catch_amalgamated.hpp"\n') + concatenate_file(cpp, os.path.join(root_path, 'catch2/internal/catch_windows_h_proxy.hpp'), False) for file in cpp_files: concatenate_file(cpp, file, False) print('Concatenated {} cpp files'.format(len(cpp_files))) diff --git a/packages/Catch2/tools/scripts/majorRelease.py b/packages/Catch2/tools/scripts/majorRelease.py index e9e285a898b967d041ee86e78290a843c97819df..eb712b46612ca329e56b26d1bcfbcbf839de98f7 100755 --- a/packages/Catch2/tools/scripts/majorRelease.py +++ b/packages/Catch2/tools/scripts/majorRelease.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3 -from __future__ import print_function import releaseCommon v = releaseCommon.Version() v.incrementMajorVersion() releaseCommon.performUpdates(v) -print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) +print( "Updated files to v{0}".format( v.getVersionString() ) ) diff --git a/packages/Catch2/tools/scripts/minorRelease.py b/packages/Catch2/tools/scripts/minorRelease.py index 2b57c2eab59075b62b8cee604dc32e8299a8f559..0992c8fb9867053236bf48246fbc0a127c736666 100755 --- a/packages/Catch2/tools/scripts/minorRelease.py +++ b/packages/Catch2/tools/scripts/minorRelease.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3 -from __future__ import print_function import releaseCommon v = releaseCommon.Version() v.incrementMinorVersion() releaseCommon.performUpdates(v) -print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) +print( "Updated files to v{0}".format( v.getVersionString() ) ) diff --git a/packages/Catch2/tools/scripts/patchRelease.py b/packages/Catch2/tools/scripts/patchRelease.py index d20db714c4341875bfed8a8a63e1e726f44668bb..48256c15dfdc87030af08d98b9e7048d6512bd31 100755 --- a/packages/Catch2/tools/scripts/patchRelease.py +++ b/packages/Catch2/tools/scripts/patchRelease.py @@ -1,10 +1,9 @@ #!/usr/bin/env python3 -from __future__ import print_function import releaseCommon v = releaseCommon.Version() v.incrementPatchNumber() releaseCommon.performUpdates(v) -print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) ) +print( "Updated files to v{0}".format( v.getVersionString() ) ) diff --git a/packages/Catch2/tools/scripts/releaseCommon.py b/packages/Catch2/tools/scripts/releaseCommon.py index 20ef1b0cd8064d6e95649c4b45babe71dcb970e9..0d995eaf7c9acf4846755339cbe094c93328a052 100644 --- a/packages/Catch2/tools/scripts/releaseCommon.py +++ b/packages/Catch2/tools/scripts/releaseCommon.py @@ -1,10 +1,6 @@ -from __future__ import print_function - import os -import sys import re import string -import glob import fnmatch from scriptCommon import catchPath @@ -15,6 +11,7 @@ versionPath = os.path.join( rootPath, "catch_version.cpp" ) definePath = os.path.join(rootPath, 'catch_version_macros.hpp') readmePath = os.path.join( catchPath, "README.md" ) cmakePath = os.path.join(catchPath, 'CMakeLists.txt') +mesonPath = os.path.join(catchPath, 'meson.build') class Version: def __init__(self): @@ -89,6 +86,16 @@ def updateCmakeFile(version): file.write(replacementRegex.sub(replacement, line)) +def updateMesonFile(version): + with open(mesonPath, 'rb') as file: + lines = file.readlines() + replacementRegex = re.compile(b'''version\s*:\s*'(\\d+.\\d+.\\d+)', # CML version placeholder, don't delete''') + replacement = '''version: '{0}', # CML version placeholder, don't delete'''.format(version.getVersionString()).encode('ascii') + with open(mesonPath, 'wb') as file: + for line in lines: + file.write(replacementRegex.sub(replacement, line)) + + def updateVersionDefine(version): # First member of the tuple is the compiled regex object, the second is replacement if it matches replacementRegexes = [(re.compile(b'#define CATCH_VERSION_MAJOR \\d+'),'#define CATCH_VERSION_MAJOR {}'.format(version.majorVersion).encode('ascii')), @@ -132,4 +139,5 @@ def performUpdates(version): generateAmalgamatedFiles.generate_cpp() updateCmakeFile(version) + updateMesonFile(version) updateDocumentationVersionPlaceholders(version) diff --git a/packages/Catch2/tools/scripts/scriptCommon.py b/packages/Catch2/tools/scripts/scriptCommon.py index a6930063a9b8bba9cb81526a388abaa4f39986a0..5894185dd24a95d148d092a5e8a279d7e2e548ee 100644 --- a/packages/Catch2/tools/scripts/scriptCommon.py +++ b/packages/Catch2/tools/scripts/scriptCommon.py @@ -1,31 +1,4 @@ import os import sys -import subprocess - catchPath = os.path.dirname(os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))) - -def getBuildExecutable(): - if os.name == 'nt': - dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest.exe") - return dir - else: - dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest") - return dir - - -def runAndCapture( args ): - child = subprocess.Popen(" ".join( args ), shell=True, stdout=subprocess.PIPE) - lines = [] - line = "" - while True: - out = child.stdout.read(1) - if out == '' and child.poll(): - break - if out != '': - if out == '\n': - lines.append( line ) - line = "" - else: - line = line + out - return lines diff --git a/packages/Catch2/tools/scripts/updateDocumentToC.py b/packages/Catch2/tools/scripts/updateDocumentToC.py index 41b48752cf68ded013ebabee38d489a229607c3c..1840cecc63bdbf80eb5576785a1b59f87f834952 100755 --- a/packages/Catch2/tools/scripts/updateDocumentToC.py +++ b/packages/Catch2/tools/scripts/updateDocumentToC.py @@ -11,8 +11,6 @@ # https://github.com/rasbt/markdown-toclify # -from __future__ import print_function - import argparse import glob import os @@ -289,7 +287,7 @@ def markdownToclify( Path to the markdown output file. min_toc_len: int (default: 2) - Miniumum number of entries to create a table of contents for. + Minimum number of entries to create a table of contents for. github: bool (default: False) Uses GitHub TOC syntax if True. diff --git a/packages/PEGTL/.clang-format b/packages/PEGTL/.clang-format index a3f254129f2326865c1ca172033c1b99f63f3a11..a111c83a236556e655e3e6c887f295e058cdd29b 100644 --- a/packages/PEGTL/.clang-format +++ b/packages/PEGTL/.clang-format @@ -1,10 +1,14 @@ # The Art of C++ -# https://github.com/PEGTL +# https://github.com/taocpp -# Copyright (c) 2016-2021 Daniel Frey +# Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) +# This is our official .clang-format style for https://github.com/taocpp +# +# clang-format -i -style=file $(find . -name '[^.]*.[hc]pp') + Language: Cpp Standard: Latest diff --git a/packages/PEGTL/.clang-tidy b/packages/PEGTL/.clang-tidy index b98e0d8b54747e3497f2e0376815d17fa55c98ac..d938e19e0f61b42ebc7d62874f0ea1a2dae2ee0b 100644 --- a/packages/PEGTL/.clang-tidy +++ b/packages/PEGTL/.clang-tidy @@ -1,12 +1,13 @@ # The Art of C++ -# https://github.com/PEGTL +# https://github.com/taocpp -# Copyright (c) 2016-2021 Daniel Frey +# Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) Checks: >- bugprone-*, + -bugprone-easily-swappable-parameters, cppcoreguidelines-slicing, cppcoreguidelines-special-member-functions, google-build-explicit-make-pair, @@ -28,6 +29,8 @@ Checks: >- performance-*, readability-*, -readability-avoid-const-params-in-decls, + -readability-function-cognitive-complexity, + -readability-identifier-length, -readability-magic-numbers, -readability-static-accessed-through-instance, diff --git a/packages/PEGTL/.github/workflows/android.yml b/packages/PEGTL/.github/workflows/android.yml index 44515ed7c67d1f4cfda8c7a4f35e5c735bc3d243..11b3c2e009426471a477a82bcdb8acb461d06746 100644 --- a/packages/PEGTL/.github/workflows/android.yml +++ b/packages/PEGTL/.github/workflows/android.yml @@ -32,7 +32,7 @@ jobs: options: --user root steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -H$GITHUB_WORKSPACE -B/home/developer/build -GNinja -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.abi }} -DANDROID_PLATFORM=${{ matrix.platform }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} diff --git a/packages/PEGTL/.github/workflows/clang-analyze.yml b/packages/PEGTL/.github/workflows/clang-analyze.yml index 3919398d2e2a4c3402d4d95d86bbddbae4f4a410..344fc8b4f68397edd996903ef11e08a71a8ef024 100644 --- a/packages/PEGTL/.github/workflows/clang-analyze.yml +++ b/packages/PEGTL/.github/workflows/clang-analyze.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: sudo apt-get update -yq diff --git a/packages/PEGTL/.github/workflows/clang-format.yml b/packages/PEGTL/.github/workflows/clang-format.yml index a6aae1ae70f2a07d4c113f98034ece5124e5ec52..472ebafdbadf2f176f90bebd07cec074c98f1a02 100644 --- a/packages/PEGTL/.github/workflows/clang-format.yml +++ b/packages/PEGTL/.github/workflows/clang-format.yml @@ -15,8 +15,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: DoozyX/clang-format-lint-action@v0.12 + - uses: actions/checkout@v3 + - uses: DoozyX/clang-format-lint-action@v0.15 with: extensions: 'hpp,cpp' - clangFormatVersion: 12 + clangFormatVersion: 15 diff --git a/packages/PEGTL/.github/workflows/clang-tidy.yml b/packages/PEGTL/.github/workflows/clang-tidy.yml index 6f640820ac1e9ea0652c3f483b463346e27801d6..d095bce35f99d40a2b91129dcb78d9d4459bc01a 100644 --- a/packages/PEGTL/.github/workflows/clang-tidy.yml +++ b/packages/PEGTL/.github/workflows/clang-tidy.yml @@ -15,12 +15,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: sudo apt-get update -yq - run: sudo apt-get install -yq clang-tidy - - run: find include/ -name '*.hpp' | grep -vF file_mapper_win32.hpp | grep -vF endian_win.hpp | xargs -I '{}' clang-tidy --quiet '{}' -- --std=c++17 -Iinclude + - run: find include/ -name '*.hpp' | grep -vF mmap_file_win32.hpp | grep -vF endian_win.hpp | xargs -I '{}' clang-tidy --quiet '{}' -- --std=c++17 -Iinclude - run: find src/ -name '*.cpp' | xargs -I '{}' clang-tidy --quiet '{}' -- --std=c++17 -Iinclude diff --git a/packages/PEGTL/.github/workflows/code-coverage.yml b/packages/PEGTL/.github/workflows/code-coverage.yml index 537752ad00839fed46cebed0281f35d6f09a6f5b..10b4c282e9e393caca5c9e001324bd4f6281c3c3 100644 --- a/packages/PEGTL/.github/workflows/code-coverage.yml +++ b/packages/PEGTL/.github/workflows/code-coverage.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -E make_directory build diff --git a/packages/PEGTL/.github/workflows/codeql-analysis.yml b/packages/PEGTL/.github/workflows/codeql-analysis.yml index d0f90dfac25b137fc821ff4e7b08d572c74c9741..5f688f37bf2b96bb004ae9216e7eabede83f2f4b 100644 --- a/packages/PEGTL/.github/workflows/codeql-analysis.yml +++ b/packages/PEGTL/.github/workflows/codeql-analysis.yml @@ -41,11 +41,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -56,7 +56,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -70,4 +70,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/packages/PEGTL/.github/workflows/linux.yml b/packages/PEGTL/.github/workflows/linux.yml index d6f6d6ef76184ee0141ea1e8a74e612c958c2add..b3f95a4f23053aad8946d0fffca84e06397e2e7d 100644 --- a/packages/PEGTL/.github/workflows/linux.yml +++ b/packages/PEGTL/.github/workflows/linux.yml @@ -18,10 +18,11 @@ jobs: compiler: - g++-9 - g++-10 - #- g++-11 - - clang++-10 - - clang++-11 + - g++-11 + - g++-12 - clang++-12 + - clang++-13 + - clang++-14 build_type: [Debug, Release] runs-on: ubuntu-latest @@ -30,7 +31,7 @@ jobs: CXX: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -E make_directory build @@ -48,25 +49,26 @@ jobs: fail-fast: false matrix: compiler: - - g++-7 - g++-8 - clang++-6.0 - clang++-7 - clang++-8 - clang++-9 + - clang++-10 + - clang++-11 build_type: [Debug, Release] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 env: CXX: ${{ matrix.compiler }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - run: sudo apt-get update -yq + - run: sudo apt-get update -y - - run: sudo apt-get install -yq ${{ matrix.compiler }} + - run: sudo apt-get install -y ${{ matrix.compiler }} - run: cmake -E make_directory build @@ -83,13 +85,13 @@ jobs: strategy: fail-fast: false matrix: - flags: ["-fno-rtti"] + flags: ["-fno-rtti", "-fno-exceptions"] build_type: [Debug, Release] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -E make_directory build @@ -106,7 +108,7 @@ jobs: strategy: fail-fast: false matrix: - flags: ["-fno-rtti", "-fms-extensions"] + flags: ["-fno-rtti", "-fno-exceptions", "-fms-extensions"] build_type: [Debug, Release] runs-on: ubuntu-latest @@ -115,7 +117,7 @@ jobs: CXX: clang++ steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -E make_directory build diff --git a/packages/PEGTL/.github/workflows/macos.yml b/packages/PEGTL/.github/workflows/macos.yml index a2dfade495df59b9173a2d79d7740606d127692e..842b1ab7cc9143d7421c75c50a1858a0408346f1 100644 --- a/packages/PEGTL/.github/workflows/macos.yml +++ b/packages/PEGTL/.github/workflows/macos.yml @@ -15,13 +15,35 @@ jobs: strategy: fail-fast: false matrix: - xcode: ['11', '12'] - build_type: [Debug, Release] - - runs-on: macos-latest + include: + - xcode: 11 + build_type: Debug + os: macos-11 + - xcode: 11 + build_type: Release + os: macos-11 + - xcode: 12 + build_type: Debug + os: macos-11 + - xcode: 12 + build_type: Release + os: macos-11 + - xcode: 13 + build_type: Debug + os: macos-12 + - xcode: 13 + build_type: Release + os: macos-12 + - xcode: 14 + build_type: Debug + os: macos-12 + - xcode: 14 + build_type: Release + os: macos-12 + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: maxim-lobanov/setup-xcode@v1 with: diff --git a/packages/PEGTL/.github/workflows/no-exceptions.yml b/packages/PEGTL/.github/workflows/no-exceptions.yml deleted file mode 100644 index 25c49e0c53fd8fc95742cffe4184c690f126323a..0000000000000000000000000000000000000000 --- a/packages/PEGTL/.github/workflows/no-exceptions.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: No-Exceptions - -on: - push: - paths-ignore: - - 'README.md' - - 'doc/**' - pull_request: - paths-ignore: - - 'README.md' - - 'doc/**' - -jobs: - no-exceptions: - strategy: - fail-fast: false - matrix: - compiler: [g++, clang++] - build_type: [Debug, Release] - - runs-on: ubuntu-latest - - env: - CXX: ${{ matrix.compiler }} - - steps: - - uses: actions/checkout@v2 - - - run: cmake -E make_directory build - - - working-directory: build/ - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_FLAGS="-fno-exceptions" - - - working-directory: build/ - run: cmake --build . - - - working-directory: build/ - run: ctest --output-on-failure diff --git a/packages/PEGTL/.github/workflows/sanitizer.yml b/packages/PEGTL/.github/workflows/sanitizer.yml index 5bcb8a9b045adb1a0620e298817a503abacd7fe5..86e4debef9c08ffcb00cf2ab3db4babe924dc33c 100644 --- a/packages/PEGTL/.github/workflows/sanitizer.yml +++ b/packages/PEGTL/.github/workflows/sanitizer.yml @@ -24,7 +24,7 @@ jobs: CXX: ${{ matrix.cxx }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -E make_directory build diff --git a/packages/PEGTL/.github/workflows/windows.yml b/packages/PEGTL/.github/workflows/windows.yml index e474984856325ae1cd2f8e064bf804161d8755a5..42eacfd4ae61aa7c504d55d468c93451583a0898 100644 --- a/packages/PEGTL/.github/workflows/windows.yml +++ b/packages/PEGTL/.github/workflows/windows.yml @@ -11,7 +11,7 @@ on: - 'doc/**' jobs: - vs2019: + vs2022: strategy: fail-fast: false matrix: @@ -20,13 +20,13 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -E make_directory build - shell: bash working-directory: build/ - run: cmake $GITHUB_WORKSPACE -G "Visual Studio 16 2019" + run: cmake $GITHUB_WORKSPACE -G "Visual Studio 17 2022" - working-directory: build/ run: cmake --build . --config ${{ matrix.build_type }} @@ -34,7 +34,7 @@ jobs: - working-directory: build/ run: ctest -C ${{ matrix.build_type }} --output-on-failure - vs2019-clang: + vs2022-clang: strategy: fail-fast: false matrix: @@ -43,13 +43,13 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -E make_directory build - shell: bash working-directory: build/ - run: cmake $GITHUB_WORKSPACE -G "Visual Studio 16 2019" -T ClangCL + run: cmake $GITHUB_WORKSPACE -G "Visual Studio 17 2022" -T ClangCL - working-directory: build/ run: cmake --build . --config ${{ matrix.build_type }} @@ -57,25 +57,45 @@ jobs: - working-directory: build/ run: ctest -C ${{ matrix.build_type }} --output-on-failure - vs2017: + vs2019: strategy: fail-fast: false matrix: - visual_studio: - - 'Visual Studio 15 2017' - - 'Visual Studio 15 2017 Win64' build_type: [Debug, Release] - runs-on: windows-2016 + runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - run: cmake -E make_directory build - shell: bash working-directory: build/ - run: cmake $GITHUB_WORKSPACE -G "${{ matrix.visual_studio }}" + run: cmake $GITHUB_WORKSPACE -G "Visual Studio 16 2019" + + - working-directory: build/ + run: cmake --build . --config ${{ matrix.build_type }} + + - working-directory: build/ + run: ctest -C ${{ matrix.build_type }} --output-on-failure + + vs2019-clang: + strategy: + fail-fast: false + matrix: + build_type: [Debug, Release] + + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v3 + + - run: cmake -E make_directory build + + - shell: bash + working-directory: build/ + run: cmake $GITHUB_WORKSPACE -G "Visual Studio 16 2019" -T ClangCL - working-directory: build/ run: cmake --build . --config ${{ matrix.build_type }} diff --git a/packages/PEGTL/.gitignore b/packages/PEGTL/.gitignore index da92b797d9a088c1565721bad71c5a4f22b94574..7ca4d8d6e46225865c34526961a2ac5d8251da27 100644 --- a/packages/PEGTL/.gitignore +++ b/packages/PEGTL/.gitignore @@ -3,3 +3,4 @@ build private /.vs /.vscode +.DS_Store diff --git a/packages/PEGTL/.gitrepo b/packages/PEGTL/.gitrepo index 279480bff62486421386892258910b04da453b3a..4ac43b7e4044c9880feadfc6c4cbcf5f5fdf40a2 100644 --- a/packages/PEGTL/.gitrepo +++ b/packages/PEGTL/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:taocpp/PEGTL.git branch = main - commit = bf4487c9793121e483291c4e516cec3e5c1c17b5 + commit = dc3d82928755046be3d66efb3015ed8b03f299ac parent = e00b72ebcd9d2add12cfe0e6fe4d114a7858dfa5 method = merge - cmdver = 0.4.3 + cmdver = 0.4.6 diff --git a/packages/PEGTL/Makefile b/packages/PEGTL/Makefile index 773c525bbc936e079e33e33084a45ed33d5e7469..ac94306836276e997943612ea9b8c894ba611668 100644 --- a/packages/PEGTL/Makefile +++ b/packages/PEGTL/Makefile @@ -1,7 +1,7 @@ # The Art of C++ # https://github.com/PEGTL -# Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +# Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/README.md b/packages/PEGTL/README.md index 399b2bb3a7c3e74c628a5df6a11fb7731f30e250..b4883158f56da430e597c132fb41389430cfb968 100644 --- a/packages/PEGTL/README.md +++ b/packages/PEGTL/README.md @@ -1,30 +1,31 @@ # Welcome to the PEGTL -[](https://github.com/taocpp/PEGTL/actions?query=workflow%3AWindows) -[](https://github.com/taocpp/PEGTL/actions?query=workflow%3AmacOS) -[](https://github.com/taocpp/PEGTL/actions?query=workflow%3ALinux) -[](https://github.com/taocpp/PEGTL/actions?query=workflow%3AAndroid) +[](https://github.com/taocpp/PEGTL/actions/workflows/windows.yml) +[](https://github.com/taocpp/PEGTL/actions/workflows/macos.yml) +[](https://github.com/taocpp/PEGTL/actions/workflows/linux.yml) +[](https://github.com/taocpp/PEGTL/actions/workflows/android.yml) <br> -[](https://github.com/taocpp/PEGTL/actions?query=workflow%3Aclang-analyze) -[](https://github.com/taocpp/PEGTL/actions?query=workflow%3Aclang-tidy) -[](https://github.com/taocpp/PEGTL/actions?query=workflow%3ASanitizer) -[](https://github.com/taocpp/PEGTL/actions?query=workflow%3ACodeQL) -[](https://codecov.io/gh/taocpp/PEGTL) +[](https://github.com/taocpp/PEGTL/actions/workflows/clang-analyze.yml) +[](https://github.com/taocpp/PEGTL/actions/workflows/clang-tidy.yml) +[](https://github.com/taocpp/PEGTL/actions/workflows/sanitizer.yml) +[](https://github.com/taocpp/PEGTL/actions/workflows/codeql-analysis.yml) +[](https://codecov.io/gh/taocpp/PEGTL) The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++ header-only parser combinator library for creating parsers according to a [Parsing Expression Grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) (PEG). +**The main branch will go through phases of incompatible changes while parts of the evolution branch are back-ported. Please download [the latest release](https://github.com/taocpp/PEGTL/releases) rather than using unreleased changes from the main branch.** + ## Documentation * [Changelog](doc/Changelog.md) -* [Version 3.x](doc/README.md) (requires C++17) +* [Development](doc/README.md) (requires C++17) +* [Version 3.x](https://github.com/taocpp/PEGTL/blob/3.x/doc/README.md) (requires C++17) * [Version 2.x](https://github.com/taocpp/PEGTL/blob/2.x/doc/README.md) (requires C++11) * [Version 1.x](https://github.com/taocpp/PEGTL/blob/1.x/doc/README.md) (requires C++11) ## Contact -<a href="https://discord.gg/VQYkppcgqN"><img align="right" src="https://discordapp.com/api/guilds/790164930083028993/embed.png?style=banner2" alt="Join us on Discord"></a> - -For questions and suggestions regarding the PEGTL, success or failure stories, and any other kind of feedback, please feel free to join our [Discord](https://discord.gg/VQYkppcgqN) server, open a [discussion](https://github.com/taocpp/PEGTL/discussions), an [issue](https://github.com/taocpp/PEGTL/issues) or a [pull request](https://github.com/taocpp/PEGTL/pulls) on GitHub or contact the authors at `taocpp(at)icemx.net`. +For questions and suggestions regarding the PEGTL, success or failure stories, and any other kind of feedback, please feel free to open a [discussion](https://github.com/taocpp/PEGTL/discussions), an [issue](https://github.com/taocpp/PEGTL/issues) or a [pull request](https://github.com/taocpp/PEGTL/pulls) on GitHub or contact the authors at `taocpp(at)icemx.net`. ## Introduction @@ -136,9 +137,9 @@ The PEGTL is part of [The Art of C++](https://taocpp.github.io/). ## License -<a href="https://opensource.org/licenses/BSL-1.0"><img align="right" src="https://opensource.org/files/OSIApproved.png" width="150" hspace="20" alt="Open Source Initiative"></a> +<a href="https://opensource.org/licenses/BSL-1.0"><img align="right" src="https://opensource.org/wp-content/uploads/2009/06/OSIApproved.svg" width="150" hspace="20" alt="Open Source Initiative"></a> -Copyright (c) 2007-2021 Daniel Frey and Dr. Colin Hirsch +Copyright (c) 2007-2023 Daniel Frey and Dr. Colin Hirsch The PEGTL is certified [Open Source](http://www.opensource.org/docs/definition.html) software. It is [licensed](https://pdimov.github.io/blog/2020/09/06/why-use-the-boost-license/) under the terms of the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt) reproduced here. diff --git a/packages/PEGTL/doc/Actions-and-States.md b/packages/PEGTL/doc/Actions-and-States.md index 272b8ac460ccd0c15bd2225142a42542e90d0865..46c2fa5dbca93d2820f4ab7594cffbb2574d7513 100644 --- a/packages/PEGTL/doc/Actions-and-States.md +++ b/packages/PEGTL/doc/Actions-and-States.md @@ -300,7 +300,7 @@ struct foo Now an action class template can be specialised for `foo`, or for `tao::pegtl::alpha`, but *not* for `tao::pegtl::plus< tao::pegtl::alpha >`. -This because base classes are not taken into consideration by the C++ language when choosing a specialisation, which might be surprising when being used to pointer arguments to functions where conversions from pointer-to-derived to pointer-to-base are performed implicitly and silently. +This is because base classes are not taken into consideration by the C++ language when choosing a specialisation, which might be surprising when being used to pointer arguments to functions where conversions from pointer-to-derived to pointer-to-base are performed implicitly and silently. So although the function called by the library to match `foo` is the inherited `tao::pegtl::plus< tao::pegtl::alpha >::match()`, the rule class is `foo` and the function known as `foo::match()`, wherefore an action needs to be specialised for `foo` instead of `tao::pegtl::plus< tao::pegtl::alpha >`. @@ -608,6 +608,6 @@ See the [section on legacy-style action rules](Rule-Reference.md#action-rules). This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Changelog.md b/packages/PEGTL/doc/Changelog.md index aca8f740a1f549f4f21702bfdd76862fdff29dc8..b05d176d3773a8134a13fab8e29d58066787f0aa 100644 --- a/packages/PEGTL/doc/Changelog.md +++ b/packages/PEGTL/doc/Changelog.md @@ -1,13 +1,54 @@ # Changelog -## 3.3.0 +## 4.0.0 **Not yet released** * Switched to Boost Software License, Version 1.0. +* Added new customization point for error messages. +* Added optional source line output for the tracer. +* Added new atomic rule `everything`. +* Added new convenience rule `partial`. +* Added new convenience rule `star_partial`. +* Added new convenience rule `strict`. +* Added new convenience rule `star_strict`. +* Moved depth counter to adapter class in contrib. +* Changed default top-level `rewind_mode` to `dontcare`. * Removed support for building an amalgamated header. -* Deprecated the `TAO_PEGTL_NAMESPACE` macro. - * Will be removed in version 4.0.0. +* Removed support for Visual Studio 2017. +* Removed support for GCC 7. + +## 3.2.7 + +Released 2022-07-14 + +* Removed superfluous deprecated include. + +## 3.2.6 + +Released 2022-06-29 + +* Made `unwind()` optional for parse tree nodes. +* Fixed `demangle()` for MSVC, again. +* Fixed `demangle()` for GCC 12. + +## 3.2.5 + +Released 2022-02-05 + +* Added missing include for fallback `demangle()` implementations. + +## 3.2.4 + +Released 2022-02-03 + +* Fixed `version.hpp`. + +## 3.2.3 + +Released 2022-02-03 + +* Fixed `static_assert` in `demangle()` with recent MSVC. ## 3.2.2 @@ -651,6 +692,6 @@ It is based on ideas from the YARD library by Christopher Diggins. This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2007-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2007-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Contrib-and-Examples.md b/packages/PEGTL/doc/Contrib-and-Examples.md index 31f9035c161de1d791d8dc2b42eaf5662b11fcc1..a2c09f4fbe6c63250d408433eceb627c063e2e93 100644 --- a/packages/PEGTL/doc/Contrib-and-Examples.md +++ b/packages/PEGTL/doc/Contrib-and-Examples.md @@ -40,11 +40,12 @@ For all questions and remarks contact us at **taocpp(at)icemx.net**. * Grammars and actions for PEGTL-input-to-integer conversions. +###### `<tao/pegtl/contrib/input_with_depth.hpp>` ###### `<tao/pegtl/contrib/limit_depth.hpp>` -* Limits the nesting level of rules when parsing a grammar, prevents stack overflows. -* Can be applied selectively at specific rules to improve efficiency. -* See `src/test/pegtl/limit_depth.cpp`. +* Limit the nesting depth of rules when parsing a grammar to prevent stack overflows. +* Can be applied selectively at specific rules to reduce overhead. +* See `src/test/pegtl/contrib_limit_depth.cpp`. ###### `<tao/pegtl/contrib/json.hpp>` @@ -216,6 +217,6 @@ Invoked with one or more URIs as command line arguments will attempt to parse th This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Control-and-Debug.md b/packages/PEGTL/doc/Control-and-Debug.md index 10fa8f80a931247c2a4be54e7bacbe954aaa1473..58b2143b6b26b3023a6157d6b44e6c671508bc06 100644 --- a/packages/PEGTL/doc/Control-and-Debug.md +++ b/packages/PEGTL/doc/Control-and-Debug.md @@ -148,6 +148,6 @@ Deriving the specialisation of the custom action for `my_rule` from `tao::pegtl: This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Errors-and-Exceptions.md b/packages/PEGTL/doc/Errors-and-Exceptions.md index a0b16d24c7bfc74228c504c38624de3cd5df7468..d186d3ee49bde9f9bb5ba4498efccfac95b35bb7 100644 --- a/packages/PEGTL/doc/Errors-and-Exceptions.md +++ b/packages/PEGTL/doc/Errors-and-Exceptions.md @@ -81,12 +81,14 @@ Global failures can also be unconditionally provoked with the `raise<>` grammar It should be mentioned that `must< R >` is semantically equivalent to `sor< R, raise< R > >`, but more efficient. In any case, the task of actually throwing an exception is delegated to the [control class'](Control-and-Debug.md) `raise()`. +The control class' `raise()` method will generate a default message for the `parse_error` that will be thrown. +The default message can be overwritten by giving the rule `R` a static member variable that contains a different error message. Note that rules and actions can throw exceptions directly, meaning those are not generated from the [control class'](Control-and-Debug.md) `raise()`. ### Non-Intrusive Local to Global Failure -If a grammar does not contain any `must<>` rule(s) (or `raise<>`, `if_must<>`, ...), one can still convert a local failure for a rule into a global failure via `must_if<>`. +If a grammar does not contain any `must<>` rule(s) (or `raise<>`, `raise_message<>`, `if_must<>`, ...), one can still convert a local failure for a rule into a global failure via `must_if<>`. This helper allows one to create a [control class'](Control-and-Debug.md) and provide custom error messages for global failures. If an error message is provided for a rule that would normally return a local failure, it is automatically converted to a global failure. See [Custom Exception Messages](#custom-exception-messages) for more information. @@ -160,8 +162,11 @@ The same use of `if_must<>` can be applied to the `literal` rule assuming that i By default, when using any `must<>` error points, the exceptions generated by the PEGTL use the demangled name of the failed parsing rule as descriptive part of the error message. This is often insufficient and one would like to provide more meaningful error messages. -A practical technique to provide customised error messages for all `must<>` error points uses the `must_if<>` helper. +One option is to add a static member variable to the rule that provides a custom error message. +For your convenience, there is a `raise_message<>` rule and the corresponding `TAO_PEGTL_RAISE_MESSAGE()` macro to simplify this. +For an example of these customization points, see `src/example/pegtl/error_messages_2.hpp` and `src/example/pegtl/error_messages_3.hpp`. +If the above is not sufficient, you can provide a customised error messages for all `must<>` error points using the `must_if<>` helper. For an example of this method see `src/example/pegtl/json_errors.hpp`, where all errors that might occur in the supplied JSON grammar are customised like this: ```c++ @@ -218,6 +223,6 @@ This choice becoming particularly cumbersome and/or resulting in a large number This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Example-Tables.md b/packages/PEGTL/doc/Example-Tables.md new file mode 100644 index 0000000000000000000000000000000000000000..2edc3e7696f18f5716d910b8d36ce88ebba63d89 --- /dev/null +++ b/packages/PEGTL/doc/Example-Tables.md @@ -0,0 +1,126 @@ +# Example Tables + +The following tables show how groups of related combinators differ by giving examples of their matching behaviour. + +We assume that the rule `x` is defined as `one< 'x' >` for all reasonable choices of `x` and that we are in namespace `tao::pegtl`. + +## Simple Combinators + +| Rule | Input | Result | Matched | +|------|-------|--------|---------| +| `seq< a, b, c >` | "" | false | | +| `opt< a, b, c >` | "" | **true** | "" | +| `strict< a, b, c >` | "" | **true** | "" | +| `partial< a, b, c >` | "" | **true** | "" | +| `if_must< a, b, c >` | "" | false | | +| `seq< a, b, c >` | "a" | false | | +| `opt< a, b, c >` | "a" | **true** | "" | +| `strict< a, b, c >` | "a" | false | | +| `partial< a, b, c >` | "a" | **true** | "a" | +| `if_must< a, b, c >` | "a" | error | | +| `seq< a, b, c >` | "ab" | false | | +| `opt< a, b, c >` | "ab" | **true** | "" | +| `strict< a, b, c >` | "ab" | false | | +| `partial< a, b, c >` | "ab" | **true** | "ab" | +| `if_must< a, b, c >` | "ab" | error | | +| `seq< a, b, c >` | "abc" | **true** | "abc" | +| `opt< a, b, c >` | "abc" | **true** | "abc" | +| `strict< a, b, c >` | "abc" | **true** | "abc" | +| `partial< a, b, c >` | "abc" | **true** | "abc" | +| `if_must< a, b, c >` | "abc" | **true** | "abc" | +| `seq< a, b, c >` | "abca" | **true** | "abc" | +| `opt< a, b, c >` | "abca" | **true** | "abc" | +| `strict< a, b, c >` | "abca" | **true** | "abc" | +| `partial< a, b, c >` | "abca" | **true** | "abc" | +| `if_must< a, b, c >` | "abca" | **true** | "abc" | +| `seq< a, b, c >` | "d" | false | | +| `opt< a, b, c >` | "d" | **true** | "" | +| `strict< a, b, c >` | "d" | **true** | "" | +| `partial< a, b, c >` | "d" | **true** | "" | +| `if_must< a, b, c >` | "d" | false | | +| `seq< a, b, c >` | "ad" | false | | +| `opt< a, b, c >` | "ad" | **true** | "" | +| `strict< a, b, c >` | "ad" | false | | +| `partial< a, b, c >` | "ad" | **true** | "a" | +| `if_must< a, b, c >` | "ad" | error | | +| `seq< a, b, c >` | "abd" | false | | +| `opt< a, b, c >` | "abd" | **true** | "" | +| `strict< a, b, c >` | "abd" | false | | +| `partial< a, b, c >` | "abd" | **true** | "ab" | +| `if_must< a, b, c >` | "abd" | error | | +| `seq< a, b, c >` | "abcd" | **true** | "abc" | +| `opt< a, b, c >` | "abcd" | **true** | "abc" | +| `strict< a, b, c >` | "abcd" | **true** | "abc" | +| `partial< a, b, c >` | "abcd" | **true** | "abc" | +| `if_must< a, b, c >` | "abcd" | **true** | "abc" | + +## Iterating Combinators + +| Rule | Input | Result | Matched | +|------|-------|--------|---------| +| `plus< a, b, c >` | "" | false | | +| `star< a, b, c >` | "" | **true** | "" | +| `star_strict< a, b, c >` | "" | **true** | "" | +| `star_partial< a, b, c >` | "" | **true** | "" | +| `star_must< a, b, c >` | "" | **true** | "" | +| `plus< a, b, c >` | "a" | false | | +| `star< a, b, c >` | "a" | **true** | "" | +| `star_strict< a, b, c >` | "a" | false | | +| `star_partial< a, b, c >` | "a" | **true** | "a" | +| `star_must< a, b, c >` | "a" | error | | +| `plus< a, b, c >` | "ab" | false | | +| `star< a, b, c >` | "ab" | **true** | "" | +| `star_strict< a, b, c >` | "ab" | false | | +| `star_partial< a, b, c >` | "ab" | **true** | "ab" | +| `star_must< a, b, c >` | "ab" | error | | +| `plus< a, b, c >` | "abc" | **true** | "abc" | +| `star< a, b, c >` | "abc" | **true** | "abc" | +| `star_strict< a, b, c >` | "abc" | **true** | "abc" | +| `star_partial< a, b, c >` | "abc" | **true** | "abc" | +| `star_must< a, b, c >` | "abc" | **true** | "abc" | +| `plus< a, b, c >` | "abca" | **true** | "abc" | +| `star< a, b, c >` | "abca" | **true** | "abc" | +| `star_strict< a, b, c >` | "abca" | false | | +| `star_partial< a, b, c >` | "abca" | **true** | "abca" | +| `star_must< a, b, c >` | "abca" | error | | +| `plus< a, b, c >` | "d" | false | | +| `star< a, b, c >` | "d" | **true** | "" | +| `star_strict< a, b, c >` | "d" | **true** | "" | +| `star_partial< a, b, c >` | "d" | **true** | "" | +| `star_must< a, b, c >` | "d" | **true** | "" | +| `plus< a, b, c >` | "ad" | false | | +| `star< a, b, c >` | "ad" | **true** | "" | +| `star_strict< a, b, c >` | "ad" | false | | +| `star_partial< a, b, c >` | "ad" | **true** | "a" | +| `star_must< a, b, c >` | "ad" | error | | +| `plus< a, b, c >` | "abd" | false | | +| `star< a, b, c >` | "abd" | **true** | "" | +| `star_strict< a, b, c >` | "abd" | false | | +| `star_partial< a, b, c >` | "abd" | **true** | "ab" | +| `star_must< a, b, c >` | "abd" | error | | +| `plus< a, b, c >` | "abcd" | **true** | "abc" | +| `star< a, b, c >` | "abcd" | **true** | "abc" | +| `star_strict< a, b, c >` | "abcd" | **true** | "abc" | +| `star_partial< a, b, c >` | "abcd" | **true** | "abc" | +| `star_must< a, b, c >` | "abcd" | **true** | "abc" | +| `plus< a, b, c >` | "abcabc" | **true** | "abcabc" | +| `star< a, b, c >` | "abcabc" | **true** | "abcabc" | +| `star_strict< a, b, c >` | "abcabc" | **true** | "abcabc" | +| `star_partial< a, b, c >` | "abcabc" | **true** | "abcabc" | +| `star_must< a, b, c >` | "abcabc" | **true** | "abcabc" | +| `plus< a, b, c >` | "abcabca" | **true** | "abcabc" | +| `star< a, b, c >` | "abcabca" | **true** | "abcabc" | +| `star_strict< a, b, c >` | "abcabca" | false | | +| `star_partial< a, b, c >` | "abcabca" | **true** | "abcabca" | +| `star_must< a, b, c >` | "abcabca" | error | | +| `plus< a, b, c >` | "abcabcb" | **true** | "abcabc" | +| `star< a, b, c >` | "abcabcb" | **true** | "abcabc" | +| `star_strict< a, b, c >` | "abcabcb" | **true** | "abcabc" | +| `star_partial< a, b, c >` | "abcabcb" | **true** | "abcabc" | +| `star_must< a, b, c >` | "abcabcb" | **true** | "abcabc" | + +This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). + +Copyright (c) 2023 Dr. Colin Hirsch and Daniel Frey +Distributed under the Boost Software License, Version 1.0<br> +See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Getting-Started.md b/packages/PEGTL/doc/Getting-Started.md index fbf71cbd304777526e661e0f50e0c2fb1b3eaf38..20c13d570d8077d25b8b13098f5a10087ff413e6 100644 --- a/packages/PEGTL/doc/Getting-Started.md +++ b/packages/PEGTL/doc/Getting-Started.md @@ -96,6 +96,9 @@ terminate called after throwing an instance of 'tao::pegtl::parse_error' Aborted (core dumped) ``` +Note that, by default, the PEGTL resides in `namespace tao::pegtl`, however this can be changed as explained in [Embedding in Library Interfaces](Installing-and-Using.md#embedding-in-library-interfaces). +The entire PEGTL documentation assumes that the default namespace applies. + The PEGTL provides multiple facilities that help to get started and develop your grammar. In the following paragraphs we will show several small programs to showcase the capabilities of the PEGTL. @@ -287,6 +290,6 @@ For more information see [Errors and Exceptions](Errors-and-Exceptions.md). This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Grammar-Analysis.md b/packages/PEGTL/doc/Grammar-Analysis.md index 94bb40aef184878e3a5d7f1c17f520bdefbc1f8c..ec9812a6347d6539038e26e788d8f81e1dd32031 100644 --- a/packages/PEGTL/doc/Grammar-Analysis.md +++ b/packages/PEGTL/doc/Grammar-Analysis.md @@ -77,10 +77,8 @@ struct my_rule the analyze traits need to be set up as ```c++ -// In namespace TAO_PEGTL_NAMESPACE - template< typename Name > -struct analyze_traits< Name, my_rule > +struct tao::pegtl::analyze_traits< Name, my_rule > : analyze_any_traits<> {}; ``` @@ -128,6 +126,6 @@ False positives are a theoretical problem in that, while relatively easy to trig This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Inputs-and-Parsing.md b/packages/PEGTL/doc/Inputs-and-Parsing.md index 96948728c3e62278d94feedb4083a9f764db382c..d661711426c3320766505ddceef4470547e386d9 100644 --- a/packages/PEGTL/doc/Inputs-and-Parsing.md +++ b/packages/PEGTL/doc/Inputs-and-Parsing.md @@ -283,8 +283,8 @@ The parse functions accept the following template parameters and arguments: Additionally, two enumeration values can be used to control the behaviour: -- The `apply_mode` which can also be set to `nothing` in order to disable action invocations, just like the `disable<>` rule does. -- The `rewind_mode` which can also be set to `dontcare` in order to not require rewinding of the input on local failure, a micro optimisation. +- The `apply_mode`, which can also be set to `nothing` in order to disable action invocations, just like the `disable<>` rule does. +- The `rewind_mode`, which can also be set to `required` when rewinding the input to its start is required for top-level parse failures. The result of a parsing run, i.e. an invocation of `tao::pegtl::parse()`, can be either @@ -298,7 +298,7 @@ template< typename Rule, template< typename... > class Action = nothing, template< typename... > class Control = normal, apply_mode A = apply_mode::action, - rewind_mode M = rewind_mode::required, + rewind_mode M = rewind_mode::dontcare, typename ParseInput, typename... States > bool parse( ParseInput& in, @@ -320,7 +320,7 @@ template< typename Rule, template< typename... > class Action = nothing, template< typename... > class Control = normal, apply_mode A = apply_mode::action, - rewind_mode M = rewind_mode::required, + rewind_mode M = rewind_mode::dontcare, typename OuterInput, typename ParseInput, typename... States > @@ -558,6 +558,6 @@ All input classes support [deduction guides](https://en.cppreference.com/w/cpp/l This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Installing-and-Using.md b/packages/PEGTL/doc/Installing-and-Using.md index 007987116287d8674c22b571c27239ca6e76a0a1..8996a729560c4089c0ec85621266b0ff5dafb1e9 100644 --- a/packages/PEGTL/doc/Installing-and-Using.md +++ b/packages/PEGTL/doc/Installing-and-Using.md @@ -24,9 +24,9 @@ The PEGTL requires a C++17-capable compiler, e.g. one of -* GCC 7 -* Clang 5 -* Visual Studio 2017 +* GCC 8 +* Clang 6 +* Visual Studio 2019 on either @@ -37,6 +37,8 @@ on either It requires C++17, e.g. using the `--std=c++17` compiler switch. Using newer versions of the C++ standard is supported. +Due to the design of the PEGTL with many small functions and the reliance on the compiler for performance it is recommended to *always* compile with at least some optimisations enabled, in particular those that inline functions. + Larger projects will frequently require the `/bigobj` option when compiling with Visual Studio on Windows. It should also work with other C++17 compilers on other Unix systems (or any sufficiently compatible platform). @@ -236,7 +238,7 @@ for customising the build process. ## Embedding the PEGTL -When embedding the PEGTL into other projects, several problems may come up +When embedding the PEGTL in other projects, several problems might show up due to the nature of C++ header-only libraries. Depending on the scenario, there are various ways of working around these problems. @@ -293,16 +295,14 @@ $ sed -i 's/TAO_PEGTL_/MYLIB_PEGTL_/g' $(find -name '[^.]*.[hc]pp') The above command needs to run from the top-level directory of the embedded PEGTL. Additionally, `MYLIB_PEGTL_NAMESPACE` needs to be set as explained -above; alternatively `include/tao/pegtl/config.hpp` can be directly modified. - -A practical example of how the result looks like can be found in our own -header-only JSON library [taoJSON](https://github.com/taocpp/json/). +above; alternatively, since the PEGTL source is already being mnodified, +`include/tao/pegtl/config.hpp` can be changed to use the desired namespace. --- This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Meta-Data-and-Visit.md b/packages/PEGTL/doc/Meta-Data-and-Visit.md index bed412efa030a9d8638dbee233b651a75276f7b9..8d0d52fc2fe9ada4af539391bae8ef777490997e 100644 --- a/packages/PEGTL/doc/Meta-Data-and-Visit.md +++ b/packages/PEGTL/doc/Meta-Data-and-Visit.md @@ -13,7 +13,7 @@ They are only required to support functions based on `visit()` and the [grammar ## Internals -While accessible in the namespace `TAO_PEGTL_NAMESPACE`, which defaults to `tao::pegtl`, the [rules and combinators](Rule-Reference.md) included with the PEGTL all have their actual implementation in the sub-namespace `internal`. +While accessible in the namespace `tao::pegtl`, the [rules and combinators](Rule-Reference.md) included with the PEGTL all have their actual implementation in the sub-namespace `internal`. For example the header `include/tao/pegtl/rules.hpp` shows how the user-facing rules are nothing more than forwarders to their `internal` implementation. The original motivation for this additional level of indirection was to prevent uninteded invocation of user-defined actions due to some PEGTL rules being built from exisiting rules instead of having a dedicated implementation. @@ -151,6 +151,6 @@ As usual, unless otherwise indicated, all functions and data structure are in th This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Migration-Guide.md b/packages/PEGTL/doc/Migration-Guide.md index 19f543d970ad7274f79811b58c93c613850fe1f2..d037ab5c652a2db9617394d3fc3e94434cb47916 100644 --- a/packages/PEGTL/doc/Migration-Guide.md +++ b/packages/PEGTL/doc/Migration-Guide.md @@ -1,5 +1,9 @@ # Migration Guide +## Version 4.0.0 + + + ## Version 3.0.0 * The build system needs to be configured for C++17 or later. @@ -60,6 +64,6 @@ Please contact the authors at `taocpp(at)icemx.net` for any further questions wh This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Parse-Tree.md b/packages/PEGTL/doc/Parse-Tree.md index e82f6cf7d49d932986bad8744bcbc7b386afc84b..4d1b02f7bc36f743a4c15714d0c73374bc4ebe47 100644 --- a/packages/PEGTL/doc/Parse-Tree.md +++ b/packages/PEGTL/doc/Parse-Tree.md @@ -57,8 +57,8 @@ template<> struct my_selector< my_rule_3 > : std::true_type {}; auto root = tao::pegtl::parse_tree::parse< my_grammar, my_selector >( in ); ``` -Note that the example uses a white-list style; the default is `std::false_type` and only rules listed with a specialisation deriving from `std::true_type` will generate nodes. -The opposite, a black-list style, is of course possible, too. +Note that the example uses an allow-list style; the default is `std::false_type` and only rules listed with a specialisation deriving from `std::true_type` will generate nodes. +The opposite, a block-list style, is of course possible, too. The PEGTL includes a selector class and additional utility classes to allow for a less verbose specification of a selector. The following definition of `my_selector` will behave just like the one above. @@ -244,6 +244,6 @@ The parse tree uses a rule's meta data supplied by [`subs_t`](Meta-Data-and-Visi This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Performance-Notes.md b/packages/PEGTL/doc/Performance-Notes.md index bad3886260a3498bbb2663ab06f9195627195e7d..ca90a90940d465e8ec799ec96b4146dbd4f562c5 100644 --- a/packages/PEGTL/doc/Performance-Notes.md +++ b/packages/PEGTL/doc/Performance-Notes.md @@ -39,6 +39,7 @@ Instead of `one< ... >` advancing the input, and `at< one< ... > >` rewinding, t Put to the test, the optimised `at_one< '"' >` rule did not show any performance advantage over `at< one< '"' > >`, at least with `-O3`. Presumably the compiler was smart enough to perform the optimisation by itself. However with `-O0`, the optimised `at_one< '"' >` was faster by 5-10% in a [JSON library](https://github.com/taocpp/json) micro-benchmark. +As the PEGTL should only be used with optimizations enabled, we removed the `at_one<>` rule, as we try to reduce the number of rules that won't provide a clear benefit. We still need to test whether the compiler manages to perform the same optimisation in more complex cases. @@ -46,6 +47,6 @@ We still need to test whether the compiler manages to perform the same optimisat This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/README.md b/packages/PEGTL/doc/README.md index 88bedb59217372fbd3a69cfa2b022e2e52806f89..bde86a1e994764e08dfdfe710a3ef93942d21d17 100644 --- a/packages/PEGTL/doc/README.md +++ b/packages/PEGTL/doc/README.md @@ -71,6 +71,7 @@ * [ICU Rules for Value Properties](Rule-Reference.md#icu-rules-for-value-properties) * [Binary Rules](Rule-Reference.md#binary-rules) * [Full Index](Rule-Reference.md#full-index) + * [Example Tables](Example-Tables.md) * [Inputs and Parsing](Inputs-and-Parsing.md) * [Tracking Mode](Inputs-and-Parsing.md#tracking-mode) * [Line Ending](Inputs-and-Parsing.md#line-ending) @@ -162,6 +163,7 @@ * [`eof`](Rule-Reference.md#eof) <sup>[(atomic rules)](Rule-Reference.md#atomic-rules)</sup> * [`eol`](Rule-Reference.md#eol) <sup>[(atomic rules)](Rule-Reference.md#atomic-rules)</sup> * [`eolf`](Rule-Reference.md#eolf) <sup>[(atomic rules)](Rule-Reference.md#atomic-rules)</sup> +* [`everything`](Rule-Reference.md#everything) <sup>[(atomic rules)](Rule-Reference.md#atomic-rules)</sup> * [`extender`](Rule-Reference.md#extender) <sup>[(icu rules)](Rule-Reference.md#icu-rules-for-binary-properties)</sup> * [`failure`](Rule-Reference.md#failure) <sup>[(atomic rules)](Rule-Reference.md#atomic-rules)</sup> * [`forty_two< C... >`](Rule-Reference.md#forty_two-c-) <sup>[(ascii rules)](Rule-Reference.md#ascii-rules)</sup> @@ -234,6 +236,7 @@ * [`opt_must< R, S...>`](Rule-Reference.md#opt_must-r-s-) <sup>[(convenience)](Rule-Reference.md#convenience)</sup> * [`pad< R, S, T = S >`](Rule-Reference.md#pad-r-s-t--s-) <sup>[(convenience)](Rule-Reference.md#convenience)</sup> * [`pad_opt< R, P >`](Rule-Reference.md#pad_opt-r-p-) <sup>[(convenience)](Rule-Reference.md#convenience)</sup> +* [`partial< R... >`](Rule-Reference.md#partial-r-) <sup>[(convenience)](Rule-Reference.md#convenience)</sup> * [`pattern_syntax`](Rule-Reference.md#pattern_syntax) <sup>[(icu rules)](Rule-Reference.md#icu-rules-for-binary-properties)</sup> * [`pattern_white_space`](Rule-Reference.md#pattern_white_space) <sup>[(icu rules)](Rule-Reference.md#icu-rules-for-binary-properties)</sup> * [`plus< R... >`](Rule-Reference.md#plus-r-) <sup>[(combinators)](Rule-Reference.md#combinators)</sup> @@ -247,6 +250,7 @@ * [`quotation_mark`](Rule-Reference.md#quotation_mark) <sup>[(icu rules)](Rule-Reference.md#icu-rules-for-binary-properties)</sup> * [`radical`](Rule-Reference.md#radical) <sup>[(icu rules)](Rule-Reference.md#icu-rules-for-binary-properties)</sup> * [`raise< T >`](Rule-Reference.md#raise-t-) <sup>[(atomic rules)](Rule-Reference.md#atomic-rules)</sup> +* [`raise_message< C... >`](Rule-Reference.md#raise_message-c-) <sup>[(atomic rules)](Rule-Reference.md#atomic-rules)</sup> * [`range< C, D >`](Rule-Reference.md#range-c-d-) <sup>[(ascii rules)](Rule-Reference.md#ascii-rules)</sup> * [`range< C, D >`](Rule-Reference.md#range-c-d--1) <sup>[(unicode rules)](Rule-Reference.md#unicode-rules)</sup> * [`range< C, D >`](Rule-Reference.md#range-c-d--2) <sup>[(binary rules)](Rule-Reference.md#binary-rules)</sup> @@ -274,13 +278,17 @@ * [`space`](Rule-Reference.md#space) <sup>[(ascii rules)](Rule-Reference.md#ascii-rules)</sup> * [`star< R... >`](Rule-Reference.md#star-r-) <sup>[(combinators)](Rule-Reference.md#combinators)</sup> * [`star_must< R, S... >`](Rule-Reference.md#star_must-r-s-) <sup>[(convenience)](Rule-Reference.md#convenience)</sup> +* [`star_partial< R... >`](Rule-Reference.md#star_partial-r-) <sup>[(convenience)](Rule-Reference.md#convenience)</sup> +* [`star_strict< R... >`](Rule-Reference.md#star_strict-r-) <sup>[(convenience)](Rule-Reference.md#convenience)</sup> * [`state< S, R... >`](Rule-Reference.md#state-s-r-) <sup>[(meta rules)](Rule-Reference.md#meta-rules)</sup> +* [`strict< R... >`](Rule-Reference.md#strict-r-) <sup>[(convenience)](Rule-Reference.md#convenience)</sup> * [`string< C... >`](Rule-Reference.md#string-c-) <sup>[(ascii rules)](Rule-Reference.md#ascii-rules)</sup> * [`string< C... >`](Rule-Reference.md#string-c--1) <sup>[(unicode rules)](Rule-Reference.md#unicode-rules)</sup> * [`string< C... >`](Rule-Reference.md#string-c--2) <sup>[(binary rules)](Rule-Reference.md#binary-rules)</sup> * [`success`](Rule-Reference.md#success) <sup>[(atomic rules)](Rule-Reference.md#atomic-rules)</sup> * [`TAO_PEGTL_ISTRING( "..." )`](Rule-Reference.md#tao_pegtl_istring--) <sup>[(ascii rules)](Rule-Reference.md#ascii_rules)</sup> * [`TAO_PEGTL_KEYWORD( "..." )`](Rule-Reference.md#tao_pegtl_keyword--) <sup>[(ascii rules)](Rule-Reference.md#ascii_rules)</sup> +* [`TAO_PEGTL_RAISE_MESSAGE( "..." )`](Rule-Reference.md#tao_pegtl_raise_message--) <sup>[(atomic rules)](Rule-Reference.md#atomic_rules)</sup> * [`TAO_PEGTL_STRING( "..." )`](Rule-Reference.md#tao_pegtl_string--) <sup>[(ascii rules)](Rule-Reference.md#ascii_rules)</sup> * [`terminal_punctuation`](Rule-Reference.md#terminal_punctuation) <sup>[(icu rules)](Rule-Reference.md#icu-rules-for-binary-properties)</sup> * [`three< C >`](Rule-Reference.md#three-c-) <sup>[(ascii rules)](Rule-Reference.md#ascii-rules)</sup> @@ -304,6 +312,6 @@ This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/doc/Rule-Reference.md b/packages/PEGTL/doc/Rule-Reference.md index b1a6757a68976bc2d9c091c150470707f64a54fa..9ea518b6beee7fec880dd347cb314404cd2f7cd0 100644 --- a/packages/PEGTL/doc/Rule-Reference.md +++ b/packages/PEGTL/doc/Rule-Reference.md @@ -90,7 +90,7 @@ These rules are in namespace `tao::pegtl`. * [Equivalent] to `success`, but: * Calls the input's `discard()` member function. * Must not be used where backtracking to before the `discard` might occur and/or nested within a rule for which an action with input can be called. -* See [Incremental Input](Inputs-and-Parsing.md#incremental-input) for details. +* See [Incremental Input] for details. * [Meta data] and [implementation] mapping: - `discard::rule_t` is `internal::discard` @@ -108,7 +108,7 @@ These rules are in namespace `tao::pegtl`. ###### `require< Num >` * Succeeds if at least `Num` further input bytes are available. -* With [Incremental Input](Inputs-and-Parsing.md#incremental-input) reads the bytes into the buffer. +* With [Incremental Input] reads the bytes into the buffer. * [Meta data] and [implementation] mapping: - `require< 0 >::rule_t` is `internal::success` - `require< N >::rule_t` is `internal::require< N >` @@ -297,17 +297,19 @@ Note that the `false` template parameter to `internal::if_must` corresponds to t * Matches a non-empty list of `R` separated by `S` with optional trailing `S`. * [Equivalent] to `seq< list< R, S >, opt< S > >`. +* [Equivalent] to `seq< R, star_partial< S, R > >`. * [Meta data] and [implementation] mapping: - - `list_tail< R, S >::rule_t` is `internal::seq< R, internal::star< S, R >, internal::opt< S > >` - - `list_tail< R, S >::subs_t` is `type_list< R, internal::star< S, R >, internal::opt< S > >` + - `list_tail< R, S >::rule_t` is `internal::seq< R, internal::star_partial< S, R > >` + - `list_tail< R, S >::subs_t` is `type_list< R, internal::star_partial< S, R > >` ###### `list_tail< R, S, P >` * Matches a non-empty list of `R` separated by `S` with optional trailing `S` and padding `P` inside the list. * [Equivalent] to `seq< list< R, S, P >, opt< star< P >, S > >`. +* [Equivalent] to `seq< R, star_partial< padl< S, P >, padl< R, P > > >`. * [Meta data] and [implementation] mapping: - - `list_tail< R, S, P >::rule_t` is `internal::seq< R, internal::star< internal::pad< S, P >, R >, internal::opt< internal::star< P >, S > >` - - `list_tail< R, S, P >::subs_t` is `type_list< R, internal::star< internal::pad< S, P >, R > >, internal::opt< internal::star< P >, S > >` + - `list_tail< R, S, P >::rule_t` is `internal::seq< R, internal::star_partial< internal::padl< S, P >, internal::padl< R, P > > >` + - `list_tail< R, S, P >::subs_t` is `type_list< R, internal::star_partial< internal::padl< S, P >, internal::padl< R, P > > >` ###### `minus< M, S >` @@ -360,6 +362,19 @@ Note that the `true` template parameter to `internal::if_must` corresponds to th - `pad_opt< R, P >::rule_t` is `internal::seq< internal::star< P >, internal::opt< R, internal::star< P > > >` - `pad_opt< R, P >::subs_t` is `type_list< internal::star< P >, internal::opt< R, internal::star< P > > >` +###### `partial< R... >` + +* Similar to `opt< R... >` with one important difference: +* Does *not* rewind the input after a partial match of `R...`. +* Attempts to match the given rules `R...` in the given order. +* Succeeds and stops matching when one of the given rules fails. +* Consumes everything that the successful rules of `R...` consumed. +* `R` must be a non-empty rule pack. +* [Equivalent] to `opt< R >` when `R...` is a single rule. +* [Meta data] and [implementation] mapping: + - `partial< R... >::rule_t` is `internal::partial< R... >` + - `partial< R... >::subs_t` is `type_list< R... >` + ###### `rematch< R, S... >` * Succeeds if `R` matches, and each `S` matches the input that `R` matched. @@ -440,6 +455,34 @@ Note that the `S` do *not* need to match *all* of the input matched by `R` (whic - `star_must< R, S... >::rule_t` is `internal::star< internal::if_must< false, R, S... > >` - `star_must< R, S... >::subs_t` is `type_list< internal::if_must< false, R, S... > >` +###### `star_partial< R... >` + +* Similar to `star< R... >` with one important difference: +* The final iteration does *not* rewind the input after a partial match of `R...`. +* `R` must be a non-empty rule pack. +* [Meta data] and [implementation] mapping: + - `star_partial< R... >::rule_t` is `internal::star_partial< R... >` + - `star_partial< R... >::subs_t` is `type_list< R... >` + +###### `star_strict< R... >` + +* Similar to `star< R... >` with one important difference: +* A partial match of `R...` lets `star_strict` fail locally. +* `R` must be a non-empty rule pack. +* [Meta data] and [implementation] mapping: + - `star_strict< R... >::rule_t` is `internal::star_strict< R... >` + - `star_strict< R... >::subs_t` is `type_list< R... >` + +###### `strict< R... >` + +* Similar to `opt< R... >` with one important difference: +* A partial match of `R...` lets `strict` fail locally. +* [Equivalent] to `sor< not_at< R1 >, seq< R... > >` if `R1` is the first rule of `R...`. +* `R` must be a non-empty rule pack. +* [Meta data] and [implementation] mapping: + - `strict< R... >::rule_t` is `internal::strict< R... >` + - `strict< R... >::subs_t` is `type_list< R... >` + ###### `try_catch< R... >` * [Equivalent] to `seq< R... >`, but: @@ -567,6 +610,14 @@ Atomic rules do not rely on other rules. * [Meta data] and [implementation] mapping: - `eolf::rule_t` is `internal::eolf` +###### `everything` + +* Matches and consumes the entire input in one go, but: +* Limited by the buffer size when using an [Incremental Input]. +* [Equivalent] to `until< eof, any >`. +* [Meta data] and [implementation] mapping: + - `everything::rule_t` is `internal::everything< std::size_t >` + ###### `failure` * Dummy rule that never succeeds. @@ -583,6 +634,14 @@ Atomic rules do not rely on other rules. * [Meta data] and [implementation] mapping: - `raise< T >::rule_t` is `internal::raise< T >` +###### `raise_message< C... >` + +* Generates a *global failure* with the message given by `C...`. +* Calls the control-class' `Control< raise_message< C... > >::raise()` static member function. +* Does not consume input. +* [Meta data] and [implementation] mapping: + - `raise_message< C... >::rule_t` is `internal::raise< raise_message< C... > >` + ###### `success` * Dummy rule that always succeeds. @@ -590,6 +649,12 @@ Atomic rules do not rely on other rules. * [Meta data] and [implementation] mapping: - `success::rule_t` is `internal::success` +###### `TAO_PEGTL_RAISE_MESSAGE( "..." )` + +* Macro where `TAO_PEGTL_RAISE_MESSAGE( "foo" )` yields `raise_message< 'f', 'o', 'o' >`. +* The argument must be a string literal. +* Works for strings up to 512 bytes of length (excluding trailing `'\0'`). + ## ASCII Rules These rules are in the inline namespace `tao::pegtl::ascii`. @@ -1412,6 +1477,7 @@ Binary rules do not rely on other rules. * [`eof`](#eof) <sup>[(atomic rules)](#atomic-rules)</sup> * [`eol`](#eol) <sup>[(atomic rules)](#atomic-rules)</sup> * [`eolf`](#eolf) <sup>[(atomic rules)](#atomic-rules)</sup> +* [`everything`](#everything) <sup>[(atomic rules)](#atomic-rules)</sup> * [`extender`](#extender) <sup>[(icu rules)](#icu-rules-for-binary-properties)</sup> * [`failure`](#failure) <sup>[(atomic rules)](#atomic-rules)</sup> * [`forty_two< C... >`](#forty_two-c-) <sup>[(ascii rules)](#ascii-rules)</sup> @@ -1483,6 +1549,7 @@ Binary rules do not rely on other rules. * [`opt_must< R, S...>`](#opt_must-r-s-) <sup>[(convenience)](#convenience)</sup> * [`pad< R, S, T = S >`](#pad-r-s-t--s-) <sup>[(convenience)](#convenience)</sup> * [`pad_opt< R, P >`](#pad_opt-r-p-) <sup>[(convenience)](#convenience)</sup> +* [`partial< R... >`](#partial-r-) <sup>[(convenience)](#convenience)</sup> * [`pattern_syntax`](#pattern_syntax) <sup>[(icu rules)](#icu-rules-for-binary-properties)</sup> * [`pattern_white_space`](#pattern_white_space) <sup>[(icu rules)](#icu-rules-for-binary-properties)</sup> * [`plus< R... >`](#plus-r-) <sup>[(combinators)](#combinators)</sup> @@ -1496,6 +1563,7 @@ Binary rules do not rely on other rules. * [`quotation_mark`](#quotation_mark) <sup>[(icu rules)](#icu-rules-for-binary-properties)</sup> * [`radical`](#radical) <sup>[(icu rules)](#icu-rules-for-binary-properties)</sup> * [`raise< T >`](#raise-t-) <sup>[(atomic rules)](#atomic-rules)</sup> +* [`raise_message< C... >`](#raise_message-c-) <sup>[(atomic rules)](#atomic-rules)</sup> * [`range< C, D >`](#range-c-d-) <sup>[(ascii rules)](#ascii-rules)</sup> * [`range< C, D >`](#range-c-d--1) <sup>[(unicode rules)](#unicode-rules)</sup> * [`range< C, D >`](#range-c-d--2) <sup>[(binary rules)](#binary-rules)</sup> @@ -1523,13 +1591,17 @@ Binary rules do not rely on other rules. * [`space`](#space) <sup>[(ascii rules)](#ascii-rules)</sup> * [`star< R... >`](#star-r-) <sup>[(combinators)](#combinators)</sup> * [`star_must< R, S... >`](#star_must-r-s-) <sup>[(convenience)](#convenience)</sup> +* [`star_partial< R... >`](#star_partial-r-) <sup>[(convenience)](#convenience)</sup> +* [`star_strict< R... >`](#star_strict-r-) <sup>[(convenience)](#convenience)</sup> * [`state< S, R... >`](#state-s-r-) <sup>[(meta rules)](#meta-rules)</sup> +* [`strict< R... >`](#strict-r-) <sup>[(convenience)](#convenience)</sup> * [`string< C... >`](#string-c-) <sup>[(ascii rules)](#ascii-rules)</sup> * [`string< C... >`](#string-c--1) <sup>[(unicode rules)](#unicode-rules)</sup> * [`string< C... >`](#string-c--2) <sup>[(binary rules)](#binary-rules)</sup> * [`success`](#success) <sup>[(atomic rules)](#atomic-rules)</sup> * [`TAO_PEGTL_ISTRING( "..." )`](#tao_pegtl_istring--) <sup>[(ascii rules)](#ascii_rules)</sup> * [`TAO_PEGTL_KEYWORD( "..." )`](#tao_pegtl_keyword--) <sup>[(ascii rules)](#ascii_rules)</sup> +* [`TAO_PEGTL_RAISE_MESSAGE( "..." )`](#tao_pegtl_raise_message--) <sup>[(atomic rules)](#atomic_rules)</sup> * [`TAO_PEGTL_STRING( "..." )`](#tao_pegtl_string--) <sup>[(ascii rules)](#ascii_rules)</sup> * [`terminal_punctuation`](#terminal_punctuation) <sup>[(icu rules)](#icu-rules-for-binary-properties)</sup> * [`three< C >`](#three-c-) <sup>[(ascii rules)](#ascii-rules)</sup> @@ -1553,10 +1625,11 @@ Binary rules do not rely on other rules. This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt [Equivalent]: #equivalence [implementation]: #implementation +[Incremental Input]: Inputs-and-Parsing.md#incremental-input [Meta data]: Meta-Data-and-Visit.md diff --git a/packages/PEGTL/doc/Rules-and-Grammars.md b/packages/PEGTL/doc/Rules-and-Grammars.md index f2242c0f4ab61786dc27b0300f4842adba1dccd9..a62a2dd4f3ea2a311d2ba71f6005a1d31f4a1cd3 100644 --- a/packages/PEGTL/doc/Rules-and-Grammars.md +++ b/packages/PEGTL/doc/Rules-and-Grammars.md @@ -155,7 +155,7 @@ Note how the return value reflects the result of the checks, and how input is on The remainder of the program checks that all characters of `argv[ 1 ]` are equal to 0 when divided by 3. ```c++ -using namespace TAO_PEGTL_NAMESPACE; +using namespace tao::pegtl; namespace modulus { @@ -402,6 +402,6 @@ long literal body was: "[foo[" This document is part of the [PEGTL](https://github.com/taocpp/PEGTL). -Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey Distributed under the Boost Software License, Version 1.0<br> See accompanying file [LICENSE_1_0.txt](../LICENSE_1_0.txt) or copy at https://www.boost.org/LICENSE_1_0.txt diff --git a/packages/PEGTL/include/tao/pegtl.hpp b/packages/PEGTL/include/tao/pegtl.hpp index 982d0759af5339d756f1af83776ca9e67118d353..4e7b9823fcbf83c873758d2185d6ecef79903202 100644 --- a/packages/PEGTL/include/tao/pegtl.hpp +++ b/packages/PEGTL/include/tao/pegtl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #define TAO_PEGTL_HPP #include "pegtl/config.hpp" + #include "pegtl/demangle.hpp" #include "pegtl/parse.hpp" #include "pegtl/version.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/apply_mode.hpp b/packages/PEGTL/include/tao/pegtl/apply_mode.hpp index e4517c6e8734be54d0c3939c590fe42aefd16ffe..8e61f254894857daa94b82ccc5a99bd27a099dbc 100644 --- a/packages/PEGTL/include/tao/pegtl/apply_mode.hpp +++ b/packages/PEGTL/include/tao/pegtl/apply_mode.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/argv_input.hpp b/packages/PEGTL/include/tao/pegtl/argv_input.hpp index 0518082ad067186846073f65845dfab233df883e..711a6b221cd39d77165a887115efecd9a5813d3b 100644 --- a/packages/PEGTL/include/tao/pegtl/argv_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/argv_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/ascii.hpp b/packages/PEGTL/include/tao/pegtl/ascii.hpp index 73bb2cf5001697be0cfc2c4536a88cd0f2e1f6f5..b0b357adb71e29663ecc2e3dcfebf50b464722c9 100644 --- a/packages/PEGTL/include/tao/pegtl/ascii.hpp +++ b/packages/PEGTL/include/tao/pegtl/ascii.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -30,13 +30,13 @@ namespace TAO_PEGTL_NAMESPACE struct lower : internal::range< internal::result_on_found::success, internal::peek_char, 'a', 'z' > {}; template< char... Cs > struct not_one : internal::one< internal::result_on_found::failure, internal::peek_char, Cs... > {}; template< char Lo, char Hi > struct not_range : internal::range< internal::result_on_found::failure, internal::peek_char, Lo, Hi > {}; - struct nul : internal::one< internal::result_on_found::success, internal::peek_char, char( 0 ) > {}; + struct nul : internal::one< internal::result_on_found::success, internal::peek_char, static_cast< char >( 0 ) > {}; struct odigit : internal::range< internal::result_on_found::success, internal::peek_char, '0', '7' > {}; template< char... Cs > struct one : internal::one< internal::result_on_found::success, internal::peek_char, Cs... > {}; - struct print : internal::range< internal::result_on_found::success, internal::peek_char, char( 32 ), char( 126 ) > {}; + struct print : internal::range< internal::result_on_found::success, internal::peek_char, static_cast< char >( 32 ), static_cast< char >( 126 ) > {}; template< char Lo, char Hi > struct range : internal::range< internal::result_on_found::success, internal::peek_char, Lo, Hi > {}; template< char... Cs > struct ranges : internal::ranges< internal::peek_char, Cs... > {}; - struct seven : internal::range< internal::result_on_found::success, internal::peek_char, char( 0 ), char( 127 ) > {}; + struct seven : internal::range< internal::result_on_found::success, internal::peek_char, static_cast< char >( 0 ), static_cast< char >( 127 ) > {}; struct shebang : internal::seq< internal::string< '#', '!' >, internal::until< internal::eolf > > {}; struct space : internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\n', '\r', '\t', '\v', '\f' > {}; template< char... Cs > struct string : internal::string< Cs... > {}; diff --git a/packages/PEGTL/include/tao/pegtl/buffer_input.hpp b/packages/PEGTL/include/tao/pegtl/buffer_input.hpp index 4ea21e7c6c4f91fd258ad2865dd1f75515e7e1a5..20e18a82f6cdeddd11135738dbc692f1b05d2d5d 100644 --- a/packages/PEGTL/include/tao/pegtl/buffer_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/buffer_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -28,8 +28,8 @@ #include "internal/action_input.hpp" #include "internal/bump.hpp" -#include "internal/iterator.hpp" -#include "internal/marker.hpp" +#include "internal/frobnicator.hpp" +#include "internal/rewind_guard.hpp" namespace TAO_PEGTL_NAMESPACE { @@ -42,7 +42,7 @@ namespace TAO_PEGTL_NAMESPACE using eol_t = Eol; using source_t = Source; - using iterator_t = internal::iterator; + using frobnicator_t = internal::frobnicator; using action_t = internal::action_input< buffer_input >; @@ -58,7 +58,7 @@ namespace TAO_PEGTL_NAMESPACE m_end( m_buffer.get() ), m_source( std::forward< T >( in_source ) ) { - static_assert( Chunk, "zero chunk size not implemented" ); + static_assert( Chunk != 0, "zero chunk size not implemented" ); assert( m_maximum > maximum ); // Catches overflow; change to >= when zero chunk size is implemented. } @@ -161,18 +161,26 @@ namespace TAO_PEGTL_NAMESPACE std::terminate(); #endif } - if( const auto r = m_reader( m_end, ( std::min )( buffer_free_after_end(), ( std::max )( amount - buffer_occupied(), Chunk ) ) ) ) { - m_end += r; - } + m_end += m_reader( m_end, ( std::min )( buffer_free_after_end(), ( std::max )( amount - buffer_occupied(), Chunk ) ) ); } template< rewind_mode M > - [[nodiscard]] internal::marker< iterator_t, M > mark() noexcept + [[nodiscard]] internal::rewind_guard< M, buffer_input > auto_rewind() noexcept + { + return internal::rewind_guard< M, buffer_input >( this ); + } + + [[nodiscard]] const frobnicator_t& rewind_save() noexcept + { + return m_current; + } + + void rewind_restore( const frobnicator_t& data ) noexcept { - return internal::marker< iterator_t, M >( m_current ); + m_current = data; } - [[nodiscard]] TAO_PEGTL_NAMESPACE::position position( const iterator_t& it ) const + [[nodiscard]] TAO_PEGTL_NAMESPACE::position position( const frobnicator_t& it ) const { return TAO_PEGTL_NAMESPACE::position( it, m_source ); } @@ -182,7 +190,7 @@ namespace TAO_PEGTL_NAMESPACE return position( m_current ); } - [[nodiscard]] const iterator_t& iterator() const noexcept + [[nodiscard]] const frobnicator_t& frobnicator() const noexcept { return m_current; } @@ -195,26 +203,26 @@ namespace TAO_PEGTL_NAMESPACE [[nodiscard]] std::size_t buffer_occupied() const noexcept { assert( m_end >= m_current.data ); - return std::size_t( m_end - m_current.data ); + return static_cast< std::size_t >( m_end - m_current.data ); } [[nodiscard]] std::size_t buffer_free_before_current() const noexcept { assert( m_current.data >= m_buffer.get() ); - return std::size_t( m_current.data - m_buffer.get() ); + return static_cast< std::size_t >( m_current.data - m_buffer.get() ); } [[nodiscard]] std::size_t buffer_free_after_end() const noexcept { assert( m_buffer.get() + m_maximum >= m_end ); - return std::size_t( m_buffer.get() + m_maximum - m_end ); + return static_cast< std::size_t >( m_buffer.get() + m_maximum - m_end ); } private: Reader m_reader; std::size_t m_maximum; std::unique_ptr< char[] > m_buffer; - iterator_t m_current; + frobnicator_t m_current; char* m_end; const Source m_source; diff --git a/packages/PEGTL/include/tao/pegtl/change_action.hpp b/packages/PEGTL/include/tao/pegtl/change_action.hpp index 75496d45fe92dfa811cd6950cde436b2929450fd..dd3d273cedda92fcc81237d774748a2888be0947 100644 --- a/packages/PEGTL/include/tao/pegtl/change_action.hpp +++ b/packages/PEGTL/include/tao/pegtl/change_action.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/change_action_and_state.hpp b/packages/PEGTL/include/tao/pegtl/change_action_and_state.hpp index 248c6fedbeb9599dafd54b6a2d19b07d2bd7477a..e29ad167363fdb3e99d7896a44c22099f7e77ab0 100644 --- a/packages/PEGTL/include/tao/pegtl/change_action_and_state.hpp +++ b/packages/PEGTL/include/tao/pegtl/change_action_and_state.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/change_action_and_states.hpp b/packages/PEGTL/include/tao/pegtl/change_action_and_states.hpp index 9d0614f2f0620c10aeaf3ce67c049cb58ed7667f..51540b685cd372cdc479ee8c9ff068cdeb332d1c 100644 --- a/packages/PEGTL/include/tao/pegtl/change_action_and_states.hpp +++ b/packages/PEGTL/include/tao/pegtl/change_action_and_states.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/change_control.hpp b/packages/PEGTL/include/tao/pegtl/change_control.hpp index e825e235903cff1d30a2d7bd44d6018f96aa02d5..98717a24332a67418fe51d9a59558a66f4d5c04d 100644 --- a/packages/PEGTL/include/tao/pegtl/change_control.hpp +++ b/packages/PEGTL/include/tao/pegtl/change_control.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/change_state.hpp b/packages/PEGTL/include/tao/pegtl/change_state.hpp index 549ff4d7bc3c8f8cb3469f28af39103d4cca6e90..1679072be3bf078c0e470a9b070ff97e955a6955 100644 --- a/packages/PEGTL/include/tao/pegtl/change_state.hpp +++ b/packages/PEGTL/include/tao/pegtl/change_state.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/change_states.hpp b/packages/PEGTL/include/tao/pegtl/change_states.hpp index 59835c266d7911820e13d08e72ba11ba8cb484ed..ae8835cc39c657e5da44b08b6b20bd87e11c4400 100644 --- a/packages/PEGTL/include/tao/pegtl/change_states.hpp +++ b/packages/PEGTL/include/tao/pegtl/change_states.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/config.hpp b/packages/PEGTL/include/tao/pegtl/config.hpp index a58f22eb00cf1947d12ad17c9a9644e2aa9c6ff9..521623d26853772d266101fa1d9a5052d9dabf3e 100644 --- a/packages/PEGTL/include/tao/pegtl/config.hpp +++ b/packages/PEGTL/include/tao/pegtl/config.hpp @@ -1,13 +1,10 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey +// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ #ifndef TAO_PEGTL_CONFIG_HPP #define TAO_PEGTL_CONFIG_HPP -#if defined( TAO_PEGTL_NAMESPACE ) -#pragma message( "TAO_PEGTL_NAMESPACE is deprecated" ) -#else +#if !defined( TAO_PEGTL_NAMESPACE ) #define TAO_PEGTL_NAMESPACE tao::pegtl #endif diff --git a/packages/PEGTL/include/tao/pegtl/contrib/abnf.hpp b/packages/PEGTL/include/tao/pegtl/contrib/abnf.hpp index 6778f7a10f9b481ab7403aa2e0974e6e781815e4..2548e53be9f730bbda319ce0e6d66f851767ef3f 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/abnf.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/abnf.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #define TAO_PEGTL_CONTRIB_ABNF_HPP #include "../config.hpp" + #include "../internal/rules.hpp" namespace TAO_PEGTL_NAMESPACE::abnf @@ -15,10 +16,10 @@ namespace TAO_PEGTL_NAMESPACE::abnf // clang-format off struct ALPHA : internal::ranges< internal::peek_char, 'a', 'z', 'A', 'Z' > {}; struct BIT : internal::one< internal::result_on_found::success, internal::peek_char, '0', '1' > {}; - struct CHAR : internal::range< internal::result_on_found::success, internal::peek_char, char( 1 ), char( 127 ) > {}; + struct CHAR : internal::range< internal::result_on_found::success, internal::peek_char, static_cast< char >( 1 ), static_cast< char >( 127 ) > {}; struct CR : internal::one< internal::result_on_found::success, internal::peek_char, '\r' > {}; struct CRLF : internal::string< '\r', '\n' > {}; - struct CTL : internal::ranges< internal::peek_char, char( 0 ), char( 31 ), char( 127 ) > {}; + struct CTL : internal::ranges< internal::peek_char, static_cast< char >( 0 ), static_cast< char >( 31 ), static_cast< char >( 127 ) > {}; struct DIGIT : internal::range< internal::result_on_found::success, internal::peek_char, '0', '9' > {}; struct DQUOTE : internal::one< internal::result_on_found::success, internal::peek_char, '"' > {}; struct HEXDIG : internal::ranges< internal::peek_char, '0', '9', 'a', 'f', 'A', 'F' > {}; @@ -27,7 +28,7 @@ namespace TAO_PEGTL_NAMESPACE::abnf struct LWSP : internal::star< internal::sor< internal::string< '\r', '\n' >, internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\t' > >, internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\t' > > {}; struct OCTET : internal::any< internal::peek_char > {}; struct SP : internal::one< internal::result_on_found::success, internal::peek_char, ' ' > {}; - struct VCHAR : internal::range< internal::result_on_found::success, internal::peek_char, char( 33 ), char( 126 ) > {}; + struct VCHAR : internal::range< internal::result_on_found::success, internal::peek_char, static_cast< char >( 33 ), static_cast< char >( 126 ) > {}; struct WSP : internal::one< internal::result_on_found::success, internal::peek_char, ' ', '\t' > {}; // clang-format on diff --git a/packages/PEGTL/include/tao/pegtl/contrib/add_state.hpp b/packages/PEGTL/include/tao/pegtl/contrib/add_state.hpp index be91cd89cb1bf9e96112a8e4b1754410415e3686..f7e2c0635b5297020c087e69bd7ed6c9340d6d7b 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/add_state.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/add_state.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/alphabet.hpp b/packages/PEGTL/include/tao/pegtl/contrib/alphabet.hpp index 798530e05af4d18eb04407412051dd6d6376bf35..05acd5874ba5fcd1413a1290dfa37999f9bfa42a 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/alphabet.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/alphabet.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -44,7 +44,7 @@ namespace TAO_PEGTL_NAMESPACE::alphabet static const char F = 'F'; // NOLINT(readability-identifier-naming) static const char G = 'G'; // NOLINT(readability-identifier-naming) static const char H = 'H'; // NOLINT(readability-identifier-naming) - static const char I = 'I'; // NOLINT(readability-identifier-naming) + static const char I = 'I'; // NOLINT(readability-identifier-naming,misc-confusable-identifiers) static const char J = 'J'; // NOLINT(readability-identifier-naming) static const char K = 'K'; // NOLINT(readability-identifier-naming) static const char L = 'L'; // NOLINT(readability-identifier-naming) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/analyze.hpp b/packages/PEGTL/include/tao/pegtl/contrib/analyze.hpp index 6b4b093b720cb5b2be239b7d1ddef9ee253506bb..3d4b7f1391796a5f6901f98b39410a40fbd3f8d0 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/analyze.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/analyze.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -68,8 +68,7 @@ namespace TAO_PEGTL_NAMESPACE protected: explicit analyze_cycles_impl( const int verbose ) noexcept - : m_verbose( verbose ), - m_problems( 0 ) + : m_verbose( verbose ) {} [[nodiscard]] const std::pair< const std::string_view, analyze_entry >& find( const std::string_view name ) const noexcept @@ -140,7 +139,7 @@ namespace TAO_PEGTL_NAMESPACE const int m_verbose; - std::size_t m_problems; + std::size_t m_problems = 0; std::set< std::string_view > m_stack; std::vector< std::string_view > m_trace; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/analyze_traits.hpp b/packages/PEGTL/include/tao/pegtl/contrib/analyze_traits.hpp index b835098fbc5076cb2801aa8c2b825c6db0263a5f..33f47d4c3d968e185838b6237ce9ad21a131a0fc 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/analyze_traits.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/analyze_traits.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -131,6 +131,11 @@ namespace TAO_PEGTL_NAMESPACE : analyze_opt_traits<> {}; + template< typename Name, typename Size > + struct analyze_traits< Name, internal::everything< Size > > + : analyze_opt_traits<> + {}; + template< typename Name > struct analyze_traits< Name, internal::failure > : analyze_any_traits<> @@ -161,9 +166,14 @@ namespace TAO_PEGTL_NAMESPACE : analyze_any_traits<> {}; - template< typename Name, typename Rule, typename... Rules > - struct analyze_traits< Name, internal::opt< Rule, Rules... > > - : analyze_opt_traits< Rule, Rules... > + template< typename Name, typename... Rules > + struct analyze_traits< Name, internal::opt< Rules... > > + : analyze_opt_traits< Rules... > + {}; + + template< typename Name, typename... Rules > + struct analyze_traits< Name, internal::partial< Rules... > > + : analyze_opt_traits< Rules... > {}; template< typename Name, typename... Rules > @@ -221,6 +231,11 @@ namespace TAO_PEGTL_NAMESPACE : analyze_traits< Name, typename opt< Rules..., Name >::rule_t > {}; + template< typename Name, typename... Rules > + struct analyze_traits< Name, internal::star_partial< Rules... > > + : analyze_traits< Name, typename opt< Rules..., Name >::rule_t > + {}; + template< typename Name, typename State, typename... Rules > struct analyze_traits< Name, internal::state< State, Rules... > > : analyze_traits< Name, typename seq< Rules... >::rule_t > diff --git a/packages/PEGTL/include/tao/pegtl/contrib/check_bytes.hpp b/packages/PEGTL/include/tao/pegtl/contrib/check_bytes.hpp index cfd313db7d7c148e4a7f366a23a895a220bcdadc..25a14d06b56d66fd4410f6f4ee4b90d2767919b7 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/check_bytes.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/check_bytes.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -25,8 +25,8 @@ namespace TAO_PEGTL_NAMESPACE : maybe_nothing { template< typename Rule, - pegtl::apply_mode A, - pegtl::rewind_mode M, + apply_mode A, + rewind_mode M, template< typename... > class Action, template< typename... > diff --git a/packages/PEGTL/include/tao/pegtl/contrib/control_action.hpp b/packages/PEGTL/include/tao/pegtl/contrib/control_action.hpp index 239e6213bdabbb0d11bcc468dbc8cb27da574586..edff6bde5043efd93335c14fb1f0242f3dd7a779 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/control_action.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/control_action.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -55,6 +55,18 @@ namespace TAO_PEGTL_NAMESPACE #endif } + template< typename ParseInput, typename... States > + static void start( const ParseInput& /*unused*/, States&&... /*unused*/ ) noexcept + {} + + template< typename ParseInput, typename... States > + static void success( const ParseInput& /*unused*/, States&&... /*unused*/ ) noexcept + {} + + template< typename ParseInput, typename... States > + static void failure( const ParseInput& /*unused*/, States&&... /*unused*/ ) noexcept + {} + private: template< typename Rule, apply_mode A, diff --git a/packages/PEGTL/include/tao/pegtl/contrib/coverage.hpp b/packages/PEGTL/include/tao/pegtl/contrib/coverage.hpp index bfa75424fbe26d170b58c69c5f84ddc25b73795c..001a9f87cf659a3ea48168f9d4bd36ffae7367b3 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/coverage.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/coverage.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/forward.hpp b/packages/PEGTL/include/tao/pegtl/contrib/forward.hpp index aa9f351e4e2956fc7f11eb719d695a117439c0ec..16905c654390b74b254e03e4db16e0d0a3dbd61d 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/forward.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/forward.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/function.hpp b/packages/PEGTL/include/tao/pegtl/contrib/function.hpp index 86d535896d4cef96d48e1b7b071060078032786d..91d1ef029f0d566baca8b3eb68be7af4033358a2 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/function.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/function.hpp @@ -1,13 +1,12 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_CONTRIB_FUNCTION_HPP #define TAO_PEGTL_CONTRIB_FUNCTION_HPP -#include "../config.hpp" - #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/http.hpp b/packages/PEGTL/include/tao/pegtl/contrib/http.hpp index e794a6dd739a803d4a323728d87daa77fbfe3426..22f439e1dc746180e1c63f220319a92ce2908202 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/http.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/http.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/icu/internal.hpp b/packages/PEGTL/include/tao/pegtl/contrib/icu/internal.hpp index 02976fd6d210a221d6f799aa72e8ef651bda4dd7..78b0323952367883769cf58bf1dd488f4da1fbdd 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/icu/internal.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/icu/internal.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -29,7 +29,7 @@ namespace TAO_PEGTL_NAMESPACE using rule_t = binary_property; using subs_t = empty_list; - [[nodiscard]] static bool test( const data_t c ) noexcept + [[nodiscard]] static bool test_one( const data_t c ) noexcept { return u_hasBinaryProperty( c, P ) == V; } @@ -38,7 +38,7 @@ namespace TAO_PEGTL_NAMESPACE [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) ) { if( const auto t = Peek::peek( in ) ) { - if( test( t.data ) ) { + if( test_one( t.data ) ) { in.bump( t.size ); return true; } @@ -56,7 +56,7 @@ namespace TAO_PEGTL_NAMESPACE using rule_t = property_value; using subs_t = empty_list; - [[nodiscard]] static bool test( const data_t c ) noexcept + [[nodiscard]] static bool test_one( const data_t c ) noexcept { return u_getIntPropertyValue( c, P ) == V; } @@ -65,7 +65,7 @@ namespace TAO_PEGTL_NAMESPACE [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) ) { if( const auto t = Peek::peek( in ) ) { - if( test( t.data ) ) { + if( test_one( t.data ) ) { in.bump( t.size ); return true; } diff --git a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp index 1b04ad8b2ec60a361ce8d32395c85c4e1332dc21..418419df0c339a4681d89d70c21944a9fc0e7a8f 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf16.hpp @@ -1,13 +1,14 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_CONTRIB_ICU_UTF16_HPP #define TAO_PEGTL_CONTRIB_ICU_UTF16_HPP +#include "../../config.hpp" + #include "internal.hpp" -#include "../../config.hpp" #include "../utf16.hpp" #include "../internal/peek_utf16.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp index 738b0e61f1dfe1f9c9d09c17e1e5e80911670908..a830cdd0cea85df796c1cf05ad1c8d8d0ae351f4 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf32.hpp @@ -1,13 +1,14 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_CONTRIB_ICU_UTF32_HPP #define TAO_PEGTL_CONTRIB_ICU_UTF32_HPP +#include "../../config.hpp" + #include "internal.hpp" -#include "../../config.hpp" #include "../utf32.hpp" #include "../internal/peek_utf32.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp index 7a7ced60128523593bc951ec037f3dfdddf603d7..065837dc4537bb38dc6d1c8a836cf4d16e50a1fc 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/icu/utf8.hpp @@ -1,13 +1,14 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_CONTRIB_ICU_UTF8_HPP #define TAO_PEGTL_CONTRIB_ICU_UTF8_HPP +#include "../../config.hpp" + #include "internal.hpp" -#include "../../config.hpp" #include "../../utf8.hpp" #include "../../internal/peek_utf8.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/if_then.hpp b/packages/PEGTL/include/tao/pegtl/contrib/if_then.hpp index 897f55c026d46394c3a63e0bbcb65083fd01bb0d..373b58ef4a6959975a21d80f9759b5e5cffde8aa 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/if_then.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/if_then.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/input_with_depth.hpp b/packages/PEGTL/include/tao/pegtl/contrib/input_with_depth.hpp new file mode 100644 index 0000000000000000000000000000000000000000..da2f6b5c683a3a1d31049b19fbbf1dc3d9dcab25 --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/contrib/input_with_depth.hpp @@ -0,0 +1,70 @@ +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_CONTRIB_INPUT_WITH_DEPTH_HPP +#define TAO_PEGTL_CONTRIB_INPUT_WITH_DEPTH_HPP + +#include <cstddef> + +#include "../config.hpp" + +namespace TAO_PEGTL_NAMESPACE +{ + namespace internal + { + class [[nodiscard]] depth_guard + { + public: + explicit depth_guard( std::size_t& depth ) noexcept + : m_depth( depth ) + { + ++m_depth; + } + + depth_guard( depth_guard&& ) = delete; + depth_guard( const depth_guard& ) = delete; + + ~depth_guard() + { + --m_depth; + } + + depth_guard& operator=( depth_guard&& ) = delete; + depth_guard& operator=( const depth_guard& ) = delete; + + [[nodiscard]] std::size_t current_depth() const noexcept + { + return m_depth; + } + + private: + std::size_t& m_depth; + }; + + } // namespace internal + + template< typename Input > + class input_with_depth + : public Input + { + public: + using Input::Input; + + [[nodiscard]] internal::depth_guard make_depth_guard() noexcept + { + return internal::depth_guard( m_depth ); // NOLINT(google-readability-casting) + } + + [[nodiscard]] std::size_t current_depth() const noexcept + { + return m_depth; + } + + private: + std::size_t m_depth = 0; + }; + +} // namespace TAO_PEGTL_NAMESPACE + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/contrib/instantiate.hpp b/packages/PEGTL/include/tao/pegtl/contrib/instantiate.hpp index ce8bb4c293fe9ef45f85d1919d49fe4cdfd4b4d3..61ac3a6233617c0750e67958ecf29cb18828baad 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/instantiate.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/instantiate.hpp @@ -1,13 +1,12 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_CONTRIB_INSTANTIATE_HPP #define TAO_PEGTL_CONTRIB_INSTANTIATE_HPP -#include "../config.hpp" - #include "../apply_mode.hpp" +#include "../config.hpp" #include "../match.hpp" #include "../nothing.hpp" #include "../rewind_mode.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/integer.hpp b/packages/PEGTL/include/tao/pegtl/contrib/integer.hpp index 2fbc7285dcde90629456db3a5c334ffb5e93e94f..8556cd68bce9c59d2aedae1ba129ea6957dc2a26 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/integer.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/integer.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -17,6 +17,7 @@ #include <type_traits> #include "../ascii.hpp" +#include "../config.hpp" #include "../parse.hpp" #include "../parse_error.hpp" #include "../rules.hpp" @@ -143,7 +144,7 @@ namespace TAO_PEGTL_NAMESPACE if( input[ 0 ] == '-' ) { return convert_negative< Signed >( result, std::string_view( input.data() + 1, input.size() - 1 ) ); } - const auto offset = unsigned( input[ 0 ] == '+' ); + const auto offset = static_cast< unsigned >( input[ 0 ] == '+' ); return convert_positive< Signed >( result, std::string_view( input.data() + offset, input.size() - offset ) ); } @@ -383,7 +384,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( in.empty() ) ) { - return TAO_PEGTL_NAMESPACE::parse< signed_rule_new >( in ); // Does not check for any overflow. + return parse< signed_rule_new >( in ); // Does not check for any overflow. } }; @@ -416,7 +417,7 @@ namespace TAO_PEGTL_NAMESPACE typename... States > [[nodiscard]] static auto match( ParseInput& in, States&&... /*unused*/ ) noexcept( noexcept( in.empty() ) ) -> std::enable_if_t< A == apply_mode::nothing, bool > { - return TAO_PEGTL_NAMESPACE::parse< signed_rule_new >( in ); // Does not check for any overflow. + return parse< signed_rule_new >( in ); // Does not check for any overflow. } template< apply_mode A, @@ -429,7 +430,7 @@ namespace TAO_PEGTL_NAMESPACE typename Signed > [[nodiscard]] static auto match( ParseInput& in, Signed& st ) -> std::enable_if_t< ( A == apply_mode::action ) && std::is_signed_v< Signed >, bool > { - return TAO_PEGTL_NAMESPACE::parse< signed_rule_new, internal::signed_action_action >( in, st ); // Throws on overflow. + return parse< signed_rule_new, internal::signed_action_action >( in, st ); // Throws on overflow. } }; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/endian.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/endian.hpp index fc997a311651a584583f72198ab325d158406cec..43d90b9d67fa5cf5ec88124a9f199ced8d6bbadf 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/endian.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/endian.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/endian_gcc.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/endian_gcc.hpp index d6a82315520517ef535f0a947284169376529dd3..c261be2b4ffec403c5a0d4fb40fb614d54a85fbf 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/endian_gcc.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/endian_gcc.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,6 +8,8 @@ #include <cstdint> #include <cstring> +#include "../../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { #if !defined( __BYTE_ORDER__ ) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/endian_win.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/endian_win.hpp index ac21c8bcc900a3a47b48ef5e9c6a029f61b45839..c0b1851ec509581a0dd8248c51b37de2b01e32c4 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/endian_win.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/endian_win.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,6 +9,8 @@ #include <cstdlib> #include <cstring> +#include "../../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< std::size_t S > diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_mask_uint.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_mask_uint.hpp index f34baa4f708fd0e06424b8100b6d98aea5a6117c..6fafc911795a0bbf3030e5f4f4acbe73b757519c 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_mask_uint.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_mask_uint.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,8 +8,7 @@ #include <cstddef> #include <cstdint> -#include "../../config.hpp" -#include "../../internal/input_pair.hpp" +#include "../../internal/data_and_size.hpp" #include "read_uint.hpp" @@ -19,7 +18,7 @@ namespace TAO_PEGTL_NAMESPACE::internal struct peek_mask_uint_impl { using data_t = typename R::type; - using pair_t = input_pair< data_t >; + using pair_t = data_and_size< data_t >; template< typename ParseInput > [[nodiscard]] static pair_t peek( ParseInput& in ) noexcept( noexcept( in.size( sizeof( data_t ) ) ) ) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_mask_uint8.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_mask_uint8.hpp index b57da1809cb774ed26c2f5339a8e04293bf36ebf..28c63ced2040231d77c72dc865579166fa4b94c8 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_mask_uint8.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_mask_uint8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,8 +8,7 @@ #include <cstddef> #include <cstdint> -#include "../../config.hpp" -#include "../../internal/input_pair.hpp" +#include "../../internal/data_and_size.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -17,7 +16,7 @@ namespace TAO_PEGTL_NAMESPACE::internal struct peek_mask_uint8 { using data_t = std::uint8_t; - using pair_t = input_pair< std::uint8_t >; + using pair_t = data_and_size< std::uint8_t >; template< typename ParseInput > [[nodiscard]] static pair_t peek( ParseInput& in ) noexcept( noexcept( in.empty() ) ) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_uint.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_uint.hpp index 62f7555b666c03a01384e9051cfcc1a99f1e8f12..8151f2a3f72a579f18c1a7009247ea868c111b4d 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_uint.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_uint.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,8 +8,7 @@ #include <cstddef> #include <cstdint> -#include "../../config.hpp" -#include "../../internal/input_pair.hpp" +#include "../../internal/data_and_size.hpp" #include "read_uint.hpp" @@ -19,7 +18,7 @@ namespace TAO_PEGTL_NAMESPACE::internal struct peek_uint_impl { using data_t = typename R::type; - using pair_t = input_pair< data_t >; + using pair_t = data_and_size< data_t >; template< typename ParseInput > [[nodiscard]] static pair_t peek( ParseInput& in ) noexcept( noexcept( in.size( sizeof( data_t ) ) ) ) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_uint8.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_uint8.hpp index 9b437f4c650d827ca9b0e3c3681d1dd62db0093c..9e343eb2d0b35f6549815685441625dbe37fa6de 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_uint8.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_uint8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,15 +8,14 @@ #include <cstddef> #include <cstdint> -#include "../../config.hpp" -#include "../../internal/input_pair.hpp" +#include "../../internal/data_and_size.hpp" namespace TAO_PEGTL_NAMESPACE::internal { struct peek_uint8 { using data_t = std::uint8_t; - using pair_t = input_pair< std::uint8_t >; + using pair_t = data_and_size< std::uint8_t >; template< typename ParseInput > [[nodiscard]] static pair_t peek( ParseInput& in ) noexcept( noexcept( in.empty() ) ) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_utf16.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_utf16.hpp index 6a5006c216e847d993b5f56b06c9459cfc2dfb26..b4ab1091c2baabd4e0cd5335cb38f99704c752f8 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_utf16.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_utf16.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,8 +7,7 @@ #include <type_traits> -#include "../../config.hpp" -#include "../../internal/input_pair.hpp" +#include "../../internal/data_and_size.hpp" #include "read_uint.hpp" @@ -18,7 +17,7 @@ namespace TAO_PEGTL_NAMESPACE::internal struct peek_utf16_impl { using data_t = char32_t; - using pair_t = input_pair< char32_t >; + using pair_t = data_and_size< char32_t >; using short_t = std::make_unsigned< char16_t >::type; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_utf32.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_utf32.hpp index 0d78db0dacf6cc8694a32e1d960362831f314ebe..a32170d94c1e271055dd9c6ef92ce52e75ab9ef4 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_utf32.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/peek_utf32.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,8 +7,7 @@ #include <cstddef> -#include "../../config.hpp" -#include "../../internal/input_pair.hpp" +#include "../../internal/data_and_size.hpp" #include "read_uint.hpp" @@ -18,7 +17,7 @@ namespace TAO_PEGTL_NAMESPACE::internal struct peek_utf32_impl { using data_t = char32_t; - using pair_t = input_pair< char32_t >; + using pair_t = data_and_size< char32_t >; static_assert( sizeof( char32_t ) == 4 ); diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/read_uint.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/read_uint.hpp index 8f294726aa7b64d9b6f358ddd8148cc40d85c900..63f61c786ab85521bf497143600be94ea47a511a 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/read_uint.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/read_uint.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,8 +7,6 @@ #include <cstdint> -#include "../../config.hpp" - #include "endian.hpp" namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/set_stack_guard.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/set_stack_guard.hpp index a7c89b5ec3c86fc76a55f228c667fb3f35960fff..4e4fb0dc0eb40b5ab70100e5832978b503132474 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/set_stack_guard.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/set_stack_guard.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,8 +8,6 @@ #include <set> #include <utility> -#include "../../config.hpp" - namespace TAO_PEGTL_NAMESPACE::internal { template< typename... Cs > @@ -35,7 +33,7 @@ namespace TAO_PEGTL_NAMESPACE::internal } } - explicit operator bool() const noexcept + [[nodiscard]] explicit operator bool() const noexcept { return m_i.second; } diff --git a/packages/PEGTL/include/tao/pegtl/contrib/internal/vector_stack_guard.hpp b/packages/PEGTL/include/tao/pegtl/contrib/internal/vector_stack_guard.hpp index b143457f4ff39776f9101b5284a16b5d53b22e29..1b7c69a8dfd9f1abd2f01bfe76c28179df3a528f 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/internal/vector_stack_guard.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/internal/vector_stack_guard.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,8 +8,6 @@ #include <utility> #include <vector> -#include "../../config.hpp" - namespace TAO_PEGTL_NAMESPACE::internal { template< typename... Cs > diff --git a/packages/PEGTL/include/tao/pegtl/contrib/iri.hpp b/packages/PEGTL/include/tao/pegtl/contrib/iri.hpp index defdc42fa0d72b1725e97c1c4bf497a8af64e84d..858432275a439041964fd38050404c34b40d0fef 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/iri.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/iri.hpp @@ -1,5 +1,5 @@ -// Copyright (c) 2021 Kelvin Hammond -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Kelvin Hammond +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/json.hpp b/packages/PEGTL/include/tao/pegtl/contrib/json.hpp index e47aaae4b5b01bb22bd1212781aa6fdd8c347559..0b9dcdaa3e2daa76f61a32e2dbf72ac63bdb059f 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/json.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/json.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -37,7 +37,7 @@ namespace TAO_PEGTL_NAMESPACE::json struct int_ : sor< one< '0' >, plus< digit > > {}; // NOLINT(readability-identifier-naming) struct number : seq< opt< one< '-' > >, int_, opt< frac >, opt< exp > > {}; - struct xdigit : pegtl::xdigit {}; + struct xdigit : TAO_PEGTL_NAMESPACE::xdigit {}; struct unicode : list< seq< one< 'u' >, rep< 4, xdigit > >, one< '\\' > > {}; struct escaped_char : one< '"', '\\', '/', 'b', 'f', 'n', 'r', 't' > {}; struct escaped : sor< escaped_char, unicode > {}; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/json_pointer.hpp b/packages/PEGTL/include/tao/pegtl/contrib/json_pointer.hpp index 5e920d720b1e0d2b82dc77f4252f965eb67e4db2..29f77030ba7d990f8efd92db7547119414e4a249 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/json_pointer.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/json_pointer.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/limit_bytes.hpp b/packages/PEGTL/include/tao/pegtl/contrib/limit_bytes.hpp index 1447e1fd58fdd2a964bcdcc1263ed90696a27005..bbcc3ccb5c8c4592a9ca7bc348ec188cc065fffd 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/limit_bytes.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/limit_bytes.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -57,6 +57,8 @@ namespace TAO_PEGTL_NAMESPACE struct limit_bytes : maybe_nothing { + static constexpr const char* error_message = "maximum allowed rule consumption reached"; + template< typename Rule, apply_mode A, rewind_mode M, @@ -72,7 +74,7 @@ namespace TAO_PEGTL_NAMESPACE if( TAO_PEGTL_NAMESPACE::match< Rule, A, M, Action, Control >( in, st... ) ) { if( in.empty() && ( bg.m_end != in.current() ) ) { #if defined( __cpp_exceptions ) - throw TAO_PEGTL_NAMESPACE::parse_error( "maximum allowed rule consumption reached", in ); + Control< limit_bytes >::raise( in ); #else std::fputs( "maximum allowed rule consumption reached\n", stderr ); std::terminate(); diff --git a/packages/PEGTL/include/tao/pegtl/contrib/limit_depth.hpp b/packages/PEGTL/include/tao/pegtl/contrib/limit_depth.hpp index a84e002eaed39f027d4c7f2b60a9c8ad27689cd3..3dbcf53b6e624e14281fec0c1b3e25da96a38663 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/limit_depth.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/limit_depth.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -20,36 +20,12 @@ namespace TAO_PEGTL_NAMESPACE { - namespace internal - { - struct [[nodiscard]] depth_guard - { - std::size_t& m_depth; - - explicit depth_guard( std::size_t& depth ) noexcept - : m_depth( depth ) - { - ++m_depth; - } - - depth_guard( depth_guard&& ) = delete; - depth_guard( const depth_guard& ) = delete; - - ~depth_guard() - { - --m_depth; - } - - depth_guard& operator=( depth_guard&& ) = delete; - depth_guard& operator=( const depth_guard& ) = delete; - }; - - } // namespace internal - template< std::size_t Maximum > struct limit_depth : maybe_nothing { + static constexpr const char* error_message = "maximum parser rule nesting depth exceeded"; + template< typename Rule, apply_mode A, rewind_mode M, @@ -62,10 +38,10 @@ namespace TAO_PEGTL_NAMESPACE [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { if constexpr( Control< Rule >::enable ) { - const internal::depth_guard dg( in.private_depth ); - if( in.private_depth > Maximum ) { + const auto dg( in.make_depth_guard() ); + if( dg.current_depth() > Maximum ) { #if defined( __cpp_exceptions ) - throw TAO_PEGTL_NAMESPACE::parse_error( "maximum parser rule nesting depth exceeded", in ); + Control< limit_depth >::raise( in ); #else std::fputs( "maximum parser rule nesting depth exceeded\n", stderr ); std::terminate(); diff --git a/packages/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp b/packages/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp index 8de35b8cd13051ba046959e108933a6c160d484e..c442da75ebdb9eaea04e30212495c776f1fe05d0 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/parse_tree.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -28,8 +28,8 @@ #include "../rewind_mode.hpp" #include "../internal/enable_control.hpp" +#include "../internal/frobnicator.hpp" #include "../internal/has_unwind.hpp" -#include "../internal/iterator.hpp" namespace TAO_PEGTL_NAMESPACE::parse_tree { @@ -43,8 +43,8 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree std::string_view type; Source source; - TAO_PEGTL_NAMESPACE::internal::iterator m_begin; - TAO_PEGTL_NAMESPACE::internal::iterator m_end; + TAO_PEGTL_NAMESPACE::internal::frobnicator m_begin; + TAO_PEGTL_NAMESPACE::internal::frobnicator m_end; // each node will be default constructed basic_node() = default; @@ -96,13 +96,13 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree [[nodiscard]] std::string_view string_view() const noexcept { assert( has_content() ); - return std::string_view( m_begin.data, m_end.data - m_begin.data ); + return { m_begin.data, static_cast< std::size_t >( m_end.data - m_begin.data ) }; } [[nodiscard]] std::string string() const { assert( has_content() ); - return std::string( m_begin.data, m_end.data ); + return { m_begin.data, m_end.data }; } template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > @@ -115,7 +115,7 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree template< typename... States > void remove_content( States&&... /*unused*/ ) noexcept { - m_end = TAO_PEGTL_NAMESPACE::internal::iterator(); + m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator(); } // all non-root nodes are initialized by calling this method @@ -124,14 +124,14 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree { set_type< Rule >(); source = in.source(); - m_begin = TAO_PEGTL_NAMESPACE::internal::iterator( in.iterator() ); + m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator( in.frobnicator() ); } // if parsing of the rule succeeded, this method is called template< typename Rule, typename ParseInput, typename... States > void success( const ParseInput& in, States&&... /*unused*/ ) noexcept { - m_end = TAO_PEGTL_NAMESPACE::internal::iterator( in.iterator() ); + m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator( in.frobnicator() ); } // if parsing of the rule failed, this method is called @@ -139,11 +139,6 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree void failure( const ParseInput& /*unused*/, States&&... /*unused*/ ) noexcept {} - // if parsing of the rule failed with an exception, this method is called - template< typename Rule, typename ParseInput, typename... States > - void unwind( const ParseInput& /*unused*/, States&&... /*unused*/ ) noexcept - {} - // if parsing succeeded and the (optional) transform call // did not discard the node, it is appended to its parent. // note that "child" is the node whose Rule just succeeded @@ -233,6 +228,19 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree using type = rotate_states_right< state_handler< Rule, is_selected_node< Rule, Selector >, is_leaf< 8, typename Rule::subs_t, Selector > > >; }; + template< typename, typename, typename... > + inline constexpr bool node_has_unwind = false; + + template< typename Node, typename Rule, typename... States > + inline constexpr bool node_has_unwind< Node, + Rule, + decltype( std::declval< Node >().template unwind< Rule >( std::declval< States >()... ) ), + States... > + = true; + + template< typename Control, typename... States > + inline constexpr bool control_has_unwind = TAO_PEGTL_NAMESPACE::internal::has_unwind< Control, void, States... >; + template< typename Node, template< typename... > class Selector, template< typename... > class Control > template< typename Rule > struct make_control< Node, Selector, Control >::state_handler< Rule, false, true > @@ -310,13 +318,19 @@ namespace TAO_PEGTL_NAMESPACE::parse_tree } template< typename ParseInput, typename... States > - static void unwind( const ParseInput& in, state< Node >& state, States&&... st ) + static void unwind( [[maybe_unused]] const ParseInput& in, [[maybe_unused]] state< Node >& state, States&&... st ) { - state.back()->template unwind< Rule >( in, st... ); + if constexpr( node_has_unwind< Node, Rule, void, const ParseInput&, States... > ) { + state.back()->template unwind< Rule >( in, st... ); + } state.pop_back(); - if constexpr( TAO_PEGTL_NAMESPACE::internal::has_unwind< Control< Rule >, void, const ParseInput&, States... > ) { + if constexpr( control_has_unwind< Control< Rule >, const ParseInput&, States... > ) { Control< Rule >::unwind( in, st... ); } +#if defined( _MSC_VER ) + ( (void)st, + ... ); +#endif } }; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/parse_tree_to_dot.hpp b/packages/PEGTL/include/tao/pegtl/contrib/parse_tree_to_dot.hpp index f186bf6ea0c559fb6d8e38c2fe1afb2d1c085b89..a713a26aa199241a439c869cb498b7a72c55e4bb 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/parse_tree_to_dot.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/parse_tree_to_dot.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,6 +9,8 @@ #include <ostream> #include <string> +#include "../config.hpp" + #include "parse_tree.hpp" namespace TAO_PEGTL_NAMESPACE::parse_tree diff --git a/packages/PEGTL/include/tao/pegtl/contrib/predicates.hpp b/packages/PEGTL/include/tao/pegtl/contrib/predicates.hpp index 4e37e29072324e5545ea1cf0dc67c70acdeba3dd..ad30169bc56304f51614f83ed359cedb645e5445 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/predicates.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/predicates.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -27,9 +27,9 @@ namespace TAO_PEGTL_NAMESPACE using peek_t = Peek; using data_t = typename Peek::data_t; - [[nodiscard]] static constexpr bool test( const data_t c ) noexcept + [[nodiscard]] static constexpr bool test_impl( const data_t c ) noexcept { - return ( Ps::test( c ) && ... ); // TODO: Static assert that Ps::peek_t is the same as peek_t?! + return ( Ps::test_one( c ) && ... ); // TODO: Static assert that Ps::peek_t is the same as peek_t?! } }; @@ -39,9 +39,9 @@ namespace TAO_PEGTL_NAMESPACE using peek_t = Peek; using data_t = typename Peek::data_t; - [[nodiscard]] static constexpr bool test( const data_t c ) noexcept + [[nodiscard]] static constexpr bool test_impl( const data_t c ) noexcept { - return !P::test( c ); // TODO: Static assert that P::peek_t is the same as peek_t?! + return !P::test_one( c ); // TODO: Static assert that P::peek_t is the same as peek_t?! } }; @@ -51,9 +51,9 @@ namespace TAO_PEGTL_NAMESPACE using peek_t = Peek; using data_t = typename Peek::data_t; - [[nodiscard]] static constexpr bool test( const data_t c ) noexcept + [[nodiscard]] static constexpr bool test_impl( const data_t c ) noexcept { - return ( Ps::test( c ) || ... ); // TODO: Static assert that Ps::peek_t is the same as peek_t?! + return ( Ps::test_one( c ) || ... ); // TODO: Static assert that Ps::peek_t is the same as peek_t?! } }; @@ -68,16 +68,22 @@ namespace TAO_PEGTL_NAMESPACE using subs_t = empty_list; using base_t = Test< Peek, Ps... >; - using base_t::test; - template< int Eol > - static constexpr bool can_match_eol = test( Eol ); + [[nodiscard]] static constexpr bool test_one( const data_t c ) noexcept + { + return Test< Peek, Ps... >::test_impl( c ); + } + + [[nodiscard]] static constexpr bool test_any( const data_t c ) noexcept + { + return Test< Peek, Ps... >::test_impl( c ); + } template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) ) { if( const auto t = Peek::peek( in ) ) { - if( test( t.data ) ) { + if( test_one( t.data ) ) { bump_help< predicates >( in, t.size ); return true; } diff --git a/packages/PEGTL/include/tao/pegtl/contrib/print.hpp b/packages/PEGTL/include/tao/pegtl/contrib/print.hpp index 18d803021412de70c06aaac6bb698d959add68b1..6e079e9dd8a3feb5235d147ff718733b21c59dee 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/print.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/print.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/print_coverage.hpp b/packages/PEGTL/include/tao/pegtl/contrib/print_coverage.hpp index 9b0774f0467249aa09eb42716112845845aea6ae..ba20d365db51c0274edb64a19ef72983434b3ba1 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/print_coverage.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/print_coverage.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,6 +7,8 @@ #include <ostream> +#include "../config.hpp" + #include "coverage.hpp" namespace TAO_PEGTL_NAMESPACE diff --git a/packages/PEGTL/include/tao/pegtl/contrib/proto3.hpp b/packages/PEGTL/include/tao/pegtl/contrib/proto3.hpp index 535cfa1c327da830d203f2e526d5d10aea3e0dcb..7be928a145c314078befd3a141ca9968f5a33724 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/proto3.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/proto3.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -39,6 +39,9 @@ namespace TAO_PEGTL_NAMESPACE::proto3 struct dec_lit : seq< range< '1', '9' >, star< digit > > {}; struct int_lit : sor< hex_lit, oct_lit, dec_lit > {}; + struct enum_dec : plus< digit > {}; // NOTE: As of time of writing the original grammar has a bug -- it uses int_lit for enum_int, which uses dec_lit instead of enum_dec, thereby not allowing a plain 0 as enum value. + struct enum_int : sor< hex_lit, oct_lit, enum_dec > {}; + struct sign : one< '+', '-' > {}; struct exp : seq< one< 'E', 'e' >, opt< sign >, plus< digit > > {}; struct float_lit : sor< @@ -110,7 +113,7 @@ namespace TAO_PEGTL_NAMESPACE::proto3 struct enum_name : ident {}; struct enum_value_option : seq< option_name, sps, equ, sps, constant > {}; - struct enum_field : seq< ident, sps, equ, sps, int_lit, sps, opt_must< one< '[' >, sps, list_must< enum_value_option, comma, sp >, sps, one< ']' >, sps >, semi > {}; + struct enum_field : seq< ident, sps, equ, sps, enum_int, sps, opt_must< one< '[' >, sps, list_must< enum_value_option, comma, sp >, sps, one< ']' >, sps >, semi > {}; struct enum_body : if_must< one< '{' >, sps, star< sor< option, enum_field, semi >, sps >, one< '}' > > {}; struct enum_def : if_must< keyword< 'e', 'n', 'u', 'm' >, sps, enum_name, sps, enum_body > {}; diff --git a/packages/PEGTL/include/tao/pegtl/contrib/raw_string.hpp b/packages/PEGTL/include/tao/pegtl/contrib/raw_string.hpp index e24c578bcbbe4e7cc49181af95a9b465986bd79a..e7c5a332864b7b76ffe33e1df1176f6ca8752719 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/raw_string.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/raw_string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -115,7 +115,7 @@ namespace TAO_PEGTL_NAMESPACE typename... States > [[nodiscard]] static bool match( ParseInput& in, const std::size_t& marker_size, States&&... /*unused*/ ) { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, marker_size ) ) { if( in.empty() ) { @@ -143,7 +143,7 @@ namespace TAO_PEGTL_NAMESPACE typename... States > [[nodiscard]] static bool match( ParseInput& in, const std::size_t& marker_size, States&&... st ) { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); using m_t = decltype( m ); while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, marker_size ) ) { diff --git a/packages/PEGTL/include/tao/pegtl/contrib/remove_first_state.hpp b/packages/PEGTL/include/tao/pegtl/contrib/remove_first_state.hpp index 74384c63973b752330946ad98703b79aeea821a0..993d0fca019afca7734c7e5603a9781557b2df8f 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/remove_first_state.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/remove_first_state.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -53,8 +53,8 @@ namespace TAO_PEGTL_NAMESPACE Base::unwind( in, st... ); } - template< template< typename... > class Action, typename Iterator, typename ParseInput, typename State, typename... States > - static auto apply( const Iterator& begin, const ParseInput& in, State&& /*unused*/, States&&... st ) noexcept( noexcept( Base::template apply< Action >( begin, in, st... ) ) ) + template< template< typename... > class Action, typename Frobnicator, typename ParseInput, typename State, typename... States > + static auto apply( const Frobnicator& begin, const ParseInput& in, State&& /*unused*/, States&&... st ) noexcept( noexcept( Base::template apply< Action >( begin, in, st... ) ) ) -> decltype( Base::template apply< Action >( begin, in, st... ) ) { return Base::template apply< Action >( begin, in, st... ); diff --git a/packages/PEGTL/include/tao/pegtl/contrib/remove_last_states.hpp b/packages/PEGTL/include/tao/pegtl/contrib/remove_last_states.hpp index 5a4d67ecc2bf9481cc3a81e27ce7fe8328826662..78a2fa68e06a603e9224bc5ce223e58bc6762780 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/remove_last_states.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/remove_last_states.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -85,15 +85,15 @@ namespace TAO_PEGTL_NAMESPACE unwind_impl( in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) - N >() ); } - template< template< typename... > class Action, typename Iterator, typename ParseInput, typename Tuple, std::size_t... Is > - static auto apply_impl( const Iterator& begin, const ParseInput& in, const Tuple& t, std::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( Base::template apply< Action >( begin, in, std::get< Is >( t )... ) ) ) + template< template< typename... > class Action, typename Frobnicator, typename ParseInput, typename Tuple, std::size_t... Is > + static auto apply_impl( const Frobnicator& begin, const ParseInput& in, const Tuple& t, std::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( Base::template apply< Action >( begin, in, std::get< Is >( t )... ) ) ) -> decltype( Base::template apply< Action >( begin, in, std::get< Is >( t )... ) ) { return Base::template apply< Action >( begin, in, std::get< Is >( t )... ); } - template< template< typename... > class Action, typename Iterator, typename ParseInput, typename... States > - static auto apply( const Iterator& begin, const ParseInput& in, States&&... st ) noexcept( noexcept( apply_impl< Action >( begin, in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) - N >() ) ) ) + template< template< typename... > class Action, typename Frobnicator, typename ParseInput, typename... States > + static auto apply( const Frobnicator& begin, const ParseInput& in, States&&... st ) noexcept( noexcept( apply_impl< Action >( begin, in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) - N >() ) ) ) -> decltype( apply_impl< Action >( begin, in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) - N >() ) ) { return apply_impl< Action >( begin, in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) - N >() ); diff --git a/packages/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp b/packages/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp index 785e46f98004242ba1202424ce5d733b931e9055..bb9ed76cc34251bf0437e7999e5d505efb1273bc 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/rep_one_min_max.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -30,8 +30,16 @@ namespace TAO_PEGTL_NAMESPACE static_assert( Min <= Max ); - template< int Eol > - static constexpr bool can_match_eol = ( C == Eol ); + [[nodiscard]] static constexpr bool test_one( const char c ) noexcept + { + static_assert( ( Min == 1 ) && ( Max == 1 ) ); + return C == c; + } + + [[nodiscard]] static constexpr bool test_any( const char c ) noexcept + { + return C == c; + } template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) @@ -58,8 +66,10 @@ namespace TAO_PEGTL_NAMESPACE using rule_t = rep_one_min_max; using subs_t = empty_list; - template< int Eol > - static constexpr bool can_match_eol = ( C == Eol ); + [[nodiscard]] static constexpr bool test_any( const char c ) noexcept + { + return C == c; + } template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/rep_string.hpp b/packages/PEGTL/include/tao/pegtl/contrib/rep_string.hpp index b42061667f759180af7dba159877423a3f226421..5aa9e22d556a9a1cb065a54dd9f65c2bf6b8f6d2 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/rep_string.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/rep_string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,6 +8,7 @@ #include <cstddef> #include "../config.hpp" + #include "../internal/string.hpp" namespace TAO_PEGTL_NAMESPACE diff --git a/packages/PEGTL/include/tao/pegtl/contrib/separated_seq.hpp b/packages/PEGTL/include/tao/pegtl/contrib/separated_seq.hpp index 26aac6ab4e5ca78977ce19ba8de23a5224a11451..f7f9dfd93cd1f9c397907bc49bde69acb95b84ee 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/separated_seq.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/separated_seq.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,7 +6,6 @@ #define TAO_PEGTL_CONTRIB_SEPARATED_SEQ_HPP #include "../config.hpp" - #include "../internal/seq.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/shuffle_states.hpp b/packages/PEGTL/include/tao/pegtl/contrib/shuffle_states.hpp index 8cc969048b756db43f1d7059ade41a8dd1303167..ad3d2fa7cb28f5bd90f3fd6a5691e63d04fbdf9d 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/shuffle_states.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/shuffle_states.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -137,22 +137,22 @@ namespace TAO_PEGTL_NAMESPACE Base::unwind( in, st ); } - template< template< typename... > class Action, typename Iterator, typename ParseInput, typename Tuple, std::size_t... Is > - static auto apply_impl( const Iterator& begin, const ParseInput& in, const Tuple& t, std::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( Base::template apply< Action >( begin, in, std::get< Shuffle::template value< Is, sizeof...( Is ) > >( t )... ) ) ) + template< template< typename... > class Action, typename Frobnicator, typename ParseInput, typename Tuple, std::size_t... Is > + static auto apply_impl( const Frobnicator& begin, const ParseInput& in, const Tuple& t, std::index_sequence< Is... > /*unused*/ ) noexcept( noexcept( Base::template apply< Action >( begin, in, std::get< Shuffle::template value< Is, sizeof...( Is ) > >( t )... ) ) ) -> decltype( Base::template apply< Action >( begin, in, std::get< Shuffle::template value< Is, sizeof...( Is ) > >( t )... ) ) { return Base::template apply< Action >( begin, in, std::get< Shuffle::template value< Is, sizeof...( Is ) > >( t )... ); } - template< template< typename... > class Action, typename Iterator, typename ParseInput, typename... States > - static auto apply( const Iterator& begin, const ParseInput& in, States&&... st ) noexcept( noexcept( apply_impl< Action >( begin, in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) >() ) ) ) + template< template< typename... > class Action, typename Frobnicator, typename ParseInput, typename... States > + static auto apply( const Frobnicator& begin, const ParseInput& in, States&&... st ) noexcept( noexcept( apply_impl< Action >( begin, in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) >() ) ) ) -> decltype( apply_impl< Action >( begin, in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) >() ) ) { return apply_impl< Action >( begin, in, std::tie( st... ), std::make_index_sequence< sizeof...( st ) >() ); } - template< template< typename... > class Action, typename Iterator, typename ParseInput, typename State > - static auto apply( const Iterator& begin, const ParseInput& in, State&& st ) noexcept( noexcept( Base::template apply< Action >( begin, in, st ) ) ) + template< template< typename... > class Action, typename Frobnicator, typename ParseInput, typename State > + static auto apply( const Frobnicator& begin, const ParseInput& in, State&& st ) noexcept( noexcept( Base::template apply< Action >( begin, in, st ) ) ) -> decltype( Base::template apply< Action >( begin, in, st ) ) { return Base::template apply< Action >( begin, in, st ); diff --git a/packages/PEGTL/include/tao/pegtl/contrib/state_control.hpp b/packages/PEGTL/include/tao/pegtl/contrib/state_control.hpp index a65a61b057b96a001777f60cd2c1227e922d7435..8041efdf81b97f6eefd9699c3369ddaa0765568c 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/state_control.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/state_control.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,11 +7,12 @@ #include <type_traits> -#include "shuffle_states.hpp" - #include "../config.hpp" + #include "../internal/has_unwind.hpp" +#include "shuffle_states.hpp" + namespace TAO_PEGTL_NAMESPACE { template< template< typename... > class Control > @@ -93,8 +94,8 @@ namespace TAO_PEGTL_NAMESPACE #endif } - template< template< typename... > class Action, typename Iterator, typename ParseInput, typename State, typename... States > - static auto apply( const Iterator& begin, const ParseInput& in, [[maybe_unused]] State& state, States&&... st ) + template< template< typename... > class Action, typename Frobnicator, typename ParseInput, typename State, typename... States > + static auto apply( const Frobnicator& begin, const ParseInput& in, [[maybe_unused]] State& state, States&&... st ) -> decltype( Control< Rule >::template apply< Action >( begin, in, st... ) ) { if constexpr( State::template enable< Rule > ) { diff --git a/packages/PEGTL/include/tao/pegtl/contrib/to_string.hpp b/packages/PEGTL/include/tao/pegtl/contrib/to_string.hpp index 1075e897efe9512e53245ea9ace873e5fad48c31..7325dfc853bb744441abe87944acec002e213bed 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/to_string.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/to_string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/trace.hpp b/packages/PEGTL/include/tao/pegtl/contrib/trace.hpp index 751ceb50a341b597bc8d2b266c014a505db82b19..67a8804248ae96075aacf5117bc52f2c8c5f8a3a 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/trace.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/trace.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -23,7 +23,11 @@ namespace TAO_PEGTL_NAMESPACE { - template< bool HideInternal = false, bool UseColor = true, std::size_t IndentIncrement = 2, std::size_t InitialIndent = 8 > + template< bool HideInternal = true, + bool UseColor = true, + bool PrintSourceLine = false, + std::size_t IndentIncrement = 2, + std::size_t InitialIndent = 8 > struct tracer_traits { template< typename Rule > @@ -32,6 +36,8 @@ namespace TAO_PEGTL_NAMESPACE static constexpr std::size_t initial_indent = InitialIndent; static constexpr std::size_t indent_increment = IndentIncrement; + static constexpr bool print_source_line = PrintSourceLine; + static constexpr std::string_view ansi_reset = UseColor ? "\033[m" : ""; static constexpr std::string_view ansi_rule = UseColor ? "\033[36m" : ""; static constexpr std::string_view ansi_hide = UseColor ? "\033[37m" : ""; @@ -64,7 +70,7 @@ namespace TAO_PEGTL_NAMESPACE m_position( in.position() ) { std::cerr << std::left; - print_position(); + print_position( in ); } tracer( const tracer& ) = delete; @@ -83,16 +89,23 @@ namespace TAO_PEGTL_NAMESPACE return TracerTraits::initial_indent + TracerTraits::indent_increment * m_stack.size(); } - void print_position() const + template< typename ParseInput > + void print_position( [[maybe_unused]] const ParseInput& in ) const { std::cerr << std::setw( indent() ) << ' ' << TracerTraits::ansi_position << "position" << TracerTraits::ansi_reset << ' ' << m_position << '\n'; + if constexpr( TracerTraits::print_source_line ) { + std::cerr << std::setw( indent() ) << ' ' << TracerTraits::ansi_position << "source" << TracerTraits::ansi_reset << ' ' << in.line_at( m_position ) << '\n'; + std::cerr << std::setw( indent() + 6 + m_position.column ) << ' ' << "^\n"; + } } - void update_position( const position& p ) + template< typename ParseInput > + void update_position( const ParseInput& in ) { + const auto p = in.position(); if( m_position != p ) { m_position = p; - print_position(); + print_position( in ); } } @@ -113,7 +126,7 @@ namespace TAO_PEGTL_NAMESPACE std::cerr << " #" << prev << ' ' << TracerTraits::ansi_hide << demangle< Rule >() << TracerTraits::ansi_reset; } std::cerr << '\n'; - update_position( in.position() ); + update_position( in ); } template< typename Rule, typename ParseInput, typename... States > @@ -126,7 +139,7 @@ namespace TAO_PEGTL_NAMESPACE std::cerr << " #" << prev << ' ' << TracerTraits::ansi_hide << demangle< Rule >() << TracerTraits::ansi_reset; } std::cerr << '\n'; - update_position( in.position() ); + update_position( in ); } template< typename Rule, typename ParseInput, typename... States > @@ -145,7 +158,7 @@ namespace TAO_PEGTL_NAMESPACE std::cerr << " #" << prev << ' ' << TracerTraits::ansi_hide << demangle< Rule >() << TracerTraits::ansi_reset; } std::cerr << '\n'; - update_position( in.position() ); + update_position( in ); } template< typename Rule, typename ParseInput, typename... States > diff --git a/packages/PEGTL/include/tao/pegtl/contrib/uint16.hpp b/packages/PEGTL/include/tao/pegtl/contrib/uint16.hpp index 1f7532861aa9c65b5a5e4570db86c0cc8f85f4a7..412686236b9de4a6aafba949d406aed47b4db0bc 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/uint16.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/uint16.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #define TAO_PEGTL_CONTRIB_UINT16_HPP #include "../config.hpp" + #include "../internal/result_on_found.hpp" #include "../internal/rules.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/uint32.hpp b/packages/PEGTL/include/tao/pegtl/contrib/uint32.hpp index 8bd88045bfa85c69a3dab544ecfc562f5201819d..05dfa6f6c33205c8e4867956e346ee8ff8c9e6e4 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/uint32.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/uint32.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #define TAO_PEGTL_CONTRIB_UINT32_HPP #include "../config.hpp" + #include "../internal/result_on_found.hpp" #include "../internal/rules.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/uint64.hpp b/packages/PEGTL/include/tao/pegtl/contrib/uint64.hpp index 366c9f4a6e95b7547f21d207495bdd19cb5c7a07..e1cdb864e59271daf22debf34754ba420cd343ad 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/uint64.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/uint64.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #define TAO_PEGTL_CONTRIB_UINT64_HPP #include "../config.hpp" + #include "../internal/result_on_found.hpp" #include "../internal/rules.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/uint8.hpp b/packages/PEGTL/include/tao/pegtl/contrib/uint8.hpp index a5b325a298cea15ddac33de276364a14ae48c10b..1b0a7c5f58c84fec131210b9a46c9bddb0e4064e 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/uint8.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/uint8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #define TAO_PEGTL_CONTRIB_UINT8_HPP #include "../config.hpp" + #include "../internal/result_on_found.hpp" #include "../internal/rules.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/unescape.hpp b/packages/PEGTL/include/tao/pegtl/contrib/unescape.hpp index 7fb0c081ba054bce64d0d3fcd3ba3a7019f94b87..7ced90f6d81f6c4dd128d0d6e86a362fb818c84d 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/unescape.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/unescape.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -20,12 +20,12 @@ namespace TAO_PEGTL_NAMESPACE::unescape [[nodiscard]] inline bool utf8_append_utf32( std::string& string, const unsigned utf32 ) { if( utf32 <= 0x7f ) { - string += char( utf32 & 0xff ); + string += static_cast< char >( utf32 & 0xff ); return true; } if( utf32 <= 0x7ff ) { - char tmp[] = { char( ( ( utf32 & 0x7c0 ) >> 6 ) | 0xc0 ), - char( ( ( utf32 & 0x03f ) ) | 0x80 ) }; + char tmp[] = { static_cast< char >( ( ( utf32 & 0x7c0 ) >> 6 ) | 0xc0 ), + static_cast< char >( ( ( utf32 & 0x03f ) ) | 0x80 ) }; string.append( tmp, sizeof( tmp ) ); return true; } @@ -34,17 +34,17 @@ namespace TAO_PEGTL_NAMESPACE::unescape // nope, this is a UTF-16 surrogate return false; } - char tmp[] = { char( ( ( utf32 & 0xf000 ) >> 12 ) | 0xe0 ), - char( ( ( utf32 & 0x0fc0 ) >> 6 ) | 0x80 ), - char( ( ( utf32 & 0x003f ) ) | 0x80 ) }; + char tmp[] = { static_cast< char >( ( ( utf32 & 0xf000 ) >> 12 ) | 0xe0 ), + static_cast< char >( ( ( utf32 & 0x0fc0 ) >> 6 ) | 0x80 ), + static_cast< char >( ( ( utf32 & 0x003f ) ) | 0x80 ) }; string.append( tmp, sizeof( tmp ) ); return true; } if( utf32 <= 0x10ffff ) { - char tmp[] = { char( ( ( utf32 & 0x1c0000 ) >> 18 ) | 0xf0 ), - char( ( ( utf32 & 0x03f000 ) >> 12 ) | 0x80 ), - char( ( ( utf32 & 0x000fc0 ) >> 6 ) | 0x80 ), - char( ( ( utf32 & 0x00003f ) ) | 0x80 ) }; + char tmp[] = { static_cast< char >( ( ( utf32 & 0x1c0000 ) >> 18 ) | 0xf0 ), + static_cast< char >( ( ( utf32 & 0x03f000 ) >> 12 ) | 0x80 ), + static_cast< char >( ( ( utf32 & 0x000fc0 ) >> 6 ) | 0x80 ), + static_cast< char >( ( ( utf32 & 0x00003f ) ) | 0x80 ) }; string.append( tmp, sizeof( tmp ) ); return true; } diff --git a/packages/PEGTL/include/tao/pegtl/contrib/uri.hpp b/packages/PEGTL/include/tao/pegtl/contrib/uri.hpp index b019a7b36bb06e259cacf2016f2cddc8138a55e3..1306251507fd2691138c00277000c75feab5f5b3 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/uri.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/uri.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/contrib/utf16.hpp b/packages/PEGTL/include/tao/pegtl/contrib/utf16.hpp index 74915e16d44c3ca310e3717a894762dbe54d659b..dabac9f703adb2bfb3a2e83c19e7ed971e479400 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/utf16.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/utf16.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #define TAO_PEGTL_CONTRIB_UTF16_HPP #include "../config.hpp" + #include "../internal/result_on_found.hpp" #include "../internal/rules.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/contrib/utf32.hpp b/packages/PEGTL/include/tao/pegtl/contrib/utf32.hpp index 1201fca885e907e8fd2011ef6d48e20248ad5662..84f3cb04bf15d0ecac736c89bdf6c0e6f8a4ab6f 100644 --- a/packages/PEGTL/include/tao/pegtl/contrib/utf32.hpp +++ b/packages/PEGTL/include/tao/pegtl/contrib/utf32.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #define TAO_PEGTL_CONTRIB_UTF32_HPP #include "../config.hpp" + #include "../internal/result_on_found.hpp" #include "../internal/rules.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/cstream_input.hpp b/packages/PEGTL/include/tao/pegtl/cstream_input.hpp index c589912261a99aeee6d9983c20be89f6a034b5d9..6e003ddb3233de7c1ae35ee92316da270022f80d 100644 --- a/packages/PEGTL/include/tao/pegtl/cstream_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/cstream_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/demangle.hpp b/packages/PEGTL/include/tao/pegtl/demangle.hpp index 97b2606528390d15f53152cb235056ce2aa02c76..aa62100d0572a2048f858c5f71b36a6e26a20425 100644 --- a/packages/PEGTL/include/tao/pegtl/demangle.hpp +++ b/packages/PEGTL/include/tao/pegtl/demangle.hpp @@ -1,35 +1,42 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_DEMANGLE_HPP #define TAO_PEGTL_DEMANGLE_HPP -#include <ciso646> #include <string_view> #include "config.hpp" namespace TAO_PEGTL_NAMESPACE { + // ensure a consistent interface + template< typename T > + [[nodiscard]] constexpr std::string_view demangle() noexcept; + +} // namespace TAO_PEGTL_NAMESPACE + #if defined( __clang__ ) #if defined( _LIBCPP_VERSION ) - template< typename T > - [[nodiscard]] constexpr std::string_view demangle() noexcept - { - constexpr std::string_view sv = __PRETTY_FUNCTION__; - constexpr auto begin = sv.find( '=' ); - static_assert( begin != std::string_view::npos ); - return sv.substr( begin + 2, sv.size() - begin - 3 ); - } +template< typename T > +[[nodiscard]] constexpr std::string_view TAO_PEGTL_NAMESPACE::demangle() noexcept +{ + constexpr std::string_view sv = __PRETTY_FUNCTION__; + constexpr auto begin = sv.find( '=' ); + static_assert( begin != std::string_view::npos ); + return sv.substr( begin + 2, sv.size() - begin - 3 ); +} #else +namespace TAO_PEGTL_NAMESPACE::internal +{ // When using libstdc++ with clang, std::string_view::find is not constexpr :( template< char C > - constexpr const char* find( const char* p, std::size_t n ) noexcept + constexpr const char* string_view_find( const char* p, std::size_t n ) noexcept { while( n ) { if( *p == C ) { @@ -41,46 +48,44 @@ namespace TAO_PEGTL_NAMESPACE return nullptr; } - template< typename T > - [[nodiscard]] constexpr std::string_view demangle() noexcept - { - constexpr std::string_view sv = __PRETTY_FUNCTION__; - constexpr auto begin = find< '=' >( sv.data(), sv.size() ); - static_assert( begin != nullptr ); - return { begin + 2, sv.data() + sv.size() - begin - 3 }; - } +} // namespace TAO_PEGTL_NAMESPACE::internal + +template< typename T > +[[nodiscard]] constexpr std::string_view TAO_PEGTL_NAMESPACE::demangle() noexcept +{ + constexpr std::string_view sv = __PRETTY_FUNCTION__; + constexpr auto begin = internal::string_view_find< '=' >( sv.data(), sv.size() ); + static_assert( begin != nullptr ); + return { begin + 2, sv.data() + sv.size() - begin - 3 }; +} #endif #elif defined( __GNUC__ ) -#if( __GNUC__ == 7 ) +#if( __GNUC__ == 9 ) && ( __GNUC_MINOR__ < 3 ) - // GCC 7 wrongly sometimes disallows __PRETTY_FUNCTION__ in constexpr functions, - // therefore we drop the 'constexpr' and hope for the best. - template< typename T > - [[nodiscard]] std::string_view demangle() noexcept - { - const std::string_view sv = __PRETTY_FUNCTION__; - const auto begin = sv.find( '=' ); - const auto tmp = sv.substr( begin + 2 ); - const auto end = tmp.rfind( ';' ); - return tmp.substr( 0, end ); - } +#if !defined( __cpp_rtti ) +#error "RTTI support required for GCC 9.1/9.2" +#else -#elif( __GNUC__ == 9 ) && ( __GNUC_MINOR__ < 3 ) +#include <typeinfo> - // GCC 9.1 and 9.2 have a bug that leads to truncated __PRETTY_FUNCTION__ names, - // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91155 - template< typename T > - [[nodiscard]] constexpr std::string_view demangle() noexcept - { - // fallback: requires RTTI, no demangling - return typeid( T ).name(); - } +// GCC 9.1 and 9.2 have a bug that leads to truncated __PRETTY_FUNCTION__ names, +// see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91155 +template< typename T > +[[nodiscard]] constexpr std::string_view TAO_PEGTL_NAMESPACE::demangle() noexcept +{ + // fallback: requires RTTI, no demangling + return typeid( T ).name(); +} + +#endif #else +namespace TAO_PEGTL_NAMESPACE::special +{ template< typename T > [[nodiscard]] constexpr std::string_view demangle() noexcept { @@ -93,49 +98,47 @@ namespace TAO_PEGTL_NAMESPACE return tmp.substr( 0, end ); } +} // namespace TAO_PEGTL_NAMESPACE::special + +template< typename T > +[[nodiscard]] constexpr std::string_view TAO_PEGTL_NAMESPACE::demangle() noexcept +{ + return TAO_PEGTL_NAMESPACE::special::demangle< T >(); +} + #endif #elif defined( _MSC_VER ) -#if( _MSC_VER < 1920 ) - - template< typename T > - [[nodiscard]] constexpr std::string_view demangle() noexcept - { - const std::string_view sv = __FUNCSIG__; - const auto begin = sv.find( "demangle<" ); - const auto tmp = sv.substr( begin + 9 ); - const auto end = tmp.rfind( '>' ); - return tmp.substr( 0, end ); - } +template< typename T > +[[nodiscard]] constexpr std::string_view TAO_PEGTL_NAMESPACE::demangle() noexcept +{ + // we can not add static_assert for additional safety, + // see issues #296, #301 and #308 + constexpr std::string_view sv = __FUNCSIG__; + constexpr auto begin = sv.find( "demangle<" ); + constexpr auto tmp = sv.substr( begin + 9 ); + constexpr auto end = tmp.rfind( '>' ); + return tmp.substr( 0, end ); +} #else - template< typename T > - [[nodiscard]] constexpr std::string_view demangle() noexcept - { - constexpr std::string_view sv = __FUNCSIG__; - constexpr auto begin = sv.find( "demangle<" ); - static_assert( begin != std::string_view::npos ); - constexpr auto tmp = sv.substr( begin + 9 ); - constexpr auto end = tmp.rfind( '>' ); - static_assert( end != std::string_view::npos ); - return tmp.substr( 0, end ); - } - -#endif - +#if !defined( __cpp_rtti ) +#error "RTTI support required for unknown compilers" #else - template< typename T > - [[nodiscard]] constexpr std::string_view demangle() noexcept - { - // fallback: requires RTTI, no demangling - return typeid( T ).name(); - } +#include <typeinfo> + +template< typename T > +[[nodiscard]] constexpr std::string_view TAO_PEGTL_NAMESPACE::demangle() noexcept +{ + // fallback: requires RTTI, no demangling + return typeid( T ).name(); +} #endif -} // namespace TAO_PEGTL_NAMESPACE +#endif #endif diff --git a/packages/PEGTL/include/tao/pegtl/disable_action.hpp b/packages/PEGTL/include/tao/pegtl/disable_action.hpp index 92bc2f4d3c0f5bc1c182a14b085729af580bab5f..d9ce99c149612d3f828370f79acb9372ec55fa87 100644 --- a/packages/PEGTL/include/tao/pegtl/disable_action.hpp +++ b/packages/PEGTL/include/tao/pegtl/disable_action.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/discard_input.hpp b/packages/PEGTL/include/tao/pegtl/discard_input.hpp index dec0a9af57f812850f981ad141487e01d2baf869..0cac8ecc6595c947643b856b71d87508bcbcc085 100644 --- a/packages/PEGTL/include/tao/pegtl/discard_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/discard_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/discard_input_on_failure.hpp b/packages/PEGTL/include/tao/pegtl/discard_input_on_failure.hpp index 305038e96b4d44663d71508d932e848e35ed92aa..12cea02e1da6b3577c955f55ed487bbde7b695d1 100644 --- a/packages/PEGTL/include/tao/pegtl/discard_input_on_failure.hpp +++ b/packages/PEGTL/include/tao/pegtl/discard_input_on_failure.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/discard_input_on_success.hpp b/packages/PEGTL/include/tao/pegtl/discard_input_on_success.hpp index c5beb7d91e56bb68ea4a533e913ea36899ccd309..0ed60d8bd3827c218e7ea915f9cfbff001df3147 100644 --- a/packages/PEGTL/include/tao/pegtl/discard_input_on_success.hpp +++ b/packages/PEGTL/include/tao/pegtl/discard_input_on_success.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/enable_action.hpp b/packages/PEGTL/include/tao/pegtl/enable_action.hpp index ae0c09983afdb813ce806793beeb24cec0989140..da41b1871abad372b41345b13dd29ed6fd4bc3ef 100644 --- a/packages/PEGTL/include/tao/pegtl/enable_action.hpp +++ b/packages/PEGTL/include/tao/pegtl/enable_action.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/eol.hpp b/packages/PEGTL/include/tao/pegtl/eol.hpp index c2df140e3edf028695f3be563f4942e075d09e4b..aaae30008aef5d274a9130fd5539387273cfa649 100644 --- a/packages/PEGTL/include/tao/pegtl/eol.hpp +++ b/packages/PEGTL/include/tao/pegtl/eol.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -19,8 +19,11 @@ namespace TAO_PEGTL_NAMESPACE { inline namespace ascii { - // this is both a rule and a pseudo-namespace for eol::cr, ... - struct eol : internal::eol + // Struct eol is both a rule and a pseudo-namespace for the + // member structs cr, etc. (which are not themselves rules). + + struct eol + : internal::eol { // clang-format off struct cr : internal::cr_eol {}; diff --git a/packages/PEGTL/include/tao/pegtl/eol_pair.hpp b/packages/PEGTL/include/tao/pegtl/eol_pair.hpp deleted file mode 100644 index b139d3bdccffb9726233a52cf65108a96a628525..0000000000000000000000000000000000000000 --- a/packages/PEGTL/include/tao/pegtl/eol_pair.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) - -#ifndef TAO_PEGTL_EOL_PAIR_HPP -#define TAO_PEGTL_EOL_PAIR_HPP - -#include <cstddef> -#include <utility> - -#include "config.hpp" - -namespace TAO_PEGTL_NAMESPACE -{ - using eol_pair = std::pair< bool, std::size_t >; - -} // namespace TAO_PEGTL_NAMESPACE - -#endif diff --git a/packages/PEGTL/include/tao/pegtl/file_input.hpp b/packages/PEGTL/include/tao/pegtl/file_input.hpp index 408b89fc0e2cbfdb62342c78d111e7ca5a475017..3eb4270565e8e2a95bcfabd80e7f2902f440368b 100644 --- a/packages/PEGTL/include/tao/pegtl/file_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/file_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/action.hpp b/packages/PEGTL/include/tao/pegtl/internal/action.hpp index 8068241e87b14c3a72419038c30b29fd7da7f820..b1c3b2d1d9daa12b5ee64b64c97e0900875ec960 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/action.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/action.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_ACTION_HPP #define TAO_PEGTL_INTERNAL_ACTION_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/action_input.hpp b/packages/PEGTL/include/tao/pegtl/internal/action_input.hpp index fa622fa326cf0e87d9b9dc3ce91dda531b753070..b371736845fcf3efb52a98851443e0312e001b26 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/action_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/action_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -10,7 +10,7 @@ #include <string> #include <string_view> -#include "iterator.hpp" +#include "frobnicator.hpp" #include "../config.hpp" #include "../position.hpp" @@ -22,9 +22,9 @@ namespace TAO_PEGTL_NAMESPACE::internal { public: using input_t = ParseInput; - using iterator_t = typename ParseInput::iterator_t; + using frobnicator_t = typename ParseInput::frobnicator_t; - action_input( const iterator_t& in_begin, const ParseInput& in_input ) noexcept + action_input( const frobnicator_t& in_begin, const ParseInput& in_input ) noexcept : m_begin( in_begin ), m_input( in_input ) {} @@ -37,7 +37,7 @@ namespace TAO_PEGTL_NAMESPACE::internal action_input& operator=( const action_input& ) = delete; action_input& operator=( action_input&& ) = delete; - [[nodiscard]] const iterator_t& iterator() const noexcept + [[nodiscard]] const frobnicator_t& frobnicator() const noexcept { return m_begin; } @@ -49,11 +49,11 @@ namespace TAO_PEGTL_NAMESPACE::internal [[nodiscard]] const char* begin() const noexcept { - if constexpr( std::is_same_v< iterator_t, const char* > ) { - return iterator(); + if constexpr( std::is_same_v< frobnicator_t, const char* > ) { + return frobnicator(); } else { - return iterator().data; + return frobnicator().data; } } @@ -94,11 +94,11 @@ namespace TAO_PEGTL_NAMESPACE::internal [[nodiscard]] TAO_PEGTL_NAMESPACE::position position() const { - return input().position( iterator() ); // NOTE: Not efficient with lazy inputs. + return input().position( frobnicator() ); // NOTE: Not efficient with lazy inputs. } protected: - const iterator_t m_begin; + const frobnicator_t m_begin; const ParseInput& m_input; }; diff --git a/packages/PEGTL/include/tao/pegtl/internal/any.hpp b/packages/PEGTL/include/tao/pegtl/internal/any.hpp index 9e710c5f876d154e3f78f4f631b6da419f9ed9b2..bc742d4d9bb63f1291b4c7fc6df3b315c91970e0 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/any.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/any.hpp @@ -1,15 +1,14 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_ANY_HPP #define TAO_PEGTL_INTERNAL_ANY_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "peek_char.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal @@ -26,7 +25,12 @@ namespace TAO_PEGTL_NAMESPACE::internal using rule_t = any; using subs_t = empty_list; - [[nodiscard]] static bool test( const char /*unused*/ ) noexcept + [[nodiscard]] static bool test_one( const char /*unused*/ ) noexcept + { + return true; + } + + [[nodiscard]] static bool test_any( const char /*unused*/ ) noexcept { return true; } @@ -51,10 +55,12 @@ namespace TAO_PEGTL_NAMESPACE::internal using rule_t = any; using subs_t = empty_list; - template< int Eol > - static constexpr bool can_match_eol = true; + [[nodiscard]] static bool test_one( const data_t /*unused*/ ) noexcept + { + return true; + } - [[nodiscard]] static bool test( const data_t /*unused*/ ) noexcept + [[nodiscard]] static bool test_any( const data_t /*unused*/ ) noexcept { return true; } diff --git a/packages/PEGTL/include/tao/pegtl/internal/apply.hpp b/packages/PEGTL/include/tao/pegtl/internal/apply.hpp index 97a342b86a45a096fa90a50af91113c698a9a39a..e83ba91141a4b6c8701ff0c7d743ae3a49186bf6 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/apply.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/apply.hpp @@ -1,16 +1,15 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_APPLY_HPP #define TAO_PEGTL_INTERNAL_APPLY_HPP -#include "../config.hpp" - #include "apply_single.hpp" #include "enable_control.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -34,7 +33,7 @@ namespace TAO_PEGTL_NAMESPACE::internal { if constexpr( ( A == apply_mode::action ) && ( sizeof...( Actions ) > 0 ) ) { using action_t = typename ParseInput::action_t; - const action_t i2( in.iterator(), in ); // No data -- range is from begin to begin. + const action_t i2( in.frobnicator(), in ); // No data -- range is from begin to begin. return ( apply_single< Actions >::match( i2, st... ) && ... ); } else { diff --git a/packages/PEGTL/include/tao/pegtl/internal/apply0.hpp b/packages/PEGTL/include/tao/pegtl/internal/apply0.hpp index 2710de8e8ab89eea8b357b7de28f4e0dcd8b20d4..1d05592553a273f3858f057da34fe3387102d53e 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/apply0.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/apply0.hpp @@ -1,16 +1,15 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_APPLY0_HPP #define TAO_PEGTL_INTERNAL_APPLY0_HPP -#include "../config.hpp" - #include "apply0_single.hpp" #include "enable_control.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/apply0_single.hpp b/packages/PEGTL/include/tao/pegtl/internal/apply0_single.hpp index 167031924635e65c26d8a67093556fc4e33f67b5..2ecf4edb3cefee047f7f21d1a83ff1db9ac18c28 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/apply0_single.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/apply0_single.hpp @@ -1,14 +1,14 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_APPLY0_SINGLE_HPP #define TAO_PEGTL_INTERNAL_APPLY0_SINGLE_HPP -#include "../config.hpp" - #include <type_traits> +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< typename Action > diff --git a/packages/PEGTL/include/tao/pegtl/internal/apply_single.hpp b/packages/PEGTL/include/tao/pegtl/internal/apply_single.hpp index 728ad4772e6d85a23f9f3d47bdde272543472b45..44c63059236f84e12a9693cd56c489a38a3b2405 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/apply_single.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/apply_single.hpp @@ -1,14 +1,14 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_APPLY_SINGLE_HPP #define TAO_PEGTL_INTERNAL_APPLY_SINGLE_HPP -#include "../config.hpp" - #include <type_traits> +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< typename Action > diff --git a/packages/PEGTL/include/tao/pegtl/internal/at.hpp b/packages/PEGTL/include/tao/pegtl/internal/at.hpp index 117b5a429d943d5c224e4afcb3254c266bb600a5..a28ba39919adb60fe621af974867bc54cb56f2a0 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/at.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/at.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_AT_HPP #define TAO_PEGTL_INTERNAL_AT_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -43,7 +42,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - const auto m = in.template mark< rewind_mode::required >(); + const auto m = in.template auto_rewind< rewind_mode::required >(); return Control< Rule >::template match< apply_mode::nothing, rewind_mode::active, Action, Control >( in, st... ); } }; diff --git a/packages/PEGTL/include/tao/pegtl/internal/bof.hpp b/packages/PEGTL/include/tao/pegtl/internal/bof.hpp index 7038d953f77dd727003bcd7d3e526f9d74b0e9e8..4bf5751ec04f193c9d89cd6466015e534703184e 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/bof.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/bof.hpp @@ -1,14 +1,13 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_BOF_HPP #define TAO_PEGTL_INTERNAL_BOF_HPP -#include "../config.hpp" - #include "enable_control.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/bol.hpp b/packages/PEGTL/include/tao/pegtl/internal/bol.hpp index 759a8bd01cf91665908301f5a25ad4365ce1c094..32ed3be87d0069b922d515995fdb86f567e1f95b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/bol.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/bol.hpp @@ -1,15 +1,15 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_BOL_HPP #define TAO_PEGTL_INTERNAL_BOL_HPP +#include "enable_control.hpp" + #include "../config.hpp" #include "../type_list.hpp" -#include "enable_control.hpp" - namespace TAO_PEGTL_NAMESPACE::internal { struct bol diff --git a/packages/PEGTL/include/tao/pegtl/internal/bump.hpp b/packages/PEGTL/include/tao/pegtl/internal/bump.hpp index 1b305f3a2f65187c05c38f16c662e81cec364d8d..5ec599124b8c2211eae0d121238ce90ee9c48469 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/bump.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/bump.hpp @@ -1,17 +1,17 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_BUMP_HPP #define TAO_PEGTL_INTERNAL_BUMP_HPP -#include "../config.hpp" +#include "frobnicator.hpp" -#include "iterator.hpp" +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { - inline void bump( iterator& iter, const std::size_t count, const int ch ) noexcept + inline void bump( frobnicator& iter, const std::size_t count, const int ch ) noexcept { for( std::size_t i = 0; i < count; ++i ) { if( iter.data[ i ] == ch ) { @@ -26,14 +26,14 @@ namespace TAO_PEGTL_NAMESPACE::internal iter.data += count; } - inline void bump_in_this_line( iterator& iter, const std::size_t count ) noexcept + inline void bump_in_this_line( frobnicator& iter, const std::size_t count ) noexcept { iter.data += count; iter.byte += count; iter.column += count; } - inline void bump_to_next_line( iterator& iter, const std::size_t count ) noexcept + inline void bump_to_next_line( frobnicator& iter, const std::size_t count ) noexcept { ++iter.line; iter.byte += count; diff --git a/packages/PEGTL/include/tao/pegtl/internal/bump_help.hpp b/packages/PEGTL/include/tao/pegtl/internal/bump_help.hpp index f40c6171cb97390956532ea7ae67b92decb3241b..d39df08805fcce063a0e9d5610b842144be4a3c2 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/bump_help.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/bump_help.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -14,7 +14,7 @@ namespace TAO_PEGTL_NAMESPACE::internal template< typename Rule, typename ParseInput > void bump_help( ParseInput& in, const std::size_t count ) { - if constexpr( Rule::template can_match_eol< ParseInput::eol_t::ch > ) { + if constexpr( Rule::test_any( ParseInput::eol_t::ch ) ) { in.bump( count ); } else { diff --git a/packages/PEGTL/include/tao/pegtl/internal/bytes.hpp b/packages/PEGTL/include/tao/pegtl/internal/bytes.hpp index 2012f05c74c340ec6084d0855aae830d53b49a9f..b192d4d8aba2187b3f917ea1914fcd5cbad3d6a1 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/bytes.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/bytes.hpp @@ -1,15 +1,14 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_BYTES_HPP #define TAO_PEGTL_INTERNAL_BYTES_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "success.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/control.hpp b/packages/PEGTL/include/tao/pegtl/internal/control.hpp index a202f5d43922327f9ac482f42a443ccb3fe776aa..e0b9aa54cb885204188ecb9f50651e2b05bb3fd7 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/control.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/control.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_CONTROL_HPP #define TAO_PEGTL_INTERNAL_CONTROL_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/cr_crlf_eol.hpp b/packages/PEGTL/include/tao/pegtl/internal/cr_crlf_eol.hpp index cf2e72ec8a74b11f8b89526b1d861233b4b6b137..00723690b87c77b7888f5c931cf33f627ee92443 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/cr_crlf_eol.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/cr_crlf_eol.hpp @@ -1,12 +1,13 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_CR_CRLF_EOL_HPP #define TAO_PEGTL_INTERNAL_CR_CRLF_EOL_HPP +#include "data_and_size.hpp" + #include "../config.hpp" -#include "../eol_pair.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -15,13 +16,13 @@ namespace TAO_PEGTL_NAMESPACE::internal static constexpr int ch = '\r'; template< typename ParseInput > - [[nodiscard]] static eol_pair match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) ) + [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) ) { - eol_pair p = { false, in.size( 2 ) }; - if( p.second ) { + bool_and_size p = { false, in.size( 2 ) }; + if( p.size > 0 ) { if( in.peek_char() == '\r' ) { - in.bump_to_next_line( 1 + ( ( p.second > 1 ) && ( in.peek_char( 1 ) == '\n' ) ) ); - p.first = true; + in.bump_to_next_line( ( p.size = 1 + ( ( p.size > 1 ) && ( in.peek_char( 1 ) == '\n' ) ) ) ); + p.data = true; } } return p; diff --git a/packages/PEGTL/include/tao/pegtl/internal/cr_eol.hpp b/packages/PEGTL/include/tao/pegtl/internal/cr_eol.hpp index 5d1a61951134c91904c87bb09d3cfbd9925872f5..0c42ba00638dd93bbc6c59a918d914aff9ae46e4 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/cr_eol.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/cr_eol.hpp @@ -1,12 +1,13 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_CR_EOL_HPP #define TAO_PEGTL_INTERNAL_CR_EOL_HPP +#include "data_and_size.hpp" + #include "../config.hpp" -#include "../eol_pair.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -15,13 +16,13 @@ namespace TAO_PEGTL_NAMESPACE::internal static constexpr int ch = '\r'; template< typename ParseInput > - [[nodiscard]] static eol_pair match( ParseInput& in ) noexcept( noexcept( in.size( 1 ) ) ) + [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 1 ) ) ) { - eol_pair p = { false, in.size( 1 ) }; - if( p.second ) { + bool_and_size p = { false, in.size( 1 ) }; + if( p.size > 0 ) { if( in.peek_char() == '\r' ) { in.bump_to_next_line(); - p.first = true; + p.data = true; } } return p; diff --git a/packages/PEGTL/include/tao/pegtl/internal/crlf_eol.hpp b/packages/PEGTL/include/tao/pegtl/internal/crlf_eol.hpp index f419a6f483ec64097884988a33ebd04240d14c0c..c8ea1aa9c0a15ec46b4ac5578bdc2b5b0138f05b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/crlf_eol.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/crlf_eol.hpp @@ -1,12 +1,13 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_CRLF_EOL_HPP #define TAO_PEGTL_INTERNAL_CRLF_EOL_HPP +#include "data_and_size.hpp" + #include "../config.hpp" -#include "../eol_pair.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -15,13 +16,13 @@ namespace TAO_PEGTL_NAMESPACE::internal static constexpr int ch = '\n'; template< typename ParseInput > - [[nodiscard]] static eol_pair match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) ) + [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) ) { - eol_pair p = { false, in.size( 2 ) }; - if( p.second > 1 ) { + bool_and_size p = { false, in.size( 2 ) }; + if( p.size > 1 ) { if( ( in.peek_char() == '\r' ) && ( in.peek_char( 1 ) == '\n' ) ) { in.bump_to_next_line( 2 ); - p.first = true; + p.data = true; } } return p; diff --git a/packages/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp b/packages/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp index 0dc630539a2d9a0b066986635627a29197b827d1..ace1a07bba5dcf1ca6d5c8103ed8f28839434353 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/cstream_reader.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/cstring_reader.hpp b/packages/PEGTL/include/tao/pegtl/internal/cstring_reader.hpp index 4c3b10e7496daccf5c75781f3b76f1c3f52b1905..4a680cd921e72707e311eab87fcdb8f7b87ec04d 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/cstring_reader.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/cstring_reader.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/input_pair.hpp b/packages/PEGTL/include/tao/pegtl/internal/data_and_size.hpp similarity index 55% rename from packages/PEGTL/include/tao/pegtl/internal/input_pair.hpp rename to packages/PEGTL/include/tao/pegtl/internal/data_and_size.hpp index 423375c23f311ca3269a725280b8204b0a2484ac..ee1cdfb6411e6cf5298cc89d3e3cd73f1f2c2760 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/input_pair.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/data_and_size.hpp @@ -1,30 +1,32 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) -#ifndef TAO_PEGTL_INTERNAL_INPUT_PAIR_HPP -#define TAO_PEGTL_INTERNAL_INPUT_PAIR_HPP +#ifndef TAO_PEGTL_INTERNAL_DATA_AND_SIZE_HPP +#define TAO_PEGTL_INTERNAL_DATA_AND_SIZE_HPP -#include <cstdint> +#include <cstddef> #include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { template< typename Data > - struct input_pair + struct data_and_size { Data data; - std::uint8_t size; + std::size_t size; using data_t = Data; - explicit operator bool() const noexcept + [[nodiscard]] explicit operator bool() const noexcept { return size > 0; } }; + using bool_and_size = data_and_size< bool >; + } // namespace TAO_PEGTL_NAMESPACE::internal #endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/dependent_false.hpp b/packages/PEGTL/include/tao/pegtl/internal/dependent_false.hpp index a5cc470a3a6cdb78b7f8f08d15ff39de33fbfa68..a96e5bcb24ff48eb9d43f10597700046dfb0dbb6 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/dependent_false.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/dependent_false.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/disable.hpp b/packages/PEGTL/include/tao/pegtl/internal/disable.hpp index 76bdc5a8e1c0cbb0c6903c8bf25dc830856bd24c..5c35ee264939c7967d1866236a14416edfeb505e 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/disable.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/disable.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_DISABLE_HPP #define TAO_PEGTL_INTERNAL_DISABLE_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/discard.hpp b/packages/PEGTL/include/tao/pegtl/internal/discard.hpp index bea7aa3f2dace46471fcc4be7e683f7c22db1c36..fb609248e2d90fef8e1effa9633887d23a7210c0 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/discard.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/discard.hpp @@ -1,14 +1,13 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_DISCARD_HPP #define TAO_PEGTL_INTERNAL_DISCARD_HPP -#include "../config.hpp" - #include "enable_control.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/enable.hpp b/packages/PEGTL/include/tao/pegtl/internal/enable.hpp index cb4fbe9dbc7a4db4bf9729b4a7bc3d93c8054379..cf95b5bef044518f7359ccc19881dbe4532e1847 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/enable.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/enable.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_ENABLE_HPP #define TAO_PEGTL_INTERNAL_ENABLE_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/enable_control.hpp b/packages/PEGTL/include/tao/pegtl/internal/enable_control.hpp index 4fe5ae199cbbc1fe5d7950d4250cf7066763b555..9650594b22030edee18bba9747eac8b35e38e3f8 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/enable_control.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/enable_control.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/eof.hpp b/packages/PEGTL/include/tao/pegtl/internal/eof.hpp index e227e0474fd0f19b40a0b070d599c77422972ee4..50b876739f6351e120b1f5d859120c8fc4abcb9b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/eof.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/eof.hpp @@ -1,14 +1,13 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_EOF_HPP #define TAO_PEGTL_INTERNAL_EOF_HPP -#include "../config.hpp" - #include "enable_control.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/eol.hpp b/packages/PEGTL/include/tao/pegtl/internal/eol.hpp index 6f8633afc96504de82d797af0aaf5563f02698c5..7d65428517d3e43e2327928f2551a8ff919ac0c6 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/eol.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/eol.hpp @@ -1,14 +1,13 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_EOL_HPP #define TAO_PEGTL_INTERNAL_EOL_HPP -#include "../config.hpp" - #include "enable_control.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal @@ -19,9 +18,9 @@ namespace TAO_PEGTL_NAMESPACE::internal using subs_t = empty_list; template< typename ParseInput > - [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( ParseInput::eol_t::match( in ) ) ) + [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( ParseInput::eol_t::eol_match( in ) ) ) { - return ParseInput::eol_t::match( in ).first; + return ParseInput::eol_t::eol_match( in ).data; } }; diff --git a/packages/PEGTL/include/tao/pegtl/internal/eolf.hpp b/packages/PEGTL/include/tao/pegtl/internal/eolf.hpp index 101605b9e50d30e875722749e8c76ec1fee9203b..01fe64ff0e60e9f05e7076ed1eda22716f922b67 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/eolf.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/eolf.hpp @@ -1,14 +1,13 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_EOLF_HPP #define TAO_PEGTL_INTERNAL_EOLF_HPP -#include "../config.hpp" - #include "enable_control.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal @@ -19,10 +18,10 @@ namespace TAO_PEGTL_NAMESPACE::internal using subs_t = empty_list; template< typename ParseInput > - [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( ParseInput::eol_t::match( in ) ) ) + [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( ParseInput::eol_t::eol_match( in ) ) ) { - const auto p = ParseInput::eol_t::match( in ); - return p.first || ( !p.second ); + const auto p = ParseInput::eol_t::eol_match( in ); + return p.data || ( p.size == 0 ); } }; diff --git a/packages/PEGTL/include/tao/pegtl/internal/everything.hpp b/packages/PEGTL/include/tao/pegtl/internal/everything.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b3e9dd9605281a26f289fb6fd508f190d39896ad --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/everything.hpp @@ -0,0 +1,34 @@ +// Copyright (c) 2022-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_EVERYTHING_HPP +#define TAO_PEGTL_INTERNAL_EVERYTHING_HPP + +#include "enable_control.hpp" + +#include "../config.hpp" +#include "../type_list.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + template< typename Size > + struct everything + { + using rule_t = everything; + using subs_t = empty_list; + + template< typename ParseInput > + [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( in.size( 0 ) ) ) + { + in.bump( in.size( Size( -1 ) ) ); + return true; + } + }; + + template< typename Size > + inline constexpr bool enable_control< everything< Size > > = false; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/failure.hpp b/packages/PEGTL/include/tao/pegtl/internal/failure.hpp index 8f14322b8167f6466dd51a456f289a0c352b8a1a..d4cc8e4bbf3fec94f168045f8acf716df70c4667 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/failure.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/failure.hpp @@ -1,14 +1,13 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_FAILURE_HPP #define TAO_PEGTL_INTERNAL_FAILURE_HPP -#include "../config.hpp" - #include "enable_control.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/filesystem.hpp b/packages/PEGTL/include/tao/pegtl/internal/filesystem.hpp index fdb5e2f1013cf8af8dd337724a6a33690d512ed5..311c74577466be60f5e9379bbe8f255ea70c307b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/filesystem.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/filesystem.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/iterator.hpp b/packages/PEGTL/include/tao/pegtl/internal/frobnicator.hpp similarity index 51% rename from packages/PEGTL/include/tao/pegtl/internal/iterator.hpp rename to packages/PEGTL/include/tao/pegtl/internal/frobnicator.hpp index 96099cab899619a0cab5815caa8a79aff3e4128d..d846d6fd7b504a99163e74ab0d620ae2fa6dc9bf 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/iterator.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/frobnicator.hpp @@ -1,9 +1,9 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) -#ifndef TAO_PEGTL_INTERNAL_ITERATOR_HPP -#define TAO_PEGTL_INTERNAL_ITERATOR_HPP +#ifndef TAO_PEGTL_INTERNAL_FROBNICATOR_HPP +#define TAO_PEGTL_INTERNAL_FROBNICATOR_HPP #include <cassert> #include <cstdlib> @@ -12,15 +12,15 @@ namespace TAO_PEGTL_NAMESPACE::internal { - struct iterator + struct frobnicator { - iterator() = default; + frobnicator() = default; - explicit iterator( const char* in_data ) noexcept + explicit frobnicator( const char* in_data ) noexcept : data( in_data ) {} - iterator( const char* in_data, const std::size_t in_byte, const std::size_t in_line, const std::size_t in_column ) noexcept + frobnicator( const char* in_data, const std::size_t in_byte, const std::size_t in_line, const std::size_t in_column ) noexcept : data( in_data ), byte( in_byte ), line( in_line ), @@ -30,13 +30,13 @@ namespace TAO_PEGTL_NAMESPACE::internal assert( in_column != 0 ); } - iterator( const iterator& ) = default; - iterator( iterator&& ) = default; + frobnicator( const frobnicator& ) = default; + frobnicator( frobnicator&& ) = default; - ~iterator() = default; + ~frobnicator() = default; - iterator& operator=( const iterator& ) = default; - iterator& operator=( iterator&& ) = default; + frobnicator& operator=( const frobnicator& ) = default; + frobnicator& operator=( frobnicator&& ) = default; const char* data = nullptr; diff --git a/packages/PEGTL/include/tao/pegtl/internal/has_apply.hpp b/packages/PEGTL/include/tao/pegtl/internal/has_apply.hpp index 5b746ebccb65a25f284c471d9c20445a3da7ff91..4610981ffdb70ac2107e84863670ff8e0fbd67e7 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/has_apply.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/has_apply.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/has_apply0.hpp b/packages/PEGTL/include/tao/pegtl/internal/has_apply0.hpp index cb14882ac98895a1ebf86f7743b1b1624f4b42ce..2763270387ca2604af00604b657c6469a180d785 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/has_apply0.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/has_apply0.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/has_error_message.hpp b/packages/PEGTL/include/tao/pegtl/internal/has_error_message.hpp new file mode 100644 index 0000000000000000000000000000000000000000..050ba54479a77aa4be8efb994c4b1e297575412f --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/has_error_message.hpp @@ -0,0 +1,22 @@ +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_HAS_ERROR_MESSAGE_HPP +#define TAO_PEGTL_INTERNAL_HAS_ERROR_MESSAGE_HPP + +#include <type_traits> + +#include "../config.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + template< typename Rule, typename = const char* > + inline constexpr bool has_error_message = false; + + template< typename Rule > + inline constexpr bool has_error_message< Rule, std::decay_t< decltype( Rule::error_message ) > > = true; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/has_match.hpp b/packages/PEGTL/include/tao/pegtl/internal/has_match.hpp index ab842587437d7e32e36ab6dfabb64fad61e2dbae..dd9a0d91a7180b52dff8cda03b934b424c2186fd 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/has_match.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/has_match.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/has_unwind.hpp b/packages/PEGTL/include/tao/pegtl/internal/has_unwind.hpp index 8714d93725868dfef1a148c6c6449a8841b26397..6054be151856e16cd67890d56d44eba70d13f983 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/has_unwind.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/has_unwind.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/identifier.hpp b/packages/PEGTL/include/tao/pegtl/internal/identifier.hpp index fc78c220b993192dc47bc9375e933fd3d5ef374c..6dc90a6fc3cbcd216ab536116275997045621542 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/identifier.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/identifier.hpp @@ -1,17 +1,17 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_IDENTIFIER_HPP #define TAO_PEGTL_INTERNAL_IDENTIFIER_HPP -#include "../config.hpp" - #include "peek_char.hpp" #include "ranges.hpp" #include "seq.hpp" #include "star.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { using identifier_first = ranges< peek_char, 'a', 'z', 'A', 'Z', '_' >; diff --git a/packages/PEGTL/include/tao/pegtl/internal/if_apply.hpp b/packages/PEGTL/include/tao/pegtl/internal/if_apply.hpp index 797be335928f20dc3bb16772ca59c45f9e1af215..7ce7c48550481155e33b10f53ef93deb1942ee78 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/if_apply.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/if_apply.hpp @@ -1,16 +1,15 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_IF_APPLY_HPP #define TAO_PEGTL_INTERNAL_IF_APPLY_HPP -#include "../config.hpp" - #include "apply_single.hpp" #include "enable_control.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -34,9 +33,9 @@ namespace TAO_PEGTL_NAMESPACE::internal { if constexpr( ( A == apply_mode::action ) && ( sizeof...( Actions ) != 0 ) ) { using action_t = typename ParseInput::action_t; - auto m = in.template mark< rewind_mode::required >(); + auto m = in.template auto_rewind< rewind_mode::required >(); if( Control< Rule >::template match< apply_mode::action, rewind_mode::active, Action, Control >( in, st... ) ) { - const action_t i2( m.iterator(), in ); + const action_t i2( m.frobnicator(), in ); return m( ( apply_single< Actions >::match( i2, st... ) && ... ) ); } return false; diff --git a/packages/PEGTL/include/tao/pegtl/internal/if_must.hpp b/packages/PEGTL/include/tao/pegtl/internal/if_must.hpp index 9f5e0bacc452056815610a0cce362aaf22fb2aa4..a0940c073eee970965bbf681f7c54f5f0fa25158 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/if_must.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/if_must.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,12 +9,11 @@ #error "Exception support required for tao/pegtl/internal/if_must.hpp" #else -#include "../config.hpp" - #include "enable_control.hpp" #include "must.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/if_must_else.hpp b/packages/PEGTL/include/tao/pegtl/internal/if_must_else.hpp index 51ad934824b5a48cb010fc909903c3691e3f05ea..d08fdd9f1a0eab9165afa3f63bbddc74a2fdc7ce 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/if_must_else.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/if_must_else.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,12 +9,10 @@ #error "Exception support required for tao/pegtl/internal/if_must_else.hpp" #else -#include "../config.hpp" - #include "if_then_else.hpp" #include "must.hpp" -#include "../type_list.hpp" +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { diff --git a/packages/PEGTL/include/tao/pegtl/internal/if_then_else.hpp b/packages/PEGTL/include/tao/pegtl/internal/if_then_else.hpp index dfe62ceb957f1943102f0837f4742fb64a3afa0a..95125b995e0ba5e16da259baddda30f09430f668 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/if_then_else.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/if_then_else.hpp @@ -1,18 +1,17 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_IF_THEN_ELSE_HPP #define TAO_PEGTL_INTERNAL_IF_THEN_ELSE_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "not_at.hpp" #include "seq.hpp" #include "sor.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -34,7 +33,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); using m_t = decltype( m ); if( Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { diff --git a/packages/PEGTL/include/tao/pegtl/internal/istream_reader.hpp b/packages/PEGTL/include/tao/pegtl/internal/istream_reader.hpp index 4b67437194f2e69f73ab6762e58a5ffb941c9c26..8c4356e7b5e446b772d113c0cdc387b57c0b12fa 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/istream_reader.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/istream_reader.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -26,10 +26,10 @@ namespace TAO_PEGTL_NAMESPACE::internal [[nodiscard]] std::size_t operator()( char* buffer, const std::size_t length ) { - m_istream.read( buffer, std::streamsize( length ) ); + m_istream.read( buffer, static_cast< std::streamsize >( length ) ); if( const auto r = m_istream.gcount() ) { - return std::size_t( r ); + return static_cast< std::size_t >( r ); } if( m_istream.eof() ) { return 0; diff --git a/packages/PEGTL/include/tao/pegtl/internal/istring.hpp b/packages/PEGTL/include/tao/pegtl/internal/istring.hpp index 5969c0672f8e2075f691daa0328fcd359cccbf04..3fafca2e950d26e4fed25284ab2f500021d5c01f 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/istring.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/istring.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,14 +7,13 @@ #include <type_traits> -#include "../config.hpp" - #include "bump_help.hpp" #include "enable_control.hpp" #include "one.hpp" #include "result_on_found.hpp" #include "success.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal @@ -58,8 +57,16 @@ namespace TAO_PEGTL_NAMESPACE::internal using rule_t = istring; using subs_t = empty_list; - template< int Eol > - static constexpr bool can_match_eol = one< result_on_found::success, peek_char, Cs... >::template can_match_eol< Eol >; + [[nodiscard]] static constexpr bool test_one( const char c ) noexcept + { + static_assert( sizeof...( Cs ) == 1 ); + return one< result_on_found::success, peek_char, Cs... >::test_one( c ); + } + + [[nodiscard]] static constexpr bool test_any( const char c ) noexcept + { + return one< result_on_found::success, peek_char, Cs... >::test_one( c ); + } template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( in.size( 0 ) ) ) diff --git a/packages/PEGTL/include/tao/pegtl/internal/lf_crlf_eol.hpp b/packages/PEGTL/include/tao/pegtl/internal/lf_crlf_eol.hpp index ac266014a7f07f1990149e47241cc3e38d1c2f09..aaa40ef7f9fb6b277ca4afd63137b0f5a237ed78 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/lf_crlf_eol.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/lf_crlf_eol.hpp @@ -1,12 +1,13 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_LF_CRLF_EOL_HPP #define TAO_PEGTL_INTERNAL_LF_CRLF_EOL_HPP +#include "data_and_size.hpp" + #include "../config.hpp" -#include "../eol_pair.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -15,18 +16,20 @@ namespace TAO_PEGTL_NAMESPACE::internal static constexpr int ch = '\n'; template< typename ParseInput > - [[nodiscard]] static eol_pair match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) ) + [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 2 ) ) ) { - eol_pair p = { false, in.size( 2 ) }; - if( p.second ) { + bool_and_size p = { false, in.size( 2 ) }; + if( p.size > 0 ) { const auto a = in.peek_char(); if( a == '\n' ) { in.bump_to_next_line(); - p.first = true; + p.size = 1; + p.data = true; } - else if( ( a == '\r' ) && ( p.second > 1 ) && ( in.peek_char( 1 ) == '\n' ) ) { + else if( ( a == '\r' ) && ( p.size > 1 ) && ( in.peek_char( 1 ) == '\n' ) ) { in.bump_to_next_line( 2 ); - p.first = true; + p.size = 2; + p.data = true; } } return p; diff --git a/packages/PEGTL/include/tao/pegtl/internal/lf_eol.hpp b/packages/PEGTL/include/tao/pegtl/internal/lf_eol.hpp index d0f3adceb71904a82e4848f253b4ea6a02d4b31b..75598d45ae55a649b017fecf0f6487d72698859a 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/lf_eol.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/lf_eol.hpp @@ -1,12 +1,13 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_LF_EOL_HPP #define TAO_PEGTL_INTERNAL_LF_EOL_HPP +#include "data_and_size.hpp" + #include "../config.hpp" -#include "../eol_pair.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -15,13 +16,13 @@ namespace TAO_PEGTL_NAMESPACE::internal static constexpr int ch = '\n'; template< typename ParseInput > - [[nodiscard]] static eol_pair match( ParseInput& in ) noexcept( noexcept( in.size( 1 ) ) ) + [[nodiscard]] static bool_and_size eol_match( ParseInput& in ) noexcept( noexcept( in.size( 1 ) ) ) { - eol_pair p = { false, in.size( 1 ) }; - if( p.second ) { + bool_and_size p = { false, in.size( 1 ) }; + if( p.size > 0 ) { if( in.peek_char() == '\n' ) { in.bump_to_next_line(); - p.first = true; + p.data = true; } } return p; diff --git a/packages/PEGTL/include/tao/pegtl/internal/list.hpp b/packages/PEGTL/include/tao/pegtl/internal/list.hpp index 24a3935163bfa627e80cc21df792f9cca5d3f41a..c08e53c0c0a6c45a147e5bfc6e2b706c37508157 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/list.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/list.hpp @@ -1,15 +1,15 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_LIST_HPP #define TAO_PEGTL_INTERNAL_LIST_HPP -#include "../config.hpp" - #include "seq.hpp" #include "star.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< typename Rule, typename Sep > diff --git a/packages/PEGTL/include/tao/pegtl/internal/list_must.hpp b/packages/PEGTL/include/tao/pegtl/internal/list_must.hpp index 1d9cef89ef7b31f22512bc1f426981a43409d081..e16f62515bbcdff993484919ff002137ca199dac 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/list_must.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/list_must.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,12 +9,12 @@ #error "Exception support required for tao/pegtl/internal/list_must.hpp" #else -#include "../config.hpp" - #include "must.hpp" #include "seq.hpp" #include "star.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< typename Rule, typename Sep > diff --git a/packages/PEGTL/include/tao/pegtl/internal/list_tail.hpp b/packages/PEGTL/include/tao/pegtl/internal/list_tail.hpp index 59fae07ff18b969770d379084ac84752a57721ac..03bf38f75162b64f9fd867eaea30e8efa8ea1706 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/list_tail.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/list_tail.hpp @@ -1,22 +1,19 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_LIST_TAIL_HPP #define TAO_PEGTL_INTERNAL_LIST_TAIL_HPP -#include "../config.hpp" - -#include "opt.hpp" #include "seq.hpp" -#include "star.hpp" +#include "star_partial.hpp" -#include "../type_list.hpp" +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { template< typename Rule, typename Sep > - using list_tail = seq< Rule, star< Sep, Rule >, opt< Sep > >; + using list_tail = seq< Rule, star_partial< Sep, Rule > >; } // namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/list_tail_pad.hpp b/packages/PEGTL/include/tao/pegtl/internal/list_tail_pad.hpp index f204b23e83f09302731442a12a71f8aae79fe27e..299e5fe975ab4b41de635c4ea92abb0b14ec3dc6 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/list_tail_pad.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/list_tail_pad.hpp @@ -1,22 +1,20 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_LIST_TAIL_PAD_HPP #define TAO_PEGTL_INTERNAL_LIST_TAIL_PAD_HPP -#include "../config.hpp" - -#include "list.hpp" -#include "opt.hpp" #include "pad.hpp" #include "seq.hpp" -#include "star.hpp" +#include "star_partial.hpp" + +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { template< typename Rule, typename Sep, typename Pad > - using list_tail_pad = seq< Rule, star< pad< Sep, Pad >, Rule >, opt< star< Pad >, Sep > >; + using list_tail_pad = seq< Rule, star_partial< lpad< Sep, Pad >, lpad< Rule, Pad > > >; } // namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/marker.hpp b/packages/PEGTL/include/tao/pegtl/internal/marker.hpp deleted file mode 100644 index a061aea738eef1866887be743e4f6125605526a3..0000000000000000000000000000000000000000 --- a/packages/PEGTL/include/tao/pegtl/internal/marker.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) - -#ifndef TAO_PEGTL_INTERNAL_MARKER_HPP -#define TAO_PEGTL_INTERNAL_MARKER_HPP - -#include "../config.hpp" -#include "../rewind_mode.hpp" - -namespace TAO_PEGTL_NAMESPACE::internal -{ - template< typename Iterator, rewind_mode M > - class [[nodiscard]] marker - { - public: - static constexpr rewind_mode next_rewind_mode = M; - - explicit marker( const Iterator& /*unused*/ ) noexcept - {} - - marker( const marker& ) = delete; - marker( marker&& ) = delete; - - ~marker() = default; - - marker& operator=( const marker& ) = delete; - marker& operator=( marker&& ) = delete; - - [[nodiscard]] bool operator()( const bool result ) const noexcept - { - return result; - } - }; - - template< typename Iterator > - class [[nodiscard]] marker< Iterator, rewind_mode::required > - { - public: - static constexpr rewind_mode next_rewind_mode = rewind_mode::active; - - explicit marker( Iterator& i ) noexcept - : m_saved( i ), - m_input( &i ) - {} - - marker( const marker& ) = delete; - marker( marker&& ) = delete; - - ~marker() - { - if( m_input != nullptr ) { - ( *m_input ) = m_saved; - } - } - - marker& operator=( const marker& ) = delete; - marker& operator=( marker&& ) = delete; - - [[nodiscard]] bool operator()( const bool result ) noexcept - { - if( result ) { - m_input = nullptr; - return true; - } - return false; - } - - [[nodiscard]] const Iterator& iterator() const noexcept - { - return m_saved; - } - - private: - const Iterator m_saved; - Iterator* m_input; - }; - -} // namespace TAO_PEGTL_NAMESPACE::internal - -#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/minus.hpp b/packages/PEGTL/include/tao/pegtl/internal/minus.hpp index f89ec02c8bf04a4937a5f8a0036657899d63aa5d..9536b821774d85504d325cf9afcb4bf819ca9e9c 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/minus.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/minus.hpp @@ -1,17 +1,17 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_MINUS_HPP #define TAO_PEGTL_INTERNAL_MINUS_HPP -#include "../config.hpp" - #include "eof.hpp" #include "not_at.hpp" #include "rematch.hpp" #include "seq.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< typename M, typename S > diff --git a/packages/PEGTL/include/tao/pegtl/internal/missing_apply.hpp b/packages/PEGTL/include/tao/pegtl/internal/missing_apply.hpp index b979c1420357a2d24dd6762a8a384d899c3700c9..6885588210861762a194afb1b808f6303ff5b6c1 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/missing_apply.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/missing_apply.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -19,8 +19,8 @@ namespace TAO_PEGTL_NAMESPACE::internal { // This function only exists for better error messages, which means that it is only called when we know that it won't compile. // LCOV_EXCL_START - auto m = in.template mark< rewind_mode::required >(); - (void)Control::template apply< Action >( m.iterator(), in, st... ); + auto m = in.template auto_rewind< rewind_mode::required >(); + (void)Control::template apply< Action >( m.frobnicator(), in, st... ); // LCOV_EXCL_STOP } diff --git a/packages/PEGTL/include/tao/pegtl/internal/missing_apply0.hpp b/packages/PEGTL/include/tao/pegtl/internal/missing_apply0.hpp index fedd156c0cb6b622488f261545effc523db15742..30ca3951c551c894dc43885a8ebd0f4172532a45 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/missing_apply0.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/missing_apply0.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/mmap_file.hpp b/packages/PEGTL/include/tao/pegtl/internal/mmap_file.hpp new file mode 100644 index 0000000000000000000000000000000000000000..361a6f0bdc9edeca5f8e886b1b0893c4a3fb82c9 --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/mmap_file.hpp @@ -0,0 +1,44 @@ +// Copyright (c) 2022-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_MMAP_FILE_HPP +#define TAO_PEGTL_INTERNAL_MMAP_FILE_HPP + +#if defined( __unix__ ) || ( defined( __APPLE__ ) && defined( __MACH__ ) ) +#include <unistd.h> // Required for _POSIX_MAPPED_FILES +#endif + +#if defined( _POSIX_MAPPED_FILES ) +#include "mmap_file_posix.hpp" +#elif defined( _WIN32 ) +#include "mmap_file_win32.hpp" +#else +#endif + +#include "filesystem.hpp" + +#include "../config.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + struct mmap_file + { + const mmap_file_impl data; + + explicit mmap_file( const internal::filesystem::path& path ) + : data( path ) + {} + + mmap_file( const mmap_file& ) = delete; + mmap_file( mmap_file&& ) = delete; + + ~mmap_file() = default; + + mmap_file& operator=( const mmap_file& ) = delete; + mmap_file& operator=( mmap_file&& ) = delete; + }; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp b/packages/PEGTL/include/tao/pegtl/internal/mmap_file_posix.hpp similarity index 66% rename from packages/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp rename to packages/PEGTL/include/tao/pegtl/internal/mmap_file_posix.hpp index def276bce3bab1a100934f66f45946dde0baf31c..367ae90d4abb9902d8c0006932eb5161d6dce5f9 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/file_mapper_posix.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/mmap_file_posix.hpp @@ -1,9 +1,9 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) -#ifndef TAO_PEGTL_INTERNAL_FILE_MAPPER_POSIX_HPP -#define TAO_PEGTL_INTERNAL_FILE_MAPPER_POSIX_HPP +#ifndef TAO_PEGTL_INTERNAL_MMAP_FILE_POSIX_HPP +#define TAO_PEGTL_INTERNAL_MMAP_FILE_POSIX_HPP #include <fcntl.h> #include <sys/mman.h> @@ -18,29 +18,29 @@ #include <utility> -#include "../config.hpp" - #include "filesystem.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { - struct file_opener + struct mmap_file_open { - explicit file_opener( const internal::filesystem::path& path ) // NOLINT(modernize-pass-by-value) + explicit mmap_file_open( const internal::filesystem::path& path ) // NOLINT(modernize-pass-by-value) : m_path( path ), m_fd( open() ) {} - file_opener( const file_opener& ) = delete; - file_opener( file_opener&& ) = delete; + mmap_file_open( const mmap_file_open& ) = delete; + mmap_file_open( mmap_file_open&& ) = delete; - ~file_opener() + ~mmap_file_open() { ::close( m_fd ); } - file_opener& operator=( const file_opener& ) = delete; - file_opener& operator=( file_opener&& ) = delete; + mmap_file_open& operator=( const mmap_file_open& ) = delete; + mmap_file_open& operator=( mmap_file_open&& ) = delete; [[nodiscard]] std::size_t size() const { @@ -49,7 +49,7 @@ namespace TAO_PEGTL_NAMESPACE::internal if( ::fstat( m_fd, &st ) < 0 ) { // LCOV_EXCL_START #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "fstat() failed", m_path, ec ); #else std::perror( "fstat() failed" ); @@ -57,7 +57,7 @@ namespace TAO_PEGTL_NAMESPACE::internal #endif // LCOV_EXCL_STOP } - return std::size_t( st.st_size ); + return static_cast< std::size_t >( st.st_size ); } const internal::filesystem::path m_path; @@ -77,7 +77,7 @@ namespace TAO_PEGTL_NAMESPACE::internal return fd; } #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "open() failed", m_path, ec ); #else std::perror( "open() failed" ); @@ -86,21 +86,21 @@ namespace TAO_PEGTL_NAMESPACE::internal } }; - class file_mapper + class mmap_file_posix { public: - explicit file_mapper( const internal::filesystem::path& path ) - : file_mapper( file_opener( path ) ) + explicit mmap_file_posix( const internal::filesystem::path& path ) + : mmap_file_posix( mmap_file_open( path ) ) {} - explicit file_mapper( const file_opener& reader ) + explicit mmap_file_posix( const mmap_file_open& reader ) : m_size( reader.size() ), m_data( static_cast< const char* >( ::mmap( nullptr, m_size, PROT_READ, MAP_PRIVATE, reader.m_fd, 0 ) ) ) { - if( ( m_size != 0 ) && ( intptr_t( m_data ) == -1 ) ) { + if( ( m_size != 0 ) && ( reinterpret_cast< intptr_t >( m_data ) == -1 ) ) { // LCOV_EXCL_START #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "mmap() failed", reader.m_path, ec ); #else std::perror( "mmap() failed" ); @@ -110,17 +110,17 @@ namespace TAO_PEGTL_NAMESPACE::internal } } - file_mapper( const file_mapper& ) = delete; - file_mapper( file_mapper&& ) = delete; + mmap_file_posix( const mmap_file_posix& ) = delete; + mmap_file_posix( mmap_file_posix&& ) = delete; - ~file_mapper() + ~mmap_file_posix() { // Legacy C interface requires pointer-to-mutable but does not write through the pointer. ::munmap( const_cast< char* >( m_data ), m_size ); } - file_mapper& operator=( const file_mapper& ) = delete; - file_mapper& operator=( file_mapper&& ) = delete; + mmap_file_posix& operator=( const mmap_file_posix& ) = delete; + mmap_file_posix& operator=( mmap_file_posix&& ) = delete; [[nodiscard]] bool empty() const noexcept { @@ -155,6 +155,8 @@ namespace TAO_PEGTL_NAMESPACE::internal const char* const m_data; }; + using mmap_file_impl = mmap_file_posix; + } // namespace TAO_PEGTL_NAMESPACE::internal #endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp b/packages/PEGTL/include/tao/pegtl/internal/mmap_file_win32.hpp similarity index 79% rename from packages/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp rename to packages/PEGTL/include/tao/pegtl/internal/mmap_file_win32.hpp index 4a353ccf4fd0feda569010d281352ed39ba42b66..5f2a3dbeeaae26f2611ba56f374cf609f1d813bc 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/file_mapper_win32.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/mmap_file_win32.hpp @@ -1,9 +1,11 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) -#ifndef TAO_PEGTL_INTERNAL_FILE_MAPPER_WIN32_HPP -#define TAO_PEGTL_INTERNAL_FILE_MAPPER_WIN32_HPP +#ifndef TAO_PEGTL_INTERNAL_MMAP_FILE_WIN32_HPP +#define TAO_PEGTL_INTERNAL_MMAP_FILE_WIN32_HPP + +#include "../config.hpp" #if !defined( NOMINMAX ) #define NOMINMAX @@ -27,8 +29,6 @@ #undef TAO_PEGTL_WIN32_LEAN_AND_MEAN_WAS_DEFINED #endif -#include "../config.hpp" - #if !defined( __cpp_exceptions ) #include <cstdio> #include <exception> @@ -38,23 +38,23 @@ namespace TAO_PEGTL_NAMESPACE::internal { - struct file_opener + struct mmap_file_open { - explicit file_opener( const internal::filesystem::path& path ) + explicit mmap_file_open( const internal::filesystem::path& path ) : m_path( path ), m_handle( open() ) {} - file_opener( const file_opener& ) = delete; - file_opener( file_opener&& ) = delete; + mmap_file_open( const mmap_file_open& ) = delete; + mmap_file_open( mmap_file_open&& ) = delete; - ~file_opener() + ~mmap_file_open() { ::CloseHandle( m_handle ); } - file_opener& operator=( const file_opener& ) = delete; - file_opener& operator=( file_opener&& ) = delete; + mmap_file_open& operator=( const mmap_file_open& ) = delete; + mmap_file_open& operator=( mmap_file_open&& ) = delete; [[nodiscard]] std::size_t size() const { @@ -116,33 +116,33 @@ namespace TAO_PEGTL_NAMESPACE::internal } }; - struct win32_file_mapper + struct mmap_file_mmap { - explicit win32_file_mapper( const internal::filesystem::path& path ) - : win32_file_mapper( file_opener( path ) ) + explicit mmap_file_mmap( const internal::filesystem::path& path ) + : mmap_file_mmap( mmap_file_open( path ) ) {} - explicit win32_file_mapper( const file_opener& reader ) + explicit mmap_file_mmap( const mmap_file_open& reader ) : m_size( reader.size() ), m_handle( open( reader ) ) {} - win32_file_mapper( const win32_file_mapper& ) = delete; - win32_file_mapper( win32_file_mapper&& ) = delete; + mmap_file_mmap( const mmap_file_mmap& ) = delete; + mmap_file_mmap( mmap_file_mmap&& ) = delete; - ~win32_file_mapper() + ~mmap_file_mmap() { ::CloseHandle( m_handle ); } - win32_file_mapper& operator=( const win32_file_mapper& ) = delete; - win32_file_mapper& operator=( win32_file_mapper&& ) = delete; + mmap_file_mmap& operator=( const mmap_file_mmap& ) = delete; + mmap_file_mmap& operator=( mmap_file_mmap&& ) = delete; const size_t m_size; const HANDLE m_handle; private: - [[nodiscard]] HANDLE open( const file_opener& reader ) const + [[nodiscard]] HANDLE open( const mmap_file_open& reader ) const { const uint64_t file_size = reader.size(); SetLastError( 0 ); @@ -169,14 +169,14 @@ namespace TAO_PEGTL_NAMESPACE::internal } }; - class file_mapper + class mmap_file_win32 { public: - explicit file_mapper( const internal::filesystem::path& path ) - : file_mapper( win32_file_mapper( path ) ) + explicit mmap_file_win32( const internal::filesystem::path& path ) + : mmap_file_win32( mmap_file_mmap( path ) ) {} - explicit file_mapper( const win32_file_mapper& mapper ) + explicit mmap_file_win32( const mmap_file_mmap& mapper ) : m_size( mapper.m_size ), m_data( static_cast< const char* >( ::MapViewOfFile( mapper.m_handle, FILE_MAP_READ, @@ -195,16 +195,16 @@ namespace TAO_PEGTL_NAMESPACE::internal } } - file_mapper( const file_mapper& ) = delete; - file_mapper( file_mapper&& ) = delete; + mmap_file_win32( const mmap_file_win32& ) = delete; + mmap_file_win32( mmap_file_win32&& ) = delete; - ~file_mapper() + ~mmap_file_win32() { ::UnmapViewOfFile( LPCVOID( m_data ) ); } - file_mapper& operator=( const file_mapper& ) = delete; - file_mapper& operator=( file_mapper&& ) = delete; + mmap_file_win32& operator=( const mmap_file_win32& ) = delete; + mmap_file_win32& operator=( mmap_file_win32&& ) = delete; [[nodiscard]] bool empty() const noexcept { @@ -239,6 +239,8 @@ namespace TAO_PEGTL_NAMESPACE::internal const char* const m_data; }; + using mmap_file_impl = mmap_file_win32; + } // namespace TAO_PEGTL_NAMESPACE::internal #endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/must.hpp b/packages/PEGTL/include/tao/pegtl/internal/must.hpp index cc77f705814392f5f43af452367d84c600172819..93be8941fd319d73d19fd9e612dd873ba868ce67 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/must.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/must.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,13 +9,12 @@ #error "Exception support required for tao/pegtl/internal/must.hpp" #else -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/not_at.hpp b/packages/PEGTL/include/tao/pegtl/internal/not_at.hpp index 2e27e2d629795cfd5b90ec53829bc5c974459c83..b665d1e739972e85296026f3b8d759f2f156457b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/not_at.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/not_at.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_NOT_AT_HPP #define TAO_PEGTL_INTERNAL_NOT_AT_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "failure.hpp" #include "seq.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -43,7 +42,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - const auto m = in.template mark< rewind_mode::required >(); + const auto m = in.template auto_rewind< rewind_mode::required >(); return !Control< Rule >::template match< apply_mode::nothing, rewind_mode::active, Action, Control >( in, st... ); } }; diff --git a/packages/PEGTL/include/tao/pegtl/internal/one.hpp b/packages/PEGTL/include/tao/pegtl/internal/one.hpp index 2eac40f659d9d982b7b60b2200b10e6495551ac1..94de5ee7abeef913f0091fa7375468200bf4000b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/one.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/one.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,14 +7,13 @@ #include <cstddef> -#include "../config.hpp" - #include "any.hpp" #include "bump_help.hpp" #include "enable_control.hpp" #include "failure.hpp" #include "result_on_found.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal @@ -28,19 +27,21 @@ namespace TAO_PEGTL_NAMESPACE::internal using rule_t = one; using subs_t = empty_list; - [[nodiscard]] static constexpr bool test( const data_t c ) noexcept + [[nodiscard]] static constexpr bool test_one( const data_t c ) noexcept { - return ( ( c == Cs ) || ... ) == bool( R ); + return ( ( c == Cs ) || ... ) == static_cast< bool >( R ); } - template< int Eol > - static constexpr bool can_match_eol = test( Eol ); + [[nodiscard]] static constexpr bool test_any( const data_t c ) noexcept + { + return test_one( c ); + } template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) ) { if( const auto t = Peek::peek( in ) ) { - if( test( t.data ) ) { + if( test_one( t.data ) ) { bump_help< one >( in, t.size ); return true; } diff --git a/packages/PEGTL/include/tao/pegtl/internal/opt.hpp b/packages/PEGTL/include/tao/pegtl/internal/opt.hpp index 4a10afe77090dea98fe3bcab1d4e570514f1318c..9d23d673c178afcdd46a3e289a9f6e2bbf8eb14e 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/opt.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/opt.hpp @@ -1,21 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_OPT_HPP #define TAO_PEGTL_INTERNAL_OPT_HPP -#include <type_traits> - -#include "../config.hpp" - #include "enable_control.hpp" +#include "partial.hpp" #include "seq.hpp" #include "success.hpp" -#include "../apply_mode.hpp" -#include "../rewind_mode.hpp" -#include "../type_list.hpp" +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -31,23 +26,9 @@ namespace TAO_PEGTL_NAMESPACE::internal template< typename Rule > struct opt< Rule > + : partial< Rule > { using rule_t = opt; - using subs_t = type_list< Rule >; - - template< apply_mode A, - rewind_mode, - template< typename... > - class Action, - template< typename... > - class Control, - typename ParseInput, - typename... States > - [[nodiscard]] static bool match( ParseInput& in, States&&... st ) - { - (void)Control< Rule >::template match< A, rewind_mode::required, Action, Control >( in, st... ); - return true; - } }; template< typename... Rules > diff --git a/packages/PEGTL/include/tao/pegtl/internal/pad.hpp b/packages/PEGTL/include/tao/pegtl/internal/pad.hpp index 13b473e2479b27f6fb738f1b7d9bf4a18b774599..44def8d1be29a14e8458696a24d9b071d935bb12 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/pad.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/pad.hpp @@ -1,20 +1,26 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_PAD_HPP #define TAO_PEGTL_INTERNAL_PAD_HPP -#include "../config.hpp" - #include "seq.hpp" #include "star.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { + template< typename Rule, typename Pad1 > + using lpad = seq< star< Pad1 >, Rule >; + template< typename Rule, typename Pad1, typename Pad2 = Pad1 > using pad = seq< star< Pad1 >, Rule, star< Pad2 > >; + template< typename Rule, typename Pad2 > + using rpad = seq< Rule, star< Pad2 > >; + } // namespace TAO_PEGTL_NAMESPACE::internal #endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/pad_opt.hpp b/packages/PEGTL/include/tao/pegtl/internal/pad_opt.hpp index 80b5064f796b8eb8818b8946742afc80871e69ec..27dffb8872f4380293203e32eb0206f8ed58fdfc 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/pad_opt.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/pad_opt.hpp @@ -1,16 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_PAD_OPT_HPP #define TAO_PEGTL_INTERNAL_PAD_OPT_HPP -#include "../config.hpp" - #include "opt.hpp" #include "seq.hpp" #include "star.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< typename Rule, typename Pad > diff --git a/packages/PEGTL/include/tao/pegtl/internal/partial.hpp b/packages/PEGTL/include/tao/pegtl/internal/partial.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eb27b8d893f1e97be7087c7300a8718d7f3d5fa3 --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/partial.hpp @@ -0,0 +1,43 @@ +// Copyright (c) 2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_PARTIAL_HPP +#define TAO_PEGTL_INTERNAL_PARTIAL_HPP + +#include "enable_control.hpp" + +#include "../apply_mode.hpp" +#include "../config.hpp" +#include "../rewind_mode.hpp" +#include "../type_list.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + template< typename... Rules > + struct partial + { + using rule_t = partial; + using subs_t = type_list< Rules... >; + + template< apply_mode A, + rewind_mode, + template< typename... > + class Action, + template< typename... > + class Control, + typename ParseInput, + typename... States > + [[nodiscard]] static bool match( ParseInput& in, States&&... st ) + { + (void)( Control< Rules >::template match< A, rewind_mode::required, Action, Control >( in, st... ) && ... ); + return true; + } + }; + + template< typename... Rules > + inline constexpr bool enable_control< partial< Rules... > > = false; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/path_to_string.hpp b/packages/PEGTL/include/tao/pegtl/internal/path_to_string.hpp index 7d7757a0bdf50f785f95bf7c6980dde0731c5b5d..4d5fe80d1bcbb2b59675f846be714ca99307bfe7 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/path_to_string.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/path_to_string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,9 +7,10 @@ #include <string> -#include "../config.hpp" #include "filesystem.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { [[nodiscard]] inline std::string path_to_string( const internal::filesystem::path& path ) diff --git a/packages/PEGTL/include/tao/pegtl/internal/peek_char.hpp b/packages/PEGTL/include/tao/pegtl/internal/peek_char.hpp index e85e5607d94e95ce669cc2c9995d159928adb25c..603eef878dbcd323daddc0ec6e3fe255966c0eb4 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/peek_char.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/peek_char.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,16 +7,16 @@ #include <cstddef> -#include "../config.hpp" +#include "data_and_size.hpp" -#include "input_pair.hpp" +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { struct peek_char { using data_t = char; - using pair_t = input_pair< char >; + using pair_t = data_and_size< char >; template< typename ParseInput > [[nodiscard]] static pair_t peek( ParseInput& in ) noexcept( noexcept( in.empty() ) ) diff --git a/packages/PEGTL/include/tao/pegtl/internal/peek_utf8.hpp b/packages/PEGTL/include/tao/pegtl/internal/peek_utf8.hpp index a47d813a361d1af48209703b1bd6e108fd926c70..3555378331aa7459e02aa12481a3592f966249bb 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/peek_utf8.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/peek_utf8.hpp @@ -1,20 +1,20 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_PEEK_UTF8_HPP #define TAO_PEGTL_INTERNAL_PEEK_UTF8_HPP -#include "../config.hpp" +#include "data_and_size.hpp" -#include "input_pair.hpp" +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { struct peek_utf8 { using data_t = char32_t; - using pair_t = input_pair< char32_t >; + using pair_t = data_and_size< char32_t >; template< typename ParseInput > [[nodiscard]] static pair_t peek( ParseInput& in ) noexcept( noexcept( in.empty() ) ) diff --git a/packages/PEGTL/include/tao/pegtl/internal/pegtl_string.hpp b/packages/PEGTL/include/tao/pegtl/internal/pegtl_string.hpp index 576c216d286a45c7c8df26b8a6351526b5143855..3811179fd8c96672d8c67ccfd6e03cc476b03cee 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/pegtl_string.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/pegtl_string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -10,6 +10,7 @@ #include "../ascii.hpp" #include "../config.hpp" +#include "../rules.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -52,17 +53,17 @@ namespace TAO_PEGTL_NAMESPACE::internal #define TAO_PEGTL_INTERNAL_EXPAND( ... ) __VA_ARGS__ #define TAO_PEGTL_INTERNAL_STRING_AT( S, x, n ) \ - TAO_PEGTL_NAMESPACE::internal::string_at< S, ( 0##n < ( sizeof( x ) / sizeof( char ) ) ) ? ( x )[ 0##n ] : 0, ( 0##n < ( sizeof( x ) / sizeof( char ) ) - 1 ) >::type - -#define TAO_PEGTL_INTERNAL_JOIN_8( M, S, x, n ) \ - TAO_PEGTL_NAMESPACE::internal::string_join< TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##0 ), \ - TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##1 ), \ - TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##2 ), \ - TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##3 ), \ - TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##4 ), \ - TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##5 ), \ - TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##6 ), \ - TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##7 ) >::type + ::TAO_PEGTL_NAMESPACE::internal::string_at< S, ( 0##n < ( sizeof( x ) / sizeof( char ) ) ) ? ( x )[ 0##n ] : 0, ( 0##n < ( sizeof( x ) / sizeof( char ) ) - 1 ) >::type + +#define TAO_PEGTL_INTERNAL_JOIN_8( M, S, x, n ) \ + ::TAO_PEGTL_NAMESPACE::internal::string_join< TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##0 ), \ + TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##1 ), \ + TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##2 ), \ + TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##3 ), \ + TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##4 ), \ + TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##5 ), \ + TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##6 ), \ + TAO_PEGTL_INTERNAL_DEFER( M )( S, x, n##7 ) >::type #define TAO_PEGTL_INTERNAL_STRING_8( S, x, n ) \ TAO_PEGTL_INTERNAL_JOIN_8( TAO_PEGTL_INTERNAL_STRING_AT, S, x, n ) @@ -77,15 +78,18 @@ namespace TAO_PEGTL_NAMESPACE::internal TAO_PEGTL_INTERNAL_EXPAND( \ TAO_PEGTL_INTERNAL_EXPAND( \ TAO_PEGTL_INTERNAL_EXPAND( \ - TAO_PEGTL_NAMESPACE::internal::string_max_length< TAO_PEGTL_INTERNAL_STRING_512( S, x, ), sizeof( x ) - 1 >::type ) ) ) + ::TAO_PEGTL_NAMESPACE::internal::string_max_length< TAO_PEGTL_INTERNAL_STRING_512( S, x, ), sizeof( x ) - 1 >::type ) ) ) #define TAO_PEGTL_STRING( x ) \ - TAO_PEGTL_INTERNAL_STRING( TAO_PEGTL_NAMESPACE::ascii::string, x ) + TAO_PEGTL_INTERNAL_STRING( ::TAO_PEGTL_NAMESPACE::ascii::string, x ) #define TAO_PEGTL_ISTRING( x ) \ - TAO_PEGTL_INTERNAL_STRING( TAO_PEGTL_NAMESPACE::ascii::istring, x ) + TAO_PEGTL_INTERNAL_STRING( ::TAO_PEGTL_NAMESPACE::ascii::istring, x ) #define TAO_PEGTL_KEYWORD( x ) \ - TAO_PEGTL_INTERNAL_STRING( TAO_PEGTL_NAMESPACE::ascii::keyword, x ) + TAO_PEGTL_INTERNAL_STRING( ::TAO_PEGTL_NAMESPACE::ascii::keyword, x ) + +#define TAO_PEGTL_RAISE_MESSAGE( x ) \ + TAO_PEGTL_INTERNAL_STRING( ::TAO_PEGTL_NAMESPACE::raise_message, x ) #endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/plus.hpp b/packages/PEGTL/include/tao/pegtl/internal/plus.hpp index 2ebdd3e62e42437d299fd4b38f7ff3ad338b4aaf..5695a9a05b047347368e4af6011dad9ab611a86d 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/plus.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/plus.hpp @@ -1,18 +1,15 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_PLUS_HPP #define TAO_PEGTL_INTERNAL_PLUS_HPP -#include <type_traits> - -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/raise.hpp b/packages/PEGTL/include/tao/pegtl/internal/raise.hpp index 11db9fce43efc3c33d438eddabbba4c6f02e148f..8e1d17fdf570a315779c6c8afd38194da79b0451 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/raise.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/raise.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -11,11 +11,10 @@ #include <stdexcept> -#include "../config.hpp" - #include "enable_control.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/range.hpp b/packages/PEGTL/include/tao/pegtl/internal/range.hpp index f504161d1c93485b4643c4ae74e055695b974ee7..3245d06c30cebb24bb53de30a561bc2f5bc7ade7 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/range.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/range.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_RANGE_HPP #define TAO_PEGTL_INTERNAL_RANGE_HPP -#include "../config.hpp" - #include "bump_help.hpp" #include "enable_control.hpp" #include "one.hpp" #include "result_on_found.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal @@ -27,19 +26,21 @@ namespace TAO_PEGTL_NAMESPACE::internal static_assert( Lo < Hi, "invalid range" ); - [[nodiscard]] static constexpr bool test( const data_t c ) noexcept + [[nodiscard]] static constexpr bool test_one( const data_t c ) noexcept { - return ( ( Lo <= c ) && ( c <= Hi ) ) == bool( R ); + return ( ( Lo <= c ) && ( c <= Hi ) ) == static_cast< bool >( R ); } - template< int Eol > - static constexpr bool can_match_eol = test( Eol ); + [[nodiscard]] static constexpr bool test_any( const data_t c ) noexcept + { + return test_one( c ); + } template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) ) { if( const auto t = Peek::peek( in ) ) { - if( test( t.data ) ) { + if( test_one( t.data ) ) { bump_help< range >( in, t.size ); return true; } diff --git a/packages/PEGTL/include/tao/pegtl/internal/ranges.hpp b/packages/PEGTL/include/tao/pegtl/internal/ranges.hpp index 9df06d7b3d756778b2fc64dd1938378f7e156468..10de9d082eaeff9f24d1d8dae7a5e143ed699ec4 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/ranges.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/ranges.hpp @@ -1,12 +1,10 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_RANGES_HPP #define TAO_PEGTL_INTERNAL_RANGES_HPP -#include "../config.hpp" - #include <utility> #include "bump_help.hpp" @@ -15,6 +13,7 @@ #include "one.hpp" #include "range.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal @@ -36,7 +35,7 @@ namespace TAO_PEGTL_NAMESPACE::internal using subs_t = empty_list; template< std::size_t... Is > - [[nodiscard]] static constexpr bool test( std::index_sequence< Is... > /*unused*/, const data_t c ) noexcept + [[nodiscard]] static constexpr bool test_impl( std::index_sequence< Is... > /*unused*/, const data_t c ) noexcept { constexpr const data_t cs[] = { Cs... }; if constexpr( sizeof...( Cs ) % 2 == 0 ) { @@ -47,19 +46,21 @@ namespace TAO_PEGTL_NAMESPACE::internal } } - [[nodiscard]] static constexpr bool test( const data_t c ) noexcept + [[nodiscard]] static constexpr bool test_one( const data_t c ) noexcept { - return test( std::make_index_sequence< sizeof...( Cs ) / 2 >(), c ); + return test_impl( std::make_index_sequence< sizeof...( Cs ) / 2 >(), c ); } - template< int Eol > - static constexpr bool can_match_eol = test( Eol ); + [[nodiscard]] static constexpr bool test_any( const data_t c ) noexcept + { + return test_impl( std::make_index_sequence< sizeof...( Cs ) / 2 >(), c ); + } template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) ) { if( const auto t = Peek::peek( in ) ) { - if( test( t.data ) ) { + if( test_one( t.data ) ) { bump_help< ranges >( in, t.size ); return true; } diff --git a/packages/PEGTL/include/tao/pegtl/internal/file_reader.hpp b/packages/PEGTL/include/tao/pegtl/internal/read_file_stdio.hpp similarity index 63% rename from packages/PEGTL/include/tao/pegtl/internal/file_reader.hpp rename to packages/PEGTL/include/tao/pegtl/internal/read_file_stdio.hpp index a842f4bd005724dea283075b7fbcca07c66b9b0d..afb08a67ee4e7062f7a6b6a98be599707085389e 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/file_reader.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/read_file_stdio.hpp @@ -1,9 +1,9 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) -#ifndef TAO_PEGTL_INTERNAL_FILE_READER_HPP -#define TAO_PEGTL_INTERNAL_FILE_READER_HPP +#ifndef TAO_PEGTL_INTERNAL_READ_FILE_STDIO_HPP +#define TAO_PEGTL_INTERNAL_READ_FILE_STDIO_HPP #include <cstdio> #include <memory> @@ -14,13 +14,14 @@ #include <exception> #endif -#include "../config.hpp" - #include "filesystem.hpp" +#include "resize_uninitialized.hpp" + +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { - [[nodiscard]] inline std::FILE* file_open( const internal::filesystem::path& path ) + [[nodiscard]] inline std::FILE* read_file_open( const internal::filesystem::path& path ) { errno = 0; #if defined( _MSC_VER ) @@ -29,7 +30,7 @@ namespace TAO_PEGTL_NAMESPACE::internal return file; } #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "_wfopen_s() failed", path, ec ); #else std::perror( "_wfopen_s() failed" ); @@ -45,7 +46,7 @@ namespace TAO_PEGTL_NAMESPACE::internal return file; } #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "std::fopen() failed", path, ec ); #else std::perror( "std::fopen() failed" ); @@ -54,7 +55,7 @@ namespace TAO_PEGTL_NAMESPACE::internal #endif } - struct file_close + struct read_file_close { void operator()( FILE* f ) const noexcept { @@ -62,25 +63,25 @@ namespace TAO_PEGTL_NAMESPACE::internal } }; - class file_reader + class read_file_stdio { public: - explicit file_reader( const internal::filesystem::path& path ) - : file_reader( file_open( path ), path ) + explicit read_file_stdio( const internal::filesystem::path& path ) + : read_file_stdio( read_file_open( path ), path ) {} - file_reader( FILE* file, const internal::filesystem::path& path ) // NOLINT(modernize-pass-by-value) + read_file_stdio( FILE* file, const internal::filesystem::path& path ) // NOLINT(modernize-pass-by-value) : m_path( path ), m_file( file ) {} - file_reader( const file_reader& ) = delete; - file_reader( file_reader&& ) = delete; + read_file_stdio( const read_file_stdio& ) = delete; + read_file_stdio( read_file_stdio&& ) = delete; - ~file_reader() = default; + ~read_file_stdio() = default; - file_reader& operator=( const file_reader& ) = delete; - file_reader& operator=( file_reader&& ) = delete; + read_file_stdio& operator=( const read_file_stdio& ) = delete; + read_file_stdio& operator=( read_file_stdio&& ) = delete; [[nodiscard]] std::size_t size() const { @@ -88,7 +89,7 @@ namespace TAO_PEGTL_NAMESPACE::internal if( std::fseek( m_file.get(), 0, SEEK_END ) != 0 ) { // LCOV_EXCL_START #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "std::fseek() failed [SEEK_END]", m_path, ec ); #else std::perror( "std::fseek() failed [SEEK_END]" ); @@ -101,7 +102,7 @@ namespace TAO_PEGTL_NAMESPACE::internal if( s < 0 ) { // LCOV_EXCL_START #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "std::ftell() failed", m_path, ec ); #else std::perror( "std::ftell() failed" ); @@ -113,7 +114,7 @@ namespace TAO_PEGTL_NAMESPACE::internal if( std::fseek( m_file.get(), 0, SEEK_SET ) != 0 ) { // LCOV_EXCL_START #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "std::fseek() failed [SEEK_SET]", m_path, ec ); #else std::perror( "std::fseek() failed [SEEK_SET]" ); @@ -121,18 +122,30 @@ namespace TAO_PEGTL_NAMESPACE::internal #endif // LCOV_EXCL_STOP } - return std::size_t( s ); + return static_cast< std::size_t >( s ); } - [[nodiscard]] std::string read() const + [[nodiscard]] std::string read_string() const { std::string nrv; - nrv.resize( size() ); + if( const std::size_t s = size(); s > 0 ) { + resize_uninitialized( nrv, s ); + read_impl( nrv.data(), nrv.size() ); + } + return nrv; + } + + private: + const internal::filesystem::path m_path; + const std::unique_ptr< std::FILE, read_file_close > m_file; + + void read_impl( void* buffer, const std::size_t length ) const + { errno = 0; - if( !nrv.empty() && ( std::fread( &nrv[ 0 ], nrv.size(), 1, m_file.get() ) != 1 ) ) { + if( std::fread( buffer, length, 1, m_file.get() ) != 1 ) { // LCOV_EXCL_START #if defined( __cpp_exceptions ) - internal::error_code ec( errno, internal::system_category() ); + const internal::error_code ec( errno, internal::system_category() ); throw internal::filesystem::filesystem_error( "std::fread() failed", m_path, ec ); #else std::perror( "std::fread() failed" ); @@ -140,12 +153,7 @@ namespace TAO_PEGTL_NAMESPACE::internal #endif // LCOV_EXCL_STOP } - return nrv; } - - private: - const internal::filesystem::path m_path; - const std::unique_ptr< std::FILE, file_close > m_file; }; } // namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/rematch.hpp b/packages/PEGTL/include/tao/pegtl/internal/rematch.hpp index 4877a3401e6d9f81d8b29159f1742f15dd6608dc..e5f8ac6fb8b1ef81772ca8eeadf9fdb8b555cb53 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/rematch.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/rematch.hpp @@ -1,15 +1,14 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_REMATCH_HPP #define TAO_PEGTL_INTERNAL_REMATCH_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../memory_input.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -55,10 +54,10 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template mark< rewind_mode::required >(); + auto m = in.template auto_rewind< rewind_mode::required >(); if( Control< Head >::template match< A, rewind_mode::active, Action, Control >( in, st... ) ) { - memory_input< ParseInput::tracking_mode_v, typename ParseInput::eol_t, typename ParseInput::source_t > i2( m.iterator(), in.current(), in.source() ); + memory_input< ParseInput::tracking_mode_v, typename ParseInput::eol_t, typename ParseInput::source_t > i2( m.frobnicator(), in.current(), in.source() ); return m( ( Control< Rule >::template match< A, rewind_mode::active, Action, Control >( i2, st... ) && ... && ( i2.restart( m ), Control< Rules >::template match< A, rewind_mode::active, Action, Control >( i2, st... ) ) ) ); } return false; diff --git a/packages/PEGTL/include/tao/pegtl/internal/rep.hpp b/packages/PEGTL/include/tao/pegtl/internal/rep.hpp index 79a2be78917f73779e906b0e9c36b1dc552ab8c4..8a16fec0d0137f8df6007f7a441edaf9fe8bdebb 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/rep.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/rep.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_REP_HPP #define TAO_PEGTL_INTERNAL_REP_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -48,7 +47,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); using m_t = decltype( m ); for( unsigned i = 0; i != Cnt; ++i ) { diff --git a/packages/PEGTL/include/tao/pegtl/internal/rep_min.hpp b/packages/PEGTL/include/tao/pegtl/internal/rep_min.hpp index a6efe9e6734f44152544c4fc5ad8111ec662c21e..e368f8af037ea7cb955bcbd861ce7610dbecfce7 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/rep_min.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/rep_min.hpp @@ -1,16 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_REP_MIN_HPP #define TAO_PEGTL_INTERNAL_REP_MIN_HPP -#include "../config.hpp" - #include "rep.hpp" #include "seq.hpp" #include "star.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< unsigned Min, typename Rule, typename... Rules > diff --git a/packages/PEGTL/include/tao/pegtl/internal/rep_min_max.hpp b/packages/PEGTL/include/tao/pegtl/internal/rep_min_max.hpp index b0026458efa40eb655aeac6f2dede2ab7111836c..562bccd26be957bd23f4f74c0103c146e198dde5 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/rep_min_max.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/rep_min_max.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,14 +7,13 @@ #include <type_traits> -#include "../config.hpp" - #include "enable_control.hpp" #include "failure.hpp" #include "not_at.hpp" #include "seq.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -57,7 +56,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); using m_t = decltype( m ); for( unsigned i = 0; i != Min; ++i ) { diff --git a/packages/PEGTL/include/tao/pegtl/internal/rep_opt.hpp b/packages/PEGTL/include/tao/pegtl/internal/rep_opt.hpp index bea26e5be97d4ff612e2c68b6e19c22d21094009..55f22308d61bed9c520827e5d4d0a06aecf7ae4e 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/rep_opt.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/rep_opt.hpp @@ -1,17 +1,16 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_REP_OPT_HPP #define TAO_PEGTL_INTERNAL_REP_OPT_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/require.hpp b/packages/PEGTL/include/tao/pegtl/internal/require.hpp index b4e24fb158c13e5bc4c3b697e8e58f2c5c20be3f..f30de0d21f22c50175da3c882b2b200d33101b64 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/require.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/require.hpp @@ -1,15 +1,14 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_REQUIRE_HPP #define TAO_PEGTL_INTERNAL_REQUIRE_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "success.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/resize_uninitialized.hpp b/packages/PEGTL/include/tao/pegtl/internal/resize_uninitialized.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7046b7a3a311d50b018acea72885d1f446f7fc03 --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/resize_uninitialized.hpp @@ -0,0 +1,124 @@ +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_RESIZE_UNINITIALIZED_HPP +#define TAO_PEGTL_INTERNAL_RESIZE_UNINITIALIZED_HPP + +#include <cstddef> +#include <string> + +#include "../config.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + // the below uses a hack to call private member functions of a class, described here: + // https://github.com/facebook/folly/blob/master/folly/memory/UninitializedMemoryHacks.h + + namespace // NOLINT(google-build-namespaces) + { + // declare some functions... + void resize_uninitialized_proxy( std::string& v, const std::size_t n ); + void resize_uninitialized_proxy( std::basic_string< unsigned char >& v, const std::size_t n ); + void resize_uninitialized_proxy( std::basic_string< std::byte >& v, const std::size_t n ); + +#if defined( _LIBCPP_STRING ) + + // ...create a proxy to generate the actual implementation of the above function... + template< typename T, void ( T::*F )( std::size_t ) > + struct proxy + { + // ...define the function declared above... + friend void resize_uninitialized_proxy( T& v, const std::size_t n ) + { + ( v.*F )( n ); // v.__set_size( n ); + v[ v.size() ] = typename T::value_type( 0 ); + } + }; + + // ...and here's the actual "trick": an explicit template instantiation skips the access checks, + // so you can reference private members and forward them to the above proxy! + template struct proxy< std::string, &std::string::__set_size >; + template struct proxy< std::basic_string< unsigned char >, &std::basic_string< unsigned char >::__set_size >; + template struct proxy< std::basic_string< std::byte >, &std::basic_string< std::byte >::__set_size >; + +#elif defined( _GLIBCXX_STRING ) && _GLIBCXX_USE_CXX11_ABI + + template< typename T, void ( T::*F )( std::size_t ) > + struct proxy + { + friend void resize_uninitialized_proxy( T& v, const std::size_t n ) + { + ( v.*F )( n ); // v._M_set_length( n ); + } + }; + + template struct proxy< std::string, &std::string::_M_set_length >; + template struct proxy< std::basic_string< unsigned char >, &std::basic_string< unsigned char >::_M_set_length >; + template struct proxy< std::basic_string< std::byte >, &std::basic_string< std::byte >::_M_set_length >; + +#elif defined( _GLIBCXX_STRING ) + + template< typename T, + typename R, + R* ( T::*F )() const > + struct proxy + { + friend void resize_uninitialized_proxy( T& v, const std::size_t n ) + { + // v._M_rep()->_M_set_length_and_sharable( n ); + ( v.*F )()->_M_set_length_and_sharable( n ); + } + }; + + template struct proxy< std::string, + std::string::_Rep, + &std::string::_M_rep >; + + template struct proxy< std::basic_string< unsigned char >, + std::basic_string< unsigned char >::_Rep, + &std::basic_string< unsigned char >::_M_rep >; + + template struct proxy< std::basic_string< std::byte >, + std::basic_string< std::byte >::_Rep, + &std::basic_string< std::byte >::_M_rep >; + +#elif defined( _MSC_VER ) + + template< typename T, void ( T::*F )( std::size_t ) > + struct proxy + { + friend void resize_uninitialized_proxy( T& v, const std::size_t n ) + { + ( v.*F )( n ); // v._Eos( n ); + } + }; + + template struct proxy< std::string, &std::string::_Eos >; + template struct proxy< std::basic_string< unsigned char >, &std::basic_string< unsigned char >::_Eos >; + template struct proxy< std::basic_string< std::byte >, &std::basic_string< std::byte >::_Eos >; + +#else +#error "No implementation for resize_uninitialized available." +#endif + + } // namespace + + template< typename T > + void resize_uninitialized( std::basic_string< T >& v, const std::size_t n ) + { + if( n <= v.size() ) { + v.resize( n ); + } + else { + // careful not to call reserve() unless necessary, as it causes shrink_to_fit() on many platforms + if( n > v.capacity() ) { + v.reserve( n ); + } + internal::resize_uninitialized_proxy( v, n ); + } + } + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/result_on_found.hpp b/packages/PEGTL/include/tao/pegtl/internal/result_on_found.hpp index df2bcd77b0e9a3d9c97783d456c0e1dd0aed0e6c..967c4427b667a123c65cf3867bf580f6fe70d523 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/result_on_found.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/result_on_found.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/internal/rewind_guard.hpp b/packages/PEGTL/include/tao/pegtl/internal/rewind_guard.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8c4a6461ac1f5c21f1f6af0aa2b8eba51f935e0c --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/rewind_guard.hpp @@ -0,0 +1,86 @@ +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_REWIND_GUARD_HPP +#define TAO_PEGTL_INTERNAL_REWIND_GUARD_HPP + +#include <type_traits> +#include <utility> + +#include "../config.hpp" +#include "../rewind_mode.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + template< rewind_mode M, typename ParseInput > + class [[nodiscard]] rewind_guard + { + public: + static constexpr rewind_mode next_rewind_mode = M; + + explicit rewind_guard( ParseInput* /*unused*/ ) noexcept + {} + + rewind_guard( const rewind_guard& ) = delete; + rewind_guard( rewind_guard&& ) = delete; + + ~rewind_guard() = default; + + rewind_guard& operator=( const rewind_guard& ) = delete; + rewind_guard& operator=( rewind_guard&& ) = delete; + + [[nodiscard]] bool operator()( const bool result ) const noexcept + { + return result; + } + }; + + template< typename ParseInput > + class [[nodiscard]] rewind_guard< rewind_mode::required, ParseInput > + { + public: + static constexpr rewind_mode next_rewind_mode = rewind_mode::active; + + using rewind_data = std::decay_t< decltype( std::declval< ParseInput >().rewind_save() ) >; + + explicit rewind_guard( ParseInput* in ) noexcept + : m_input( in ), + m_saved( in->rewind_save() ) + {} + + rewind_guard( const rewind_guard& ) = delete; + rewind_guard( rewind_guard&& ) = delete; + + ~rewind_guard() + { + if( m_input != nullptr ) { + m_input->rewind_restore( std::move( m_saved ) ); + } + } + + rewind_guard& operator=( const rewind_guard& ) = delete; + rewind_guard& operator=( rewind_guard&& ) = delete; + + [[nodiscard]] bool operator()( const bool result ) noexcept + { + if( result ) { + m_input = nullptr; + return true; + } + return false; + } + + [[nodiscard]] const rewind_data& frobnicator() const noexcept + { + return m_saved; + } + + private: + ParseInput* m_input; + rewind_data m_saved; + }; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/rules.hpp b/packages/PEGTL/include/tao/pegtl/internal/rules.hpp index 2f89826f167b17fdb77da2a21e20ea930c42925f..5a53bcf498ab5f497a46ed2c0291724ed2bca42a 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/rules.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/rules.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -21,6 +21,7 @@ #include "eof.hpp" #include "eol.hpp" #include "eolf.hpp" +#include "everything.hpp" #include "failure.hpp" #include "identifier.hpp" #include "if_apply.hpp" @@ -35,6 +36,7 @@ #include "opt.hpp" #include "pad.hpp" #include "pad_opt.hpp" +#include "partial.hpp" #include "plus.hpp" #include "range.hpp" #include "ranges.hpp" @@ -47,7 +49,10 @@ #include "seq.hpp" #include "sor.hpp" #include "star.hpp" +#include "star_partial.hpp" +#include "star_strict.hpp" #include "state.hpp" +#include "strict.hpp" #include "string.hpp" #include "success.hpp" #include "until.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/seq.hpp b/packages/PEGTL/include/tao/pegtl/internal/seq.hpp index eb0a8624d7eea11ef11996f3885dff7092d6197a..277b6d9bbd78b61f5309f4ec4049f8f6990db95b 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/seq.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/seq.hpp @@ -1,16 +1,15 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_SEQ_HPP #define TAO_PEGTL_INTERNAL_SEQ_HPP -#include "../config.hpp" - #include "enable_control.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -44,7 +43,7 @@ namespace TAO_PEGTL_NAMESPACE::internal return Control< Rules... >::template match< A, M, Action, Control >( in, st... ); } else { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); using m_t = decltype( m ); return m( ( Control< Rules >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) && ... ) ); } diff --git a/packages/PEGTL/include/tao/pegtl/internal/sor.hpp b/packages/PEGTL/include/tao/pegtl/internal/sor.hpp index b09d6779c0cd781257028754012ab5f116afb35b..c153adf1420bef5d11d7ab9e9f088d5a4c543d64 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/sor.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/sor.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,12 +7,11 @@ #include <utility> -#include "../config.hpp" - #include "enable_control.hpp" #include "failure.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/star.hpp b/packages/PEGTL/include/tao/pegtl/internal/star.hpp index bc2360bf759b911ef7c27b74f9423fdbbb142a45..693cb28fe4603e41ceefa59586c3d5fd2b015942 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/star.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/star.hpp @@ -1,20 +1,15 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_STAR_HPP #define TAO_PEGTL_INTERNAL_STAR_HPP -#include <type_traits> - -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" +#include "star_partial.hpp" -#include "../apply_mode.hpp" -#include "../rewind_mode.hpp" -#include "../type_list.hpp" +#include "../config.hpp" namespace TAO_PEGTL_NAMESPACE::internal { @@ -25,24 +20,9 @@ namespace TAO_PEGTL_NAMESPACE::internal template< typename Rule > struct star< Rule > + : star_partial< Rule > { using rule_t = star; - using subs_t = type_list< Rule >; - - template< apply_mode A, - rewind_mode, - template< typename... > - class Action, - template< typename... > - class Control, - typename ParseInput, - typename... States > - [[nodiscard]] static bool match( ParseInput& in, States&&... st ) - { - while( Control< Rule >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { - } - return true; - } }; template< typename Rule, typename... Rules > diff --git a/packages/PEGTL/include/tao/pegtl/internal/star_must.hpp b/packages/PEGTL/include/tao/pegtl/internal/star_must.hpp index 8dff5771bef509bce1fb6634aea0f75006b89f7e..65474be3583a8d1755ca56a918b2a12cc7ee10d6 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/star_must.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/star_must.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,11 +9,11 @@ #error "Exception support required for tao/pegtl/internal/star_must.hpp" #else -#include "../config.hpp" - #include "if_must.hpp" #include "star.hpp" +#include "../config.hpp" + namespace TAO_PEGTL_NAMESPACE::internal { template< typename Cond, typename... Rules > diff --git a/packages/PEGTL/include/tao/pegtl/internal/star_partial.hpp b/packages/PEGTL/include/tao/pegtl/internal/star_partial.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dbe1e04d2f3bdaca7c9945ed1b6b6d763ff45b05 --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/star_partial.hpp @@ -0,0 +1,44 @@ +// Copyright (c) 2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_STAR_PARTIAL_HPP +#define TAO_PEGTL_INTERNAL_STAR_PARTIAL_HPP + +#include "enable_control.hpp" + +#include "../apply_mode.hpp" +#include "../config.hpp" +#include "../rewind_mode.hpp" +#include "../type_list.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + template< typename... Rules > + struct star_partial + { + using rule_t = star_partial; + using subs_t = type_list< Rules... >; + + template< apply_mode A, + rewind_mode, + template< typename... > + class Action, + template< typename... > + class Control, + typename ParseInput, + typename... States > + [[nodiscard]] static bool match( ParseInput& in, States&&... st ) + { + while( ( Control< Rules >::template match< A, rewind_mode::required, Action, Control >( in, st... ) && ... ) ) { + } + return true; + } + }; + + template< typename... Rules > + inline constexpr bool enable_control< star_partial< Rules... > > = false; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/star_strict.hpp b/packages/PEGTL/include/tao/pegtl/internal/star_strict.hpp new file mode 100644 index 0000000000000000000000000000000000000000..633104ed60a8d48a19f1bb7cb5632bd94a812d7e --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/star_strict.hpp @@ -0,0 +1,52 @@ +// Copyright (c) 2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_STAR_STRICT_HPP +#define TAO_PEGTL_INTERNAL_STAR_STRICT_HPP + +#include "enable_control.hpp" +#include "seq.hpp" + +#include "../apply_mode.hpp" +#include "../config.hpp" +#include "../rewind_mode.hpp" +#include "../type_list.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + template< typename Rule, typename... Rules > + struct star_strict + { + using rule_t = star_strict; + using subs_t = type_list< Rule, Rules... >; + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename ParseInput, + typename... States > + [[nodiscard]] static bool match( ParseInput& in, States&&... st ) + { + auto m = in.template auto_rewind< M >(); + using m_t = decltype( m ); + + while( Control< Rule >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { + if( Control< seq< Rules... > >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) ) { + continue; + } + return m( false ); + } + return m( true ); + } + }; + + template< typename... Rules > + inline constexpr bool enable_control< star_strict< Rules... > > = false; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/state.hpp b/packages/PEGTL/include/tao/pegtl/internal/state.hpp index 4ed8d22c859b10782101168cb60320d8da5047d0..ddfbad33a8c3c1f6dc29bd49f8ec3a7d8c9bc40f 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/state.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/state.hpp @@ -1,12 +1,10 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_STATE_HPP #define TAO_PEGTL_INTERNAL_STATE_HPP -#include "../config.hpp" - #include <type_traits> #include "dependent_false.hpp" @@ -15,6 +13,7 @@ #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" diff --git a/packages/PEGTL/include/tao/pegtl/internal/strict.hpp b/packages/PEGTL/include/tao/pegtl/internal/strict.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a4c0ba44f0d3b00c7d88752a3efa496e5daaadf3 --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/strict.hpp @@ -0,0 +1,52 @@ +// Copyright (c) 2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_STRICT_HPP +#define TAO_PEGTL_INTERNAL_STRICT_HPP + +#include "enable_control.hpp" +#include "seq.hpp" + +#include "../apply_mode.hpp" +#include "../config.hpp" +#include "../rewind_mode.hpp" +#include "../type_list.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + template< typename Rule, typename... Rules > + struct strict + { + using rule_t = strict; + using subs_t = type_list< Rule, Rules... >; + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename ParseInput, + typename... States > + [[nodiscard]] static bool match( ParseInput& in, States&&... st ) + { + auto m = in.template auto_rewind< M >(); + using m_t = decltype( m ); + + if( Control< Rule >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { + if( Control< seq< Rules... > >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) ) { + return m( true ); + } + return m( false ); + } + return m( true ); + } + }; + + template< typename... Rules > + inline constexpr bool enable_control< strict< Rules... > > = false; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/internal/string.hpp b/packages/PEGTL/include/tao/pegtl/internal/string.hpp index 4ad5fcb548ef922fa21b4e3353d9d7eda83d53d1..9fadadaaa8c8d7cf1156900687421e4a696e25da 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/string.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/string.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,14 +8,13 @@ #include <cstring> #include <utility> -#include "../config.hpp" - #include "bump_help.hpp" #include "enable_control.hpp" #include "one.hpp" #include "result_on_found.hpp" #include "success.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal @@ -44,8 +43,16 @@ namespace TAO_PEGTL_NAMESPACE::internal using rule_t = string; using subs_t = empty_list; - template< int Eol > - static constexpr bool can_match_eol = one< result_on_found::success, peek_char, Cs... >::template can_match_eol< Eol >; + [[nodiscard]] static constexpr bool test_one( const char c ) noexcept + { + static_assert( sizeof...( Cs ) == 1 ); + return one< result_on_found::success, peek_char, Cs... >::test_one( c ); + } + + [[nodiscard]] static constexpr bool test_any( const char c ) noexcept + { + return one< result_on_found::success, peek_char, Cs... >::test_one( c ); + } template< typename ParseInput > [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( in.size( 0 ) ) ) diff --git a/packages/PEGTL/include/tao/pegtl/internal/success.hpp b/packages/PEGTL/include/tao/pegtl/internal/success.hpp index 706122bd578b2e98ae425d563556e5bbc91addd3..ea98b13d36d0a714b721ab87ea4ea6dcf58b51aa 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/success.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/success.hpp @@ -1,14 +1,13 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_SUCCESS_HPP #define TAO_PEGTL_INTERNAL_SUCCESS_HPP -#include "../config.hpp" - #include "enable_control.hpp" +#include "../config.hpp" #include "../type_list.hpp" namespace TAO_PEGTL_NAMESPACE::internal diff --git a/packages/PEGTL/include/tao/pegtl/internal/try_catch_type.hpp b/packages/PEGTL/include/tao/pegtl/internal/try_catch_type.hpp index ebeb3de01e3ede936f55682d9984f4616a26e930..f61a9ae9700c42fe6e7e5962da86bd833deb2a88 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/try_catch_type.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/try_catch_type.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -11,13 +11,12 @@ #include <type_traits> -#include "../config.hpp" - #include "enable_control.hpp" #include "seq.hpp" #include "success.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -49,7 +48,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); using m_t = decltype( m ); try { diff --git a/packages/PEGTL/include/tao/pegtl/internal/until.hpp b/packages/PEGTL/include/tao/pegtl/internal/until.hpp index b6efd3a18a963feae054cae9f05e363bb96145ba..f2b9a788281982d150644277536f71c911149bad 100644 --- a/packages/PEGTL/include/tao/pegtl/internal/until.hpp +++ b/packages/PEGTL/include/tao/pegtl/internal/until.hpp @@ -1,12 +1,10 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_INTERNAL_UNTIL_HPP #define TAO_PEGTL_INTERNAL_UNTIL_HPP -#include "../config.hpp" - #include "bytes.hpp" #include "enable_control.hpp" #include "eof.hpp" @@ -15,6 +13,7 @@ #include "star.hpp" #include "../apply_mode.hpp" +#include "../config.hpp" #include "../rewind_mode.hpp" #include "../type_list.hpp" @@ -41,7 +40,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { if( in.empty() ) { @@ -69,7 +68,7 @@ namespace TAO_PEGTL_NAMESPACE::internal typename... States > [[nodiscard]] static bool match( ParseInput& in, States&&... st ) { - auto m = in.template mark< M >(); + auto m = in.template auto_rewind< M >(); using m_t = decltype( m ); while( !Control< Cond >::template match< A, rewind_mode::required, Action, Control >( in, st... ) ) { diff --git a/packages/PEGTL/include/tao/pegtl/internal/unwind_guard.hpp b/packages/PEGTL/include/tao/pegtl/internal/unwind_guard.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d02e06f3c9b8c6b31dcd150b00a9fbbf780b1367 --- /dev/null +++ b/packages/PEGTL/include/tao/pegtl/internal/unwind_guard.hpp @@ -0,0 +1,40 @@ +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#ifndef TAO_PEGTL_INTERNAL_UNWIND_GUARD_HPP +#define TAO_PEGTL_INTERNAL_UNWIND_GUARD_HPP + +#include <optional> +#include <utility> + +#include "../config.hpp" + +namespace TAO_PEGTL_NAMESPACE::internal +{ + template< typename Unwind > + struct unwind_guard + { + explicit unwind_guard( Unwind&& unwind_impl ) + : unwind( std::move( unwind_impl ) ) + {} + + ~unwind_guard() + { + if( unwind ) { + ( *unwind )(); + } + } + + unwind_guard( const unwind_guard& ) = delete; + unwind_guard( unwind_guard&& ) noexcept = delete; + + unwind_guard& operator=( const unwind_guard& ) = delete; + unwind_guard& operator=( unwind_guard&& ) noexcept = delete; + + std::optional< Unwind > unwind; + }; + +} // namespace TAO_PEGTL_NAMESPACE::internal + +#endif diff --git a/packages/PEGTL/include/tao/pegtl/istream_input.hpp b/packages/PEGTL/include/tao/pegtl/istream_input.hpp index f37c1bc9653bddfaffaa5656d8e33914b1072278..a020734ce19c3b4e24a41327cce9152664cbd60c 100644 --- a/packages/PEGTL/include/tao/pegtl/istream_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/istream_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/match.hpp b/packages/PEGTL/include/tao/pegtl/match.hpp index ad42582286d1a1e2364d302a60dec8a2aba9aa9a..f4c953f2458bd15fb62ada87ff0465a8e313870f 100644 --- a/packages/PEGTL/include/tao/pegtl/match.hpp +++ b/packages/PEGTL/include/tao/pegtl/match.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -17,9 +17,10 @@ #include "internal/has_apply.hpp" #include "internal/has_apply0.hpp" #include "internal/has_unwind.hpp" -#include "internal/marker.hpp" #include "internal/missing_apply.hpp" #include "internal/missing_apply0.hpp" +#include "internal/rewind_guard.hpp" +#include "internal/unwind_guard.hpp" #if defined( _MSC_VER ) #pragma warning( push ) @@ -73,13 +74,12 @@ namespace TAO_PEGTL_NAMESPACE { #if defined( __cpp_exceptions ) if constexpr( has_unwind< Control< Rule >, void, const ParseInput&, States... > ) { - try { - return match_no_control< Rule, A, M, Action, Control >( in, st... ); - } - catch( ... ) { + unwind_guard ug( [ & ] { Control< Rule >::unwind( static_cast< const ParseInput& >( in ), st... ); - throw; - } + } ); + const auto result = match_no_control< Rule, A, M, Action, Control >( in, st... ); + ug.unwind.reset(); + return result; } else { return match_no_control< Rule, A, M, Action, Control >( in, st... ); @@ -108,9 +108,9 @@ namespace TAO_PEGTL_NAMESPACE else { constexpr bool enable_action = ( A == apply_mode::action ); - using iterator_t = typename ParseInput::iterator_t; - constexpr bool has_apply_void = enable_action && internal::has_apply< Control< Rule >, void, Action, const iterator_t&, const ParseInput&, States... >; - constexpr bool has_apply_bool = enable_action && internal::has_apply< Control< Rule >, bool, Action, const iterator_t&, const ParseInput&, States... >; + using frobnicator_t = typename ParseInput::frobnicator_t; + constexpr bool has_apply_void = enable_action && internal::has_apply< Control< Rule >, void, Action, const frobnicator_t&, const ParseInput&, States... >; + constexpr bool has_apply_bool = enable_action && internal::has_apply< Control< Rule >, bool, Action, const frobnicator_t&, const ParseInput&, States... >; constexpr bool has_apply = has_apply_void || has_apply_bool; constexpr bool has_apply0_void = enable_action && internal::has_apply0< Control< Rule >, void, Action, const ParseInput&, States... >; @@ -135,17 +135,17 @@ namespace TAO_PEGTL_NAMESPACE constexpr bool is_maybe_nothing = std::is_base_of_v< maybe_nothing, Action< Rule > >; static_assert( !enable_action || !validate_nothing || is_nothing || is_maybe_nothing || has_apply || has_apply0, "either apply() or apply0() must be defined" ); - constexpr bool use_marker = has_apply || has_apply0_bool; + constexpr bool use_guard = has_apply || has_apply0_bool; - auto m = in.template mark< ( use_marker ? rewind_mode::required : rewind_mode::dontcare ) >(); + auto m = in.template auto_rewind< ( use_guard ? rewind_mode::required : rewind_mode::dontcare ) >(); Control< Rule >::start( static_cast< const ParseInput& >( in ), st... ); - auto result = internal::match_control_unwind< Rule, A, ( use_marker ? rewind_mode::active : M ), Action, Control >( in, st... ); + auto result = internal::match_control_unwind< Rule, A, ( use_guard ? rewind_mode::active : M ), Action, Control >( in, st... ); if( result ) { if constexpr( has_apply_void ) { - Control< Rule >::template apply< Action >( m.iterator(), static_cast< const ParseInput& >( in ), st... ); + Control< Rule >::template apply< Action >( m.frobnicator(), static_cast< const ParseInput& >( in ), st... ); } else if constexpr( has_apply_bool ) { - result = Control< Rule >::template apply< Action >( m.iterator(), static_cast< const ParseInput& >( in ), st... ); + result = Control< Rule >::template apply< Action >( m.frobnicator(), static_cast< const ParseInput& >( in ), st... ); } else if constexpr( has_apply0_void ) { Control< Rule >::template apply0< Action >( static_cast< const ParseInput& >( in ), st... ); diff --git a/packages/PEGTL/include/tao/pegtl/memory_input.hpp b/packages/PEGTL/include/tao/pegtl/memory_input.hpp index c20887131eb2beff684f74217df55ea5c90f31b0..93702353f9dddb13f5617f2116b8b77ce0a5d521 100644 --- a/packages/PEGTL/include/tao/pegtl/memory_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/memory_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -25,8 +25,8 @@ #include "internal/at.hpp" #include "internal/bump.hpp" #include "internal/eolf.hpp" -#include "internal/iterator.hpp" -#include "internal/marker.hpp" +#include "internal/frobnicator.hpp" +#include "internal/rewind_guard.hpp" #include "internal/until.hpp" namespace TAO_PEGTL_NAMESPACE @@ -40,10 +40,10 @@ namespace TAO_PEGTL_NAMESPACE class memory_input_base< tracking_mode::eager, Eol, Source > { public: - using iterator_t = internal::iterator; + using frobnicator_t = internal::frobnicator; template< typename T > - memory_input_base( const iterator_t& in_begin, const char* in_end, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) + memory_input_base( const frobnicator_t& in_begin, const char* in_end, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) : m_begin( in_begin.data ), m_current( in_begin ), m_end( in_end ), @@ -111,7 +111,7 @@ namespace TAO_PEGTL_NAMESPACE internal::bump_to_next_line( m_current, in_count ); } - [[nodiscard]] TAO_PEGTL_NAMESPACE::position position( const iterator_t& it ) const + [[nodiscard]] TAO_PEGTL_NAMESPACE::position position( const frobnicator_t& it ) const { return TAO_PEGTL_NAMESPACE::position( it, m_source ); } @@ -130,7 +130,7 @@ namespace TAO_PEGTL_NAMESPACE protected: const char* const m_begin; - iterator_t m_current; + frobnicator_t m_current; const char* m_end; const Source m_source; @@ -142,10 +142,10 @@ namespace TAO_PEGTL_NAMESPACE class memory_input_base< tracking_mode::lazy, Eol, Source > { public: - using iterator_t = const char*; + using frobnicator_t = const char*; template< typename T > - memory_input_base( const internal::iterator& in_begin, const char* in_end, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) + memory_input_base( const internal::frobnicator& in_begin, const char* in_end, T&& in_source ) noexcept( std::is_nothrow_constructible_v< Source, T&& > ) : m_begin( in_begin ), m_current( in_begin.data ), m_end( in_end ), @@ -203,10 +203,10 @@ namespace TAO_PEGTL_NAMESPACE m_current += in_count; } - [[nodiscard]] TAO_PEGTL_NAMESPACE::position position( const iterator_t it ) const + [[nodiscard]] TAO_PEGTL_NAMESPACE::position position( const frobnicator_t it ) const { - internal::iterator c( m_begin ); - internal::bump( c, std::size_t( it - m_begin.data ), Eol::ch ); + internal::frobnicator c( m_begin ); + internal::bump( c, static_cast< std::size_t >( it - m_begin.data ), Eol::ch ); return TAO_PEGTL_NAMESPACE::position( c, m_source ); } @@ -217,8 +217,8 @@ namespace TAO_PEGTL_NAMESPACE } protected: - const internal::iterator m_begin; - iterator_t m_current; + const internal::frobnicator m_begin; + frobnicator_t m_current; const char* m_end; const Source m_source; @@ -238,7 +238,7 @@ namespace TAO_PEGTL_NAMESPACE using eol_t = Eol; using source_t = Source; - using typename internal::memory_input_base< P, Eol, Source >::iterator_t; + using typename internal::memory_input_base< P, Eol, Source >::frobnicator_t; using action_t = internal::action_input< memory_input >; @@ -305,29 +305,29 @@ namespace TAO_PEGTL_NAMESPACE return static_cast< std::uint8_t >( peek_char( offset ) ); } - [[nodiscard]] iterator_t& iterator() noexcept + [[nodiscard]] frobnicator_t& frobnicator() noexcept { return this->m_current; } - [[nodiscard]] const iterator_t& iterator() const noexcept + [[nodiscard]] const frobnicator_t& frobnicator() const noexcept { return this->m_current; } using internal::memory_input_base< P, Eol, Source >::restart; - template< rewind_mode M > - void restart( const internal::marker< iterator_t, M >& m ) noexcept + template< rewind_mode M, typename ParseInput > + void restart( const internal::rewind_guard< M, ParseInput >& m ) noexcept { - iterator() = m.iterator(); + this->m_current = m.frobnicator(); } using internal::memory_input_base< P, Eol, Source >::position; [[nodiscard]] TAO_PEGTL_NAMESPACE::position position() const { - return position( iterator() ); + return position( frobnicator() ); } void discard() const noexcept {} @@ -335,9 +335,19 @@ namespace TAO_PEGTL_NAMESPACE void require( const std::size_t /*unused*/ ) const noexcept {} template< rewind_mode M > - [[nodiscard]] internal::marker< iterator_t, M > mark() noexcept + [[nodiscard]] internal::rewind_guard< M, memory_input > auto_rewind() noexcept + { + return internal::rewind_guard< M, memory_input >( this ); + } + + [[nodiscard]] const frobnicator_t& rewind_save() noexcept + { + return this->m_current; + } + + void rewind_restore( const frobnicator_t& data ) noexcept { - return internal::marker< iterator_t, M >( iterator() ); + this->m_current = data; } [[nodiscard]] const char* at( const TAO_PEGTL_NAMESPACE::position& p ) const noexcept @@ -362,7 +372,7 @@ namespace TAO_PEGTL_NAMESPACE [[nodiscard]] std::string_view line_at( const TAO_PEGTL_NAMESPACE::position& p ) const noexcept { const char* b = begin_of_line( p ); - return std::string_view( b, static_cast< std::size_t >( end_of_line( p ) - b ) ); + return { b, static_cast< std::size_t >( end_of_line( p ) - b ) }; } void private_set_end( const char* new_end ) noexcept diff --git a/packages/PEGTL/include/tao/pegtl/mmap_input.hpp b/packages/PEGTL/include/tao/pegtl/mmap_input.hpp index 759ea7035521ff20aac72e5a8d0068f9c25c26fb..83f69158b4c6d4b682569395ecad35404ec59cec 100644 --- a/packages/PEGTL/include/tao/pegtl/mmap_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/mmap_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -13,49 +13,18 @@ #include "tracking_mode.hpp" #include "internal/filesystem.hpp" +#include "internal/mmap_file.hpp" #include "internal/path_to_string.hpp" -#if defined( __unix__ ) || ( defined( __APPLE__ ) && defined( __MACH__ ) ) -#include <unistd.h> // Required for _POSIX_MAPPED_FILES -#endif - -#if defined( _POSIX_MAPPED_FILES ) -#include "internal/file_mapper_posix.hpp" -#elif defined( _WIN32 ) -#include "internal/file_mapper_win32.hpp" -#else -#endif - namespace TAO_PEGTL_NAMESPACE { - namespace internal - { - struct mmap_holder - { - const file_mapper data; - - explicit mmap_holder( const internal::filesystem::path& path ) - : data( path ) - {} - - mmap_holder( const mmap_holder& ) = delete; - mmap_holder( mmap_holder&& ) = delete; - - ~mmap_holder() = default; - - mmap_holder& operator=( const mmap_holder& ) = delete; - mmap_holder& operator=( mmap_holder&& ) = delete; - }; - - } // namespace internal - template< tracking_mode P = tracking_mode::eager, typename Eol = eol::lf_crlf > struct mmap_input - : private internal::mmap_holder, + : private internal::mmap_file, public memory_input< P, Eol > { mmap_input( const internal::filesystem::path& path, const std::string& source ) - : internal::mmap_holder( path ), + : internal::mmap_file( path ), memory_input< P, Eol >( data.begin(), data.end(), source ) {} diff --git a/packages/PEGTL/include/tao/pegtl/must_if.hpp b/packages/PEGTL/include/tao/pegtl/must_if.hpp index 875e7e9c2a20e0a6c948dfcbeeba0f42e7ff4a4a..f53b045836dd93680e619701ef59721369d59a48 100644 --- a/packages/PEGTL/include/tao/pegtl/must_if.hpp +++ b/packages/PEGTL/include/tao/pegtl/must_if.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -14,6 +14,8 @@ #include "config.hpp" #include "normal.hpp" +#include "internal/has_error_message.hpp" + namespace TAO_PEGTL_NAMESPACE { namespace internal @@ -47,9 +49,6 @@ namespace TAO_PEGTL_NAMESPACE template< typename ParseInput, typename... States > [[noreturn]] static void raise( const ParseInput& in, [[maybe_unused]] States&&... st ) { - if constexpr( RequireMessage ) { - static_assert( Errors::template message< Rule > != nullptr ); - } if constexpr( Errors::template message< Rule > != nullptr ) { constexpr const char* p = Errors::template message< Rule >; throw parse_error( p, in ); @@ -58,6 +57,9 @@ namespace TAO_PEGTL_NAMESPACE #endif } else { + if constexpr( !internal::has_error_message< Rule > ) { + static_assert( !RequireMessage, "explicit error message required for Rule" ); + } Base< Rule >::raise( in, st... ); } } diff --git a/packages/PEGTL/include/tao/pegtl/normal.hpp b/packages/PEGTL/include/tao/pegtl/normal.hpp index bdbdd85eedf79a606db8a376c473e7a6ac9f47c5..d370d8c2fc747d215987a96bd76f82c309adc62a 100644 --- a/packages/PEGTL/include/tao/pegtl/normal.hpp +++ b/packages/PEGTL/include/tao/pegtl/normal.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -16,6 +16,7 @@ #include "rewind_mode.hpp" #include "internal/enable_control.hpp" +#include "internal/has_error_message.hpp" #include "internal/has_match.hpp" #if defined( __cpp_exceptions ) @@ -48,7 +49,12 @@ namespace TAO_PEGTL_NAMESPACE [[noreturn]] static void raise( const ParseInput& in, States&&... /*unused*/ ) { #if defined( __cpp_exceptions ) - throw parse_error( "parse error matching " + std::string( demangle< Rule >() ), in ); + if constexpr( internal::has_error_message< Rule > ) { + throw parse_error( Rule::error_message, in ); + } + else { + throw parse_error( "parse error matching " + std::string( demangle< Rule >() ), in ); + } #else static_assert( internal::dependent_false< Rule >, "exception support required for normal< Rule >::raise()" ); (void)in; @@ -57,10 +63,10 @@ namespace TAO_PEGTL_NAMESPACE } template< template< typename... > class Action, - typename Iterator, + typename Frobnicator, typename ParseInput, typename... States > - static auto apply( const Iterator& begin, const ParseInput& in, States&&... st ) noexcept( noexcept( Action< Rule >::apply( std::declval< const typename ParseInput::action_t& >(), st... ) ) ) + static auto apply( const Frobnicator& begin, const ParseInput& in, States&&... st ) noexcept( noexcept( Action< Rule >::apply( std::declval< const typename ParseInput::action_t& >(), st... ) ) ) -> decltype( Action< Rule >::apply( std::declval< const typename ParseInput::action_t& >(), st... ) ) { const typename ParseInput::action_t action_input( begin, in ); diff --git a/packages/PEGTL/include/tao/pegtl/nothing.hpp b/packages/PEGTL/include/tao/pegtl/nothing.hpp index 28b68f8449c09c81303f53d9a965aadcac05bf74..04754dc2fd1e9a63a701f2a5aae77106500a1e2e 100644 --- a/packages/PEGTL/include/tao/pegtl/nothing.hpp +++ b/packages/PEGTL/include/tao/pegtl/nothing.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/parse.hpp b/packages/PEGTL/include/tao/pegtl/parse.hpp index 962f3051a2bdc94af2efc7157ba5048e64714db0..da05d0a2150893c99997bc1d28125f43b4eb1fc3 100644 --- a/packages/PEGTL/include/tao/pegtl/parse.hpp +++ b/packages/PEGTL/include/tao/pegtl/parse.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -36,7 +36,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename... > class Action = nothing, template< typename... > class Control = normal, apply_mode A = apply_mode::action, - rewind_mode M = rewind_mode::required, + rewind_mode M = rewind_mode::dontcare, typename ParseInput, typename... States > auto parse( ParseInput&& in, States&&... st ) @@ -48,7 +48,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename... > class Action = nothing, template< typename... > class Control = normal, apply_mode A = apply_mode::action, - rewind_mode M = rewind_mode::required, + rewind_mode M = rewind_mode::dontcare, typename Outer, typename ParseInput, typename... States > diff --git a/packages/PEGTL/include/tao/pegtl/parse_error.hpp b/packages/PEGTL/include/tao/pegtl/parse_error.hpp index 6a0ad019510caf8aa95132f1766d3806b11f99c7..954e5717ace970cdb0e1003cc918ad17da2a56ae 100644 --- a/packages/PEGTL/include/tao/pegtl/parse_error.hpp +++ b/packages/PEGTL/include/tao/pegtl/parse_error.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/position.hpp b/packages/PEGTL/include/tao/pegtl/position.hpp index 78ed32c9f35db5355f4df69ea6f43beed440d1e8..af20a0d5511383159767cb6c31b461f81a2c786e 100644 --- a/packages/PEGTL/include/tao/pegtl/position.hpp +++ b/packages/PEGTL/include/tao/pegtl/position.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -13,7 +13,7 @@ #include "config.hpp" -#include "internal/iterator.hpp" +#include "internal/frobnicator.hpp" namespace TAO_PEGTL_NAMESPACE { @@ -21,35 +21,14 @@ namespace TAO_PEGTL_NAMESPACE { position() = delete; -#if defined( __GNUC__ ) && !defined( __clang__ ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif - position( position&& p ) noexcept - : byte( p.byte ), - line( p.line ), - column( p.column ), - source( std::move( p.source ) ) - {} -#if defined( __GNUC__ ) && !defined( __clang__ ) -#pragma GCC diagnostic pop -#endif - + position( position&& ) noexcept = default; position( const position& ) = default; - position& operator=( position&& p ) noexcept - { - byte = p.byte; - line = p.line; - column = p.column; - source = std::move( p.source ); - return *this; - } - + position& operator=( position&& p ) noexcept = default; position& operator=( const position& ) = default; template< typename T > - position( const internal::iterator& in_iter, T&& in_source ) + position( const internal::frobnicator& in_iter, T&& in_source ) : byte( in_iter.byte ), line( in_iter.line ), column( in_iter.column ), @@ -61,7 +40,7 @@ namespace TAO_PEGTL_NAMESPACE : byte( in_byte ), line( in_line ), column( in_column ), - source( in_source ) + source( std::forward< T >( in_source ) ) {} ~position() = default; @@ -72,12 +51,12 @@ namespace TAO_PEGTL_NAMESPACE std::string source; }; - inline bool operator==( const position& lhs, const position& rhs ) noexcept + [[nodiscard]] inline bool operator==( const position& lhs, const position& rhs ) noexcept { return ( lhs.byte == rhs.byte ) && ( lhs.source == rhs.source ); } - inline bool operator!=( const position& lhs, const position& rhs ) noexcept + [[nodiscard]] inline bool operator!=( const position& lhs, const position& rhs ) noexcept { return !( lhs == rhs ); } diff --git a/packages/PEGTL/include/tao/pegtl/read_input.hpp b/packages/PEGTL/include/tao/pegtl/read_input.hpp index adbad4ca0484f8aa3669e92948f4faa3bff023f5..b730aff8435cb7b2b2e4311445c8a48e6144faa8 100644 --- a/packages/PEGTL/include/tao/pegtl/read_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/read_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -12,9 +12,9 @@ #include "string_input.hpp" #include "tracking_mode.hpp" -#include "internal/file_reader.hpp" #include "internal/filesystem.hpp" #include "internal/path_to_string.hpp" +#include "internal/read_file_stdio.hpp" namespace TAO_PEGTL_NAMESPACE { @@ -23,7 +23,7 @@ namespace TAO_PEGTL_NAMESPACE : string_input< P, Eol > { read_input( const internal::filesystem::path& path, const std::string& source ) - : string_input< P, Eol >( internal::file_reader( path ).read(), source ) + : string_input< P, Eol >( internal::read_file_stdio( path ).read_string(), source ) {} explicit read_input( const internal::filesystem::path& path ) @@ -31,7 +31,7 @@ namespace TAO_PEGTL_NAMESPACE {} read_input( FILE* file, const internal::filesystem::path& path, const std::string& source ) - : string_input< P, Eol >( internal::file_reader( file, path ).read(), source ) + : string_input< P, Eol >( internal::read_file_stdio( file, path ).read_string(), source ) {} read_input( FILE* file, const internal::filesystem::path& path ) diff --git a/packages/PEGTL/include/tao/pegtl/require_apply.hpp b/packages/PEGTL/include/tao/pegtl/require_apply.hpp index 7eaa5cc07bc2d85f5ed8d3037b03e8200d8110d1..b574cb3a25da7d832272537fc98dd4fde8ad50fc 100644 --- a/packages/PEGTL/include/tao/pegtl/require_apply.hpp +++ b/packages/PEGTL/include/tao/pegtl/require_apply.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/require_apply0.hpp b/packages/PEGTL/include/tao/pegtl/require_apply0.hpp index a20f0a21085a4db72278511ecc1b2df93c3dc936..fbbf59f8231cde44af1d6278404e8115fd7569be 100644 --- a/packages/PEGTL/include/tao/pegtl/require_apply0.hpp +++ b/packages/PEGTL/include/tao/pegtl/require_apply0.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/rewind_mode.hpp b/packages/PEGTL/include/tao/pegtl/rewind_mode.hpp index b97cbcfaf4e53593c7390b2170c22eb11226371e..e51a4281ea42dba18e91967eb3b53c10b423986c 100644 --- a/packages/PEGTL/include/tao/pegtl/rewind_mode.hpp +++ b/packages/PEGTL/include/tao/pegtl/rewind_mode.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/rules.hpp b/packages/PEGTL/include/tao/pegtl/rules.hpp index 59d73c742fae9131514ecd01aa421a71a3191ba5..9e4c111e1decf4847f649d3c7395dc26243b5b59 100644 --- a/packages/PEGTL/include/tao/pegtl/rules.hpp +++ b/packages/PEGTL/include/tao/pegtl/rules.hpp @@ -1,10 +1,12 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_RULES_HPP #define TAO_PEGTL_RULES_HPP +#include <cstddef> + #include "config.hpp" #include "parse_error.hpp" @@ -26,6 +28,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename... Rules > struct enable : internal::enable< Rules... > {}; struct eof : internal::eof {}; struct eolf : internal::eolf {}; + struct everything : internal::everything< std::size_t > {}; struct failure : internal::failure {}; template< typename Rule, typename... Actions > struct if_apply : internal::if_apply< Rule, Actions... > {}; template< typename Cond, typename Then, typename Else > struct if_then_else : internal::if_then_else< Cond, Then, Else > {}; @@ -38,6 +41,7 @@ namespace TAO_PEGTL_NAMESPACE template< typename... Rules > struct opt : internal::opt< Rules... > {}; template< typename Rule, typename Pad1, typename Pad2 = Pad1 > struct pad : internal::pad< Rule, Pad1, Pad2 > {}; template< typename Rule, typename Pad > struct pad_opt : internal::pad_opt< Rule, Pad > {}; + template< typename Rule, typename... Rules > struct partial : internal::partial< Rule, Rules... > {}; template< typename Rule, typename... Rules > struct plus : internal::plus< Rule, Rules... > {}; template< typename Head, typename... Rules > struct rematch : internal::rematch< Head, Rules... > {}; template< unsigned Num, typename... Rules > struct rep : internal::rep< Num, Rules... > {}; @@ -49,7 +53,10 @@ namespace TAO_PEGTL_NAMESPACE template< typename... Rules > struct seq : internal::seq< Rules... > {}; template< typename... Rules > struct sor : internal::sor< Rules... > {}; template< typename Rule, typename... Rules > struct star : internal::star< Rule, Rules... > {}; + template< typename Rule, typename... Rules > struct star_partial : internal::star_partial< Rule, Rules... > {}; + template< typename Rule, typename... Rules > struct star_strict : internal::star_strict< Rule, Rules... > {}; template< typename State, typename... Rules > struct state : internal::state< State, Rules... > {}; + template< typename Rule, typename... Rules > struct strict : internal::strict< Rule, Rules... > {}; struct success : internal::success {}; template< typename Cond, typename... Rules > struct until : internal::until< Cond, Rules... > {}; @@ -61,6 +68,9 @@ namespace TAO_PEGTL_NAMESPACE template< typename... Rules > struct must : internal::must< Rules... > {}; template< typename Cond, typename... Rules > struct opt_must : internal::if_must< true, Cond, Rules... > {}; template< typename Exception > struct raise : internal::raise< Exception > {}; + template< char... Cs > struct raise_message : internal::raise< raise_message< Cs... > > { + static constexpr const char error_message[] = { Cs..., 0 }; + }; template< typename Cond, typename... Rules > struct star_must : internal::star_must< Cond, Rules... > {}; template< typename... Rules > struct try_catch : internal::try_catch_type< parse_error, Rules... > {}; template< typename Exception, typename... Rules > struct try_catch_type : internal::seq< internal::try_catch_type< Exception, Rules... > > {}; diff --git a/packages/PEGTL/include/tao/pegtl/string_input.hpp b/packages/PEGTL/include/tao/pegtl/string_input.hpp index f66ee24c8fb8ddd348efeb5393187852e6783274..91b66bef021939e81e3a690ded40ffe5f8be2e69 100644 --- a/packages/PEGTL/include/tao/pegtl/string_input.hpp +++ b/packages/PEGTL/include/tao/pegtl/string_input.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/tracking_mode.hpp b/packages/PEGTL/include/tao/pegtl/tracking_mode.hpp index 6e0f06b8fd5b74934c4a68d84502366eeaf639ad..a15e58d4346d702376c3f17fe52ebe3b83bf5f87 100644 --- a/packages/PEGTL/include/tao/pegtl/tracking_mode.hpp +++ b/packages/PEGTL/include/tao/pegtl/tracking_mode.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/type_list.hpp b/packages/PEGTL/include/tao/pegtl/type_list.hpp index f0704aabea50744da880609ee97aeb47eb8b41e2..3f30b0cad4dff0b79e38ca4162f3aae5598fb059 100644 --- a/packages/PEGTL/include/tao/pegtl/type_list.hpp +++ b/packages/PEGTL/include/tao/pegtl/type_list.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/utf8.hpp b/packages/PEGTL/include/tao/pegtl/utf8.hpp index 95b45ef49ccab20bb6a8b8bab23ad708104f4410..302b4b0ca5efb340c9250ed6b3710f9e5706754b 100644 --- a/packages/PEGTL/include/tao/pegtl/utf8.hpp +++ b/packages/PEGTL/include/tao/pegtl/utf8.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/include/tao/pegtl/version.hpp b/packages/PEGTL/include/tao/pegtl/version.hpp index 034954416633cf614672005f8047bd3b275a35d4..cc4023fd6c8af3097cb61315c5aa55ed8d5937cf 100644 --- a/packages/PEGTL/include/tao/pegtl/version.hpp +++ b/packages/PEGTL/include/tao/pegtl/version.hpp @@ -1,14 +1,14 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #ifndef TAO_PEGTL_VERSION_HPP #define TAO_PEGTL_VERSION_HPP -#define TAO_PEGTL_VERSION "3.3.0" +#define TAO_PEGTL_VERSION "4.0.0" -#define TAO_PEGTL_VERSION_MAJOR 3 -#define TAO_PEGTL_VERSION_MINOR 3 +#define TAO_PEGTL_VERSION_MAJOR 4 +#define TAO_PEGTL_VERSION_MINOR 0 #define TAO_PEGTL_VERSION_PATCH 0 #endif diff --git a/packages/PEGTL/include/tao/pegtl/visit.hpp b/packages/PEGTL/include/tao/pegtl/visit.hpp index 81ca6ac75cb151d9694b72f15b8f0196f66f1f52..4fa3a1380163d1bb87d82b1b408f731f81fe53ac 100644 --- a/packages/PEGTL/include/tao/pegtl/visit.hpp +++ b/packages/PEGTL/include/tao/pegtl/visit.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/CMakeLists.txt b/packages/PEGTL/src/example/pegtl/CMakeLists.txt index 236d365ddc71c1ce53e984963df5abd4c026765e..9fcabc707f20654bb6e8e9fd24a84f714ac84321 100644 --- a/packages/PEGTL/src/example/pegtl/CMakeLists.txt +++ b/packages/PEGTL/src/example/pegtl/CMakeLists.txt @@ -27,6 +27,7 @@ set(example_sources parse_tree.cpp parse_tree_user_state.cpp proto3.cpp + random_order.cpp recover.cpp s_expression.cpp sum.cpp diff --git a/packages/PEGTL/src/example/pegtl/abnf2pegtl.cpp b/packages/PEGTL/src/example/pegtl/abnf2pegtl.cpp index 3fd3b976941bb5c87770f31c33dbb46f14f886a1..dcdfd3548a4d2ee4f5e0bd8066db2e46f13cdfd2 100644 --- a/packages/PEGTL/src/example/pegtl/abnf2pegtl.cpp +++ b/packages/PEGTL/src/example/pegtl/abnf2pegtl.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -38,7 +38,7 @@ namespace TAO_PEGTL_NAMESPACE namespace { - std::string prefix = "tao::pegtl::"; + std::string prefix = "TAO_PEGTL_NAMESPACE::"; std::set< std::string > keywords = { "alignas", @@ -178,7 +178,7 @@ namespace TAO_PEGTL_NAMESPACE return v.substr( pos ); } - void shift( internal::iterator& it, int delta ) + void shift( internal::frobnicator& it, int delta ) { it.data += delta; it.byte += delta; diff --git a/packages/PEGTL/src/example/pegtl/analyze.cpp b/packages/PEGTL/src/example/pegtl/analyze.cpp index 8f7aa0057d4f51ff363936f6dfb70db07993dfa8..fae02a098eaa54340a045665701401b5cc703b80 100644 --- a/packages/PEGTL/src/example/pegtl/analyze.cpp +++ b/packages/PEGTL/src/example/pegtl/analyze.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/calculator.cpp b/packages/PEGTL/src/example/pegtl/calculator.cpp index ed9fb2b05512e06196ac23e136457b869c9fbb8d..76997f3fabf7014a900b740b78c5ee222e0109ab 100644 --- a/packages/PEGTL/src/example/pegtl/calculator.cpp +++ b/packages/PEGTL/src/example/pegtl/calculator.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -183,7 +183,7 @@ namespace calculator // Here the actual grammar starts. - using namespace tao::pegtl; + using namespace TAO_PEGTL_NAMESPACE; // Comments are introduced by a '#' and proceed to the end-of-line/file. diff --git a/packages/PEGTL/src/example/pegtl/chomsky_hierarchy.cpp b/packages/PEGTL/src/example/pegtl/chomsky_hierarchy.cpp index cb671c0e8894908e1dd3cf8f53bc852a617a2623..5832f3beeb656798319b8e43353683fd8d6b1484 100644 --- a/packages/PEGTL/src/example/pegtl/chomsky_hierarchy.cpp +++ b/packages/PEGTL/src/example/pegtl/chomsky_hierarchy.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/csv1.cpp b/packages/PEGTL/src/example/pegtl/csv1.cpp index 826363fde8d3b6dc213a591e3db7372c8f341444..4d9d24b31f4ad682f92f27d6f14ed56adb2b84f2 100644 --- a/packages/PEGTL/src/example/pegtl/csv1.cpp +++ b/packages/PEGTL/src/example/pegtl/csv1.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/csv2.cpp b/packages/PEGTL/src/example/pegtl/csv2.cpp index c4aafd56ca8860ec60e9857011b7b71f5f0a8b96..ac0d52e6deebd97250293c7a35a0015f14910633 100644 --- a/packages/PEGTL/src/example/pegtl/csv2.cpp +++ b/packages/PEGTL/src/example/pegtl/csv2.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/double.hpp b/packages/PEGTL/src/example/pegtl/double.hpp index c79f5cc755659155e64db2edfef6be602b476f2a..50c23bafd45d1fa8f46254008d8877fa548450ee 100644 --- a/packages/PEGTL/src/example/pegtl/double.hpp +++ b/packages/PEGTL/src/example/pegtl/double.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/dynamic_match.cpp b/packages/PEGTL/src/example/pegtl/dynamic_match.cpp index bf1465066e88c21dbcb5703f7a84ca7cb971299e..76213ef020ba871b439d7bfd50f8fb5422087d99 100644 --- a/packages/PEGTL/src/example/pegtl/dynamic_match.cpp +++ b/packages/PEGTL/src/example/pegtl/dynamic_match.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/expression.cpp b/packages/PEGTL/src/example/pegtl/expression.cpp index 5602ad3f09fb464f4fff6d963c1239d8496506b6..12be3bb8ba98423fca18e0f810e06a3462add501 100644 --- a/packages/PEGTL/src/example/pegtl/expression.cpp +++ b/packages/PEGTL/src/example/pegtl/expression.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/hello_world.cpp b/packages/PEGTL/src/example/pegtl/hello_world.cpp index 8ecbdb813a87e41c1410da79e786acb9e507a9fb..40eb9dd92107e4495609f4fc70758ce3bcfdb1d7 100644 --- a/packages/PEGTL/src/example/pegtl/hello_world.cpp +++ b/packages/PEGTL/src/example/pegtl/hello_world.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/indent_aware.cpp b/packages/PEGTL/src/example/pegtl/indent_aware.cpp index 1462f89af04646a740182e9554e0b5c965f8585e..54cada30506a28998d591acd7f17f23600bd08fc 100644 --- a/packages/PEGTL/src/example/pegtl/indent_aware.cpp +++ b/packages/PEGTL/src/example/pegtl/indent_aware.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/iri.cpp b/packages/PEGTL/src/example/pegtl/iri.cpp index aed3e981bf7630fd85f8ea330b1e5b373b6e317b..bfc0d876f4bddf20bd52408ea69f314c241f48f1 100644 --- a/packages/PEGTL/src/example/pegtl/iri.cpp +++ b/packages/PEGTL/src/example/pegtl/iri.cpp @@ -1,5 +1,5 @@ -// Copyright (c) 2021 Kelvin Hammond -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Kelvin Hammond +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_analyze.cpp b/packages/PEGTL/src/example/pegtl/json_analyze.cpp index 9a23359a53f694f672c821f78eb24738a729762a..44a552faf067021208f597c04b9d44ac6b650a57 100644 --- a/packages/PEGTL/src/example/pegtl/json_analyze.cpp +++ b/packages/PEGTL/src/example/pegtl/json_analyze.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_ast.cpp b/packages/PEGTL/src/example/pegtl/json_ast.cpp index e227ea874f418f034b9de2411cd4b12157ad181c..1b96455ff45be4a983422c944533f4064d26fb6d 100644 --- a/packages/PEGTL/src/example/pegtl/json_ast.cpp +++ b/packages/PEGTL/src/example/pegtl/json_ast.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_build.cpp b/packages/PEGTL/src/example/pegtl/json_build.cpp index 00d90a587455f721b7e5541ad9bd454fc6762cc2..bf945b317b447e66164043e5a2e11f39036b20ff 100644 --- a/packages/PEGTL/src/example/pegtl/json_build.cpp +++ b/packages/PEGTL/src/example/pegtl/json_build.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_classes.hpp b/packages/PEGTL/src/example/pegtl/json_classes.hpp index 840804328240a2f5534642682740576bd1e9b97d..7585b270dade7919e8950d75f3f0166a88dfc946 100644 --- a/packages/PEGTL/src/example/pegtl/json_classes.hpp +++ b/packages/PEGTL/src/example/pegtl/json_classes.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_count.cpp b/packages/PEGTL/src/example/pegtl/json_count.cpp index f5de1e2ed3b342b84c26faa152ea9760ba2227b0..efda8bf012d3762b0ccac9ecaf9138bdd34477b4 100644 --- a/packages/PEGTL/src/example/pegtl/json_count.cpp +++ b/packages/PEGTL/src/example/pegtl/json_count.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_coverage.cpp b/packages/PEGTL/src/example/pegtl/json_coverage.cpp index 99bf55a14ef4d383ec3692fb95e891e038e00b98..d73124cf14f4608ac5b319aa60727731f7c5241e 100644 --- a/packages/PEGTL/src/example/pegtl/json_coverage.cpp +++ b/packages/PEGTL/src/example/pegtl/json_coverage.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_errors.hpp b/packages/PEGTL/src/example/pegtl/json_errors.hpp index 5dd28f0ac628f9f6fd7b0faaf46560bcaaa03026..9f5eac7733c88181ff9afcc41afb28e79fb2d758 100644 --- a/packages/PEGTL/src/example/pegtl/json_errors.hpp +++ b/packages/PEGTL/src/example/pegtl/json_errors.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_parse.cpp b/packages/PEGTL/src/example/pegtl/json_parse.cpp index cdff8772a535a1a275e5bac85504998063e0e506..1681988b051e7c76c345d2629cc997e6b84197c8 100644 --- a/packages/PEGTL/src/example/pegtl/json_parse.cpp +++ b/packages/PEGTL/src/example/pegtl/json_parse.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,6 +6,7 @@ #include <iostream> #include <tao/pegtl.hpp> +#include <tao/pegtl/contrib/input_with_depth.hpp> #include <tao/pegtl/contrib/json.hpp> #include <tao/pegtl/contrib/limit_depth.hpp> #include <tao/pegtl/contrib/trace.hpp> @@ -38,7 +39,7 @@ int main( int argc, char** argv ) // NOLINT(bugprone-exception-escape) return 1; } - pegtl::argv_input in( argv, 1 ); + pegtl::input_with_depth< pegtl::argv_input<> > in( argv, 1 ); #if defined( __cpp_exceptions ) try { pegtl::parse< example::grammar, example::action, example::control >( in ); diff --git a/packages/PEGTL/src/example/pegtl/json_print_debug.cpp b/packages/PEGTL/src/example/pegtl/json_print_debug.cpp index 8adadfdb0aad76e2b702a1fe9d8ca300c6c13e58..ee344aa815d53400ec71645c2d7b232842b52ae9 100644 --- a/packages/PEGTL/src/example/pegtl/json_print_debug.cpp +++ b/packages/PEGTL/src/example/pegtl/json_print_debug.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,6 +9,6 @@ int main() // NOLINT(bugprone-exception-escape) { - tao::pegtl::print_debug< tao::pegtl::json::text >( std::cout ); + TAO_PEGTL_NAMESPACE::print_debug< TAO_PEGTL_NAMESPACE::json::text >( std::cout ); return 0; } diff --git a/packages/PEGTL/src/example/pegtl/json_print_names.cpp b/packages/PEGTL/src/example/pegtl/json_print_names.cpp index 2537b7c06b18fb21e50266acc6fc72c00e913819..7df4fbe674e3180d8ecb8c3b3728d7436811f6eb 100644 --- a/packages/PEGTL/src/example/pegtl/json_print_names.cpp +++ b/packages/PEGTL/src/example/pegtl/json_print_names.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -9,6 +9,6 @@ int main() // NOLINT(bugprone-exception-escape) { - tao::pegtl::print_names< tao::pegtl::json::text >( std::cout ); + TAO_PEGTL_NAMESPACE::print_names< TAO_PEGTL_NAMESPACE::json::text >( std::cout ); return 0; } diff --git a/packages/PEGTL/src/example/pegtl/json_trace.cpp b/packages/PEGTL/src/example/pegtl/json_trace.cpp index 345118a29e0681f845d545883c1f3274808687e0..c6a1ce673f624533d6e3eeeb51cd5e3922976ea9 100644 --- a/packages/PEGTL/src/example/pegtl/json_trace.cpp +++ b/packages/PEGTL/src/example/pegtl/json_trace.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/json_unescape.hpp b/packages/PEGTL/src/example/pegtl/json_unescape.hpp index 210087e205d9bd27fa2ee19e9a3cadb7f47ad17d..d96367c3f34e15aa4095ad2fb353165ce56f821a 100644 --- a/packages/PEGTL/src/example/pegtl/json_unescape.hpp +++ b/packages/PEGTL/src/example/pegtl/json_unescape.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -13,17 +13,19 @@ namespace example { + namespace pegtl = TAO_PEGTL_NAMESPACE; + // Action class for parsing literal strings, uses the PEGTL unescape utilities, cf. unescape.cpp. // clang-format off template< typename Rule > struct json_unescape_action {}; - template<> struct json_unescape_action< TAO_PEGTL_NAMESPACE::json::unicode > : TAO_PEGTL_NAMESPACE::unescape::unescape_j {}; - template<> struct json_unescape_action< TAO_PEGTL_NAMESPACE::json::escaped_char > : TAO_PEGTL_NAMESPACE::unescape::unescape_c< TAO_PEGTL_NAMESPACE::json::escaped_char, '"', '\\', '/', '\b', '\f', '\n', '\r', '\t' > {}; - template<> struct json_unescape_action< TAO_PEGTL_NAMESPACE::json::unescaped > : TAO_PEGTL_NAMESPACE::unescape::append_all {}; + template<> struct json_unescape_action< pegtl::json::unicode > : pegtl::unescape::unescape_j {}; + template<> struct json_unescape_action< pegtl::json::escaped_char > : pegtl::unescape::unescape_c< pegtl::json::escaped_char, '"', '\\', '/', '\b', '\f', '\n', '\r', '\t' > {}; + template<> struct json_unescape_action< pegtl::json::unescaped > : pegtl::unescape::append_all {}; // clang-format on - using json_unescape = tao::pegtl::change_action_and_states< json_unescape_action, std::string >; + using json_unescape = pegtl::change_action_and_states< json_unescape_action, std::string >; } // namespace example diff --git a/packages/PEGTL/src/example/pegtl/lua53.hpp b/packages/PEGTL/src/example/pegtl/lua53.hpp index da57ea822bb17947e8725e32ceabd64ab5a84fa0..371843cfd3261602f51d5f963d03c39adfb79695 100644 --- a/packages/PEGTL/src/example/pegtl/lua53.hpp +++ b/packages/PEGTL/src/example/pegtl/lua53.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -14,6 +14,8 @@ namespace lua53 { + namespace pegtl = TAO_PEGTL_NAMESPACE; + // PEGTL grammar for the Lua 5.3.0 lexer and parser. // // The grammar here is not very similar to the grammar @@ -97,12 +99,12 @@ namespace lua53 // right padding is used. // clang-format off - struct short_comment : tao::pegtl::until< tao::pegtl::eolf > {}; - struct long_string : tao::pegtl::raw_string< '[', '=', ']' > {}; - struct comment : tao::pegtl::disable< tao::pegtl::two< '-' >, tao::pegtl::sor< long_string, short_comment > > {}; + struct short_comment : pegtl::until< pegtl::eolf > {}; + struct long_string : pegtl::raw_string< '[', '=', ']' > {}; + struct comment : pegtl::disable< pegtl::two< '-' >, pegtl::sor< long_string, short_comment > > {}; - struct sep : tao::pegtl::sor< tao::pegtl::ascii::space, comment > {}; - struct seps : tao::pegtl::star< sep > {}; + struct sep : pegtl::sor< pegtl::ascii::space, comment > {}; + struct seps : pegtl::star< sep > {}; struct str_and : TAO_PEGTL_STRING( "and" ) {}; struct str_break : TAO_PEGTL_STRING( "break" ) {}; @@ -132,9 +134,9 @@ namespace lua53 // 'keyword' rule. template< typename Key > - struct key : tao::pegtl::seq< Key, tao::pegtl::not_at< tao::pegtl::identifier_other > > {}; + struct key : pegtl::seq< Key, pegtl::not_at< pegtl::identifier_other > > {}; - struct sor_keyword : tao::pegtl::sor< str_and, str_break, str_do, str_elseif, str_else, str_end, str_false, str_for, str_function, str_goto, str_if, str_in, str_local, str_nil, str_not, str_repeat, str_return, str_then, str_true, str_until, str_while > {}; + struct sor_keyword : pegtl::sor< str_and, str_break, str_do, str_elseif, str_else, str_end, str_false, str_for, str_function, str_goto, str_if, str_in, str_local, str_nil, str_not, str_repeat, str_return, str_then, str_true, str_until, str_while > {}; struct key_and : key< str_and > {}; struct key_break : key< str_break > {}; @@ -162,177 +164,177 @@ namespace lua53 struct keyword : key< sor_keyword > {}; template< typename R > - struct pad : tao::pegtl::pad< R, sep > {}; + struct pad : pegtl::pad< R, sep > {}; - struct name : tao::pegtl::seq< tao::pegtl::not_at< keyword >, tao::pegtl::identifier > {}; + struct name : pegtl::seq< pegtl::not_at< keyword >, pegtl::identifier > {}; - struct single : tao::pegtl::one< 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '"', '\'', '0', '\n' > {}; - struct spaces : tao::pegtl::seq< tao::pegtl::one< 'z' >, tao::pegtl::star< tao::pegtl::space > > {}; - struct hexbyte : tao::pegtl::if_must< tao::pegtl::one< 'x' >, tao::pegtl::xdigit, tao::pegtl::xdigit > {}; - struct decbyte : tao::pegtl::if_must< tao::pegtl::digit, tao::pegtl::rep_opt< 2, tao::pegtl::digit > > {}; - struct unichar : tao::pegtl::if_must< tao::pegtl::one< 'u' >, tao::pegtl::one< '{' >, tao::pegtl::plus< tao::pegtl::xdigit >, tao::pegtl::one< '}' > > {}; - struct escaped : tao::pegtl::if_must< tao::pegtl::one< '\\' >, tao::pegtl::sor< hexbyte, decbyte, unichar, single, spaces > > {}; - struct regular : tao::pegtl::not_one< '\r', '\n' > {}; - struct character : tao::pegtl::sor< escaped, regular > {}; + struct single : pegtl::one< 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '"', '\'', '0', '\n' > {}; + struct spaces : pegtl::seq< pegtl::one< 'z' >, pegtl::star< pegtl::space > > {}; + struct hexbyte : pegtl::if_must< pegtl::one< 'x' >, pegtl::xdigit, pegtl::xdigit > {}; + struct decbyte : pegtl::if_must< pegtl::digit, pegtl::rep_opt< 2, pegtl::digit > > {}; + struct unichar : pegtl::if_must< pegtl::one< 'u' >, pegtl::one< '{' >, pegtl::plus< pegtl::xdigit >, pegtl::one< '}' > > {}; + struct escaped : pegtl::if_must< pegtl::one< '\\' >, pegtl::sor< hexbyte, decbyte, unichar, single, spaces > > {}; + struct regular : pegtl::not_one< '\r', '\n' > {}; + struct character : pegtl::sor< escaped, regular > {}; template< char Q > - struct short_string : tao::pegtl::if_must< tao::pegtl::one< Q >, tao::pegtl::until< tao::pegtl::one< Q >, character > > {}; - struct literal_string : tao::pegtl::sor< short_string< '"' >, short_string< '\'' >, long_string > {}; + struct short_string : pegtl::if_must< pegtl::one< Q >, pegtl::until< pegtl::one< Q >, character > > {}; + struct literal_string : pegtl::sor< short_string< '"' >, short_string< '\'' >, long_string > {}; template< typename E > - struct exponent : tao::pegtl::opt_must< E, tao::pegtl::opt< tao::pegtl::one< '+', '-' > >, tao::pegtl::plus< tao::pegtl::digit > > {}; + struct exponent : pegtl::opt_must< E, pegtl::opt< pegtl::one< '+', '-' > >, pegtl::plus< pegtl::digit > > {}; template< typename D, typename E > - struct numeral_three : tao::pegtl::seq< tao::pegtl::if_must< tao::pegtl::one< '.' >, tao::pegtl::plus< D > >, exponent< E > > {}; + struct numeral_three : pegtl::seq< pegtl::if_must< pegtl::one< '.' >, pegtl::plus< D > >, exponent< E > > {}; template< typename D, typename E > - struct numeral_two : tao::pegtl::seq< tao::pegtl::plus< D >, tao::pegtl::opt< tao::pegtl::one< '.' >, tao::pegtl::star< D > >, exponent< E > > {}; + struct numeral_two : pegtl::seq< pegtl::plus< D >, pegtl::opt< pegtl::one< '.' >, pegtl::star< D > >, exponent< E > > {}; template< typename D, typename E > - struct numeral_one : tao::pegtl::sor< numeral_two< D, E >, numeral_three< D, E > > {}; + struct numeral_one : pegtl::sor< numeral_two< D, E >, numeral_three< D, E > > {}; - struct decimal : numeral_one< tao::pegtl::digit, tao::pegtl::one< 'e', 'E' > > {}; - struct hexadecimal : tao::pegtl::if_must< tao::pegtl::istring< '0', 'x' >, numeral_one< tao::pegtl::xdigit, tao::pegtl::one< 'p', 'P' > > > {}; - struct numeral : tao::pegtl::sor< hexadecimal, decimal > {}; + struct decimal : numeral_one< pegtl::digit, pegtl::one< 'e', 'E' > > {}; + struct hexadecimal : pegtl::if_must< pegtl::istring< '0', 'x' >, numeral_one< pegtl::xdigit, pegtl::one< 'p', 'P' > > > {}; + struct numeral : pegtl::sor< hexadecimal, decimal > {}; - struct label_statement : tao::pegtl::if_must< tao::pegtl::two< ':' >, seps, name, seps, tao::pegtl::two< ':' > > {}; - struct goto_statement : tao::pegtl::if_must< key_goto, seps, name > {}; + struct label_statement : pegtl::if_must< pegtl::two< ':' >, seps, name, seps, pegtl::two< ':' > > {}; + struct goto_statement : pegtl::if_must< key_goto, seps, name > {}; struct statement; struct expression; - struct name_list : tao::pegtl::list< name, tao::pegtl::one< ',' >, sep > {}; - struct name_list_must : tao::pegtl::list_must< name, tao::pegtl::one< ',' >, sep > {}; - struct expr_list_must : tao::pegtl::list_must< expression, tao::pegtl::one< ',' >, sep > {}; + struct name_list : pegtl::list< name, pegtl::one< ',' >, sep > {}; + struct name_list_must : pegtl::list_must< name, pegtl::one< ',' >, sep > {}; + struct expr_list_must : pegtl::list_must< expression, pegtl::one< ',' >, sep > {}; - struct statement_return : tao::pegtl::seq< tao::pegtl::pad_opt< expr_list_must, sep >, tao::pegtl::opt< tao::pegtl::one< ';' >, seps > > {}; + struct statement_return : pegtl::seq< pegtl::pad_opt< expr_list_must, sep >, pegtl::opt< pegtl::one< ';' >, seps > > {}; template< typename E > - struct statement_list : tao::pegtl::seq< seps, tao::pegtl::until< tao::pegtl::sor< E, tao::pegtl::if_must< key_return, statement_return, E > >, statement, seps > > {}; + struct statement_list : pegtl::seq< seps, pegtl::until< pegtl::sor< E, pegtl::if_must< key_return, statement_return, E > >, statement, seps > > {}; template< char O, char... N > - struct op_one : tao::pegtl::seq< tao::pegtl::one< O >, tao::pegtl::at< tao::pegtl::not_one< N... > > > {}; + struct op_one : pegtl::seq< pegtl::one< O >, pegtl::at< pegtl::not_one< N... > > > {}; template< char O, char P, char... N > - struct op_two : tao::pegtl::seq< tao::pegtl::string< O, P >, tao::pegtl::at< tao::pegtl::not_one< N... > > > {}; + struct op_two : pegtl::seq< pegtl::string< O, P >, pegtl::at< pegtl::not_one< N... > > > {}; - struct table_field_one : tao::pegtl::if_must< tao::pegtl::one< '[' >, seps, expression, seps, tao::pegtl::one< ']' >, seps, tao::pegtl::one< '=' >, seps, expression > {}; - struct table_field_two : tao::pegtl::if_must< tao::pegtl::seq< name, seps, op_one< '=', '=' > >, seps, expression > {}; - struct table_field : tao::pegtl::sor< table_field_one, table_field_two, expression > {}; - struct table_field_list : tao::pegtl::list_tail< table_field, tao::pegtl::one< ',', ';' >, sep > {}; - struct table_constructor : tao::pegtl::if_must< tao::pegtl::one< '{' >, tao::pegtl::pad_opt< table_field_list, sep >, tao::pegtl::one< '}' > > {}; + struct table_field_one : pegtl::if_must< pegtl::one< '[' >, seps, expression, seps, pegtl::one< ']' >, seps, pegtl::one< '=' >, seps, expression > {}; + struct table_field_two : pegtl::if_must< pegtl::seq< name, seps, op_one< '=', '=' > >, seps, expression > {}; + struct table_field : pegtl::sor< table_field_one, table_field_two, expression > {}; + struct table_field_list : pegtl::list_tail< table_field, pegtl::one< ',', ';' >, sep > {}; + struct table_constructor : pegtl::if_must< pegtl::one< '{' >, pegtl::pad_opt< table_field_list, sep >, pegtl::one< '}' > > {}; - struct parameter_list_one : tao::pegtl::seq< name_list, tao::pegtl::opt_must< pad< tao::pegtl::one< ',' > >, tao::pegtl::ellipsis > > {}; - struct parameter_list : tao::pegtl::sor< tao::pegtl::ellipsis, parameter_list_one > {}; + struct parameter_list_one : pegtl::seq< name_list, pegtl::opt_must< pad< pegtl::one< ',' > >, pegtl::ellipsis > > {}; + struct parameter_list : pegtl::sor< pegtl::ellipsis, parameter_list_one > {}; - struct function_body : tao::pegtl::seq< tao::pegtl::one< '(' >, tao::pegtl::pad_opt< parameter_list, sep >, tao::pegtl::one< ')' >, seps, statement_list< key_end > > {}; - struct function_literal : tao::pegtl::if_must< key_function, seps, function_body > {}; + struct function_body : pegtl::seq< pegtl::one< '(' >, pegtl::pad_opt< parameter_list, sep >, pegtl::one< ')' >, seps, statement_list< key_end > > {}; + struct function_literal : pegtl::if_must< key_function, seps, function_body > {}; - struct bracket_expr : tao::pegtl::if_must< tao::pegtl::one< '(' >, seps, expression, seps, tao::pegtl::one< ')' > > {}; + struct bracket_expr : pegtl::if_must< pegtl::one< '(' >, seps, expression, seps, pegtl::one< ')' > > {}; - struct function_args_one : tao::pegtl::if_must< tao::pegtl::one< '(' >, tao::pegtl::pad_opt< expr_list_must, sep >, tao::pegtl::one< ')' > > {}; - struct function_args : tao::pegtl::sor< function_args_one, table_constructor, literal_string > {}; + struct function_args_one : pegtl::if_must< pegtl::one< '(' >, pegtl::pad_opt< expr_list_must, sep >, pegtl::one< ')' > > {}; + struct function_args : pegtl::sor< function_args_one, table_constructor, literal_string > {}; - struct variable_tail_one : tao::pegtl::if_must< tao::pegtl::one< '[' >, seps, expression, seps, tao::pegtl::one< ']' > > {}; - struct variable_tail_two : tao::pegtl::if_must< tao::pegtl::seq< tao::pegtl::not_at< tao::pegtl::two< '.' > >, tao::pegtl::one< '.' > >, seps, name > {}; - struct variable_tail : tao::pegtl::sor< variable_tail_one, variable_tail_two > {}; + struct variable_tail_one : pegtl::if_must< pegtl::one< '[' >, seps, expression, seps, pegtl::one< ']' > > {}; + struct variable_tail_two : pegtl::if_must< pegtl::seq< pegtl::not_at< pegtl::two< '.' > >, pegtl::one< '.' > >, seps, name > {}; + struct variable_tail : pegtl::sor< variable_tail_one, variable_tail_two > {}; - struct function_call_tail_one : tao::pegtl::if_must< tao::pegtl::seq< tao::pegtl::not_at< tao::pegtl::two< ':' > >, tao::pegtl::one< ':' > >, seps, name, seps, function_args > {}; - struct function_call_tail : tao::pegtl::sor< function_args, function_call_tail_one > {}; + struct function_call_tail_one : pegtl::if_must< pegtl::seq< pegtl::not_at< pegtl::two< ':' > >, pegtl::one< ':' > >, seps, name, seps, function_args > {}; + struct function_call_tail : pegtl::sor< function_args, function_call_tail_one > {}; - struct variable_head_one : tao::pegtl::seq< bracket_expr, seps, variable_tail > {}; - struct variable_head : tao::pegtl::sor< name, variable_head_one > {}; + struct variable_head_one : pegtl::seq< bracket_expr, seps, variable_tail > {}; + struct variable_head : pegtl::sor< name, variable_head_one > {}; - struct function_call_head : tao::pegtl::sor< name, bracket_expr > {}; + struct function_call_head : pegtl::sor< name, bracket_expr > {}; - struct variable : tao::pegtl::seq< variable_head, tao::pegtl::star< tao::pegtl::star< seps, function_call_tail >, seps, variable_tail > > {}; - struct function_call : tao::pegtl::seq< function_call_head, tao::pegtl::plus< tao::pegtl::until< tao::pegtl::seq< seps, function_call_tail >, seps, variable_tail > > > {}; + struct variable : pegtl::seq< variable_head, pegtl::star< pegtl::star< seps, function_call_tail >, seps, variable_tail > > {}; + struct function_call : pegtl::seq< function_call_head, pegtl::plus< pegtl::until< pegtl::seq< seps, function_call_tail >, seps, variable_tail > > > {}; template< typename S, typename O > - struct left_assoc : tao::pegtl::seq< S, seps, tao::pegtl::star_must< O, seps, S, seps > > {}; + struct left_assoc : pegtl::seq< S, seps, pegtl::star_must< O, seps, S, seps > > {}; template< typename S, typename O > - struct right_assoc : tao::pegtl::seq< S, seps, tao::pegtl::opt_must< O, seps, right_assoc< S, O > > > {}; + struct right_assoc : pegtl::seq< S, seps, pegtl::opt_must< O, seps, right_assoc< S, O > > > {}; - struct unary_operators : tao::pegtl::sor< tao::pegtl::one< '-' >, - tao::pegtl::one< '#' >, - op_one< '~', '=' >, - key_not > {}; + struct unary_operators : pegtl::sor< pegtl::one< '-' >, + pegtl::one< '#' >, + op_one< '~', '=' >, + key_not > {}; struct expr_ten; - struct expr_thirteen : tao::pegtl::seq< tao::pegtl::sor< bracket_expr, name >, tao::pegtl::star< seps, tao::pegtl::sor< function_call_tail, variable_tail > > > {}; - struct expr_twelve : tao::pegtl::sor< key_nil, - key_true, - key_false, - tao::pegtl::ellipsis, - numeral, - literal_string, - function_literal, - expr_thirteen, - table_constructor > {}; - struct expr_eleven : tao::pegtl::seq< expr_twelve, seps, tao::pegtl::opt< tao::pegtl::one< '^' >, seps, expr_ten, seps > > {}; - struct unary_apply : tao::pegtl::if_must< unary_operators, seps, expr_ten, seps > {}; - struct expr_ten : tao::pegtl::sor< unary_apply, expr_eleven > {}; - struct operators_nine : tao::pegtl::sor< tao::pegtl::two< '/' >, - tao::pegtl::one< '/' >, - tao::pegtl::one< '*' >, - tao::pegtl::one< '%' > > {}; + struct expr_thirteen : pegtl::seq< pegtl::sor< bracket_expr, name >, pegtl::star< seps, pegtl::sor< function_call_tail, variable_tail > > > {}; + struct expr_twelve : pegtl::sor< key_nil, + key_true, + key_false, + pegtl::ellipsis, + numeral, + literal_string, + function_literal, + expr_thirteen, + table_constructor > {}; + struct expr_eleven : pegtl::seq< expr_twelve, seps, pegtl::opt< pegtl::one< '^' >, seps, expr_ten, seps > > {}; + struct unary_apply : pegtl::if_must< unary_operators, seps, expr_ten, seps > {}; + struct expr_ten : pegtl::sor< unary_apply, expr_eleven > {}; + struct operators_nine : pegtl::sor< pegtl::two< '/' >, + pegtl::one< '/' >, + pegtl::one< '*' >, + pegtl::one< '%' > > {}; struct expr_nine : left_assoc< expr_ten, operators_nine > {}; - struct operators_eight : tao::pegtl::sor< tao::pegtl::one< '+' >, - tao::pegtl::one< '-' > > {}; + struct operators_eight : pegtl::sor< pegtl::one< '+' >, + pegtl::one< '-' > > {}; struct expr_eight : left_assoc< expr_nine, operators_eight > {}; struct expr_seven : right_assoc< expr_eight, op_two< '.', '.', '.' > > {}; - struct operators_six : tao::pegtl::sor< tao::pegtl::two< '<' >, - tao::pegtl::two< '>' > > {}; + struct operators_six : pegtl::sor< pegtl::two< '<' >, + pegtl::two< '>' > > {}; struct expr_six : left_assoc< expr_seven, operators_six > {}; - struct expr_five : left_assoc< expr_six, tao::pegtl::one< '&' > > {}; + struct expr_five : left_assoc< expr_six, pegtl::one< '&' > > {}; struct expr_four : left_assoc< expr_five, op_one< '~', '=' > > {}; - struct expr_three : left_assoc< expr_four, tao::pegtl::one< '|' > > {}; - struct operators_two : tao::pegtl::sor< tao::pegtl::two< '=' >, - tao::pegtl::string< '<', '=' >, - tao::pegtl::string< '>', '=' >, - op_one< '<', '<' >, - op_one< '>', '>' >, - tao::pegtl::string< '~', '=' > > {}; + struct expr_three : left_assoc< expr_four, pegtl::one< '|' > > {}; + struct operators_two : pegtl::sor< pegtl::two< '=' >, + pegtl::string< '<', '=' >, + pegtl::string< '>', '=' >, + op_one< '<', '<' >, + op_one< '>', '>' >, + pegtl::string< '~', '=' > > {}; struct expr_two : left_assoc< expr_three, operators_two > {}; struct expr_one : left_assoc< expr_two, key_and > {}; struct expression : left_assoc< expr_one, key_or > {}; - struct do_statement : tao::pegtl::if_must< key_do, statement_list< key_end > > {}; - struct while_statement : tao::pegtl::if_must< key_while, seps, expression, seps, key_do, statement_list< key_end > > {}; - struct repeat_statement : tao::pegtl::if_must< key_repeat, statement_list< key_until >, seps, expression > {}; - - struct at_elseif_else_end : tao::pegtl::sor< tao::pegtl::at< key_elseif >, tao::pegtl::at< key_else >, tao::pegtl::at< key_end > > {}; - struct elseif_statement : tao::pegtl::if_must< key_elseif, seps, expression, seps, key_then, statement_list< at_elseif_else_end > > {}; - struct else_statement : tao::pegtl::if_must< key_else, statement_list< key_end > > {}; - struct if_statement : tao::pegtl::if_must< key_if, seps, expression, seps, key_then, statement_list< at_elseif_else_end >, seps, tao::pegtl::until< tao::pegtl::sor< else_statement, key_end >, elseif_statement, seps > > {}; - - struct for_statement_one : tao::pegtl::seq< tao::pegtl::one< '=' >, seps, expression, seps, tao::pegtl::one< ',' >, seps, expression, tao::pegtl::pad_opt< tao::pegtl::if_must< tao::pegtl::one< ',' >, seps, expression >, sep > > {}; - struct for_statement_two : tao::pegtl::seq< tao::pegtl::opt_must< tao::pegtl::one< ',' >, seps, name_list_must, seps >, key_in, seps, expr_list_must, seps > {}; - struct for_statement : tao::pegtl::if_must< key_for, seps, name, seps, tao::pegtl::sor< for_statement_one, for_statement_two >, key_do, statement_list< key_end > > {}; - - struct assignment_variable_list : tao::pegtl::list_must< variable, tao::pegtl::one< ',' >, sep > {}; - struct assignments_one : tao::pegtl::if_must< tao::pegtl::one< '=' >, seps, expr_list_must > {}; - struct assignments : tao::pegtl::seq< assignment_variable_list, seps, assignments_one > {}; - struct function_name : tao::pegtl::seq< tao::pegtl::list< name, tao::pegtl::one< '.' >, sep >, seps, tao::pegtl::opt_must< tao::pegtl::one< ':' >, seps, name, seps > > {}; - struct function_definition : tao::pegtl::if_must< key_function, seps, function_name, function_body > {}; - - struct local_function : tao::pegtl::if_must< key_function, seps, name, seps, function_body > {}; - struct local_variables : tao::pegtl::if_must< name_list_must, seps, tao::pegtl::opt< assignments_one > > {}; - struct local_statement : tao::pegtl::if_must< key_local, seps, tao::pegtl::sor< local_function, local_variables > > {}; - - struct semicolon : tao::pegtl::one< ';' > {}; - struct statement : tao::pegtl::sor< semicolon, - assignments, - function_call, - label_statement, - key_break, - goto_statement, - do_statement, - while_statement, - repeat_statement, - if_statement, - for_statement, - function_definition, - local_statement > {}; - - struct grammar : tao::pegtl::must< tao::pegtl::opt< tao::pegtl::shebang >, statement_list< tao::pegtl::eof > > {}; + struct do_statement : pegtl::if_must< key_do, statement_list< key_end > > {}; + struct while_statement : pegtl::if_must< key_while, seps, expression, seps, key_do, statement_list< key_end > > {}; + struct repeat_statement : pegtl::if_must< key_repeat, statement_list< key_until >, seps, expression > {}; + + struct at_elseif_else_end : pegtl::sor< pegtl::at< key_elseif >, pegtl::at< key_else >, pegtl::at< key_end > > {}; + struct elseif_statement : pegtl::if_must< key_elseif, seps, expression, seps, key_then, statement_list< at_elseif_else_end > > {}; + struct else_statement : pegtl::if_must< key_else, statement_list< key_end > > {}; + struct if_statement : pegtl::if_must< key_if, seps, expression, seps, key_then, statement_list< at_elseif_else_end >, seps, pegtl::until< pegtl::sor< else_statement, key_end >, elseif_statement, seps > > {}; + + struct for_statement_one : pegtl::seq< pegtl::one< '=' >, seps, expression, seps, pegtl::one< ',' >, seps, expression, pegtl::pad_opt< pegtl::if_must< pegtl::one< ',' >, seps, expression >, sep > > {}; + struct for_statement_two : pegtl::seq< pegtl::opt_must< pegtl::one< ',' >, seps, name_list_must, seps >, key_in, seps, expr_list_must, seps > {}; + struct for_statement : pegtl::if_must< key_for, seps, name, seps, pegtl::sor< for_statement_one, for_statement_two >, key_do, statement_list< key_end > > {}; + + struct assignment_variable_list : pegtl::list_must< variable, pegtl::one< ',' >, sep > {}; + struct assignments_one : pegtl::if_must< pegtl::one< '=' >, seps, expr_list_must > {}; + struct assignments : pegtl::seq< assignment_variable_list, seps, assignments_one > {}; + struct function_name : pegtl::seq< pegtl::list< name, pegtl::one< '.' >, sep >, seps, pegtl::opt_must< pegtl::one< ':' >, seps, name, seps > > {}; + struct function_definition : pegtl::if_must< key_function, seps, function_name, function_body > {}; + + struct local_function : pegtl::if_must< key_function, seps, name, seps, function_body > {}; + struct local_variables : pegtl::if_must< name_list_must, seps, pegtl::opt< assignments_one > > {}; + struct local_statement : pegtl::if_must< key_local, seps, pegtl::sor< local_function, local_variables > > {}; + + struct semicolon : pegtl::one< ';' > {}; + struct statement : pegtl::sor< semicolon, + assignments, + function_call, + label_statement, + key_break, + goto_statement, + do_statement, + while_statement, + repeat_statement, + if_statement, + for_statement, + function_definition, + local_statement > {}; + + struct grammar : pegtl::must< pegtl::opt< pegtl::shebang >, statement_list< pegtl::eof > > {}; // clang-format on } // namespace lua53 diff --git a/packages/PEGTL/src/example/pegtl/lua53_analyze.cpp b/packages/PEGTL/src/example/pegtl/lua53_analyze.cpp index d785e2a98c2139ef6fddab75cb5b95beceb6e658..572046486486e5ff9e794d71157b9e91fb7c4972 100644 --- a/packages/PEGTL/src/example/pegtl/lua53_analyze.cpp +++ b/packages/PEGTL/src/example/pegtl/lua53_analyze.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/lua53_parse.cpp b/packages/PEGTL/src/example/pegtl/lua53_parse.cpp index 317e23c47b2454d33fb9d1817e61d51bd35b63a2..95ad94ea372138e969efaabb428d4949c50bc369 100644 --- a/packages/PEGTL/src/example/pegtl/lua53_parse.cpp +++ b/packages/PEGTL/src/example/pegtl/lua53_parse.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/modulus_match.cpp b/packages/PEGTL/src/example/pegtl/modulus_match.cpp index fd866c5a53d167f67f043e833c41d98c38a089f7..2ebf1c7904caabb778343be19ac81c79e49c7348 100644 --- a/packages/PEGTL/src/example/pegtl/modulus_match.cpp +++ b/packages/PEGTL/src/example/pegtl/modulus_match.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/parse_tree.cpp b/packages/PEGTL/src/example/pegtl/parse_tree.cpp index c105e1621fc06a747f7c07ad5aacb930a14fd647..77436e7b83de1b895ceb435c58748c0b333f82c6 100644 --- a/packages/PEGTL/src/example/pegtl/parse_tree.cpp +++ b/packages/PEGTL/src/example/pegtl/parse_tree.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/parse_tree_user_state.cpp b/packages/PEGTL/src/example/pegtl/parse_tree_user_state.cpp index 6bb7a382a26fec64a91d16e6ac8451b66db3a978..98faabf283d12aa3fdce5dcecd769f9664145c3a 100644 --- a/packages/PEGTL/src/example/pegtl/parse_tree_user_state.cpp +++ b/packages/PEGTL/src/example/pegtl/parse_tree_user_state.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/proto3.cpp b/packages/PEGTL/src/example/pegtl/proto3.cpp index cb7303787ccc7be48c9e5cc4887b9f511264d974..d49dcdbd44097b9eb4927e01730d18373a5f5cd0 100644 --- a/packages/PEGTL/src/example/pegtl/proto3.cpp +++ b/packages/PEGTL/src/example/pegtl/proto3.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/random_order.cpp b/packages/PEGTL/src/example/pegtl/random_order.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e9842291c773fc302b8d0ab89c35acbcdd07a758 --- /dev/null +++ b/packages/PEGTL/src/example/pegtl/random_order.cpp @@ -0,0 +1,109 @@ +// Copyright (c) 2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#include <bitset> +#include <iostream> +#include <utility> + +#include <tao/pegtl.hpp> + +namespace TAO_PEGTL_NAMESPACE +{ + namespace internal + { + template< bool Optional, typename... Rules > + struct rnd; + + template< bool Optional > + struct rnd< Optional > + : success + {}; + + template< bool Optional, typename... Rules > + struct rnd + { + using rule_t = rnd; + using subs_t = type_list< Rules... >; + + static constexpr std::size_t rule_count = sizeof...( Rules ); + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + std::size_t... Indices, + typename ParseInput, + typename... States > + [[nodiscard]] static bool match( std::index_sequence< Indices... > /*unused*/, ParseInput& in, States&&... st ) + { + std::bitset< rule_count > b; + auto m = in.template auto_rewind< M >(); + using m_t = decltype( m ); + for( std::size_t i = 0; i < rule_count; ++i ) { + if( !( ( ( b.test( Indices ) == false ) && ( Control< Rules >::template match< A, m_t::next_rewind_mode, Action, Control >( in, st... ) ) && ( b.set( Indices ), true ) ) || ... ) ) { + return m( Optional ); + } + } + return m( true ); + } + + template< apply_mode A, + rewind_mode M, + template< typename... > + class Action, + template< typename... > + class Control, + typename ParseInput, + typename... States > + [[nodiscard]] static bool match( ParseInput& in, States&&... st ) + { + if constexpr( sizeof...( Rules ) == 1 ) { + return Control< Rules... >::template match< A, M, Action, Control >( in, st... ); + } + else { + return match< A, M, Action, Control >( std::index_sequence_for< Rules... >(), in, st... ); + } + } + }; + + template< bool Optional, typename... Rules > + inline constexpr bool enable_control< rnd< Optional, Rules... > > = false; + + } // namespace internal + + template< typename... Rules > + struct rnd + : internal::rnd< false, Rules... > + {}; + + template< typename... Rules > + struct rnd_opt + : internal::rnd< true, Rules... > + {}; + +} // namespace TAO_PEGTL_NAMESPACE + +int main( int argc, char** argv ) +{ + using namespace TAO_PEGTL_NAMESPACE; + + using grammar1 = seq< rnd< one< 'a' >, one< 'b' >, one< 'c' > >, eolf >; + using grammar2 = seq< rnd_opt< one< 'a' >, one< 'b' >, one< 'c' > >, eolf >; + + for( int i = 1; i < argc; ++i ) { + { + argv_input in( argv, i ); + const bool b = parse< grammar1 >( in ); + std::cout << "input: " << argv[ i ] << " rnd: " << b << std::endl; + } + { + argv_input in( argv, i ); + const bool b = parse< grammar2 >( in ); + std::cout << "input: " << argv[ i ] << " rnd_opt: " << b << std::endl; + } + } + return 0; +} diff --git a/packages/PEGTL/src/example/pegtl/recover.cpp b/packages/PEGTL/src/example/pegtl/recover.cpp index 9f6e2076799d5b8e34c58eba022f10340c3f72a9..12d581e918b549cc7e2c524e60ab22c03f491209 100644 --- a/packages/PEGTL/src/example/pegtl/recover.cpp +++ b/packages/PEGTL/src/example/pegtl/recover.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/s_expression.cpp b/packages/PEGTL/src/example/pegtl/s_expression.cpp index d0ab218c5928e8c326b3bdf81a22c4108aa84690..a93dbb8b68e2db72f11ced567468ebb5746ee77b 100644 --- a/packages/PEGTL/src/example/pegtl/s_expression.cpp +++ b/packages/PEGTL/src/example/pegtl/s_expression.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -19,31 +19,33 @@ int main() namespace sexpr { + namespace pegtl = TAO_PEGTL_NAMESPACE; + // clang-format off - struct hash_comment : tao::pegtl::until< tao::pegtl::eolf > {}; + struct hash_comment : pegtl::until< pegtl::eolf > {}; struct list; - struct list_comment : tao::pegtl::if_must< tao::pegtl::at< tao::pegtl::one< '(' > >, tao::pegtl::disable< list > > {}; + struct list_comment : pegtl::if_must< pegtl::at< pegtl::one< '(' > >, pegtl::disable< list > > {}; - struct read_include : tao::pegtl::seq< tao::pegtl::one< ' ' >, tao::pegtl::one< '"' >, tao::pegtl::plus< tao::pegtl::not_one< '"' > >, tao::pegtl::one< '"' > > {}; - struct hash_include : tao::pegtl::if_must< tao::pegtl::string< 'i', 'n', 'c', 'l', 'u', 'd', 'e' >, read_include > {}; + struct read_include : pegtl::seq< pegtl::one< ' ' >, pegtl::one< '"' >, pegtl::plus< pegtl::not_one< '"' > >, pegtl::one< '"' > > {}; + struct hash_include : pegtl::if_must< pegtl::string< 'i', 'n', 'c', 'l', 'u', 'd', 'e' >, read_include > {}; - struct hashed : tao::pegtl::if_must< tao::pegtl::one< '#' >, tao::pegtl::sor< hash_include, list_comment, hash_comment > > {}; + struct hashed : pegtl::if_must< pegtl::one< '#' >, pegtl::sor< hash_include, list_comment, hash_comment > > {}; - struct number : tao::pegtl::plus< tao::pegtl::digit > {}; - struct symbol : tao::pegtl::identifier {}; + struct number : pegtl::plus< pegtl::digit > {}; + struct symbol : pegtl::identifier {}; - struct atom : tao::pegtl::sor< number, symbol > {}; + struct atom : pegtl::sor< number, symbol > {}; struct anything; - struct list : tao::pegtl::if_must< tao::pegtl::one< '(' >, tao::pegtl::until< tao::pegtl::one< ')' >, anything > > {}; + struct list : pegtl::if_must< pegtl::one< '(' >, pegtl::until< pegtl::one< ')' >, anything > > {}; - struct normal : tao::pegtl::sor< atom, list > {}; + struct normal : pegtl::sor< atom, list > {}; - struct anything : tao::pegtl::sor< tao::pegtl::space, hashed, normal > {}; + struct anything : pegtl::sor< pegtl::space, hashed, normal > {}; - struct main : tao::pegtl::until< tao::pegtl::eof, tao::pegtl::must< anything > > {}; + struct main : pegtl::until< pegtl::eof, pegtl::must< anything > > {}; // clang-format on template< typename Rule > @@ -51,7 +53,7 @@ namespace sexpr {}; template<> - struct action< tao::pegtl::plus< tao::pegtl::not_one< '"' > > > + struct action< pegtl::plus< pegtl::not_one< '"' > > > { template< typename ActionInput > static void apply( const ActionInput& in, std::string& fn ) @@ -73,8 +75,8 @@ namespace sexpr // last string literal that we use as filename here, and // the input is passed on for chained error messages (as // in "error in line x file foo included from file bar...) - tao::pegtl::file_input i2( fn ); - tao::pegtl::parse_nested< main, sexpr::action >( in, i2, f2 ); + pegtl::file_input i2( fn ); + pegtl::parse_nested< main, sexpr::action >( in, i2, f2 ); } }; @@ -82,16 +84,16 @@ namespace sexpr int main( int argc, char** argv ) // NOLINT(bugprone-exception-escape) { - if( tao::pegtl::analyze< sexpr::main >() != 0 ) { + if( TAO_PEGTL_NAMESPACE::analyze< sexpr::main >() != 0 ) { return 1; } for( int i = 1; i < argc; ++i ) { std::string fn; - tao::pegtl::argv_input in( argv, i ); + TAO_PEGTL_NAMESPACE::argv_input in( argv, i ); try { - tao::pegtl::parse< sexpr::main, sexpr::action >( in, fn ); + TAO_PEGTL_NAMESPACE::parse< sexpr::main, sexpr::action >( in, fn ); } - catch( const tao::pegtl::parse_error& e ) { + catch( const TAO_PEGTL_NAMESPACE::parse_error& e ) { const auto p = e.positions().front(); std::cerr << e.what() << '\n' << in.line_at( p ) << '\n' diff --git a/packages/PEGTL/src/example/pegtl/sum.cpp b/packages/PEGTL/src/example/pegtl/sum.cpp index 9867e3ab84475b9a2c06fbd52ea791d46e36beff..d632e5a6e9d6ee603d3fef95636d79f38a0a8b22 100644 --- a/packages/PEGTL/src/example/pegtl/sum.cpp +++ b/packages/PEGTL/src/example/pegtl/sum.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/symbol_table.cpp b/packages/PEGTL/src/example/pegtl/symbol_table.cpp index 5dba51e3b91b1ebab816d25d759854b3e1286a90..3b10a9813226d5a78a3c2947c35964b2bfb1af87 100644 --- a/packages/PEGTL/src/example/pegtl/symbol_table.cpp +++ b/packages/PEGTL/src/example/pegtl/symbol_table.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/token_input.cpp b/packages/PEGTL/src/example/pegtl/token_input.cpp index df35d4aafdbc061753dd69ca6d75a79b766a6ee3..2ddf46053d78286d3313b277cac881a2ed0960e2 100644 --- a/packages/PEGTL/src/example/pegtl/token_input.cpp +++ b/packages/PEGTL/src/example/pegtl/token_input.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -24,9 +24,9 @@ namespace TAO_PEGTL_NAMESPACE public: using input_t = ParseInput; using value_t = typename ParseInput::value_t; - using iterator_t = typename ParseInput::iterator_t; + using frobnicator_t = typename ParseInput::frobnicator_t; - token_action_input( const iterator_t& in_begin, const ParseInput& in_input ) noexcept + token_action_input( const frobnicator_t& in_begin, const ParseInput& in_input ) noexcept : m_begin( in_begin ), m_input( in_input ) {} @@ -39,7 +39,7 @@ namespace TAO_PEGTL_NAMESPACE token_action_input& operator=( const token_action_input& ) = delete; token_action_input& operator=( token_action_input&& ) = delete; - [[nodiscard]] const iterator_t& iterator() const noexcept + [[nodiscard]] const frobnicator_t& frobnicator() const noexcept { return m_begin; } @@ -49,12 +49,12 @@ namespace TAO_PEGTL_NAMESPACE return m_input; } - [[nodiscard]] iterator_t begin() const noexcept + [[nodiscard]] frobnicator_t begin() const noexcept { return m_begin; } - [[nodiscard]] iterator_t end() const noexcept + [[nodiscard]] frobnicator_t end() const noexcept { return m_input.current(); } @@ -70,7 +70,7 @@ namespace TAO_PEGTL_NAMESPACE } protected: - const iterator_t m_begin; + const frobnicator_t m_begin; const ParseInput& m_input; }; @@ -80,12 +80,12 @@ namespace TAO_PEGTL_NAMESPACE public: using value_t = T; using source_t = Source; - using iterator_t = const T*; + using frobnicator_t = const T*; using action_t = token_action_input< token_parse_input >; template< typename S > - token_parse_input( const iterator_t in_begin, const iterator_t in_end, S&& in_source ) + token_parse_input( const frobnicator_t in_begin, const frobnicator_t in_end, S&& in_source ) : m_begin( in_begin ), m_current( in_begin ), m_end( in_end ), @@ -109,17 +109,17 @@ namespace TAO_PEGTL_NAMESPACE void require( const std::size_t /*unused*/ ) const noexcept {} - [[nodiscard]] iterator_t current() const noexcept + [[nodiscard]] frobnicator_t current() const noexcept { return m_current; } - [[nodiscard]] iterator_t begin() const noexcept + [[nodiscard]] frobnicator_t begin() const noexcept { return m_begin; } - [[nodiscard]] iterator_t end( const std::size_t /*unused*/ = 0 ) const noexcept + [[nodiscard]] frobnicator_t end( const std::size_t /*unused*/ = 0 ) const noexcept { return m_end; } @@ -130,9 +130,19 @@ namespace TAO_PEGTL_NAMESPACE } template< rewind_mode M > - [[nodiscard]] internal::marker< iterator_t, M > mark() noexcept + [[nodiscard]] internal::rewind_guard< M, token_parse_input > auto_rewind() noexcept { - return internal::marker< iterator_t, M >( iterator() ); + return internal::rewind_guard< M, token_parse_input >( this ); + } + + [[nodiscard]] const frobnicator_t& rewind_save() const noexcept + { + return m_current; + } + + void rewind_restore( const frobnicator_t& data ) noexcept + { + m_current = data; } void bump( const std::size_t in_count = 1 ) noexcept @@ -165,20 +175,20 @@ namespace TAO_PEGTL_NAMESPACE return this->current()[ offset ]; } - [[nodiscard]] iterator_t& iterator() noexcept + [[nodiscard]] frobnicator_t& frobnicator() noexcept { return this->m_current; } - [[nodiscard]] const iterator_t& iterator() const noexcept + [[nodiscard]] const frobnicator_t& frobnicator() const noexcept { return this->m_current; } private: - const iterator_t m_begin; - iterator_t m_current; - const iterator_t m_end; + const frobnicator_t m_begin; + frobnicator_t m_current; + const frobnicator_t m_end; const Source m_source; }; diff --git a/packages/PEGTL/src/example/pegtl/unescape.cpp b/packages/PEGTL/src/example/pegtl/unescape.cpp index 10f2a1f4071517108dad344cef0a938ec384264b..7ae3b96e8f2988c8ec9d18057bd0c50518cf2baa 100644 --- a/packages/PEGTL/src/example/pegtl/unescape.cpp +++ b/packages/PEGTL/src/example/pegtl/unescape.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/uri.cpp b/packages/PEGTL/src/example/pegtl/uri.cpp index a964959c41d1b7e9840eceb1b2f9c2ebc737f8da..62ceaf6ccf1ffe392285bc03a866c71ca118340d 100644 --- a/packages/PEGTL/src/example/pegtl/uri.cpp +++ b/packages/PEGTL/src/example/pegtl/uri.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/example/pegtl/uri_print_debug.cpp b/packages/PEGTL/src/example/pegtl/uri_print_debug.cpp index f535e3a11b5c070e95ad64a3b9511b65a5b989c6..f71c8c0f3b4330900a6f6a068a57a8a99a4f7692 100644 --- a/packages/PEGTL/src/example/pegtl/uri_print_debug.cpp +++ b/packages/PEGTL/src/example/pegtl/uri_print_debug.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -18,7 +18,7 @@ int main() int main() // NOLINT(bugprone-exception-escape) { - tao::pegtl::print_debug< tao::pegtl::uri::URI >( std::cout ); + TAO_PEGTL_NAMESPACE::print_debug< TAO_PEGTL_NAMESPACE::uri::URI >( std::cout ); return 0; } diff --git a/packages/PEGTL/src/example/pegtl/uri_print_names.cpp b/packages/PEGTL/src/example/pegtl/uri_print_names.cpp index 95361921756a6d13d4c4a0b73ba6f533e6bf1097..1e766fdbd3053746f71c9a601704fc636b3446a9 100644 --- a/packages/PEGTL/src/example/pegtl/uri_print_names.cpp +++ b/packages/PEGTL/src/example/pegtl/uri_print_names.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -18,7 +18,7 @@ int main() int main() // NOLINT(bugprone-exception-escape) { - tao::pegtl::print_names< tao::pegtl::uri::URI >( std::cout ); + TAO_PEGTL_NAMESPACE::print_names< TAO_PEGTL_NAMESPACE::uri::URI >( std::cout ); return 0; } diff --git a/packages/PEGTL/src/example/pegtl/uri_trace.cpp b/packages/PEGTL/src/example/pegtl/uri_trace.cpp index d041d3343a468a1c651fbd6d09edc3e354b6f20a..ba64c55c56665e555e700cc5d2d155a65dcbe2b6 100644 --- a/packages/PEGTL/src/example/pegtl/uri_trace.cpp +++ b/packages/PEGTL/src/example/pegtl/uri_trace.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/CMakeLists.txt b/packages/PEGTL/src/test/pegtl/CMakeLists.txt index eae7a9546c6fa5b0cb113cb999788a6cbbd828cc..7f707c33a4c9306c84642b3fe297855212e3d263 100644 --- a/packages/PEGTL/src/test/pegtl/CMakeLists.txt +++ b/packages/PEGTL/src/test/pegtl/CMakeLists.txt @@ -36,6 +36,7 @@ set(test_sources contrib_integer.cpp contrib_iri.cpp contrib_json.cpp + contrib_limit_depth.cpp contrib_parse_tree.cpp contrib_parse_tree_to_dot.cpp contrib_partial_trace.cpp @@ -59,6 +60,8 @@ set(test_sources discard_input.cpp enable_control.cpp error_message.cpp + error_message_2.cpp + error_message_3.cpp file_cstream.cpp file_file.cpp file_istream.cpp @@ -69,7 +72,6 @@ set(test_sources internal_file_mapper.cpp internal_file_opener.cpp limit_bytes.cpp - limit_depth.cpp parse_error.cpp pegtl_string_t.cpp position.cpp @@ -86,6 +88,7 @@ set(test_sources rule_discard.cpp rule_enable.cpp rule_eof.cpp + rule_everything.cpp rule_failure.cpp rule_if_apply.cpp rule_if_must.cpp @@ -101,6 +104,7 @@ set(test_sources rule_opt_must.cpp rule_pad.cpp rule_pad_opt.cpp + rule_partial.cpp rule_plus.cpp rule_raise.cpp rule_rematch.cpp @@ -114,6 +118,7 @@ set(test_sources rule_sor.cpp rule_star.cpp rule_star_must.cpp + rule_star_partial.cpp rule_state.cpp rule_success.cpp rule_try_catch.cpp diff --git a/packages/PEGTL/src/test/pegtl/action_enable.cpp b/packages/PEGTL/src/test/pegtl/action_enable.cpp index 3f7a5cb4228da53c3ec04d1b4938925631b38c22..89118e275454777b67c992bca91a8b64e3238fa8 100644 --- a/packages/PEGTL/src/test/pegtl/action_enable.cpp +++ b/packages/PEGTL/src/test/pegtl/action_enable.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/action_match.cpp b/packages/PEGTL/src/test/pegtl/action_match.cpp index af6f5709d0902103073a114981bc0cb065fe641b..29446bc6c681b9b6213c0534a0e320390913a771 100644 --- a/packages/PEGTL/src/test/pegtl/action_match.cpp +++ b/packages/PEGTL/src/test/pegtl/action_match.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/actions_one.cpp b/packages/PEGTL/src/test/pegtl/actions_one.cpp index 4b0f4b6fda87e735883ec3e2f5a27c586f7dbbf6..5e6172986ad7215652bae95192f6040129cc45f8 100644 --- a/packages/PEGTL/src/test/pegtl/actions_one.cpp +++ b/packages/PEGTL/src/test/pegtl/actions_one.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/actions_three.cpp b/packages/PEGTL/src/test/pegtl/actions_three.cpp index 987f764578a77f2c8d9afdcd1983b968d927b318..4accf9c2e9a0c74b32b20f75eae9dc28a4ebce4a 100644 --- a/packages/PEGTL/src/test/pegtl/actions_three.cpp +++ b/packages/PEGTL/src/test/pegtl/actions_three.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/actions_two.cpp b/packages/PEGTL/src/test/pegtl/actions_two.cpp index 77687875c6755d5f8558a3fc4f6445ac69ecf2b7..f55f08134fa6b3e765c74e182edea7fd53fa2a40 100644 --- a/packages/PEGTL/src/test/pegtl/actions_two.cpp +++ b/packages/PEGTL/src/test/pegtl/actions_two.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -102,9 +102,9 @@ namespace TAO_PEGTL_NAMESPACE template< typename ActionInput > static void apply( const ActionInput& in ) { - TAO_PEGTL_TEST_ASSERT( in.iterator().byte == count_byte ); - TAO_PEGTL_TEST_ASSERT( in.iterator().line == count_line ); - TAO_PEGTL_TEST_ASSERT( in.iterator().column == count_column ); + TAO_PEGTL_TEST_ASSERT( in.frobnicator().byte == count_byte ); + TAO_PEGTL_TEST_ASSERT( in.frobnicator().line == count_line ); + TAO_PEGTL_TEST_ASSERT( in.frobnicator().column == count_column ); TAO_PEGTL_TEST_ASSERT( in.input().source() == count_source ); TAO_PEGTL_TEST_ASSERT( in.size() == 1 ); TAO_PEGTL_TEST_ASSERT( in.begin() + 1 == in.end() ); diff --git a/packages/PEGTL/src/test/pegtl/argv_input.cpp b/packages/PEGTL/src/test/pegtl/argv_input.cpp index 0f3c283d20b99ae08f1e94a265a4f7c0ffd440c4..b6788378f66a5f56b503b212a561461f4073d9f5 100644 --- a/packages/PEGTL/src/test/pegtl/argv_input.cpp +++ b/packages/PEGTL/src/test/pegtl/argv_input.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_classes.cpp b/packages/PEGTL/src/test/pegtl/ascii_classes.cpp index f9e255c33f11bbe7e47e6f879a8234271faf061d..bf9db08d9672ea70b02dce408e621d8c6d9b5a69 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_classes.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_classes.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_eol.cpp b/packages/PEGTL/src/test/pegtl/ascii_eol.cpp index 0169eda66cd94f2794254e7990b6dd7e4c93ced5..da2364479728fa5539e84177d29a08472f3bb95e 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_eol.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_eol.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_eolf.cpp b/packages/PEGTL/src/test/pegtl/ascii_eolf.cpp index c6033080c516ba6b6eeebd9755511834f9067c6d..32bb2801896cc09c3e692f82240923c1d115a43c 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_eolf.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_eolf.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_forty_two.cpp b/packages/PEGTL/src/test/pegtl/ascii_forty_two.cpp index bf3edcbdc123c1b33e39f655f05cd15ec51f8d22..e5854c57c658770528d7eb2351c28efee4c07b1b 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_forty_two.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_forty_two.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -17,19 +17,19 @@ namespace TAO_PEGTL_NAMESPACE verify_rule< forty_two< 'a' > >( __LINE__, __FILE__, std::string( i, 'a' ), result_type::local_failure ); } for( std::size_t i = 42; i < 100; ++i ) { - verify_rule< forty_two< 'a' > >( __LINE__, __FILE__, std::string( i, 'a' ), result_type::success, int( i - 42 ) ); + verify_rule< forty_two< 'a' > >( __LINE__, __FILE__, std::string( i, 'a' ), result_type::success, static_cast< int >( i - 42 ) ); } for( std::size_t i = 0; i < 42; ++i ) { verify_rule< forty_two< 'a', 'z' > >( __LINE__, __FILE__, std::string( i, 'a' ), result_type::local_failure ); } for( std::size_t i = 42; i < 100; ++i ) { - verify_rule< forty_two< 'a', 'z' > >( __LINE__, __FILE__, std::string( i, 'a' ), result_type::success, int( i - 42 ) ); + verify_rule< forty_two< 'a', 'z' > >( __LINE__, __FILE__, std::string( i, 'a' ), result_type::success, static_cast< int >( i - 42 ) ); } for( std::size_t i = 0; i < 42; ++i ) { verify_rule< forty_two< 'a', 'z' > >( __LINE__, __FILE__, std::string( i, 'z' ), result_type::local_failure ); } for( std::size_t i = 42; i < 100; ++i ) { - verify_rule< forty_two< 'a', 'z' > >( __LINE__, __FILE__, std::string( i, 'z' ), result_type::success, int( i - 42 ) ); + verify_rule< forty_two< 'a', 'z' > >( __LINE__, __FILE__, std::string( i, 'z' ), result_type::success, static_cast< int >( i - 42 ) ); } verify_rule< forty_two< 'a', 'z' > >( __LINE__, __FILE__, "azzaazaazaaazzzaaaazzaaazzaazazzzaazzazaza", result_type::success ); } diff --git a/packages/PEGTL/src/test/pegtl/ascii_identifier.cpp b/packages/PEGTL/src/test/pegtl/ascii_identifier.cpp index 8c1a14b852f6d3ea69a194ff625f7eb6b80be8e6..0e613d1a15f8b6ab415116c3010d15b30ff012e7 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_identifier.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_identifier.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_istring.cpp b/packages/PEGTL/src/test/pegtl/ascii_istring.cpp index 3f1b1ff09aa1aa19dffc33e55dc256d80baaeaa7..be028c65e19fad39cad7448457392e403d4d9c23 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_istring.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_istring.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_keyword.cpp b/packages/PEGTL/src/test/pegtl/ascii_keyword.cpp index 5d384c5f120f3eb644533944031d14875058bef6..43182bfeb5d75fecfc7c0e048a6ba444cc7285c1 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_keyword.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_keyword.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_shebang.cpp b/packages/PEGTL/src/test/pegtl/ascii_shebang.cpp index 71fc843daa3365e3c2eda3f4c7c7b7e273a87f00..06a6393998c696228fbcf3040ec61717a6030e18 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_shebang.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_shebang.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_string.cpp b/packages/PEGTL/src/test/pegtl/ascii_string.cpp index e128dca6a002a1f92d10227996d37292da275207..3f846d6b9921f732bf2c80411f9d836b54a7f21a 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_string.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_string.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_three.cpp b/packages/PEGTL/src/test/pegtl/ascii_three.cpp index 68a026debfec176c96238da99298b896669b1610..7da1ef3659b73e67bcb40086149e645af3edd027 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_three.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_three.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/ascii_two.cpp b/packages/PEGTL/src/test/pegtl/ascii_two.cpp index 8c0ff00973cd87f0bf28eb3108aa3ac10e4d5a80..4f94775e796eb01de8a893cb8b9fa356a9445198 100644 --- a/packages/PEGTL/src/test/pegtl/ascii_two.cpp +++ b/packages/PEGTL/src/test/pegtl/ascii_two.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/buffer_input.cpp b/packages/PEGTL/src/test/pegtl/buffer_input.cpp index eff7614e5f347d52cc942487ecf8856643f94e70..74ec6173b7aac21e2bbde62576ec4579f2dc4b4b 100644 --- a/packages/PEGTL/src/test/pegtl/buffer_input.cpp +++ b/packages/PEGTL/src/test/pegtl/buffer_input.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/change_action_and_state.cpp b/packages/PEGTL/src/test/pegtl/change_action_and_state.cpp index 9cf3cce155c0ce5ab17966ad50bb2637f989fcf5..4f2039a131f29fd79ca27d70d4ffc639a88aef92 100644 --- a/packages/PEGTL/src/test/pegtl/change_action_and_state.cpp +++ b/packages/PEGTL/src/test/pegtl/change_action_and_state.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/change_action_and_states.cpp b/packages/PEGTL/src/test/pegtl/change_action_and_states.cpp index 9ea7faa781b2f2aad0ce01633e4e15908dc3d7e0..e03eca89555959caad9b069b93a04637a8043a44 100644 --- a/packages/PEGTL/src/test/pegtl/change_action_and_states.cpp +++ b/packages/PEGTL/src/test/pegtl/change_action_and_states.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/change_state.cpp b/packages/PEGTL/src/test/pegtl/change_state.cpp index 6061b9178cc9e0ec0a3e5ebcfa2182a5d8a051d8..d52302a236cb6a56bb3bb9fe28a4a1511a971e8e 100644 --- a/packages/PEGTL/src/test/pegtl/change_state.cpp +++ b/packages/PEGTL/src/test/pegtl/change_state.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/change_states.cpp b/packages/PEGTL/src/test/pegtl/change_states.cpp index 64a4b27620d241d9e23d02860b8dd972e8a66773..b401332717a0e00da62d4fadfa67a7e07f8f7a3c 100644 --- a/packages/PEGTL/src/test/pegtl/change_states.cpp +++ b/packages/PEGTL/src/test/pegtl/change_states.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/check_bytes.cpp b/packages/PEGTL/src/test/pegtl/check_bytes.cpp index d5dc2ad00eb8e9c666f352df8a9cf674f59aa021..c02e91a4708a6ba5e85ccb0816dc69c4e1bd1dc9 100644 --- a/packages/PEGTL/src/test/pegtl/check_bytes.cpp +++ b/packages/PEGTL/src/test/pegtl/check_bytes.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -29,20 +29,20 @@ namespace TAO_PEGTL_NAMESPACE void unit_test() { memory_input<> i1( "aaa", __FUNCTION__ ); - const auto r1 = pegtl::parse< test_grammar >( i1 ); + const auto r1 = parse< test_grammar >( i1 ); TAO_PEGTL_TEST_ASSERT( r1 ); memory_input<> i2( "aaaaaaaaaaa", __FUNCTION__ ); - const auto r2 = pegtl::parse< test_grammar >( i2 ); + const auto r2 = parse< test_grammar >( i2 ); TAO_PEGTL_TEST_ASSERT( r2 ); memory_input<> i3( "aaa", __FUNCTION__ ); - const auto r3 = pegtl::parse< test_grammar, test_action >( i3 ); + const auto r3 = parse< test_grammar, test_action >( i3 ); TAO_PEGTL_TEST_ASSERT( r3 ); #if defined( __cpp_exceptions ) memory_input<> i4( "aaaaaaaaaaa", __FUNCTION__ ); - TAO_PEGTL_TEST_THROWS( pegtl::parse< test_grammar, test_action >( i4 ) ); + TAO_PEGTL_TEST_THROWS( parse< test_grammar, test_action >( i4 ) ); #endif } diff --git a/packages/PEGTL/src/test/pegtl/contains.cpp b/packages/PEGTL/src/test/pegtl/contains.cpp index ee1d9a6fb2a9b57d86c87af48d6fb966354c5d62..764b0d152e240ab439980a61b7337253e82d3d83 100644 --- a/packages/PEGTL/src/test/pegtl/contains.cpp +++ b/packages/PEGTL/src/test/pegtl/contains.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_alphabet.cpp b/packages/PEGTL/src/test/pegtl/contrib_alphabet.cpp index 73fdecf224063ac5e1e0f3900b35c3b459238f72..8b01e1e3dcbe1c1178ac66a86c5c2b0062bc3ac3 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_alphabet.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_alphabet.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_analyze.cpp b/packages/PEGTL/src/test/pegtl/contrib_analyze.cpp index cce72b544c35918843e7707def84b4f28019709c..6880f406a60daec90d6523ce9e96ed7929e066da 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_analyze.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_analyze.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_control_action.cpp b/packages/PEGTL/src/test/pegtl/contrib_control_action.cpp index 512d1ba541fcccb93543b5c3b0cd3747497f9386..df0f802cfeb05397a52d71a15b9c604134432061 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_control_action.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_control_action.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -15,6 +15,11 @@ namespace TAO_PEGTL_NAMESPACE : nothing< Rule > {}; + template< typename Rule > + struct dummy_action + : control_action + {}; + struct first_rule : sor< alpha, digit > {}; @@ -137,6 +142,12 @@ namespace TAO_PEGTL_NAMESPACE void unit_test() { + { + memory_input in( "0", __FUNCTION__ ); + const auto b = parse< first_rule, dummy_action >( in, 42 ); + TAO_PEGTL_TEST_ASSERT( b ); + TAO_PEGTL_TEST_ASSERT( story.empty() ); + } { memory_input in( "0", __FUNCTION__ ); const auto b = parse< first_rule, test_action >( in, 42 ); diff --git a/packages/PEGTL/src/test/pegtl/contrib_coverage.cpp b/packages/PEGTL/src/test/pegtl/contrib_coverage.cpp index b70954e24ec22f59ecf26775aa8d703e6461cd75..2c1d5798fa870382eeba9f6b084c2d4226c5f9ae 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_coverage.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_coverage.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_function.cpp b/packages/PEGTL/src/test/pegtl/contrib_function.cpp index 3455fe18cc4046c29bb47bfda689ff5dc2ce0e42..eca901aab5ed7c9ebe240944d712d2c3f8b602f7 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_function.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_function.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_http.cpp b/packages/PEGTL/src/test/pegtl/contrib_http.cpp index 3bdb52d59c4fa9d9756b5ecf5189fb45da75d8b4..486a8774a3ba7841dc1bee0d992bda379d859dbf 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_http.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_http.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_if_then.cpp b/packages/PEGTL/src/test/pegtl/contrib_if_then.cpp index b98a3ba598dababe65395bf4e85653b369373cc5..ff40b3bfd8d494e7d4f9a3cd23df6043fdfc12da 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_if_then.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_if_then.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_instantiate.cpp b/packages/PEGTL/src/test/pegtl/contrib_instantiate.cpp index 86566822b095f1465fd9ca848e365c7c4bba89da..a8257c72cca2c8a990ff522ef748e953b893e160 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_instantiate.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_instantiate.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_integer.cpp b/packages/PEGTL/src/test/pegtl/contrib_integer.cpp index f3441c0ea0e199e58083c8426d8589ef555def94..1421cd8f9991bb04da02f01dd86f4142f75c8cc4 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_integer.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_integer.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_iri.cpp b/packages/PEGTL/src/test/pegtl/contrib_iri.cpp index 96890d71c3e66aa9f68db8f7c3f2486c99bcc890..84440b48670faf2cfda0b05e5184e0b7851082df 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_iri.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_iri.cpp @@ -1,5 +1,5 @@ -// Copyright (c) 2021 Kelvin Hammond -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Kelvin Hammond +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_json.cpp b/packages/PEGTL/src/test/pegtl/contrib_json.cpp index 62cf3b778a657c90cfc029cc83b85d97773f61ad..d57adc48648dd5a86463813a08c30ae87b4acace 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_json.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_json.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/limit_depth.cpp b/packages/PEGTL/src/test/pegtl/contrib_limit_depth.cpp similarity index 54% rename from packages/PEGTL/src/test/pegtl/limit_depth.cpp rename to packages/PEGTL/src/test/pegtl/contrib_limit_depth.cpp index 3f9df51639fef2d3eef3d5414845fd29c4163666..b32055cccb0d9bfe044624f59f075451db5e1112 100644 --- a/packages/PEGTL/src/test/pegtl/limit_depth.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_limit_depth.cpp @@ -1,7 +1,8 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) +#include <tao/pegtl/contrib/input_with_depth.hpp> #include <tao/pegtl/contrib/limit_depth.hpp> #include "test.hpp" @@ -28,21 +29,23 @@ namespace TAO_PEGTL_NAMESPACE void unit_test() { - memory_input<> i1( "aaa", __FUNCTION__ ); - const auto r1 = pegtl::parse< test_grammar >( i1 ); + using memory_input_with_depth = input_with_depth< memory_input<> >; + + memory_input_with_depth i1( "aaa", __FUNCTION__ ); + const auto r1 = parse< test_grammar >( i1 ); TAO_PEGTL_TEST_ASSERT( r1 ); - memory_input<> i2( "aaaaaaaaaaa", __FUNCTION__ ); - const auto r2 = pegtl::parse< test_grammar >( i2 ); + memory_input_with_depth i2( "aaaaaaaaaaa", __FUNCTION__ ); + const auto r2 = parse< test_grammar >( i2 ); TAO_PEGTL_TEST_ASSERT( r2 ); - memory_input<> i3( "aaa", __FUNCTION__ ); - const auto r3 = pegtl::parse< test_grammar, test_action >( i3 ); + memory_input_with_depth i3( "aaa", __FUNCTION__ ); + const auto r3 = parse< test_grammar, test_action >( i3 ); TAO_PEGTL_TEST_ASSERT( r3 ); #if defined( __cpp_exceptions ) - memory_input<> i4( "aaaaaaaaaaa", __FUNCTION__ ); - TAO_PEGTL_TEST_THROWS( pegtl::parse< test_grammar, test_action >( i4 ) ); + memory_input_with_depth i4( "aaaaaaaaaaa", __FUNCTION__ ); + TAO_PEGTL_TEST_THROWS( parse< test_grammar, test_action >( i4 ) ); #endif } diff --git a/packages/PEGTL/src/test/pegtl/contrib_parse_tree.cpp b/packages/PEGTL/src/test/pegtl/contrib_parse_tree.cpp index 04a8a0a797fae9a1b0967c25af2aa0fb9e8294ac..cf2387fb6b27c024afd23395459549aa29c60297 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_parse_tree.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_parse_tree.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_parse_tree_to_dot.cpp b/packages/PEGTL/src/test/pegtl/contrib_parse_tree_to_dot.cpp index 517092ab26237f66b7d563e84c84aebcba0af72b..160c3f1a06d05c3f029e278f49641f9206d6633c 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_parse_tree_to_dot.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_parse_tree_to_dot.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_partial_trace.cpp b/packages/PEGTL/src/test/pegtl/contrib_partial_trace.cpp index 1c8f1a97786d7e4632dc596a573eca742b202641..a643026b6a588b62ecb52fa9a89a02e69e076ba5 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_partial_trace.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_partial_trace.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_predicates.cpp b/packages/PEGTL/src/test/pegtl/contrib_predicates.cpp index 00403c330686cb07f8dcd52d86192314f0db2588..548a5447eab5052cb853d0938a66aa392ac02ec6 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_predicates.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_predicates.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_print.cpp b/packages/PEGTL/src/test/pegtl/contrib_print.cpp index 2c2bde7e73dca9565e4c44b1ffcbda2216208e57..c07a63c1a768332265e98ca99ea1655f9413989a 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_print.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_print.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_raw_string.cpp b/packages/PEGTL/src/test/pegtl/contrib_raw_string.cpp index ef6abda59265fd317fc3bded653ceb7559c6767d..b2a95a4d492af29ed6335ebfd68ba3f7382e7d23 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_raw_string.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_raw_string.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_remove_first_state.cpp b/packages/PEGTL/src/test/pegtl/contrib_remove_first_state.cpp index c31ef5d40739576a07e59fcaad5db9a7a7e2bc07..b3283dfb433ba2851c0fdf9720b8420f9dec15f2 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_remove_first_state.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_remove_first_state.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_remove_last_states.cpp b/packages/PEGTL/src/test/pegtl/contrib_remove_last_states.cpp index 240c2abb0001d82c8e7dbc6596740900620c6f33..fd9a6149c5b2704a6f2b9bf682a7764d8599c60c 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_remove_last_states.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_remove_last_states.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_rep_one_min_max.cpp b/packages/PEGTL/src/test/pegtl/contrib_rep_one_min_max.cpp index 69dd862afa5312d7ef385552e2dbf7a7d8ba1af3..17518ab82fc44483bdbf08520748a7ff41229e18 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_rep_one_min_max.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_rep_one_min_max.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_rep_string.cpp b/packages/PEGTL/src/test/pegtl/contrib_rep_string.cpp index 91eda129eb8fc62b9a70c2caca00947cb4b02dc6..bbecece8f7b38c3f76f0e608e8b3f6f1ba08cd04 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_rep_string.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_rep_string.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_separated_seq.cpp b/packages/PEGTL/src/test/pegtl/contrib_separated_seq.cpp index 1a47a5fbeddf3a2c826a5ab95c96f1086d56f1a3..870237d36043a77e88136d7d9b735f709fac7901 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_separated_seq.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_separated_seq.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_state_control.cpp b/packages/PEGTL/src/test/pegtl/contrib_state_control.cpp index 7fc3b2b2929a904fe4c30efb1bd3fbc8e107a986..0ee3293ecba120fac145e9f33532d48e5fdd870a 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_state_control.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_state_control.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_to_string.cpp b/packages/PEGTL/src/test/pegtl/contrib_to_string.cpp index bd03ed78940f1abbf14f56d7abffd71c6c038717..3d94ee8fa570d8d8977a2647a36067aaeb357317 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_to_string.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_to_string.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_trace1.cpp b/packages/PEGTL/src/test/pegtl/contrib_trace1.cpp index 31cc5c866e3d732f0c26a53276f534a1aca443f6..ec207cf23123172d425ab396d0741475e4bcfc77 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_trace1.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_trace1.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -8,14 +8,20 @@ #include <tao/pegtl/contrib/trace.hpp> -namespace TAO_PEGTL_NAMESPACE +namespace test { + using namespace TAO_PEGTL_NAMESPACE; + #if defined( __cpp_exceptions ) using grammar = seq< sor< try_catch< must< one< 'a' > > >, one< 'F' > >, eof >; #else using grammar = seq< sor< one< 'a' >, one< 'F' > >, eof >; #endif +} // namespace test + +namespace TAO_PEGTL_NAMESPACE +{ void unit_test() { const std::string data = "F"; @@ -23,9 +29,9 @@ namespace TAO_PEGTL_NAMESPACE // Just enough to see that it compiles and nothing explodes; // the output format probabaly changes between compilers and // versions making a proper test difficult. - standard_trace< grammar >( in ); + standard_trace< test::grammar >( in ); in.restart(); - complete_trace< grammar >( in ); + complete_trace< test::grammar >( in ); } } // namespace TAO_PEGTL_NAMESPACE diff --git a/packages/PEGTL/src/test/pegtl/contrib_trace2.cpp b/packages/PEGTL/src/test/pegtl/contrib_trace2.cpp index 90112f7e896c7a3af151d23d884cf9990ccc9621..a717379687db4cf8fe206caad1f135b64e5ef421 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_trace2.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_trace2.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -6,8 +6,10 @@ #include <tao/pegtl/contrib/trace.hpp> -namespace TAO_PEGTL_NAMESPACE +namespace test { + using namespace TAO_PEGTL_NAMESPACE; + using GRAMMAR1 = sor< failure, one< 'a' > >; using GRAMMAR2 = seq< one< 'a' >, any, any, any, any, one< 'b' >, eof >; using GRAMMAR3 = sor< one< 'a' >, one< 'b' > >; @@ -42,45 +44,49 @@ namespace TAO_PEGTL_NAMESPACE } }; +} // namespace test + +namespace TAO_PEGTL_NAMESPACE +{ void unit_test() { { memory_input in( "ab", "trace test please ignore" ); - const auto result = standard_trace< GRAMMAR1 >( in ); + const auto result = standard_trace< test::GRAMMAR1 >( in ); TAO_PEGTL_TEST_ASSERT( result ); - TAO_PEGTL_TEST_ASSERT( a0 == 0 ); - TAO_PEGTL_TEST_ASSERT( a == 0 ); + TAO_PEGTL_TEST_ASSERT( test::a0 == 0 ); + TAO_PEGTL_TEST_ASSERT( test::a == 0 ); } { memory_input in( "ab", "trace test please ignore" ); - const auto result = standard_trace< GRAMMAR1, trace_action >( in ); + const auto result = standard_trace< test::GRAMMAR1, test::trace_action >( in ); TAO_PEGTL_TEST_ASSERT( result ); - TAO_PEGTL_TEST_ASSERT( a0 == 1 ); - TAO_PEGTL_TEST_ASSERT( a == 1 ); + TAO_PEGTL_TEST_ASSERT( test::a0 == 1 ); + TAO_PEGTL_TEST_ASSERT( test::a == 1 ); } { memory_input in( "a\r\n\t\0b", 6, "trace test please ignore" ); - const auto result = standard_trace< GRAMMAR2 >( in ); + const auto result = standard_trace< test::GRAMMAR2 >( in ); TAO_PEGTL_TEST_ASSERT( result ); - TAO_PEGTL_TEST_ASSERT( a0 == 1 ); - TAO_PEGTL_TEST_ASSERT( a == 1 ); + TAO_PEGTL_TEST_ASSERT( test::a0 == 1 ); + TAO_PEGTL_TEST_ASSERT( test::a == 1 ); } { memory_input in( "a\r\n\t\0b", 6, "trace test please ignore" ); - const auto result = standard_trace< GRAMMAR2, trace_action >( in ); + const auto result = standard_trace< test::GRAMMAR2, test::trace_action >( in ); TAO_PEGTL_TEST_ASSERT( result ); - TAO_PEGTL_TEST_ASSERT( a0 == 2 ); - TAO_PEGTL_TEST_ASSERT( a == 1 ); + TAO_PEGTL_TEST_ASSERT( test::a0 == 2 ); + TAO_PEGTL_TEST_ASSERT( test::a == 1 ); } { memory_input in( "c", "trace test please ignore" ); - const auto result = standard_trace< GRAMMAR3 >( in ); + const auto result = standard_trace< test::GRAMMAR3 >( in ); TAO_PEGTL_TEST_ASSERT( !result ); } #if defined( __cpp_exceptions ) { memory_input in( "c", "trace test please ignore" ); - const auto result = standard_trace< GRAMMAR4 >( in ); + const auto result = standard_trace< test::GRAMMAR4 >( in ); TAO_PEGTL_TEST_ASSERT( !result ); } #endif diff --git a/packages/PEGTL/src/test/pegtl/contrib_unescape.cpp b/packages/PEGTL/src/test/pegtl/contrib_unescape.cpp index 9efda4b9001406bcfd82d09cc5a6aedb25b01f89..6a21ff9f17acaba64ddd9d153593a2a83de65172 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_unescape.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_unescape.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/contrib_uri.cpp b/packages/PEGTL/src/test/pegtl/contrib_uri.cpp index 9162abe33b8b81c83a92a0d468ff3f686fcbd1ff..9121b7f9ee9b7d2387cd56c807c9391efe2077ba 100644 --- a/packages/PEGTL/src/test/pegtl/contrib_uri.cpp +++ b/packages/PEGTL/src/test/pegtl/contrib_uri.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/control_unwind.cpp b/packages/PEGTL/src/test/pegtl/control_unwind.cpp index 468678e23268f6bd7d830d6f9a83a83cd4487acd..d69eb6914e6760b2e43800e2affc5ffa36bb1e72 100644 --- a/packages/PEGTL/src/test/pegtl/control_unwind.cpp +++ b/packages/PEGTL/src/test/pegtl/control_unwind.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/data_cstring.cpp b/packages/PEGTL/src/test/pegtl/data_cstring.cpp index f8e86171e85e0e00ac5ec5a0b0c706eb6097e222..d361e7d388fa1386b3fa10f8e3882e7d47de0251 100644 --- a/packages/PEGTL/src/test/pegtl/data_cstring.cpp +++ b/packages/PEGTL/src/test/pegtl/data_cstring.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/demangle.cpp b/packages/PEGTL/src/test/pegtl/demangle.cpp index b7acf79c27f62ec3e8f1058213f34e29e284b7ac..38217f1953c326059f979678d7a0e3cae5189d37 100644 --- a/packages/PEGTL/src/test/pegtl/demangle.cpp +++ b/packages/PEGTL/src/test/pegtl/demangle.cpp @@ -1,35 +1,45 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) #include "test.hpp" +#include <string> + #include <tao/pegtl/demangle.hpp> +#define TAO_PEGTL_STRINGIFY( a ) TAO_PEGTL_STRINGIFY_IMPL( a ) +#define TAO_PEGTL_STRINGIFY_IMPL( a ) #a + namespace TAO_PEGTL_NAMESPACE { template< typename T > void test( const std::string& s ) { + std::cerr << s << std::endl; + std::cerr << demangle< T >() << std::endl; TAO_PEGTL_TEST_ASSERT( demangle< T >() == s ); } void unit_test() { + const std::string ns = TAO_PEGTL_STRINGIFY( TAO_PEGTL_NAMESPACE ); #if !defined( __clang__ ) && defined( __GNUC__ ) && ( __GNUC__ == 9 ) && ( __GNUC_MINOR__ <= 2 ) // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91155 test< int >( "i" ); test< double >( "d" ); - test< seq< bytes< 42 >, eof > >( "N3tao5pegtl3seqIJNS0_5bytesILj42EEENS0_3eofEEEE" ); + if( ns == "tao::pegtl" ) { + test< seq< bytes< 42 >, eof > >( "N3tao5pegtl3seqIJNS0_5bytesILj42EEENS0_3eofEEEE" ); + } #elif defined( _MSC_VER ) && !defined( __clang__ ) test< int >( "int" ); test< double >( "double" ); // in the Microsoft world, class and struct are not the same! - test< seq< bytes< 42 >, eof > >( "struct tao::pegtl::seq<struct tao::pegtl::bytes<42>,struct tao::pegtl::eof>" ); + test< seq< bytes< 42 >, eof > >( "struct " + ns + "::seq<struct " + ns + "::bytes<42>,struct " + ns + "::eof>" ); #else test< int >( "int" ); test< double >( "double" ); - test< seq< bytes< 42 >, eof > >( "tao::pegtl::seq<tao::pegtl::bytes<42>, tao::pegtl::eof>" ); + test< seq< bytes< 42 >, eof > >( ns + "::seq<" + ns + "::bytes<42>, " + ns + "::eof>" ); #endif } diff --git a/packages/PEGTL/src/test/pegtl/discard_input.cpp b/packages/PEGTL/src/test/pegtl/discard_input.cpp index 3dac97076d12635e3cb8ea9f209b262a3aedd043..3e8a39187246718a6ac0d792737261ccc4abe14f 100644 --- a/packages/PEGTL/src/test/pegtl/discard_input.cpp +++ b/packages/PEGTL/src/test/pegtl/discard_input.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/enable_control.cpp b/packages/PEGTL/src/test/pegtl/enable_control.cpp index 49429e39142d7a05b5074af83a41b5300e118dda..72a3cb64d1a0078ef15b46bbfc9bf4d5d09b2a9c 100644 --- a/packages/PEGTL/src/test/pegtl/enable_control.cpp +++ b/packages/PEGTL/src/test/pegtl/enable_control.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/error_message.cpp b/packages/PEGTL/src/test/pegtl/error_message.cpp index 220cfbc5292fb517020a67b5f256e5ad643ea3fd..66cc87444ec46983856449f701362ec9e0b47c09 100644 --- a/packages/PEGTL/src/test/pegtl/error_message.cpp +++ b/packages/PEGTL/src/test/pegtl/error_message.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -22,7 +22,7 @@ namespace test1 struct grammar : sor< a, b > {}; template< typename > inline constexpr const char* error_message = nullptr; - template<> inline constexpr auto error_message< test1::b > = "test123"; + template<> inline constexpr auto error_message< b > = "test123"; // clang-format on struct error diff --git a/packages/PEGTL/src/test/pegtl/error_message_2.cpp b/packages/PEGTL/src/test/pegtl/error_message_2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..15aff7a7a628c57940e79d22728b058eed4bc598 --- /dev/null +++ b/packages/PEGTL/src/test/pegtl/error_message_2.cpp @@ -0,0 +1,44 @@ +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#if !defined( __cpp_exceptions ) +#include <iostream> +int main() +{ + std::cout << "Exception support disabled, skipping test..." << std::endl; +} +#else + +#include "test.hpp" + +namespace test2 +{ + using namespace TAO_PEGTL_NAMESPACE; + + // clang-format off + struct a : one< 'a' > {}; + struct b : one< 'b' > {}; + struct grammar : sor< a, sor< b, TAO_PEGTL_RAISE_MESSAGE( "test123" ) > > {}; + // clang-format on + +} // namespace test2 + +namespace TAO_PEGTL_NAMESPACE +{ + void unit_test() + { + try { + parse< test2::grammar >( memory_input( "c", __FUNCTION__ ) ); + TAO_PEGTL_TEST_UNREACHABLE; // LCOV_EXCL_LINE + } + catch( const parse_error& e ) { + TAO_PEGTL_TEST_ASSERT( e.message() == "test123" ); + } + } + +} // namespace TAO_PEGTL_NAMESPACE + +#include "main.hpp" + +#endif diff --git a/packages/PEGTL/src/test/pegtl/error_message_3.cpp b/packages/PEGTL/src/test/pegtl/error_message_3.cpp new file mode 100644 index 0000000000000000000000000000000000000000..16b00ae7d6acae8eb698c2e26ffb230a7bd6df91 --- /dev/null +++ b/packages/PEGTL/src/test/pegtl/error_message_3.cpp @@ -0,0 +1,48 @@ +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#if !defined( __cpp_exceptions ) +#include <iostream> +int main() +{ + std::cout << "Exception support disabled, skipping test..." << std::endl; +} +#else + +#include "test.hpp" + +namespace test3 +{ + using namespace TAO_PEGTL_NAMESPACE; + + // clang-format off + struct a : one< 'a' > {}; + + struct b : one< 'b' > { + static constexpr const char* error_message = "test123"; + }; + + struct grammar : sor< a, must< b > > {}; + // clang-format on + +} // namespace test3 + +namespace TAO_PEGTL_NAMESPACE +{ + void unit_test() + { + try { + parse< test3::grammar >( memory_input( "c", __FUNCTION__ ) ); + TAO_PEGTL_TEST_UNREACHABLE; // LCOV_EXCL_LINE + } + catch( const parse_error& e ) { + TAO_PEGTL_TEST_ASSERT( e.message() == "test123" ); + } + } + +} // namespace TAO_PEGTL_NAMESPACE + +#include "main.hpp" + +#endif diff --git a/packages/PEGTL/src/test/pegtl/file_cstream.cpp b/packages/PEGTL/src/test/pegtl/file_cstream.cpp index d51dbd2b08f669e6a1edda1b18f82219fc8ab656..72b3f857c016bd181ffdefcc52aebedcf0696f71 100644 --- a/packages/PEGTL/src/test/pegtl/file_cstream.cpp +++ b/packages/PEGTL/src/test/pegtl/file_cstream.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/file_file.cpp b/packages/PEGTL/src/test/pegtl/file_file.cpp index fcc20af53b7d42e61ae4362a2a409d8b469be792..b1b3b18193a1dfe2b62c08aff119ac2b9d6821b5 100644 --- a/packages/PEGTL/src/test/pegtl/file_file.cpp +++ b/packages/PEGTL/src/test/pegtl/file_file.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/file_istream.cpp b/packages/PEGTL/src/test/pegtl/file_istream.cpp index cb4e3cae24b090ec563cd5c19279bf2a326f4820..b315c497f69bfa86f588b7eb23eae43aba70dc72 100644 --- a/packages/PEGTL/src/test/pegtl/file_istream.cpp +++ b/packages/PEGTL/src/test/pegtl/file_istream.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/file_mmap.cpp b/packages/PEGTL/src/test/pegtl/file_mmap.cpp index afa83d1c3a635c36122aae00ca22010fabf00bf1..6c15aa139fb7ff07afa961e71587ba5df402dc74 100644 --- a/packages/PEGTL/src/test/pegtl/file_mmap.cpp +++ b/packages/PEGTL/src/test/pegtl/file_mmap.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/file_read.cpp b/packages/PEGTL/src/test/pegtl/file_read.cpp index 963120e7d66733c080c98cfefa17a703d6934879..36e07afbfbdbbe019d150e23764ba4444fe18eb1 100644 --- a/packages/PEGTL/src/test/pegtl/file_read.cpp +++ b/packages/PEGTL/src/test/pegtl/file_read.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -12,7 +12,7 @@ namespace TAO_PEGTL_NAMESPACE : public read_input< P, Eol > { explicit open_input( const internal::filesystem::path& path ) - : read_input< P, Eol >( internal::file_open( path ), path ) + : read_input< P, Eol >( internal::read_file_open( path ), path ) {} }; diff --git a/packages/PEGTL/src/test/pegtl/icu_general.cpp b/packages/PEGTL/src/test/pegtl/icu_general.cpp index 15e6e62cd7424d3c1c00687ea44675b607ae1c2e..9db69db5346fb2510f49902351a1457b92cd2ca1 100644 --- a/packages/PEGTL/src/test/pegtl/icu_general.cpp +++ b/packages/PEGTL/src/test/pegtl/icu_general.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/internal_endian.cpp b/packages/PEGTL/src/test/pegtl/internal_endian.cpp index f1bb6b1cb57b838aea115e93aa0b424931a758e5..b890817789dd3576922124ed6eb2263fab706cf3 100644 --- a/packages/PEGTL/src/test/pegtl/internal_endian.cpp +++ b/packages/PEGTL/src/test/pegtl/internal_endian.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/internal_file_mapper.cpp b/packages/PEGTL/src/test/pegtl/internal_file_mapper.cpp index 94f6e3f5bf94eb71c1e4e0bbdbb6e0dd0e653e91..1034bea58edc0117b4eef4a411be8e5c84bb2522 100644 --- a/packages/PEGTL/src/test/pegtl/internal_file_mapper.cpp +++ b/packages/PEGTL/src/test/pegtl/internal_file_mapper.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/internal_file_opener.cpp b/packages/PEGTL/src/test/pegtl/internal_file_opener.cpp index 1ca75d9609c386e2fd1945b25c24868d29fb5b94..b3f05ef34a38ffe85b2e654997085f4e60950065 100644 --- a/packages/PEGTL/src/test/pegtl/internal_file_opener.cpp +++ b/packages/PEGTL/src/test/pegtl/internal_file_opener.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/limit_bytes.cpp b/packages/PEGTL/src/test/pegtl/limit_bytes.cpp index f376ad835650bd77f27cd284bf3323ef11bb7afa..2ef432af1d80b107ae9a51353add866169461822 100644 --- a/packages/PEGTL/src/test/pegtl/limit_bytes.cpp +++ b/packages/PEGTL/src/test/pegtl/limit_bytes.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2021-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -29,20 +29,20 @@ namespace TAO_PEGTL_NAMESPACE void unit_test() { memory_input<> i1( "aaa", __FUNCTION__ ); - const auto r1 = pegtl::parse< test_grammar >( i1 ); + const auto r1 = parse< test_grammar >( i1 ); TAO_PEGTL_TEST_ASSERT( r1 ); memory_input<> i2( "aaaaaaaaaaa", __FUNCTION__ ); - const auto r2 = pegtl::parse< test_grammar >( i2 ); + const auto r2 = parse< test_grammar >( i2 ); TAO_PEGTL_TEST_ASSERT( r2 ); memory_input<> i3( "aaa", __FUNCTION__ ); - const auto r3 = pegtl::parse< test_grammar, test_action >( i3 ); + const auto r3 = parse< test_grammar, test_action >( i3 ); TAO_PEGTL_TEST_ASSERT( r3 ); #if defined( __cpp_exceptions ) memory_input<> i4( "aaaaaaaaaaa", __FUNCTION__ ); - TAO_PEGTL_TEST_THROWS( pegtl::parse< test_grammar, test_action >( i4 ) ); + TAO_PEGTL_TEST_THROWS( parse< test_grammar, test_action >( i4 ) ); #endif } diff --git a/packages/PEGTL/src/test/pegtl/main.hpp b/packages/PEGTL/src/test/pegtl/main.hpp index cb09aebbe7c1832dce27c9f46c8a370d97a3ef47..05bdb03697aee20263a2d2c1ddca54965118ca46 100644 --- a/packages/PEGTL/src/test/pegtl/main.hpp +++ b/packages/PEGTL/src/test/pegtl/main.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/parse_error.cpp b/packages/PEGTL/src/test/pegtl/parse_error.cpp index 7fda8f61eea8ab51a9b077e7b8791097aba6e442..c8582482c6f301583eda475b2ee304a3b7b27b1f 100644 --- a/packages/PEGTL/src/test/pegtl/parse_error.cpp +++ b/packages/PEGTL/src/test/pegtl/parse_error.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/pegtl_string_t.cpp b/packages/PEGTL/src/test/pegtl/pegtl_string_t.cpp index 41147a373d26bdb40c23f3cf6f600b544e212293..1f224414e837583d1b8b7e85c44058ca7741a526 100644 --- a/packages/PEGTL/src/test/pegtl/pegtl_string_t.cpp +++ b/packages/PEGTL/src/test/pegtl/pegtl_string_t.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/position.cpp b/packages/PEGTL/src/test/pegtl/position.cpp index 60590e47492627cc48448d98308871d62dc046e5..4759fc68b34ad8d3b6c220d442c8b59e64f75dd5 100644 --- a/packages/PEGTL/src/test/pegtl/position.cpp +++ b/packages/PEGTL/src/test/pegtl/position.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -125,10 +125,10 @@ namespace TAO_PEGTL_NAMESPACE } } - void test_iterator() + void test_frobnicator() { const std::string s = "source"; - const internal::iterator i( nullptr, 1, 2, 3 ); + const internal::frobnicator i( nullptr, 1, 2, 3 ); const position p( i, s ); TAO_PEGTL_TEST_ASSERT( p.byte == 1 ); TAO_PEGTL_TEST_ASSERT( p.line == 2 ); @@ -209,7 +209,7 @@ namespace TAO_PEGTL_NAMESPACE test_nested<>(); test_nested< buffer_input_t >(); - test_iterator(); + test_frobnicator(); } } // namespace TAO_PEGTL_NAMESPACE diff --git a/packages/PEGTL/src/test/pegtl/restart_input.cpp b/packages/PEGTL/src/test/pegtl/restart_input.cpp index 648d118289f8a425f61627e4ea9d2d9f206b6b43..a8b5a122103befde7bbf530620957c9cf3022b6e 100644 --- a/packages/PEGTL/src/test/pegtl/restart_input.cpp +++ b/packages/PEGTL/src/test/pegtl/restart_input.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -22,7 +22,7 @@ namespace TAO_PEGTL_NAMESPACE void test_eager() { const std::string data = "abc"; - memory_input< tracking_mode::eager, eol::lf_crlf, std::string > in( std::string_view( data ), __FUNCTION__ ); + memory_input< tracking_mode::eager, eol::lf_crlf, std::string > in( std::string_view{ data }, __FUNCTION__ ); bool success = parse< grammar >( in ); TAO_PEGTL_TEST_ASSERT( success ); in.restart(); diff --git a/packages/PEGTL/src/test/pegtl/result_type.hpp b/packages/PEGTL/src/test/pegtl/result_type.hpp index 9f8448f3e7de52869b388ab776d5e18101391415..995af78b263528fb9ad529ae0ba60369c197b078 100644 --- a/packages/PEGTL/src/test/pegtl/result_type.hpp +++ b/packages/PEGTL/src/test/pegtl/result_type.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -7,8 +7,6 @@ #include <ostream> -#include <tao/pegtl/config.hpp> - namespace TAO_PEGTL_NAMESPACE { enum class result_type : int diff --git a/packages/PEGTL/src/test/pegtl/rule_action.cpp b/packages/PEGTL/src/test/pegtl/rule_action.cpp index c9e5a9f600340fdbf1f9c7cf3e46fb8f1e11b3be..95a26ba81f295bde456b1d02d9af906589313086 100644 --- a/packages/PEGTL/src/test/pegtl/rule_action.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_action.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_apply.cpp b/packages/PEGTL/src/test/pegtl/rule_apply.cpp index 6ae99f88a5b216b01eea245915289baeda386896..7504613a539fcd9f528cdf0ac9f8dc9fb54c9d31 100644 --- a/packages/PEGTL/src/test/pegtl/rule_apply.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_apply.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_apply0.cpp b/packages/PEGTL/src/test/pegtl/rule_apply0.cpp index 2c4fdfffe86bfe68f384ab84b53355d8a7b74fa3..d70f4af2c75709577d8112f82e19082d7a06467f 100644 --- a/packages/PEGTL/src/test/pegtl/rule_apply0.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_apply0.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_at.cpp b/packages/PEGTL/src/test/pegtl/rule_at.cpp index 996081fda56252f71c57de571a4ade36b4bc0f12..9ef61d6a509d79c47065267928fb132cc5bf30c3 100644 --- a/packages/PEGTL/src/test/pegtl/rule_at.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_at.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_bof.cpp b/packages/PEGTL/src/test/pegtl/rule_bof.cpp index 7462e560b4edfeec65c4ae2960a58790beef7875..125dc810313abb357acf6012d61e563d8e3bb322 100644 --- a/packages/PEGTL/src/test/pegtl/rule_bof.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_bof.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_bol.cpp b/packages/PEGTL/src/test/pegtl/rule_bol.cpp index 837fcc331eebf5a82b9f6703c781d331470086f4..2ec7667f8e8b052914b44af6207bb5b0ecb729b7 100644 --- a/packages/PEGTL/src/test/pegtl/rule_bol.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_bol.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_bytes.cpp b/packages/PEGTL/src/test/pegtl/rule_bytes.cpp index 806640778857cfa885171e8a6046d8eb6f71c86d..a8ede5fba61abdf3f55e291b1c8cbe045654d458 100644 --- a/packages/PEGTL/src/test/pegtl/rule_bytes.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_bytes.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_control.cpp b/packages/PEGTL/src/test/pegtl/rule_control.cpp index 1b69ebd453c300e8de8cb37ce0543f3985b0e9a8..a76a5897422b625c18a2fb56dade4e09398103ef 100644 --- a/packages/PEGTL/src/test/pegtl/rule_control.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_control.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_disable.cpp b/packages/PEGTL/src/test/pegtl/rule_disable.cpp index 65570121b73fad4b103dae193cbb019180f982cc..ec3035ada1e6bd219f959afd01ca2d77c034ee19 100644 --- a/packages/PEGTL/src/test/pegtl/rule_disable.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_disable.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_discard.cpp b/packages/PEGTL/src/test/pegtl/rule_discard.cpp index bce896337e55c24232496ef593ef926c1277cc5b..462612809e3e1840daee3504a6b583077ae0982f 100644 --- a/packages/PEGTL/src/test/pegtl/rule_discard.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_discard.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_enable.cpp b/packages/PEGTL/src/test/pegtl/rule_enable.cpp index 63c4d1560339faaa290c9ead46c2b82517340528..7dde7516d8ddc5ae76a95be5dfb0a26b66e575a2 100644 --- a/packages/PEGTL/src/test/pegtl/rule_enable.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_enable.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_eof.cpp b/packages/PEGTL/src/test/pegtl/rule_eof.cpp index 8ed986e9b6a6d40821811d8dbe061b74cac8bd26..8111a046faa8e0ea748964ea8d62e4b09dc30fbd 100644 --- a/packages/PEGTL/src/test/pegtl/rule_eof.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_eof.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_everything.cpp b/packages/PEGTL/src/test/pegtl/rule_everything.cpp new file mode 100644 index 0000000000000000000000000000000000000000..735ea87763b3e0544d8614bff8615a27ce0f235c --- /dev/null +++ b/packages/PEGTL/src/test/pegtl/rule_everything.cpp @@ -0,0 +1,24 @@ +// Copyright (c) 2022-2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" +#include "verify_meta.hpp" +#include "verify_rule.hpp" + +namespace TAO_PEGTL_NAMESPACE +{ + void unit_test() + { + verify_meta< everything, internal::everything< std::size_t > >(); + + verify_analyze< everything >( __LINE__, __FILE__, false, false ); + + verify_rule< everything >( __LINE__, __FILE__, "", result_type::success ); + verify_rule< everything >( __LINE__, __FILE__, "asodfuaofj", result_type::success ); + verify_rule< everything >( __LINE__, __FILE__, "asfhalfj;alsjfdo;asjdfo;asjf;laskjdfl;afwfj2;093vmu;oaivu;v390fm;aosumvos3fefalihgfis", result_type::success ); + } + +} // namespace TAO_PEGTL_NAMESPACE + +#include "main.hpp" diff --git a/packages/PEGTL/src/test/pegtl/rule_failure.cpp b/packages/PEGTL/src/test/pegtl/rule_failure.cpp index 19044b3446f767d1af60e7c46daf353d3486f8ab..4a5010d15b5a68ad90b81bcc8162a57fb3839be4 100644 --- a/packages/PEGTL/src/test/pegtl/rule_failure.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_failure.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_if_apply.cpp b/packages/PEGTL/src/test/pegtl/rule_if_apply.cpp index 74602f9a77e384c5dc69eb3266d3bbaa32de5755..daa028292b84ea2d96284867abb4d4c5654ec4da 100644 --- a/packages/PEGTL/src/test/pegtl/rule_if_apply.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_if_apply.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_if_must.cpp b/packages/PEGTL/src/test/pegtl/rule_if_must.cpp index 13f7332ae56146a674760412432539bc0c494e85..9918b2c645bc2ae32a51d0ad48860b207954a0bd 100644 --- a/packages/PEGTL/src/test/pegtl/rule_if_must.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_if_must.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_if_must_else.cpp b/packages/PEGTL/src/test/pegtl/rule_if_must_else.cpp index fa28715d0f1b4170f3607d94383a97e9820a0b27..569430ab2e3d82e2fcdf877c28068120c84cc132 100644 --- a/packages/PEGTL/src/test/pegtl/rule_if_must_else.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_if_must_else.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_if_then_else.cpp b/packages/PEGTL/src/test/pegtl/rule_if_then_else.cpp index b1596f69085b28266f70d966bc52e8dcb7d1f2b2..50a6192d4d77bd9d514ce43aada23c926c17fc37 100644 --- a/packages/PEGTL/src/test/pegtl/rule_if_then_else.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_if_then_else.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_list.cpp b/packages/PEGTL/src/test/pegtl/rule_list.cpp index 2abf474ee895277bf3d88d7d6a0e11e9ea4c5c11..03dac04c3791cc2c1b64b77e4616495a985b02ce 100644 --- a/packages/PEGTL/src/test/pegtl/rule_list.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_list.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_list_must.cpp b/packages/PEGTL/src/test/pegtl/rule_list_must.cpp index 0fab79e8a76524d455a32f45b3f39c0e9f052607..5361e4ebc109449081f650606b698712f190707c 100644 --- a/packages/PEGTL/src/test/pegtl/rule_list_must.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_list_must.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_list_tail.cpp b/packages/PEGTL/src/test/pegtl/rule_list_tail.cpp index 41296111d8b3356af4771f20bd934d575e87d8ff..9a51f59269964ca8efd4ec939792892609c39f1c 100644 --- a/packages/PEGTL/src/test/pegtl/rule_list_tail.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_list_tail.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -10,18 +10,18 @@ namespace TAO_PEGTL_NAMESPACE { void unit_test() { - verify_analyze< list_tail< eof, eof > >( __LINE__, __FILE__, false, true ); - verify_analyze< list_tail< eof, any > >( __LINE__, __FILE__, false, false ); - verify_analyze< list_tail< any, eof > >( __LINE__, __FILE__, true, false ); + verify_analyze< list_tail< opt< any >, opt< any > > >( __LINE__, __FILE__, false, true ); + verify_analyze< list_tail< opt< any >, any > >( __LINE__, __FILE__, false, false ); + verify_analyze< list_tail< any, opt< any > > >( __LINE__, __FILE__, true, false ); verify_analyze< list_tail< any, any > >( __LINE__, __FILE__, true, false ); - verify_analyze< list_tail< eof, eof, eof > >( __LINE__, __FILE__, false, true ); - verify_analyze< list_tail< eof, eof, any > >( __LINE__, __FILE__, false, true ); - verify_analyze< list_tail< eof, any, eof > >( __LINE__, __FILE__, false, true ); - verify_analyze< list_tail< eof, any, any > >( __LINE__, __FILE__, false, false ); - verify_analyze< list_tail< any, eof, eof > >( __LINE__, __FILE__, true, true ); - verify_analyze< list_tail< any, eof, any > >( __LINE__, __FILE__, true, false ); - verify_analyze< list_tail< any, any, eof > >( __LINE__, __FILE__, true, true ); + verify_analyze< list_tail< opt< any >, opt< any >, opt< any > > >( __LINE__, __FILE__, false, true ); + verify_analyze< list_tail< opt< any >, opt< any >, any > >( __LINE__, __FILE__, false, true ); + verify_analyze< list_tail< opt< any >, any, opt< any > > >( __LINE__, __FILE__, false, true ); + verify_analyze< list_tail< opt< any >, any, any > >( __LINE__, __FILE__, false, false ); + verify_analyze< list_tail< any, opt< any >, opt< any > > >( __LINE__, __FILE__, true, true ); + verify_analyze< list_tail< any, opt< any >, any > >( __LINE__, __FILE__, true, false ); + verify_analyze< list_tail< any, any, opt< any > > >( __LINE__, __FILE__, true, true ); verify_analyze< list_tail< any, any, any > >( __LINE__, __FILE__, true, false ); verify_rule< list_tail< one< 'a' >, one< ',' > > >( __LINE__, __FILE__, "", result_type::local_failure, 0 ); @@ -33,6 +33,7 @@ namespace TAO_PEGTL_NAMESPACE verify_rule< list_tail< one< 'a' >, one< ',' > > >( __LINE__, __FILE__, "a,a", result_type::success, 0 ); verify_rule< list_tail< one< 'a' >, one< ',' > > >( __LINE__, __FILE__, "a,b", result_type::success, 1 ); verify_rule< list_tail< one< 'a' >, one< ',' > > >( __LINE__, __FILE__, "a,a,a", result_type::success, 0 ); + verify_rule< list_tail< one< 'a' >, one< ',' > > >( __LINE__, __FILE__, "a,a,a,", result_type::success, 0 ); verify_rule< list_tail< one< 'a' >, one< ',' > > >( __LINE__, __FILE__, "a,a,a,a", result_type::success, 0 ); verify_rule< list_tail< one< 'a' >, one< ',' > > >( __LINE__, __FILE__, "a,a,a,b", result_type::success, 1 ); verify_rule< list_tail< one< 'a' >, one< ',' > > >( __LINE__, __FILE__, "a,a,a,,", result_type::success, 1 ); @@ -51,6 +52,8 @@ namespace TAO_PEGTL_NAMESPACE verify_rule< list_tail< one< 'a' >, one< ',' >, blank > >( __LINE__, __FILE__, "a, a", result_type::success, 0 ); verify_rule< list_tail< one< 'a' >, one< ',' >, blank > >( __LINE__, __FILE__, "a, a,", result_type::success, 0 ); verify_rule< list_tail< one< 'a' >, one< ',' >, blank > >( __LINE__, __FILE__, "a, a ,", result_type::success, 0 ); + verify_rule< list_tail< one< 'a' >, one< ',' >, blank > >( __LINE__, __FILE__, "a , a ,", result_type::success, 0 ); + verify_rule< list_tail< one< 'a' >, one< ',' >, blank > >( __LINE__, __FILE__, "a , a , ", result_type::success, 1 ); verify_rule< list_tail< one< 'a' >, one< ',' >, blank > >( __LINE__, __FILE__, " a , a ", result_type::local_failure, 7 ); } diff --git a/packages/PEGTL/src/test/pegtl/rule_minus.cpp b/packages/PEGTL/src/test/pegtl/rule_minus.cpp index 66c37197343fe2a3376554d14dc0e94827d639ec..f9b7c3c46b8291ab71bd6b95cabc1fe27a15ebaa 100644 --- a/packages/PEGTL/src/test/pegtl/rule_minus.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_minus.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2016-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_must.cpp b/packages/PEGTL/src/test/pegtl/rule_must.cpp index 1065457c58dca1c5796bf9b15c6a88f27081fafa..d10d793b8d8c707b004562a80ed435aa3d104b5f 100644 --- a/packages/PEGTL/src/test/pegtl/rule_must.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_must.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_not_at.cpp b/packages/PEGTL/src/test/pegtl/rule_not_at.cpp index aa5ba3b6641a13a1f2943f98887f149361e96c98..dedb5751f972c4c53ff821727ce22ff5ff388ad4 100644 --- a/packages/PEGTL/src/test/pegtl/rule_not_at.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_not_at.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_opt.cpp b/packages/PEGTL/src/test/pegtl/rule_opt.cpp index f05a738b7514319540fd3bf6f03f075bebbe5065..f145f091b9ad5a4aef36f08fd2b71f6501cea58b 100644 --- a/packages/PEGTL/src/test/pegtl/rule_opt.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_opt.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_opt_must.cpp b/packages/PEGTL/src/test/pegtl/rule_opt_must.cpp index 0adb157f657ccc8fb822782eab8d56c99bab3926..a6948b628a3a0c8f04a10ecd9dc345577193d293 100644 --- a/packages/PEGTL/src/test/pegtl/rule_opt_must.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_opt_must.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_pad.cpp b/packages/PEGTL/src/test/pegtl/rule_pad.cpp index 2bbfc254b2294c58d678e30540717005fb450174..8799e4eb047ab16276bf95de37b0ef2f1a65d703 100644 --- a/packages/PEGTL/src/test/pegtl/rule_pad.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_pad.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_pad_opt.cpp b/packages/PEGTL/src/test/pegtl/rule_pad_opt.cpp index d21bb55d8ef48f307918216618941aa71e7db600..993064a3fc86faef35d8a77e3798b7d9b5ce864d 100644 --- a/packages/PEGTL/src/test/pegtl/rule_pad_opt.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_pad_opt.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_partial.cpp b/packages/PEGTL/src/test/pegtl/rule_partial.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f1cc24df95cc1a4780b6b7b0b4adf12494c780a5 --- /dev/null +++ b/packages/PEGTL/src/test/pegtl/rule_partial.cpp @@ -0,0 +1,70 @@ +// Copyright (c) 2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" + +#include "verify_meta.hpp" +#include "verify_rule.hpp" + +namespace TAO_PEGTL_NAMESPACE +{ + template< typename Rule > + struct my_action + {}; + + template<> + struct my_action< eof > + { + static void apply0( bool& b ) + { + b = true; + } + }; + + void unit_test() + { + verify_meta< partial< eof >, internal::partial< eof >, eof >(); + verify_meta< partial< eof, any >, internal::partial< eof, any >, eof, any >(); + + verify_analyze< partial< any > >( __LINE__, __FILE__, false, false ); + verify_analyze< partial< eof > >( __LINE__, __FILE__, false, false ); + + verify_rule< partial< one< 'a' > > >( __LINE__, __FILE__, "", result_type::success, 0 ); + verify_rule< partial< one< 'a' > > >( __LINE__, __FILE__, "a", result_type::success, 0 ); + verify_rule< partial< one< 'a' > > >( __LINE__, __FILE__, "aa", result_type::success, 1 ); + verify_rule< partial< one< 'a' > > >( __LINE__, __FILE__, "ab", result_type::success, 1 ); + verify_rule< partial< one< 'a' > > >( __LINE__, __FILE__, "ba", result_type::success, 2 ); + + verify_rule< partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "", result_type::success, 0 ); + verify_rule< partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "a", result_type::success, 0 ); + verify_rule< partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "ab", result_type::success, 0 ); + verify_rule< partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "aba", result_type::success, 1 ); + verify_rule< partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "abab", result_type::success, 2 ); + verify_rule< partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "bab", result_type::success, 3 ); + verify_rule< partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "cb", result_type::success, 2 ); + +#if defined( __cpp_exceptions ) + verify_rule< must< partial< one< 'a' > > > >( __LINE__, __FILE__, "", result_type::success, 0 ); + verify_rule< must< partial< one< 'a' > > > >( __LINE__, __FILE__, "a", result_type::success, 0 ); + verify_rule< must< partial< one< 'a' > > > >( __LINE__, __FILE__, "aa", result_type::success, 1 ); + verify_rule< must< partial< one< 'a' > > > >( __LINE__, __FILE__, "ab", result_type::success, 1 ); + verify_rule< must< partial< one< 'a' > > > >( __LINE__, __FILE__, "ba", result_type::success, 2 ); + + verify_rule< must< partial< one< 'a' >, one< 'b' > > > >( __LINE__, __FILE__, "", result_type::success, 0 ); + verify_rule< must< partial< one< 'a' >, one< 'b' > > > >( __LINE__, __FILE__, "a", result_type::success, 0 ); + verify_rule< must< partial< one< 'a' >, one< 'b' > > > >( __LINE__, __FILE__, "ab", result_type::success, 0 ); + verify_rule< must< partial< one< 'a' >, one< 'b' > > > >( __LINE__, __FILE__, "aba", result_type::success, 1 ); + verify_rule< must< partial< one< 'a' >, one< 'b' > > > >( __LINE__, __FILE__, "abab", result_type::success, 2 ); + verify_rule< must< partial< one< 'a' >, one< 'b' > > > >( __LINE__, __FILE__, "bab", result_type::success, 3 ); + verify_rule< must< partial< one< 'a' >, one< 'b' > > > >( __LINE__, __FILE__, "cb", result_type::success, 2 ); +#endif + + bool success = false; + TAO_PEGTL_TEST_ASSERT( parse< partial< eof >, my_action >( memory_input( "", __FUNCTION__ ), success ) ); + TAO_PEGTL_TEST_ASSERT( success ); + } + +} // namespace TAO_PEGTL_NAMESPACE + +#include "main.hpp" diff --git a/packages/PEGTL/src/test/pegtl/rule_plus.cpp b/packages/PEGTL/src/test/pegtl/rule_plus.cpp index f0b0942d34399a8d700f7c234e54829f23cc628c..4159bc6620760d0998683498d1811536414353e1 100644 --- a/packages/PEGTL/src/test/pegtl/rule_plus.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_plus.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_raise.cpp b/packages/PEGTL/src/test/pegtl/rule_raise.cpp index 7eaa05d97f5cdb1bc7f73c8c0c19e2934fad116e..2829d8033a05c888e6e5817a663d1ad32af1b746 100644 --- a/packages/PEGTL/src/test/pegtl/rule_raise.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_raise.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_rematch.cpp b/packages/PEGTL/src/test/pegtl/rule_rematch.cpp index 3c505d0b0cd627d47e4bd71d415edc9c64d260f1..b161a9c904d7ea1a8803862e22d51b0cdd5f9e52 100644 --- a/packages/PEGTL/src/test/pegtl/rule_rematch.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_rematch.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2019-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_rep.cpp b/packages/PEGTL/src/test/pegtl/rule_rep.cpp index ce259438a70d88b1c3030ebaa95b4d1d47c6c614..44d4303cdcfc5096eaa44e795716232b6d997e70 100644 --- a/packages/PEGTL/src/test/pegtl/rule_rep.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_rep.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_rep_max.cpp b/packages/PEGTL/src/test/pegtl/rule_rep_max.cpp index 2ff63e9cc90302325b70e90ffd2f53302b89fa0c..0c11dbb101b7d8317013807a830d8725fb1e92ef 100644 --- a/packages/PEGTL/src/test/pegtl/rule_rep_max.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_rep_max.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_rep_min.cpp b/packages/PEGTL/src/test/pegtl/rule_rep_min.cpp index 614db7363e91a188c27cd03e8f38523e3b28b2be..9d45e9b3b6958914482a4e1604835a20dd7588f2 100644 --- a/packages/PEGTL/src/test/pegtl/rule_rep_min.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_rep_min.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_rep_min_max.cpp b/packages/PEGTL/src/test/pegtl/rule_rep_min_max.cpp index ebf85c500b889a5df9b39322f85c1336b04cf7e1..8cd7143ae892010e16ce7e5d9d0a4efc04b967c5 100644 --- a/packages/PEGTL/src/test/pegtl/rule_rep_min_max.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_rep_min_max.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_rep_opt.cpp b/packages/PEGTL/src/test/pegtl/rule_rep_opt.cpp index c94a11ab7c0186463b1d714eea5e2b8d3b5f3917..75752541766eb8ec7097e7575c6f5f84bfba3138 100644 --- a/packages/PEGTL/src/test/pegtl/rule_rep_opt.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_rep_opt.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_require.cpp b/packages/PEGTL/src/test/pegtl/rule_require.cpp index b93e2e3a1c31ed9059de670ec98c3360a49697af..ce27ddf3480e2178a98145123008e684ab053439 100644 --- a/packages/PEGTL/src/test/pegtl/rule_require.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_require.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2017-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_seq.cpp b/packages/PEGTL/src/test/pegtl/rule_seq.cpp index f5eac6bbdbaad5755b2bbe5f62ec99885f3e569c..e5c72db17c520937be18fa2cf99e038340abfade 100644 --- a/packages/PEGTL/src/test/pegtl/rule_seq.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_seq.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_sor.cpp b/packages/PEGTL/src/test/pegtl/rule_sor.cpp index 7d087cb73c1a279bfb1beff03e7f7d8d52a7f9a9..decd73168d7e7523f4810bd17e7f100defa65464 100644 --- a/packages/PEGTL/src/test/pegtl/rule_sor.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_sor.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_star.cpp b/packages/PEGTL/src/test/pegtl/rule_star.cpp index df7d63e08164efe27e35c2572c2d7a9fe0f04dde..eb856b6987a6cafc73be9799845ece7cf62b30c2 100644 --- a/packages/PEGTL/src/test/pegtl/rule_star.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_star.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -23,6 +23,7 @@ namespace TAO_PEGTL_NAMESPACE verify_rule< star< one< 'a' > > >( __LINE__, __FILE__, "a", result_type::success, 0 ); verify_rule< star< one< 'a' > > >( __LINE__, __FILE__, "aa", result_type::success, 0 ); verify_rule< star< one< 'a' > > >( __LINE__, __FILE__, "aaa", result_type::success, 0 ); + verify_rule< star< one< 'a' > > >( __LINE__, __FILE__, "aaab", result_type::success, 1 ); verify_rule< star< one< 'a' > > >( __LINE__, __FILE__, "ba", result_type::success, 2 ); verify_rule< star< one< 'a' > > >( __LINE__, __FILE__, "b", result_type::success, 1 ); @@ -30,6 +31,7 @@ namespace TAO_PEGTL_NAMESPACE verify_rule< star< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "a", result_type::success, 1 ); verify_rule< star< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "ab", result_type::success, 0 ); verify_rule< star< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "aba", result_type::success, 1 ); + verify_rule< star< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "abac", result_type::success, 2 ); verify_rule< star< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "abb", result_type::success, 1 ); verify_rule< star< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "abab", result_type::success, 0 ); verify_rule< star< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "ababc", result_type::success, 1 ); diff --git a/packages/PEGTL/src/test/pegtl/rule_star_must.cpp b/packages/PEGTL/src/test/pegtl/rule_star_must.cpp index 6b22eac70ffe94e4180473135e29fa7d68374941..60b88510fd84be6f3dcf93062f0f4e8bff2fa6c8 100644 --- a/packages/PEGTL/src/test/pegtl/rule_star_must.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_star_must.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_star_partial.cpp b/packages/PEGTL/src/test/pegtl/rule_star_partial.cpp new file mode 100644 index 0000000000000000000000000000000000000000..99826a3c2787b3b53b2ff53296697dfa8f1c564f --- /dev/null +++ b/packages/PEGTL/src/test/pegtl/rule_star_partial.cpp @@ -0,0 +1,44 @@ +// Copyright (c) 2023 Dr. Colin Hirsch and Daniel Frey +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) + +#include "test.hpp" + +#include "verify_meta.hpp" +#include "verify_rule.hpp" + +namespace TAO_PEGTL_NAMESPACE +{ + void unit_test() + { + verify_meta< star_partial< alpha >, internal::star_partial< alpha >, alpha >(); + verify_meta< star_partial< alpha, digit >, internal::star_partial< alpha, digit >, alpha, digit >(); + + verify_analyze< star_partial< eof > >( __LINE__, __FILE__, false, true ); + verify_analyze< star_partial< any > >( __LINE__, __FILE__, false, false ); + verify_analyze< star_partial< eof, eof, eof > >( __LINE__, __FILE__, false, true ); + verify_analyze< star_partial< any, eof, any > >( __LINE__, __FILE__, false, false ); + + verify_rule< star_partial< one< 'a' > > >( __LINE__, __FILE__, "", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' > > >( __LINE__, __FILE__, "a", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' > > >( __LINE__, __FILE__, "aa", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' > > >( __LINE__, __FILE__, "aaa", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' > > >( __LINE__, __FILE__, "aaab", result_type::success, 1 ); + verify_rule< star_partial< one< 'a' > > >( __LINE__, __FILE__, "ba", result_type::success, 2 ); + verify_rule< star_partial< one< 'a' > > >( __LINE__, __FILE__, "b", result_type::success, 1 ); + + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "a", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "aa", result_type::success, 1 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "ab", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "aba", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "abac", result_type::success, 1 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "abb", result_type::success, 1 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "abab", result_type::success, 0 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "ababc", result_type::success, 1 ); + verify_rule< star_partial< one< 'a' >, one< 'b' > > >( __LINE__, __FILE__, "ababab", result_type::success, 0 ); + } + +} // namespace TAO_PEGTL_NAMESPACE + +#include "main.hpp" diff --git a/packages/PEGTL/src/test/pegtl/rule_state.cpp b/packages/PEGTL/src/test/pegtl/rule_state.cpp index f29701262982d0eb081acbc42725dbd792b09aa7..30178bb7d01a80d3f5c0611b2a510cf80cc8a824 100644 --- a/packages/PEGTL/src/test/pegtl/rule_state.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_state.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_success.cpp b/packages/PEGTL/src/test/pegtl/rule_success.cpp index 03e0835369ed22bb8981190a6284b90acb729421..248b1a9b53903cb8943d888f4bc3c0542a032a33 100644 --- a/packages/PEGTL/src/test/pegtl/rule_success.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_success.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_try_catch.cpp b/packages/PEGTL/src/test/pegtl/rule_try_catch.cpp index 909cc77d9943b7c76d1259cd9da90ceeec3d225e..4fa24e6890664868740901b0e58cae65d04f7b51 100644 --- a/packages/PEGTL/src/test/pegtl/rule_try_catch.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_try_catch.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/rule_until.cpp b/packages/PEGTL/src/test/pegtl/rule_until.cpp index 12385c15a5ee30481d2118d1df11bd327d4ea8e5..32a19fef4be7e6f9f6ed5fec83fc8305165ff62f 100644 --- a/packages/PEGTL/src/test/pegtl/rule_until.cpp +++ b/packages/PEGTL/src/test/pegtl/rule_until.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/test.hpp b/packages/PEGTL/src/test/pegtl/test.hpp index e25635ee2c02fbfe6ced5f1cfcd1079e9ec611d0..1fdba82661020ae838b1265ba0b8d6cbcb850a5c 100644 --- a/packages/PEGTL/src/test/pegtl/test.hpp +++ b/packages/PEGTL/src/test/pegtl/test.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -24,18 +24,18 @@ namespace TAO_PEGTL_NAMESPACE #define TAO_PEGTL_TEST_UNWRAP( ... ) __VA_ARGS__ -#define TAO_PEGTL_TEST_FAILED( MeSSaGe ) \ - do { \ - std::cerr << "pegtl: unit test failed for [ " \ - << TAO_PEGTL_NAMESPACE::demangle< Rule >() \ - << " ] " \ - << TAO_PEGTL_TEST_UNWRAP( MeSSaGe ) \ - << " in line [ " \ - << line \ - << " ] file [ " \ - << file << " ]" \ - << std::endl; \ - ++TAO_PEGTL_NAMESPACE::failed; \ +#define TAO_PEGTL_TEST_FAILED( MeSSaGe ) \ + do { \ + std::cerr << "pegtl: unit test failed for [ " \ + << TAO_PEGTL_NAMESPACE::demangle< Rule >() \ + << " ] " \ + << TAO_PEGTL_TEST_UNWRAP( MeSSaGe ) \ + << " in line [ " \ + << line \ + << " ] file [ " \ + << file << " ]" \ + << std::endl; \ + ++TAO_PEGTL_NAMESPACE::failed; \ } while( false ) #define TAO_PEGTL_TEST_ASSERT( ... ) \ @@ -48,7 +48,7 @@ namespace TAO_PEGTL_NAMESPACE << " ] file [ " \ << __FILE__ << " ]" \ << std::endl; \ - ++TAO_PEGTL_NAMESPACE::failed; \ + ++TAO_PEGTL_NAMESPACE::failed; \ } \ } while( false ) @@ -63,7 +63,7 @@ namespace TAO_PEGTL_NAMESPACE << " ] file [ " \ << __FILE__ << " ]" \ << std::endl; \ - ++TAO_PEGTL_NAMESPACE::failed; \ + ++TAO_PEGTL_NAMESPACE::failed; \ } \ catch( ... ) { \ } \ diff --git a/packages/PEGTL/src/test/pegtl/test_empty.cpp b/packages/PEGTL/src/test/pegtl/test_empty.cpp index bfc9967778d806fb6ee34979cba1ee8232a17c88..ab937430aac72d3973f1dac704d33e8b1e182038 100644 --- a/packages/PEGTL/src/test/pegtl/test_empty.cpp +++ b/packages/PEGTL/src/test/pegtl/test_empty.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/test_result.cpp b/packages/PEGTL/src/test/pegtl/test_result.cpp index 86554fb558a4cad9e4a3fdb75af72188cee44082..e95e9eb0ad1657e0c3546a07fe3a1f9cd9a72dd7 100644 --- a/packages/PEGTL/src/test/pegtl/test_result.cpp +++ b/packages/PEGTL/src/test/pegtl/test_result.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -29,7 +29,7 @@ namespace TAO_PEGTL_NAMESPACE } { std::ostringstream oss; - oss << result_type( 1764 ); + oss << static_cast< result_type >( 1764 ); TAO_PEGTL_TEST_ASSERT( oss.str() == "1764" ); } } diff --git a/packages/PEGTL/src/test/pegtl/test_setup.cpp b/packages/PEGTL/src/test/pegtl/test_setup.cpp index 20c3737bfa10b1986bdca50114aeb613fc25cb75..8496d8861441e48db291f11ca3bf66370de4c270 100644 --- a/packages/PEGTL/src/test/pegtl/test_setup.cpp +++ b/packages/PEGTL/src/test/pegtl/test_setup.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/uint16_general.cpp b/packages/PEGTL/src/test/pegtl/uint16_general.cpp index 134ecbb9baf87083b59a0b516cc1059d07d42a2f..7e82970265b57b574264e9a28594e79034328d9e 100644 --- a/packages/PEGTL/src/test/pegtl/uint16_general.cpp +++ b/packages/PEGTL/src/test/pegtl/uint16_general.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/uint32_general.cpp b/packages/PEGTL/src/test/pegtl/uint32_general.cpp index f5f259df1b85902578c1fcb058fdd2011322d8bd..45a8f376e49a643249abd7963cac0dd1389511b0 100644 --- a/packages/PEGTL/src/test/pegtl/uint32_general.cpp +++ b/packages/PEGTL/src/test/pegtl/uint32_general.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/uint64_general.cpp b/packages/PEGTL/src/test/pegtl/uint64_general.cpp index 91daedb35648d9bef7a01ed482e5e4f92c31ffaf..47a7326f23f3565ce03fd2ff28e386566990a88f 100644 --- a/packages/PEGTL/src/test/pegtl/uint64_general.cpp +++ b/packages/PEGTL/src/test/pegtl/uint64_general.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/uint8_general.cpp b/packages/PEGTL/src/test/pegtl/uint8_general.cpp index ee6baff86d76ca5992d7171392a293c2a9761111..df2ed319ae167dc11acf4d0c5d835ef6fd19b16c 100644 --- a/packages/PEGTL/src/test/pegtl/uint8_general.cpp +++ b/packages/PEGTL/src/test/pegtl/uint8_general.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2018-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/utf16_general.cpp b/packages/PEGTL/src/test/pegtl/utf16_general.cpp index 7e32a8cce8a3e4de9d92dc00bc419fe98c885edb..875395ca82a33a7926945bd3ddf1ddd057a66aee 100644 --- a/packages/PEGTL/src/test/pegtl/utf16_general.cpp +++ b/packages/PEGTL/src/test/pegtl/utf16_general.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2015-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -13,19 +13,19 @@ namespace TAO_PEGTL_NAMESPACE { std::string u16s( const char16_t u ) { - return std::string( reinterpret_cast< const char* >( &u ), sizeof( u ) ); + return { reinterpret_cast< const char* >( &u ), sizeof( u ) }; } std::string u16s_be( const char16_t v ) { - const std::uint16_t u = internal::h_to_be( std::uint16_t( v ) ); - return std::string( reinterpret_cast< const char* >( &u ), sizeof( u ) ); + const std::uint16_t u = internal::h_to_be( static_cast< std::uint16_t >( v ) ); + return { reinterpret_cast< const char* >( &u ), sizeof( u ) }; } std::string u16s_le( const char16_t v ) { - const std::uint16_t u = internal::h_to_le( std::uint16_t( v ) ); - return std::string( reinterpret_cast< const char* >( &u ), sizeof( u ) ); + const std::uint16_t u = internal::h_to_le( static_cast< std::uint16_t >( v ) ); + return { reinterpret_cast< const char* >( &u ), sizeof( u ) }; } } // namespace diff --git a/packages/PEGTL/src/test/pegtl/utf32_general.cpp b/packages/PEGTL/src/test/pegtl/utf32_general.cpp index 21895a9dfb3534c4a639c6a3c2d7d54a3cbc4876..837fcd149578709388d018ea4958b2ab33a6ac26 100644 --- a/packages/PEGTL/src/test/pegtl/utf32_general.cpp +++ b/packages/PEGTL/src/test/pegtl/utf32_general.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) @@ -13,19 +13,19 @@ namespace TAO_PEGTL_NAMESPACE { std::string u32s( const char32_t u ) { - return std::string( reinterpret_cast< const char* >( &u ), sizeof( u ) ); + return { reinterpret_cast< const char* >( &u ), sizeof( u ) }; } std::string u32s_be( const char32_t v ) { - const std::uint32_t u = internal::h_to_be( std::uint32_t( v ) ); - return std::string( reinterpret_cast< const char* >( &u ), sizeof( u ) ); + const std::uint32_t u = internal::h_to_be( static_cast< std::uint32_t >( v ) ); + return { reinterpret_cast< const char* >( &u ), sizeof( u ) }; } std::string u32s_le( const char32_t v ) { - const std::uint32_t u = internal::h_to_le( std::uint32_t( v ) ); - return std::string( reinterpret_cast< const char* >( &u ), sizeof( u ) ); + const std::uint32_t u = internal::h_to_le( static_cast< std::uint32_t >( v ) ); + return { reinterpret_cast< const char* >( &u ), sizeof( u ) }; } } // namespace diff --git a/packages/PEGTL/src/test/pegtl/utf8_general.cpp b/packages/PEGTL/src/test/pegtl/utf8_general.cpp index cab108dc67bfa4766f7b83f505a268eb5177cbd4..3f06ef683734ca2e4b5c07a6e081fe486ebb0df5 100644 --- a/packages/PEGTL/src/test/pegtl/utf8_general.cpp +++ b/packages/PEGTL/src/test/pegtl/utf8_general.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/verify_char.hpp b/packages/PEGTL/src/test/pegtl/verify_char.hpp index 32290bc4f82a36d1bf4763c1a5d4bb11205fb122..301687f89a2db4c058c000a8217a31f45910da46 100644 --- a/packages/PEGTL/src/test/pegtl/verify_char.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_char.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/verify_file.hpp b/packages/PEGTL/src/test/pegtl/verify_file.hpp index b8a27230c97778eb286be3387d25dffb02b6efb9..f146e55dd9b11446d85f3b8716ec36ee4531e97b 100644 --- a/packages/PEGTL/src/test/pegtl/verify_file.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_file.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/verify_ifmt.hpp b/packages/PEGTL/src/test/pegtl/verify_ifmt.hpp index 1dffef16e4b02cbfd93e8e6983cb0e14c5afbfcc..94312aedec06af1b5cb80db5bf2c1ebfc872e995 100644 --- a/packages/PEGTL/src/test/pegtl/verify_ifmt.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_ifmt.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/verify_impl.hpp b/packages/PEGTL/src/test/pegtl/verify_impl.hpp index 6a4a93f898f08aa29558eb334bc0b0e4d11326df..cfe61a1aa04da0dbe0ab09fdc0356076d0c30314 100644 --- a/packages/PEGTL/src/test/pegtl/verify_impl.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_impl.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/verify_meta.hpp b/packages/PEGTL/src/test/pegtl/verify_meta.hpp index 40d871210d756f4c90579c75281d5420395bac56..6f4252ec984319ce2b18e49cbd886cbb09b4b5e1 100644 --- a/packages/PEGTL/src/test/pegtl/verify_meta.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_meta.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/verify_rule.hpp b/packages/PEGTL/src/test/pegtl/verify_rule.hpp index d24076b9d4eb38d08fa8b4b0d4be52c6e7238474..e952a83770d3f3b6398c1ac1cfa1b9580a6faca3 100644 --- a/packages/PEGTL/src/test/pegtl/verify_rule.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_rule.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/verify_seqs.hpp b/packages/PEGTL/src/test/pegtl/verify_seqs.hpp index 487c995276b64ccbd82fd75496229b6fa5289e9f..6b57e0a88e585d111ebb8eee2ba2dfb3d94aaa8e 100644 --- a/packages/PEGTL/src/test/pegtl/verify_seqs.hpp +++ b/packages/PEGTL/src/test/pegtl/verify_seqs.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2014-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/PEGTL/src/test/pegtl/visit.cpp b/packages/PEGTL/src/test/pegtl/visit.cpp index 2b30442f05dcceaa0c7de9fba8b8d901de8e5a94..837250edf16a321f392e21cf34c75968fa37c7cd 100644 --- a/packages/PEGTL/src/test/pegtl/visit.cpp +++ b/packages/PEGTL/src/test/pegtl/visit.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021 Dr. Colin Hirsch and Daniel Frey +// Copyright (c) 2020-2023 Dr. Colin Hirsch and Daniel Frey // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) diff --git a/packages/kokkos/.github/workflows/continuous-integration-workflow-hpx.yml b/packages/kokkos/.github/workflows/continuous-integration-workflow-hpx.yml index b17d173ba2488891bd0ab3b3c8eb31d797b526eb..35bb5bb2cb2924a5000ab1087457ce6afea6029b 100644 --- a/packages/kokkos/.github/workflows/continuous-integration-workflow-hpx.yml +++ b/packages/kokkos/.github/workflows/continuous-integration-workflow-hpx.yml @@ -71,7 +71,7 @@ jobs: -DHPX_ROOT=$PWD/../../hpx/install \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ -DKokkos_ENABLE_EXAMPLES=ON \ -DKokkos_ENABLE_HPX=ON \ -DKokkos_ENABLE_HPX_ASYNC_DISPATCH=ON \ diff --git a/packages/kokkos/.github/workflows/continuous-integration-workflow.yml b/packages/kokkos/.github/workflows/continuous-integration-workflow.yml index 4ae42bc93ff649401818962ee7e4f16c2c468cb2..55b881794868bdccc8408870dc025b7c35d98d76 100644 --- a/packages/kokkos/.github/workflows/continuous-integration-workflow.yml +++ b/packages/kokkos/.github/workflows/continuous-integration-workflow.yml @@ -10,7 +10,7 @@ jobs: continue-on-error: true strategy: matrix: - distro: ['fedora:latest', 'ubuntu:latest'] + distro: ['fedora:latest', 'fedora:rawhide', 'ubuntu:latest'] cxx: ['g++', 'clang++'] cmake_build_type: ['Release', 'Debug'] backend: ['OPENMP'] @@ -76,6 +76,13 @@ jobs: - name: maybe_disable_death_tests if: ${{ matrix.distro == 'fedora:rawhide' }} run: echo "GTEST_FILTER=-*DeathTest*" >> $GITHUB_ENV +# Re-enable when latest is F37+ +# - name: maybe_use_flang +# if: ${{ matrix.cxx == 'clang++' && startsWith(matrix.distro,'fedora:') }} +# run: echo "FC=flang" >> $GITHUB_ENV + - name: maybe_use_flang_new + if: ${{ matrix.cxx == 'clang++' && startsWith(matrix.distro,'fedora:rawhide') }} + run: echo "FC=flang-new" >> $GITHUB_ENV - name: maybe_use_external_gtest if: ${{ matrix.distro == 'ubuntu:latest' }} run: sudo apt-get update && sudo apt-get install -y libgtest-dev @@ -93,8 +100,9 @@ jobs: -DKokkos_ENABLE_HWLOC=ON \ -DKokkos_ENABLE_${{ matrix.backend }}=ON \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_EXAMPLES=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} diff --git a/packages/kokkos/.github/workflows/osx.yml b/packages/kokkos/.github/workflows/osx.yml index 0e043c5f8f1b6ea81965a7a6e87a33d6bfc7e7b3..dae8343f20d6fc2861c6c4221faada46ca84d99a 100644 --- a/packages/kokkos/.github/workflows/osx.yml +++ b/packages/kokkos/.github/workflows/osx.yml @@ -30,10 +30,10 @@ jobs: cmake -B build . -DKokkos_ENABLE_${{ matrix.backend }}=On -DCMAKE_CXX_FLAGS="-Werror" - -DCMAKE_CXX_STANDARD=14 + -DCMAKE_CXX_STANDARD=17 -DKokkos_ARCH_NATIVE=ON -DKokkos_ENABLE_COMPILER_WARNINGS=ON - -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF + -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF -DKokkos_ENABLE_TESTS=On -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} - name: build diff --git a/packages/kokkos/.gitrepo b/packages/kokkos/.gitrepo index 4c3eed6dba9d2682fd85d2185169ac1f5c8e17a6..a6de31a618c04db9d43e4fd3cadc16cf74b7bd95 100644 --- a/packages/kokkos/.gitrepo +++ b/packages/kokkos/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:kokkos/kokkos.git branch = master - commit = 5ad609661e570ba6aa7716a26a91cb67d559f8a2 - parent = db24c19be339723f3a10fffce3075fd72dccdfeb + commit = 62d2b6c879b74b6ae7bd06eb3e5e80139c4708e6 + parent = c1b35ca4d5df2b2052224274c26bea7a8eee8ac5 method = merge - cmdver = 0.4.5 + cmdver = 0.4.6 diff --git a/packages/kokkos/.jenkins b/packages/kokkos/.jenkins index 3025cb558eab0c10d6be328b199515807fbba03b..1775a57d3b2a1d12843ac38fe5e8d38a5f77e8f7 100644 --- a/packages/kokkos/.jenkins +++ b/packages/kokkos/.jenkins @@ -32,10 +32,13 @@ pipeline { dockerfile { filename 'Dockerfile.nvhpc' dir 'scripts/docker' - label 'nvidia-docker && large_images' + label 'nvidia-docker && volta && large_images' args '--env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' } } + environment { + CUDA_HOME = '/opt/nvidia/hpc_sdk/Linux_x86_64/22.3/cuda/11.6' + } steps { sh '''rm -rf build && mkdir -p build && cd build && \ /opt/cmake/bin/cmake \ @@ -50,11 +53,12 @@ pipeline { make -j8 && ctest --verbose''' } } - stage('CUDA-11.6-NVHPC') { + stage('CUDA-11.7-NVHPC') { agent { dockerfile { filename 'Dockerfile.nvhpc' dir 'scripts/docker' + additionalBuildArgs '--build-arg BASE=nvcr.io/nvidia/nvhpc:22.9-devel-cuda11.7-ubuntu20.04' label 'nvidia-docker && large_images' args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' } @@ -66,18 +70,18 @@ pipeline { OMP_MAX_ACTIVE_LEVELS = 1 OMP_PLACES = 'threads' OMP_PROC_BIND = 'spread' - NVCC_WRAPPER_DEFAULT_COMPILER = 'nvc++' + NVHPC_CUDA_HOME = '/opt/nvidia/hpc_sdk/Linux_x86_64/22.9/cuda/11.7' } steps { sh '''rm -rf build && mkdir -p build && cd build && \ /opt/cmake/bin/cmake \ - -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_CXX_COMPILER=$WORKSPACE/bin/nvcc_wrapper \ - -DCMAKE_CXX_FLAGS=-Werror \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_CXX_COMPILER=nvc++ \ -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_FLAGS="--diag_suppress=implicit_return_from_non_void_function,no_device_stack" \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ -DKokkos_ENABLE_TESTS=ON \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ENABLE_CUDA_LAMBDA=ON \ @@ -106,10 +110,11 @@ pipeline { -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ARCH_VOLTA70=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ -DKokkos_ENABLE_EXAMPLES=ON \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_SYCL=ON \ -DKokkos_ENABLE_UNSUPPORTED_ARCHS=ON \ -DCMAKE_CXX_STANDARD=17 \ @@ -122,12 +127,12 @@ pipeline { } } } - stage('HIP-ROCm-4.5-C++14') { + stage('HIP-ROCm-5.2') { agent { dockerfile { filename 'Dockerfile.hipcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:4.5' + additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:5.2' label 'rocm-docker && vega' args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' } @@ -146,11 +151,12 @@ pipeline { -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_COMPILER=hipcc \ -DCMAKE_CXX_FLAGS="-Werror -Wno-unused-command-line-argument -DNDEBUG" \ - -DCMAKE_CXX_STANDARD=14 \ + -DCMAKE_CXX_STANDARD=17 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_HIP=ON \ -DKokkos_ENABLE_OPENMP=ON \ -DKokkos_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS=ON \ @@ -163,12 +169,12 @@ pipeline { } } } - stage('HIP-ROCm-4.5-C++17') { + stage('HIP-ROCm-5.2-C++20') { agent { dockerfile { filename 'Dockerfile.hipcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:4.5' + additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:5.2' label 'rocm-docker && vega' args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' } @@ -180,12 +186,13 @@ pipeline { -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_COMPILER=hipcc \ -DCMAKE_CXX_FLAGS="-Werror -Wno-unused-command-line-argument" \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_HIP=ON \ .. && \ make -j8 && ctest --verbose''' @@ -197,12 +204,12 @@ pipeline { } } /* - stage('OPENMPTARGET-ROCm-4.5') { + stage('OPENMPTARGET-ROCm-5.2') { agent { dockerfile { filename 'Dockerfile.hipcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:4.5' + additionalBuildArgs '--build-arg BASE=rocm/dev-ubuntu-20.04:5.2' label 'rocm-docker && vega && AMD_Radeon_Instinct_MI60' args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES' } @@ -225,8 +232,9 @@ pipeline { -DCMAKE_CXX_STANDARD=17 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_OPENMPTARGET=ON \ -DKokkos_ENABLE_OPENMP=ON \ -DKokkos_ARCH_VEGA906=ON \ @@ -260,9 +268,10 @@ pipeline { -DCMAKE_CXX_FLAGS="-Wno-unknown-cuda-version -Werror -Wno-undefined-internal -Wno-pass-failed" \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_TUNING=ON \ -DKokkos_ENABLE_OPENMPTARGET=ON \ -DKokkos_ARCH_VOLTA70=ON \ @@ -294,12 +303,13 @@ pipeline { -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_CXX_FLAGS=-Werror \ - -DCMAKE_CXX_STANDARD=14 \ + -DCMAKE_CXX_STANDARD=17 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ENABLE_CUDA_LAMBDA=ON \ -DKokkos_ENABLE_TUNING=ON \ @@ -313,12 +323,12 @@ pipeline { } } } - stage('CUDA-9.2-NVCC') { + stage('CUDA-11.7-NVCC') { agent { dockerfile { filename 'Dockerfile.nvcc' dir 'scripts/docker' - additionalBuildArgs '--build-arg BASE=nvidia/cuda:9.2-devel' + additionalBuildArgs '--build-arg BASE=nvidia/cuda:11.7.0-devel-ubuntu20.04' label 'nvidia-docker && volta' args '-v /tmp/ccache.kokkos:/tmp/ccache --env NVIDIA_VISIBLE_DEVICES=$NVIDIA_VISIBLE_DEVICES' } @@ -329,7 +339,7 @@ pipeline { ../gnu_generate_makefile.bash \ --with-options=compiler_warnings \ --cxxflags="-Werror" \ - --cxxstandard=c++14 \ + --cxxstandard=c++17 \ --with-cuda \ --with-cuda-options=enable_lambda \ --arch=Volta70 \ @@ -342,7 +352,7 @@ pipeline { } } } - stage('CUDA-11.0-NVCC-C++17-RDC') { + stage('CUDA-11.0-NVCC-RDC') { agent { dockerfile { filename 'Dockerfile.nvcc' @@ -372,12 +382,13 @@ pipeline { -DCMAKE_CXX_STANDARD=17 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_OPENMP=ON \ + -DKokkos_ENABLE_OPENMP=OFF \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ENABLE_CUDA_LAMBDA=OFF \ -DKokkos_ENABLE_CUDA_UVM=ON \ -DKokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE=ON \ -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ -DCMAKE_INSTALL_PREFIX=${PWD}/../install \ .. && \ @@ -431,13 +442,14 @@ pipeline { -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER=$WORKSPACE/bin/nvcc_wrapper \ -DCMAKE_CXX_FLAGS=-Werror \ - -DCMAKE_CXX_STANDARD=14 \ + -DCMAKE_CXX_STANDARD=17 \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ -DKokkos_ENABLE_DEBUG=ON \ -DKokkos_ENABLE_DEBUG_BOUNDS_CHECK=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_CUDA=ON \ -DKokkos_ENABLE_CUDA_LAMBDA=ON \ -DKokkos_ENABLE_LIBDL=OFF \ @@ -445,7 +457,7 @@ pipeline { make -j8 && ctest --verbose && \ cd ../example/build_cmake_in_tree && \ rm -rf build && mkdir -p build && cd build && \ - cmake -DCMAKE_CXX_STANDARD=14 .. && make -j8 && ctest --verbose''' + cmake -DCMAKE_CXX_STANDARD=17 .. && make -j8 && ctest --verbose''' } post { always { @@ -453,7 +465,7 @@ pipeline { } } } - stage('GCC-5.3.1') { + stage('GCC-8.4.0') { agent { dockerfile { filename 'Dockerfile.gcc' @@ -463,6 +475,7 @@ pipeline { } environment { OMP_NUM_THREADS = 8 + OMP_NESTED = 'true' OMP_MAX_ACTIVE_LEVELS = 3 OMP_PROC_BIND = 'true' } @@ -470,18 +483,18 @@ pipeline { sh '''rm -rf build && mkdir -p build && cd build && \ cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_STANDARD=14 \ + -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_CXX_FLAGS=-Werror \ -DKokkos_ARCH_NATIVE=ON \ -DKokkos_ENABLE_COMPILER_WARNINGS=ON \ - -DKokkos_ENABLE_DEPRECATED_CODE_3=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_4=ON \ -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ -DKokkos_ENABLE_TESTS=ON \ + -DKokkos_ENABLE_BENCHMARKS=ON \ -DKokkos_ENABLE_OPENMP=ON \ -DKokkos_ENABLE_LIBDL=OFF \ -DKokkos_ENABLE_LIBQUADMATH=ON \ -DKokkos_ENABLE_SERIAL=ON \ - -DCMAKE_PREFIX_PATH=/usr/lib/gcc/x86_64-linux-gnu/5.3.1 \ .. && \ make -j8 && ctest --verbose && gcc -I$PWD/../core/src/ ../core/unit_test/tools/TestCInterface.c''' } diff --git a/packages/kokkos/.travis.yml b/packages/kokkos/.travis.yml deleted file mode 100644 index 87d0fd5cf6ed8b9ebc158d1eb8bbe91d56101963..0000000000000000000000000000000000000000 --- a/packages/kokkos/.travis.yml +++ /dev/null @@ -1,108 +0,0 @@ -sudo: false - -language: cpp - -os: - - linux - -compiler: - - gcc - - clang - -cache: - - ccache - -stages: - - canary - - test - -jobs: - include: - - stage: canary - env: CMAKE_BUILD_TYPE=Release BACKEND="OPENMP" - os: linux - -branches: - only: - - master - - develop - - /^release/ - -env: - - -# - BACKEND="OPENMP" - - BACKEND="PTHREAD" - - CMAKE_BUILD_TYPE=Debug COVERAGE=yes GTEST_FILTER="-*DeathTest*" - - CMAKE_BUILD_TYPE=Debug BACKEND="OPENMP" COVERAGE=yes GTEST_FILTER="-*DeathTest*" -# - CMAKE_BUILD_TYPE=Debug BACKEND="PTHREAD" COVERAGE=yes - - CMAKE_BUILD_TYPE=Release - - CMAKE_BUILD_TYPE=Release BACKEND="OPENMP" -# - CMAKE_BUILD_TYPE=Release BACKEND="PTHREAD" - -matrix: - exclude: - - os: linux - compiler: gcc - env: CMAKE_BUILD_TYPE=Release BACKEND="OPENMP" - -# Install newer CMake. The distribution comes with CMake 3.12.4 but we require at least 3.16 -install: - - CMAKE_VERSION=3.17.1 - - CMAKE_DIR=/opt/cmake - - CMAKE_KEY=2D2CEF1034921684 && - CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION} && - CMAKE_SCRIPT=cmake-${CMAKE_VERSION}-Linux-x86_64.sh && - CMAKE_SHA256=cmake-${CMAKE_VERSION}-SHA-256.txt && - wget --quiet ${CMAKE_URL}/${CMAKE_SHA256} && - wget --quiet ${CMAKE_URL}/${CMAKE_SHA256}.asc && - wget --quiet ${CMAKE_URL}/${CMAKE_SCRIPT} && - #gpg --keyserver pool.sks-keyservers.net --recv-keys ${CMAKE_KEY} && - #gpg --verify ${CMAKE_SHA256}.asc ${CMAKE_SHA256} && - #grep ${CMAKE_SCRIPT} ${CMAKE_SHA256} | sha256sum --check && - mkdir -p ${CMAKE_DIR} && - sh ${CMAKE_SCRIPT} --skip-license --prefix=${CMAKE_DIR} && - rm cmake* - - PATH=${CMAKE_DIR}/bin:$PATH - - cd ${TRAVIS_BUILD_DIR} - -before_script: - - ccache -z - - if [[ ${COVERAGE} ]]; then export CXX="${CXX} --coverage"; fi - - if [[ ! ${CMAKE_BUILD_TYPE} ]]; then export CXXFLAGS="${CXXFLAGS} -O2"; fi - -script: - - export OMP_NUM_THREADS=2 - - export OMP_PLACES=threads - - export OMP_PROC_BIND=spread - # LD_LIBRARY_PATH workaround to find clang's libomp: https://github.com/travis-ci/travis-ci/issues/8613 - - if [[ ${CC} = clang ]]; then export LD_LIBRARY_PATH=/usr/local/clang/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH; fi - # enable ccache for clang on linux and add CCACHE_CPP2 to avoid 'Argument unused during compilation -I...' warning - - if [[ ${TRAVIS_OS_NAME} = linux && ${CC} = clang ]]; then - ln -s /usr/bin/ccache $HOME/bin/clang++; - export CCACHE_CPP2=yes; - fi - - mkdir build && - pushd build && - cmake .. - ${BACKEND:+-DKokkos_ENABLE_${BACKEND}=On} - -DCMAKE_CXX_FLAGS="${CXXFLAGS} -Werror" - -DCMAKE_CXX_STANDARD=14 - -DKokkos_ENABLE_COMPILER_WARNINGS=ON - -DKokkos_ENABLE_TESTS=On - ${CMAKE_BUILD_TYPE:+-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}} && - make VERBOSE=1 -j2 && - travis_wait 60 make test CTEST_OUTPUT_ON_FAILURE=1 && - make install DESTDIR=${PWD}/install && rm -rf ${PWD}/install/usr/local && rmdir ${PWD}/install/usr && - popd - -after_success: - - ccache -s - - if [[ ${COVERAGE} ]]; then - mkdir -p $HOME/.local/bin && wget -O $HOME/.local/bin/codecov https://codecov.io/bash && chmod +x $HOME/.local/bin/codecov; - pushd build && - if [[ ${CC} = clang* ]]; then - codecov -x "llvm-cov gcov" -F "${CC}"; - else - codecov -x gcov -F "${CC}"; - fi; - fi diff --git a/packages/kokkos/BUILD.md b/packages/kokkos/BUILD.md index a8985ef1fd8c5f8507d646d70bb5b1cf756e711c..b0d603e6db0e9c6f76eda03f1343fce4105d2835 100644 --- a/packages/kokkos/BUILD.md +++ b/packages/kokkos/BUILD.md @@ -52,6 +52,10 @@ There are numerous device backends, options, and architecture-specific optimizat ```` which activates the OpenMP backend. All of the options controlling device backends, options, architectures, and third-party libraries (TPLs) are given below. +Kokkos requires as a minimum C++17, however C++20 and C++23 are supported depending on the compiler. + +The latest minimum compiler versions can be found in `cmake/kokkos_compiler_id.cmake`. + ## Known Issues<a name="KnownIssues"></a> ### Cray @@ -148,12 +152,14 @@ Options can be enabled by specifying `-DKokkos_ENABLE_X`. * Whether to activate experimental lambda features * BOOL Default: OFF * Kokkos_ENABLE_CUDA_LDG_INTRINSIC + * Deprecated since 4.0, LDG intrinsics are always enabled. * Whether to use CUDA LDG intrinsics * BOOL Default: OFF * Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE * Whether to enable relocatable device code (RDC) for CUDA * BOOL Default: OFF * Kokkos_ENABLE_CUDA_UVM + * Deprecated since 4.0 * Whether to use unified memory (UM) by default for CUDA * BOOL Default: OFF * Kokkos_ENABLE_DEBUG @@ -184,10 +190,6 @@ Options can be enabled by specifying `-DKokkos_ENABLE_X`. * Whether to enable test suite * BOOL Default: OFF -## Other Options -* Kokkos_CXX_STANDARD - * The C++ standard for Kokkos to use: c++14, c++17, or c++20. This should be given in CMake style as 14, 17, or 20. - * STRING Default: 14 ## Third-party Libraries (TPLs) The following options control enabling TPLs: diff --git a/packages/kokkos/CHANGELOG.md b/packages/kokkos/CHANGELOG.md index bdbc75604bab5fbbfd436767531ab30371cc788b..a381f16129fd4846a8f786da0172556ff2cf5034 100644 --- a/packages/kokkos/CHANGELOG.md +++ b/packages/kokkos/CHANGELOG.md @@ -1,5 +1,128 @@ # Change Log +## [4.0.01](https://github.com/kokkos/kokkos/tree/4.0.01) (2023-04-14) +[Full Changelog](https://github.com/kokkos/kokkos/compare/4.0.00...4.0.01) + +### Backend and Architecture Enhancements: + +#### CUDA: + +- Allow NVCC 12 to compile using C++20 flag [\#6020](https://github.com/kokkos/kokkos/pull/6020) +- Add CUDA Ada architecture support [\#6022](https://github.com/kokkos/kokkos/pull/6022) + +#### HIP: + +- Add support for AMDGPU target NAVI31 / RX 7900 XT(X): gfx1100 [\#6021](https://github.com/kokkos/kokkos/pull/6021) +- HIP: Fix warning from `std::memcpy` [\#6019](https://github.com/kokkos/kokkos/pull/6019) + +#### SYCL: +- Fix `SYCLTeamMember` to take arguments for scratch sizes as `std::size_t` [\#5986](https://github.com/kokkos/kokkos/pull/5986) + +### General Enhancements +- Fixup 4.0 change log [\#6023](https://github.com/kokkos/kokkos/pull/6023) + +### Build System Changes +- Cherry-pick TriBITS update from Trilinos [\#6037](https://github.com/kokkos/kokkos/pull/6037) +- CMake: update package compatibility mode when building within Trilinos [\#6013](https://github.com/kokkos/kokkos/pull/6013) + +### Bug Fixes +- Fix an incorrectly returning size for SIMD uint64_t in AVX2 [\#6011](https://github.com/kokkos/kokkos/pull/6011) +- Desul atomics: wrong value for `desul::Impl::numeric_limits_max<uint64_t>` [\#6018](https://github.com/kokkos/kokkos/pull/6018) +- Fix warning in some user code when using std::memcpy [\#6000](https://github.com/kokkos/kokkos/pull/6000) + +## [4.0.0](https://github.com/kokkos/kokkos/tree/4.0.0) (2023-02-21) +[Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.01...4.0.00) + +### Features: +- Allow value types without default constructor in `Kokkos::View` with `Kokkos::WithoutInitializing` [\#5307](https://github.com/kokkos/kokkos/pull/5307) +- `parallel_scan` with `View` as result type. [\#5146](https://github.com/kokkos/kokkos/pull/5146) +- Introduced `SharedSpace`, an alias for a `MemorySpace` that is accessible by every `ExecutionSpace`. The memory is moved and then accessed locally. [\#5289](https://github.com/kokkos/kokkos/pull/5289) +- Introduced `SharedHostPinnedSpace`, an alias for a `MemorySpace` that is accessible by every `ExecutionSpace`. The memory is pinned to the host and accessed via zero-copy access. [\#5405](https://github.com/kokkos/kokkos/pull/5405) +- Groundwork for `MDSpan` integration. [\#4973](https://github.com/kokkos/kokkos/pull/4973) and [\#5304](https://github.com/kokkos/kokkos/pull/5304) +- Introduced MD version of hierarchical parallelism: `TeamThreadMDRange`, `ThreadVectorMDRange` and `TeamVectorMDRange`. [\#5238](https://github.com/kokkos/kokkos/pull/5238) + +### Backend and Architecture Enhancements: + +#### CUDA: +- Allow CUDA PTX forward compatibility [\#3612](https://github.com/kokkos/kokkos/pull/3612) [\#5536](https://github.com/kokkos/kokkos/pull/5536) [\#5527](https://github.com/kokkos/kokkos/pull/5527) +- Add support for NVIDIA Hopper GPU architecture [\#5538](https://github.com/kokkos/kokkos/pull/5538) +- Don't rely on synchronization behavior of default stream in CUDA and HIP [\#5391](https://github.com/kokkos/kokkos/pull/5391) +- Improve CUDA cache config settings [\#5706](https://github.com/kokkos/kokkos/pull/5706) + +#### HIP: + - Move `HIP`, `HIPSpace`, `HIPHostPinnedSpace`, and `HIPManagedSpace` out of the `Experimental` namespace [\#5383](https://github.com/kokkos/kokkos/pull/5383) + - Don't rely on synchronization behavior of default stream in CUDA and HIP [\#5391](https://github.com/kokkos/kokkos/pull/5391) + - Export AMD architecture flag when using Trilinos [\#5528](https://github.com/kokkos/kokkos/pull/5528) + - Fix linking error (see [OLCF issue](https://docs.olcf.ornl.gov/systems/crusher_quick_start_guide.html#olcfdev-1167-kokkos-build-failures-with-prgenv-amd)) when using `amdclang`: [\#5539](https://github.com/kokkos/kokkos/pull/5539) + - Remove support for MI25 and added support for Navi 1030 [\#5522](https://github.com/kokkos/kokkos/pull/5522) + - Fix race condition when using `HSA_XNACK=1` [\#5755](https://github.com/kokkos/kokkos/pull/5755) + - Add parameter to force using GlobalMemory launch mechanism. This can be used when encountering compiler bugs with ROCm 5.3 and 5.4 [\#5796](https://github.com/kokkos/kokkos/pull/5796) + +#### SYCL: +- Delegate choice of workgroup size for `parallel_reduce` with `RangePolicy` to the compiler. [\#5227](https://github.com/kokkos/kokkos/pull/5227) +- SYCL `RangePolicy`: manually specify workgroup size through chunk size [\#4875](https://github.com/kokkos/kokkos/pull/4875) + +#### OpenMPTarget: +- Select the right device [\#5492](https://github.com/kokkos/kokkos/pull/5492) + +#### OpenMP: + - Add `partition_space` [\#5105](https://github.com/kokkos/kokkos/pull/5105) + +### General Enhancements +- Implement `OffsetView` constructor taking `pair`s and `ViewCtorProp` [\#5303](https://github.com/kokkos/kokkos/pull/5303) +- Promote math constants to `Kokkos::numbers` namespace [\#5434](https://github.com/kokkos/kokkos/pull/5434) +- Add overloads of `hypot` math function that take 3 arguments [\#5341](https://github.com/kokkos/kokkos/pull/5341) +- Add `fma` fused multiply-add math function [\#5428](https://github.com/kokkos/kokkos/pull/5428) +- Views using `MemoryTraits::Atomic` don't need `volatile` overloads for the value type anymore. [\#5455](https://github.com/kokkos/kokkos/pull/5455) +- Added `is_team_handle` trait [\#5375](https://github.com/kokkos/kokkos/pull/5375) +- Refactor desul atomics to support compiling CUDA with NVC++ [\#5431](https://github.com/kokkos/kokkos/pull/5431) [\#5497](https://github.com/kokkos/kokkos/pull/5497) [\#5498](https://github.com/kokkos/kokkos/pull/5498) +- Support finding `libquadmath` with native compiler support [\#5286](https://github.com/kokkos/kokkos/pull/5286) +- Add architecture flags for MSVC [\#5673](https://github.com/kokkos/kokkos/pull/5673) +- SIMD backend for ARM NEON [\#5829](https://github.com/kokkos/kokkos/pull/5829) + +### Build System Changes +- Let CMake determine OpenMP flags. [\#4105](https://github.com/kokkos/kokkos/pull/4105) +- Update minimum compiler versions. [\#5323](https://github.com/kokkos/kokkos/pull/5323) +- Makefile and CMake support for C++23 [\#5283](https://github.com/kokkos/kokkos/pull/5283) +- Do not add `-cuda` to the link line with NVHPC compiler when the CUDA backend is not actually enabled [\#5485](https://github.com/kokkos/kokkos/pull/5485) +- Only add `-latomic` in generated GNU makefiles when OpenMPTarget backend is enabled [\#5501](https://github.com/kokkos/kokkos/pull/5501) [\#5537](https://github.com/kokkos/kokkos/pull/5537) (3.7 patch release candidate) +- `Kokkos_ENABLE_CUDA_LAMBDA` now `ON` by default with NVCC [\#5580](https://github.com/kokkos/kokkos/pull/5580) +- Fix enabling of relocatable device code when using CUDA as CMake language [\#5564](https://github.com/kokkos/kokkos/pull/5564) +- Fix cmake configuration with CUDA 12 [\#5691](https://github.com/kokkos/kokkos/pull/5691) + +### Incompatibilities (i.e. breaking changes) +- ***Require C++17*** [\#5277](https://github.com/kokkos/kokkos/pull/5277) +- Turn setting `Kokkos_CXX_STANDARD` into an error [\#5293](https://github.com/kokkos/kokkos/pull/5293) +- Remove all deprecations in Kokkos 3 [\#5297](https://github.com/kokkos/kokkos/pull/5297) +- Remove `KOKKOS_COMPILER_CUDA_VERSION` [\#5430](https://github.com/kokkos/kokkos/pull/5430) +- Drop `reciprocal_overflow_threshold` numeric trait [\#5326](https://github.com/kokkos/kokkos/pull/5326) +- Move `reduction_identity` out of `<Kokkos_NumericTraits.hpp>` into a new `<Kokkos_ReductionIdentity.hpp>` header [\#5450](https://github.com/kokkos/kokkos/pull/5450) +- Reduction and scan routines will report an error if the `join()` operator they would use takes `volatile`-qualified parameters [\#5409](https://github.com/kokkos/kokkos/pull/5409) +- `ENABLE_CUDA_UVM` is dropped in favor of using `SharedSpace` as `MemorySpace` explicitly [\#5608](https://github.com/kokkos/kokkos/pull/5608) +- Remove Kokkos_ENABLE_CUDA_LDG_INTRINSIC option [\#5623](https://github.com/kokkos/kokkos/pull/5623) +- Don't rely on synchronization behavior of default stream in CUDA and HIP - this potentially will break unintended implicit synchronization with other libraries such as MPI [\#5391](https://github.com/kokkos/kokkos/pull/5391) +- Make ExecutionSpace::concurrency() a non-static member function [\#5655](https://github.com/kokkos/kokkos/pull/5655) and related PRs +- Remove code guarded by `KOKKOS_ENABLE_DEPRECATED_CODE_3` + +### Deprecations +- Deprecate `CudaUVMSpace::available()` which always returned `true` [\#5614](https://github.com/kokkos/kokkos/pull/5614) +- Deprecate `volatile`-qualified members from `Kokkos::pair` and `Kokkos::complex` [\#5412](https://github.com/kokkos/kokkos/pull/5412) +- Deprecate `KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_*` macros [\#5824](https://github.com/kokkos/kokkos/pull/5824) (oversight in 3.6) + +### Bug Fixes +- Avoid allocating memory for `UniqueToken` [\#5300](https://github.com/kokkos/kokkos/pull/5300) +- Fix `pragma ivdep` in `Kokkos_OpenMP_Parallel.hpp` [\#5356](https://github.com/kokkos/kokkos/pull/5356) +- Fix configuring with Threads support when rerunning CMake [\#5486](https://github.com/kokkos/kokkos/pull/5486) +- Fix View assignment between `LayoutLeft` and `LayoutRight` with static extents [\#5535](https://github.com/kokkos/kokkos/pull/5535) (3.7 patch release candidate) +- Add `fence()` calls to sorting routine overloads that don't take an execution space parameter [\#5389](https://github.com/kokkos/kokkos/pull/5389) +- `ClockTic` changed to 64 bit to fix overflow on Power [\#5577](https://github.com/kokkos/kokkos/pull/5577) (incl. in 3.7.01 patch release) +- Fix incorrect offset in CUDA and HIP `parallel_scan` for < 4 byte types [\#5555](https://github.com/kokkos/kokkos/pull/5555) (3.7 patch release candidate) +- Fix incorrect alignment behavior of scratch allocations in some corner cases (e.g. very small allocations) [\#5687](https://github.com/kokkos/kokkos/pull/5687) (3.7 patch release candidate) +- Add missing `ReductionIdentity<char>` specialization [\#5798](https://github.com/kokkos/kokkos/pull/5798) +- Don't install standard algorithms headers multiple times [\#5670](https://github.com/kokkos/kokkos/pull/5670) +- Fix max scratch size calculation for level 0 scratch in CUDA and HIP [\#5718](https://github.com/kokkos/kokkos/pull/5718) +- Fix excessive build times using Makefile.kokkos [\#6068](https://github.com/kokkos/kokkos/pull/6068) + ## [3.7.01](https://github.com/kokkos/kokkos/tree/3.7.01) (2022-12-01) [Full Changelog](https://github.com/kokkos/kokkos/compare/3.7.00...3.7.01) diff --git a/packages/kokkos/CMakeLists.txt b/packages/kokkos/CMakeLists.txt index 7b78f29d7340499aff394302911e59c5ef120d52..aa712f56127aab50c02aa89a6c13a3472036e36f 100644 --- a/packages/kokkos/CMakeLists.txt +++ b/packages/kokkos/CMakeLists.txt @@ -5,13 +5,16 @@ if( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" ) message( FATAL_ERROR "FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt." ) endif() +if (COMMAND TRIBITS_PACKAGE_DECL) + TRIBITS_PACKAGE_DECL(Kokkos) +endif() + # We want to determine if options are given with the wrong case # In order to detect which arguments are given to compare against # the list of valid arguments, at the beginning here we need to # form a list of all the given variables. If it begins with any # case of KoKkOS, we add it to the list. - GET_CMAKE_PROPERTY(_variableNames VARIABLES) SET(KOKKOS_GIVEN_VARIABLES) FOREACH (var ${_variableNames}) @@ -87,6 +90,16 @@ IF(NOT KOKKOS_HAS_TRILINOS) SET(KOKKOS_COMPILE_LANGUAGE CUDA) ENDIF() + # use lower case here since we haven't parsed options yet + IF (Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE AND Kokkos_ENABLE_HIP) + + # Without this as a language for the package we would get a C++ compiler enabled. + # but we still need a C++ compiler even if we build all our cpp files as HIP only + # because otherwise the C++ features don't work etc. + SET(KOKKOS_INTERNAL_EXTRA_COMPILE_LANGUAGE CXX) + + SET(KOKKOS_COMPILE_LANGUAGE HIP) + ENDIF() IF (Spack_WORKAROUND) IF (Kokkos_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) @@ -113,6 +126,8 @@ IF(NOT KOKKOS_HAS_TRILINOS) FORCE) ENDIF() ENDIF() +ELSE() + SET(KOKKOS_COMPILE_LANGUAGE CXX) ENDIF() IF (NOT CMAKE_SIZEOF_VOID_P) @@ -127,11 +142,17 @@ ELSEIF (NOT CMAKE_SIZEOF_VOID_P EQUAL 8) ENDIF() -set(Kokkos_VERSION_MAJOR 3) -set(Kokkos_VERSION_MINOR 7) -set(Kokkos_VERSION_PATCH 01) +set(Kokkos_VERSION_MAJOR 4) +set(Kokkos_VERSION_MINOR 0) +set(Kokkos_VERSION_PATCH 1) set(Kokkos_VERSION "${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}.${Kokkos_VERSION_PATCH}") math(EXPR KOKKOS_VERSION "${Kokkos_VERSION_MAJOR} * 10000 + ${Kokkos_VERSION_MINOR} * 100 + ${Kokkos_VERSION_PATCH}") +# mathematical expressions below are not stricly necessary but they eliminate +# the rather aggravating leading 0 in the releases patch version number, and, +# in some way, are a sanity check for our arithmetic +math(EXPR KOKKOS_VERSION_MAJOR "${KOKKOS_VERSION} / 10000") +math(EXPR KOKKOS_VERSION_MINOR "${KOKKOS_VERSION} / 100 % 100") +math(EXPR KOKKOS_VERSION_PATCH "${KOKKOS_VERSION} % 100") # Load either the real TriBITS or a TriBITS wrapper # for certain utility functions that are universal (like GLOBAL_SET) @@ -167,7 +188,7 @@ IF(NOT MSVC) ENDIF() IF(Kokkos_ENABLE_TESTS AND NOT KOKKOS_HAS_TRILINOS) - find_package(GTest) + find_package(GTest QUIET) ENDIF() # Include a set of Kokkos-specific wrapper functions that @@ -180,6 +201,14 @@ INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_tribits.cmake) # to allow platform-specific checks INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_check_env.cmake) +IF(NOT KOKKOS_HAS_TRILINOS) + # This does not work in Trilinos and we simply don't care + # to fix it for Trilinos + # Gather information about the runtime environment + INCLUDE(${KOKKOS_SRC_PATH}/cmake/build_env_info.cmake) + check_git_setup() +ENDIF() + # The build environment setup goes in the following steps # 1) Check all the enable options. This includes checking Kokkos_DEVICES # 2) Check the compiler ID (type and version) @@ -194,14 +223,8 @@ KOKKOS_SETUP_BUILD_ENVIRONMENT() OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF) -SET(KOKKOS_EXT_LIBRARIES Kokkos::kokkos Kokkos::kokkoscore Kokkos::kokkoscontainers Kokkos::kokkosalgorithms) -SET(KOKKOS_SUB_LIBRARIES kokkoscore kokkoscontainers kokkosalgorithms) -IF (KOKKOS_CXX_STANDARD GREATER_EQUAL 17) - LIST(APPEND KOKKOS_EXT_LIBRARIES Kokkos::kokkossimd) - LIST(APPEND KOKKOS_SUB_LIBRARIES kokkossimd) -ENDIF() -SET(KOKKOS_INT_LIBRARIES kokkos ${KOKKOS_SUB_LIBRARIES}) -SET_PROPERTY(GLOBAL PROPERTY KOKKOS_INT_LIBRARIES ${KOKKOS_INT_LIBRARIES}) +SET(KOKKOS_COMPONENT_LIBRARIES kokkoscore kokkoscontainers kokkosalgorithms kokkossimd) +SET_PROPERTY(GLOBAL PROPERTY KOKKOS_INT_LIBRARIES kokkos ${KOKKOS_COMPONENT_LIBRARIES}) IF (KOKKOS_HAS_TRILINOS) SET(TRILINOS_INCDIR ${${PROJECT_NAME}_INSTALL_INCLUDE_DIR}) @@ -270,7 +293,9 @@ IF (KOKKOS_HAS_TRILINOS) $<$<COMPILE_LANGUAGE:CXX>:${KOKKOS_ALL_COMPILE_OPTIONS}>) ENDIF() -KOKKOS_PACKAGE_DECL() +if (NOT COMMAND TRIBITS_PACKAGE_DECL) + KOKKOS_PACKAGE_DECL() +endif() #------------------------------------------------------------------------------ @@ -295,7 +320,7 @@ IF (NOT KOKKOS_HAS_TRILINOS AND NOT Kokkos_INSTALL_TESTING) #Make sure in-tree projects can reference this as Kokkos:: #to match the installed target names ADD_LIBRARY(Kokkos::kokkos ALIAS kokkos) - TARGET_LINK_LIBRARIES(kokkos INTERFACE ${KOKKOS_SUB_LIBRARIES}) + TARGET_LINK_LIBRARIES(kokkos INTERFACE ${KOKKOS_COMPONENT_LIBRARIES}) KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(kokkos) ENDIF() INCLUDE(${KOKKOS_SRC_PATH}/cmake/kokkos_install.cmake) diff --git a/packages/kokkos/LICENSE b/packages/kokkos/LICENSE index c6f17087d5a1b160a5fddeaab39ed9380328b485..6572cc2db055e848e53f82c024d75b3404ef0bf8 100644 --- a/packages/kokkos/LICENSE +++ b/packages/kokkos/LICENSE @@ -1,43 +1,238 @@ -//@HEADER -// ************************************************************************ -// -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Kokkos is licensed under 3-clause BSD terms of use: -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ -//@HEADER + ************************************************************************ + + Kokkos v. 4.0 + Copyright (2022) National Technology & Engineering + Solutions of Sandia, LLC (NTESS). + + Under the terms of Contract DE-NA0003525 with NTESS, + the U.S. Government retains certain rights in this software. + + + ============================================================================== + Kokkos is under the Apache License v2.0 with LLVM Exceptions: + ============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS Apache 2.0 + + ---- LLVM Exceptions to the Apache 2.0 License ---- + + As an exception, if, as a result of your compiling your source code, portions + of this Software are embedded into an Object form of such source code, you + may redistribute such embedded portions in such Object form without complying + with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + + In addition, if you combine or link compiled forms of this Software with + software that is licensed under the GPLv2 ("Combined Software") and if a + court of competent jurisdiction determines that the patent provision (Section + 3), the indemnity provision (Section 9) or other Section of the License + conflicts with the conditions of the GPLv2, you may retroactively and + prospectively choose to deem waived or otherwise exclude such Section(s) of + the License, but only in their entirety and only with respect to the Combined + Software. + + ============================================================================== + Software from third parties included in Kokkos: + ============================================================================== + + Kokkos contains third party software which is under different license + terms. All such code will be identified clearly using at least one of two + mechanisms: + 1) It will be in a separate directory tree with its own `LICENSE.txt` or + `LICENSE` file at the top containing the specific license and restrictions + which apply to that software, or + 2) It will contain specific license and restriction terms at the top of every + file. + + + THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Questions? Contact: + Christian R. Trott (crtrott@sandia.gov) and + Damien T. Lebrun-Grandie (lebrungrandt@ornl.gov) + + ************************************************************************ diff --git a/packages/kokkos/LICENSE_FILE_HEADER b/packages/kokkos/LICENSE_FILE_HEADER new file mode 100644 index 0000000000000000000000000000000000000000..03eb04f8bdcb9234d1f22b33dfb62d6e22479dbf --- /dev/null +++ b/packages/kokkos/LICENSE_FILE_HEADER @@ -0,0 +1,15 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER diff --git a/packages/kokkos/Makefile.kokkos b/packages/kokkos/Makefile.kokkos index 2e32c9d53893bf552381eb618db37acaf8156822..60cef6c7f30eb8fc3525add860d9806fb332a16b 100644 --- a/packages/kokkos/Makefile.kokkos +++ b/packages/kokkos/Makefile.kokkos @@ -1,8 +1,8 @@ # Default settings common options. -KOKKOS_VERSION_MAJOR = 3 -KOKKOS_VERSION_MINOR = 7 -KOKKOS_VERSION_PATCH = 01 +KOKKOS_VERSION_MAJOR = 4 +KOKKOS_VERSION_MINOR = 0 +KOKKOS_VERSION_PATCH = 1 KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MINOR)*100+$(KOKKOS_VERSION_PATCH) | bc) # Options: Cuda,HIP,SYCL,OpenMPTarget,OpenMP,Threads,Serial @@ -10,10 +10,10 @@ KOKKOS_VERSION = $(shell echo $(KOKKOS_VERSION_MAJOR)*10000+$(KOKKOS_VERSION_MIN KOKKOS_DEVICES ?= "Threads" # Options: # Intel: KNC,KNL,SNB,HSW,BDW,SKL,SKX,ICL,ICX,SPR -# NVIDIA: Kepler,Kepler30,Kepler32,Kepler35,Kepler37,Maxwell,Maxwell50,Maxwell52,Maxwell53,Pascal60,Pascal61,Volta70,Volta72,Turing75,Ampere80,Ampere86 +# NVIDIA: Kepler,Kepler30,Kepler32,Kepler35,Kepler37,Maxwell,Maxwell50,Maxwell52,Maxwell53,Pascal60,Pascal61,Volta70,Volta72,Turing75,Ampere80,Ampere86,Ada89,Hopper90 # ARM: ARMv80,ARMv81,ARMv8-ThunderX,ARMv8-TX2,A64FX # IBM: BGQ,Power7,Power8,Power9 -# AMD-GPUS: Vega900,Vega906,Vega908,Vega90A +# AMD-GPUS: Vega906,Vega908,Vega90A,Navi1030 # AMD-CPUS: AMDAVX,Zen,Zen2,Zen3 # Intel-GPUs: Gen9,Gen11,Gen12LP,DG1,XeHP,PVC KOKKOS_ARCH ?= "" @@ -21,8 +21,8 @@ KOKKOS_ARCH ?= "" KOKKOS_DEBUG ?= "no" # Options: hwloc,librt,experimental_memkind KOKKOS_USE_TPLS ?= "" -# Options: c++14,c++1y,c++17,c++1z,c++2a -KOKKOS_CXX_STANDARD ?= "c++14" +# Options: c++17,c++1z,c++20,c++2a,c++23,c++2b +KOKKOS_CXX_STANDARD ?= "c++17" # Options: aggressive_vectorization,disable_profiling,enable_large_mem_tests,disable_complex_align,disable_deprecated_code,enable_deprecation_warnings,disable_desul_atomics KOKKOS_OPTIONS ?= "" KOKKOS_CMAKE ?= "no" @@ -57,12 +57,12 @@ kokkos_path_exists=$(if $(wildcard $1),1,0) # Check for general settings KOKKOS_INTERNAL_ENABLE_DEBUG := $(call kokkos_has_string,$(KOKKOS_DEBUG),yes) -KOKKOS_INTERNAL_ENABLE_CXX14 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++14) -KOKKOS_INTERNAL_ENABLE_CXX1Y := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++1y) KOKKOS_INTERNAL_ENABLE_CXX17 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++17) KOKKOS_INTERNAL_ENABLE_CXX1Z := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++1z) -KOKKOS_INTERNAL_ENABLE_CXX2A := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2a) KOKKOS_INTERNAL_ENABLE_CXX20 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++20) +KOKKOS_INTERNAL_ENABLE_CXX2A := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2a) +KOKKOS_INTERNAL_ENABLE_CXX23 := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++23) +KOKKOS_INTERNAL_ENABLE_CXX2B := $(call kokkos_has_string,$(KOKKOS_CXX_STANDARD),c++2b) # Check for external libraries. KOKKOS_INTERNAL_USE_HWLOC := $(call kokkos_has_string,$(KOKKOS_USE_TPLS),hwloc) @@ -77,6 +77,7 @@ KOKKOS_INTERNAL_DISABLE_COMPLEX_ALIGN := $(call kokkos_has_string,$(KOKKOS_OPTIO KOKKOS_INTERNAL_DISABLE_DUALVIEW_MODIFY_CHECK := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_dualview_modify_check) KOKKOS_INTERNAL_ENABLE_PROFILING_LOAD_PRINT := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_profile_load_print) KOKKOS_INTERNAL_ENABLE_LARGE_MEM_TESTS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_large_mem_tests) +# deprecated KOKKOS_INTERNAL_CUDA_USE_LDG := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),use_ldg) KOKKOS_INTERNAL_CUDA_USE_UVM := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),force_uvm) KOKKOS_INTERNAL_CUDA_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_CUDA_OPTIONS),rdc) @@ -86,6 +87,7 @@ KOKKOS_INTERNAL_HPX_ENABLE_ASYNC_DISPATCH := $(call kokkos_has_string,$(KOKKOS_H # deprecated KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_desul_atomics) KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_desul_atomics) +KOKKOS_INTERNAL_DISABLE_BUNDLED_MDSPAN := $(call kokkos_has_string,$(KOKKOS_OPTIONS),impl_disable_bundled_mdspan) KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE := $(call kokkos_has_string,$(KOKKOS_OPTIONS),disable_deprecated_code) KOKKOS_INTERNAL_ENABLE_DEPRECATION_WARNINGS := $(call kokkos_has_string,$(KOKKOS_OPTIONS),enable_deprecation_warnings) @@ -94,14 +96,8 @@ KOKKOS_INTERNAL_HIP_USE_RELOC := $(call kokkos_has_string,$(KOKKOS_HIP_OPTIONS), # Check for Kokkos Host Execution Spaces one of which must be on. KOKKOS_INTERNAL_USE_OPENMP := $(call kokkos_has_string,$(subst OpenMPTarget,,$(KOKKOS_DEVICES)),OpenMP) KOKKOS_INTERNAL_USE_THREADS := $(call kokkos_has_string,$(KOKKOS_DEVICES),Threads) -# deprecated -KOKKOS_INTERNAL_USE_PTHREAD := $(call kokkos_has_string,$(KOKKOS_DEVICES),Pthread) KOKKOS_INTERNAL_USE_HPX := $(call kokkos_has_string,$(KOKKOS_DEVICES),HPX) KOKKOS_INTERNAL_USE_SERIAL := $(call kokkos_has_string,$(KOKKOS_DEVICES),Serial) -ifeq ($(KOKKOS_INTERNAL_USE_PTHREAD), 1) - KOKKOS_INTERNAL_USE_THREADS := 1 - $(warning Warning: Pthread is deprecated. Use Threads instead! KOKKOS_DEVICES=$(KOKKOS_DEVICES)) -endif ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 0) ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 0) @@ -116,6 +112,7 @@ KOKKOS_INTERNAL_USE_CUDA := $(call kokkos_has_string,$(KOKKOS_DEVICES),Cuda) KOKKOS_INTERNAL_USE_HIP := $(call kokkos_has_string,$(KOKKOS_DEVICES),HIP) KOKKOS_INTERNAL_USE_SYCL := $(call kokkos_has_string,$(KOKKOS_DEVICES),SYCL) KOKKOS_INTERNAL_USE_OPENMPTARGET := $(call kokkos_has_string,$(KOKKOS_DEVICES),OpenMPTarget) +KOKKOS_INTERNAL_USE_OPENACC := $(call kokkos_has_string,$(KOKKOS_DEVICES),OpenACC) KOKKOS_DEVICELIST = ifeq ($(KOKKOS_INTERNAL_USE_SERIAL), 1) @@ -136,21 +133,14 @@ endif ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) KOKKOS_DEVICELIST += HIP endif -KOKKOS_INTERNAL_HAVE_CXX17_OR_NEWER := $(shell expr $(KOKKOS_INTERNAL_ENABLE_CXX17) \ - + $(KOKKOS_INTERNAL_ENABLE_CXX20) \ - + $(KOKKOS_INTERNAL_ENABLE_CXX2A)) ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) KOKKOS_DEVICELIST += SYCL - ifneq ($(KOKKOS_INTERNAL_HAVE_CXX17_OR_NEWER), 1) - $(error SYCL backend requires C++17 or newer) - endif - endif ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) KOKKOS_DEVICELIST += OPENMPTARGET - ifneq ($(KOKKOS_INTERNAL_HAVE_CXX17_OR_NEWER), 1) - $(error OpenMPTarget backend requires C++17 or newer) - endif +endif +ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) + KOKKOS_DEVICELIST += OpenACC endif ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) @@ -173,10 +163,9 @@ KOKKOS_INTERNAL_OS_DARWIN := $(call kokkos_has_string,$(KOKKOS_OS),Darwin) # Check compiler. KOKKOS_CXX_VERSION := $(strip $(shell $(CXX) --version 2>&1)) KOKKOS_INTERNAL_COMPILER_INTEL := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),Intel Corporation) -KOKKOS_INTERNAL_COMPILER_PGI := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),PGI) -KOKKOS_INTERNAL_COMPILER_XL := $(strip $(shell $(CXX) -qversion 2>&1 | grep -c XL)) KOKKOS_INTERNAL_COMPILER_CRAY := $(strip $(shell $(CXX) -craype-verbose 2>&1 | grep -c "CC-")) KOKKOS_INTERNAL_COMPILER_NVCC := $(strip $(shell echo "$(shell export OMPI_CXX=$(OMPI_CXX); export MPICH_CXX=$(MPICH_CXX); $(CXX) --version 2>&1 | grep -c nvcc)>0" | bc)) +KOKKOS_INTERNAL_COMPILER_NVHPC := $(strip $(shell $(CXX) --version 2>&1 | grep -c "nvc++")) KOKKOS_INTERNAL_COMPILER_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),clang) KOKKOS_INTERNAL_COMPILER_CRAY_CLANG := $(strip $(shell $(CXX) -craype-verbose 2>&1 | grep -c "clang++")) KOKKOS_INTERNAL_COMPILER_INTEL_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_VERSION),oneAPI) @@ -192,7 +181,6 @@ ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC_WRAPPER), 1) KOKKOS_CXX_HOST_VERSION := $(strip $(shell $(CXX) $(CXXFLAGS) --host-version 2>&1)) - KOKKOS_INTERNAL_COMPILER_PGI := $(call kokkos_has_string,$(KOKKOS_CXX_HOST_VERSION),PGI) KOKKOS_INTERNAL_COMPILER_INTEL := $(call kokkos_has_string,$(KOKKOS_CXX_HOST_VERSION),Intel Corporation) KOKKOS_INTERNAL_COMPILER_CLANG := $(call kokkos_has_string,$(KOKKOS_CXX_HOST_VERSION),clang) endif @@ -201,9 +189,6 @@ endif ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 2) KOKKOS_INTERNAL_COMPILER_CLANG = 1 endif -ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 2) - KOKKOS_INTERNAL_COMPILER_XL = 1 -endif # Apple Clang passes both clang and apple clang tests, so turn off clang. ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) @@ -243,113 +228,78 @@ endif # Set compiler warnings flags. ifeq ($(KOKKOS_INTERNAL_ENABLE_COMPILER_WARNINGS), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - # TODO check if PGI accepts GNU style warnings + ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) + KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized + else ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) + KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) + # TODO check if cray accepts GNU style warnings KOKKOS_INTERNAL_COMPILER_WARNINGS = else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) - KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1) - KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wuninitialized - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - # TODO check if cray accepts GNU style warnings - KOKKOS_INTERNAL_COMPILER_WARNINGS = - else - #gcc - KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wignored-qualifiers -Wempty-body -Wclobbered -Wuninitialized - endif - endif - endif - endif + #gcc + KOKKOS_INTERNAL_COMPILER_WARNINGS = -Wall -Wunused-parameter -Wshadow -pedantic -Wsign-compare -Wtype-limits -Wignored-qualifiers -Wempty-body -Wclobbered -Wuninitialized endif else KOKKOS_INTERNAL_COMPILER_WARNINGS = endif # Set OpenMP flags. -ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_INTERNAL_OPENMP_FLAG := -mp -else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 1) +ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) + ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY_CLANG), 1) + KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp + else ifeq ($(KOKKOS_INTERNAL_COMPILER_FUJITSU), 1) + # fujitsu (clang mode) fails with `=libomp` KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_FUJITSU), 1) - # fujitsu (clang mode) fails with `=libomp` - KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp - else - KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp - endif - endif else - ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) - KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1) - KOKKOS_INTERNAL_OPENMP_FLAG := -qsmp=omp - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - # OpenMP is turned on by default in Cray compiler environment. - KOKKOS_INTERNAL_OPENMP_FLAG := - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1) - KOKKOS_INTERNAL_OPENMP_FLAG := -fiopenmp - else - KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp - endif - endif - endif - endif + KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp + endif +else + ifeq ($(KOKKOS_INTERNAL_COMPILER_APPLE_CLANG), 1) + KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp=libomp + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) + # OpenMP is turned on by default in Cray compiler environment. + KOKKOS_INTERNAL_OPENMP_FLAG := + else ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1) + KOKKOS_INTERNAL_OPENMP_FLAG := -fiopenmp + else + KOKKOS_INTERNAL_OPENMP_FLAG := -fopenmp endif endif -ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1) - KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_IBM_XL_OMP45_WORKAROUND -qsmp=omp -qoffload -qnoeh +ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) + #KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_BUG_WORKAROUND_IBM_CLANG_OMP45_VIEW_INIT -fopenmp-implicit-declare-target -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp -fopenmp=libomp + KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_WORKAROUND_OPENMPTARGET_CLANG -fopenmp -fopenmp=libomp -Wno-openmp-mapping + KOKKOS_INTERNAL_OPENMPTARGET_LIB := -lomptarget +else ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1) + KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fiopenmp -Wno-openmp-mapping else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - #KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_BUG_WORKAROUND_IBM_CLANG_OMP45_VIEW_INIT -fopenmp-implicit-declare-target -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp -fopenmp=libomp - KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -DKOKKOS_WORKAROUND_OPENMPTARGET_CLANG -fopenmp -fopenmp=libomp -Wno-openmp-mapping - KOKKOS_INTERNAL_OPENMPTARGET_LIB := -lomptarget + #Assume GCC + KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fopenmp -foffload=nvptx-none +endif + +ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) + # Set OpenACC flags. + ifeq ($(KOKKOS_INTERNAL_COMPILER_NVHPC), 1) + KOKKOS_INTERNAL_OPENACC_FLAG := -acc else - ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL_CLANG), 1) - KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fiopenmp -Wno-openmp-mapping - else - #Assume GCC - KOKKOS_INTERNAL_OPENMPTARGET_FLAG := -fopenmp -foffload=nvptx-none - endif + $(error Makefile.kokkos: OpenACC is enabled but the compiler must be NVHPC (got version string $(KOKKOS_CXX_VERSION))) endif endif # Set C++ version flags. -ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_INTERNAL_CXX14_FLAG := --c++14 - KOKKOS_INTERNAL_CXX17_FLAG := --c++17 +ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) + KOKKOS_INTERNAL_CXX17_FLAG := -hstd=c++17 + KOKKOS_INTERNAL_CXX1Z_FLAG := -hstd=c++1z + KOKKOS_INTERNAL_CXX20_FLAG := -hstd=c++20 + KOKKOS_INTERNAL_CXX2A_FLAG := -hstd=c++2a + KOKKOS_INTERNAL_CXX23_FLAG := -hstd=c++23 + KOKKOS_INTERNAL_CXX2A_FLAG := -hstd=c++2b else - ifeq ($(KOKKOS_INTERNAL_COMPILER_XL), 1) - KOKKOS_INTERNAL_CXX14_FLAG := -std=c++14 - KOKKOS_INTERNAL_CXX1Y_FLAG := -std=c++1y - #KOKKOS_INTERNAL_CXX17_FLAG := -std=c++17 - #KOKKOS_INTERNAL_CXX1Z_FLAG := -std=c++1Z - #KOKKOS_INTERNAL_CXX2A_FLAG := -std=c++2a - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - KOKKOS_INTERNAL_CXX14_FLAG := -hstd=c++14 - #KOKKOS_INTERNAL_CXX1Y_FLAG := -hstd=c++1y - #KOKKOS_INTERNAL_CXX17_FLAG := -hstd=c++17 - #KOKKOS_INTERNAL_CXX1Z_FLAG := -hstd=c++1z - #KOKKOS_INTERNAL_CXX2A_FLAG := -hstd=c++2a - else - KOKKOS_INTERNAL_CXX14_FLAG := -std=c++14 - KOKKOS_INTERNAL_CXX1Y_FLAG := -std=c++1y - KOKKOS_INTERNAL_CXX17_FLAG := -std=c++17 - KOKKOS_INTERNAL_CXX1Z_FLAG := -std=c++1z - KOKKOS_INTERNAL_CXX2A_FLAG := -std=c++2a - endif - endif + KOKKOS_INTERNAL_CXX17_FLAG := -std=c++17 + KOKKOS_INTERNAL_CXX1Z_FLAG := -std=c++1z + KOKKOS_INTERNAL_CXX20_FLAG := -std=c++20 + KOKKOS_INTERNAL_CXX2A_FLAG := -std=c++2a + KOKKOS_INTERNAL_CXX23_FLAG := -std=c++23 + KOKKOS_INTERNAL_CXX2B_FLAG := -std=c++2b endif # Check for Kokkos Architecture settings. @@ -391,6 +341,8 @@ KOKKOS_INTERNAL_USE_ARCH_VOLTA72 := $(call kokkos_has_string,$(KOKKOS_ARCH),Volt KOKKOS_INTERNAL_USE_ARCH_TURING75 := $(call kokkos_has_string,$(KOKKOS_ARCH),Turing75) KOKKOS_INTERNAL_USE_ARCH_AMPERE80 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ampere80) KOKKOS_INTERNAL_USE_ARCH_AMPERE86 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ampere86) +KOKKOS_INTERNAL_USE_ARCH_ADA89 := $(call kokkos_has_string,$(KOKKOS_ARCH),Ada89) +KOKKOS_INTERNAL_USE_ARCH_HOPPER90 := $(call kokkos_has_string,$(KOKKOS_ARCH),Hopper90) KOKKOS_INTERNAL_USE_ARCH_NVIDIA := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_KEPLER30) \ + $(KOKKOS_INTERNAL_USE_ARCH_KEPLER32) \ + $(KOKKOS_INTERNAL_USE_ARCH_KEPLER35) \ @@ -404,7 +356,9 @@ KOKKOS_INTERNAL_USE_ARCH_NVIDIA := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_KEPLE + $(KOKKOS_INTERNAL_USE_ARCH_VOLTA72) \ + $(KOKKOS_INTERNAL_USE_ARCH_TURING75) \ + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE80) \ - + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE86)) + + $(KOKKOS_INTERNAL_USE_ARCH_AMPERE86) \ + + $(KOKKOS_INTERNAL_USE_ARCH_ADA89) \ + + $(KOKKOS_INTERNAL_USE_ARCH_HOPPER90)) #SEK: This seems like a bug to me ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0) @@ -447,10 +401,10 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ZEN3), 0) KOKKOS_INTERNAL_USE_ARCH_ZEN := $(call kokkos_has_string,$(KOKKOS_ARCH),Zen) endif endif -KOKKOS_INTERNAL_USE_ARCH_VEGA900 := $(call kokkos_has_string,$(KOKKOS_ARCH),Vega900) KOKKOS_INTERNAL_USE_ARCH_VEGA906 := $(call kokkos_has_string,$(KOKKOS_ARCH),Vega906) KOKKOS_INTERNAL_USE_ARCH_VEGA908 := $(call kokkos_has_string,$(KOKKOS_ARCH),Vega908) KOKKOS_INTERNAL_USE_ARCH_VEGA90A := $(call kokkos_has_string,$(KOKKOS_ARCH),Vega90A) +KOKKOS_INTERNAL_USE_ARCH_NAVI1030 := $(call kokkos_has_string,$(KOKKOS_ARCH),Navi1030) # Any AVX? KOKKOS_INTERNAL_USE_ARCH_SSE42 := $(shell expr $(KOKKOS_INTERNAL_USE_ARCH_WSM)) @@ -518,13 +472,15 @@ tmp := $(call kokkos_append_header,'$H''endif') tmp := $(call kokkos_append_header,"") tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION $(KOKKOS_VERSION)") +tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_MAJOR $(KOKKOS_VERSION_MAJOR)") +tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_MINOR $(KOKKOS_VERSION_MINOR)") +tmp := $(call kokkos_append_header,"$H""define KOKKOS_VERSION_PATCH $(KOKKOS_VERSION_PATCH)") tmp := $(call kokkos_append_header,"") tmp := $(call kokkos_append_header,"/* Execution Spaces */") ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_COMPILER_CUDA_VERSION $(KOKKOS_INTERNAL_COMPILER_NVCC_VERSION)") endif ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) @@ -543,6 +499,10 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) endif endif +ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_OPENACC") +endif + ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) tmp := $(call kokkos_append_header,'$H''define KOKKOS_ENABLE_OPENMP') endif @@ -562,22 +522,11 @@ endif #only add the c++ standard flags if this is not CMake tmp := $(call kokkos_append_header,"/* General Settings */") ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEPRECATED_CODE_3") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEPRECATED_CODE_4") endif ifeq ($(KOKKOS_INTERNAL_ENABLE_DEPRECATION_WARNINGS), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_DEPRECATION_WARNINGS") endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX14), 1) -ifneq ($(KOKKOS_STANDALONE_CMAKE), yes) - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX14_FLAG) -endif - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX14") -endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX1Y), 1) - #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX1Y_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX14") -endif ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX17), 1) ifneq ($(KOKKOS_STANDALONE_CMAKE), yes) KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX17_FLAG) @@ -589,15 +538,25 @@ ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX1Z), 1) KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX1Z_FLAG) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX17") endif +ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX20), 1) + #I cannot make CMake add this in a good way - so add it here + KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX20_FLAG) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX20") +endif ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX2A), 1) #I cannot make CMake add this in a good way - so add it here KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX2A_FLAG) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX20") endif -ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX20), 1) +ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX23), 1) #I cannot make CMake add this in a good way - so add it here - KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX20_FLAG) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX20") + KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX23_FLAG) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX23") +endif +ifeq ($(KOKKOS_INTERNAL_ENABLE_CXX2B), 1) + #I cannot make CMake add this in a good way - so add it here + KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CXX2B_FLAG) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CXX23") endif ifeq ($(KOKKOS_INTERNAL_ENABLE_DEBUG), 1) @@ -678,15 +637,15 @@ endif tmp := $(call kokkos_append_header,"/* Cuda Settings */") ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) + #deprecated ifeq ($(KOKKOS_INTERNAL_CUDA_USE_LDG), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC") - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC") - endif + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC") endif ifeq ($(KOKKOS_INTERNAL_CUDA_USE_UVM), 1) + # deprecated tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_UVM") endif @@ -711,12 +670,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) ifeq ($(KOKKOS_INTERNAL_CUDA_USE_LAMBDA), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - ifeq ($(shell test $(KOKKOS_INTERNAL_COMPILER_NVCC_VERSION) -gt 70; echo $$?),0) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA") - KOKKOS_CXXFLAGS += -expt-extended-lambda - else - $(warning Warning: Cuda Lambda support was requested but NVCC version is too low. This requires NVCC for Cuda version 7.5 or higher. Disabling Lambda support now.) - endif + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_LAMBDA") + KOKKOS_CXXFLAGS += -expt-extended-lambda endif ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) @@ -726,12 +681,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) ifeq ($(KOKKOS_INTERNAL_CUDA_USE_CONSTEXPR), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_NVCC), 1) - ifeq ($(shell test $(KOKKOS_INTERNAL_COMPILER_NVCC_VERSION) -ge 80; echo $$?),0) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_CONSTEXPR") - KOKKOS_CXXFLAGS += -expt-relaxed-constexpr - else - $(warning Warning: Cuda relaxed constexpr support was requested but NVCC version is too low. This requires NVCC for Cuda version 8.0 or higher. Disabling relaxed constexpr support now.) - endif + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_CUDA_CONSTEXPR") + KOKKOS_CXXFLAGS += -expt-relaxed-constexpr endif ifeq ($(KOKKOS_INTERNAL_COMPILER_CLANG), 1) @@ -759,13 +710,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV80), 1) KOKKOS_CXXFLAGS += KOKKOS_LDFLAGS += else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -march=armv8-a - KOKKOS_LDFLAGS += -march=armv8-a - endif + KOKKOS_CXXFLAGS += -march=armv8-a + KOKKOS_LDFLAGS += -march=armv8-a endif endif @@ -776,13 +722,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV81), 1) KOKKOS_CXXFLAGS += KOKKOS_LDFLAGS += else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -march=armv8.1-a - KOKKOS_LDFLAGS += -march=armv8.1-a - endif + KOKKOS_CXXFLAGS += -march=armv8.1-a + KOKKOS_LDFLAGS += -march=armv8.1-a endif endif @@ -848,13 +789,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX), 1) KOKKOS_CXXFLAGS += KOKKOS_LDFLAGS += else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -march=armv8-a -mtune=thunderx - KOKKOS_LDFLAGS += -march=armv8-a -mtune=thunderx - endif + KOKKOS_CXXFLAGS += -march=armv8-a -mtune=thunderx + KOKKOS_LDFLAGS += -march=armv8-a -mtune=thunderx endif endif @@ -866,13 +802,8 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ARMV8_THUNDERX2), 1) KOKKOS_CXXFLAGS += KOKKOS_LDFLAGS += else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_CXXFLAGS += - KOKKOS_LDFLAGS += - else - KOKKOS_CXXFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99 - KOKKOS_LDFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99 - endif + KOKKOS_CXXFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99 + KOKKOS_LDFLAGS += -mtune=thunderx2t99 -mcpu=thunderx2t99 endif endif @@ -882,19 +813,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SSE42), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) KOKKOS_CXXFLAGS += -xSSE4.2 KOKKOS_LDFLAGS += -xSSE4.2 + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_CXXFLAGS += -tp=nehalem - KOKKOS_LDFLAGS += -tp=nehalem - else - # Assume that this is a really a GNU compiler. - KOKKOS_CXXFLAGS += -msse4.2 - KOKKOS_LDFLAGS += -msse4.2 - endif - endif + # Assume that this is a really a GNU compiler. + KOKKOS_CXXFLAGS += -msse4.2 + KOKKOS_LDFLAGS += -msse4.2 endif endif @@ -904,54 +827,34 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) KOKKOS_CXXFLAGS += -mavx KOKKOS_LDFLAGS += -mavx + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_CXXFLAGS += -tp=sandybridge - KOKKOS_LDFLAGS += -tp=sandybridge - else - # Assume that this is a really a GNU compiler. - KOKKOS_CXXFLAGS += -mavx - KOKKOS_LDFLAGS += -mavx - endif - endif + # Assume that this is a really a GNU compiler. + KOKKOS_CXXFLAGS += -mavx + KOKKOS_LDFLAGS += -mavx endif endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER7), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER7") - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - - else - # Assume that this is a really a GNU compiler or it could be XL on P8. - KOKKOS_CXXFLAGS += -mcpu=power7 -mtune=power7 - KOKKOS_LDFLAGS += -mcpu=power7 -mtune=power7 - endif + # Assume that this is a really a GNU compiler. + KOKKOS_CXXFLAGS += -mcpu=power7 -mtune=power7 + KOKKOS_LDFLAGS += -mcpu=power7 -mtune=power7 endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER8), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER8") - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - - else - KOKKOS_CXXFLAGS += -mcpu=power8 -mtune=power8 - KOKKOS_LDFLAGS += -mcpu=power8 -mtune=power8 - endif + KOKKOS_CXXFLAGS += -mcpu=power8 -mtune=power8 + KOKKOS_LDFLAGS += -mcpu=power8 -mtune=power8 endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_POWER9), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_POWER9") - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - - else - KOKKOS_CXXFLAGS += -mcpu=power9 -mtune=power9 - KOKKOS_LDFLAGS += -mcpu=power9 -mtune=power9 - endif + KOKKOS_CXXFLAGS += -mcpu=power9 -mtune=power9 + KOKKOS_LDFLAGS += -mcpu=power9 -mtune=power9 endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HSW), 1) @@ -960,19 +863,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HSW), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) KOKKOS_CXXFLAGS += -xCORE-AVX2 KOKKOS_LDFLAGS += -xCORE-AVX2 + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_CXXFLAGS += -tp=haswell - KOKKOS_LDFLAGS += -tp=haswell - else - # Assume that this is a really a GNU compiler. - KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2 - KOKKOS_LDFLAGS += -march=core-avx2 -mtune=core-avx2 - endif - endif + # Assume that this is a really a GNU compiler. + KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2 + KOKKOS_LDFLAGS += -march=core-avx2 -mtune=core-avx2 endif endif @@ -982,19 +877,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_BDW), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) KOKKOS_CXXFLAGS += -xCORE-AVX2 KOKKOS_LDFLAGS += -xCORE-AVX2 + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - KOKKOS_CXXFLAGS += -tp=haswell - KOKKOS_LDFLAGS += -tp=haswell - else - # Assume that this is a really a GNU compiler. - KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2 -mrtm - KOKKOS_LDFLAGS += -march=core-avx2 -mtune=core-avx2 -mrtm - endif - endif + # Assume that this is a really a GNU compiler. + KOKKOS_CXXFLAGS += -march=core-avx2 -mtune=core-avx2 -mrtm + KOKKOS_LDFLAGS += -march=core-avx2 -mtune=core-avx2 -mrtm endif endif @@ -1004,18 +891,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_AVX512MIC), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) KOKKOS_CXXFLAGS += -xMIC-AVX512 KOKKOS_LDFLAGS += -xMIC-AVX512 + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - - else - # Asssume that this is really a GNU compiler. - KOKKOS_CXXFLAGS += -march=knl -mtune=knl - KOKKOS_LDFLAGS += -march=knl -mtune=knl - endif - endif + # Asssume that this is really a GNU compiler. + KOKKOS_CXXFLAGS += -march=knl -mtune=knl + KOKKOS_LDFLAGS += -march=knl -mtune=knl endif endif @@ -1025,18 +905,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SKL), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) KOKKOS_CXXFLAGS += -xSKYLAKE KOKKOS_LDFLAGS += -xSKYLAKE + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - - else - # Nothing here yet. - KOKKOS_CXXFLAGS += -march=skylake - KOKKOS_LDFLAGS += -march=skylake - endif - endif + # Nothing here yet. + KOKKOS_CXXFLAGS += -march=skylake + KOKKOS_LDFLAGS += -march=skylake endif endif @@ -1046,18 +919,11 @@ ifeq ($(KOKKOS_INTERNAL_USE_ARCH_SKX), 1) ifeq ($(KOKKOS_INTERNAL_COMPILER_INTEL), 1) KOKKOS_CXXFLAGS += -xCORE-AVX512 KOKKOS_LDFLAGS += -xCORE-AVX512 + else ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) else - ifeq ($(KOKKOS_INTERNAL_COMPILER_CRAY), 1) - - else - ifeq ($(KOKKOS_INTERNAL_COMPILER_PGI), 1) - - else - # Nothing here yet. - KOKKOS_CXXFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 - KOKKOS_LDFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 - endif - endif + # Nothing here yet. + KOKKOS_CXXFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 + KOKKOS_LDFLAGS += -march=skylake-avx512 -mtune=skylake-avx512 endif endif @@ -1184,6 +1050,15 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA_ARCH), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_AMPERE86") KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_86 endif + ifeq ($(KOKKOS_INTERNAL_USE_ARCH_ADA89), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_ADA89") + KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_89 + endif + ifeq ($(KOKKOS_INTERNAL_USE_ARCH_HOPPER90), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_HOPPER90") + KOKKOS_INTERNAL_CUDA_ARCH_FLAG := $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG)=sm_90 + endif ifneq ($(KOKKOS_INTERNAL_USE_ARCH_NVIDIA), 0) KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_CUDA_ARCH_FLAG) @@ -1197,20 +1072,12 @@ ifeq ($(KOKKOS_INTERNAL_USE_CUDA_ARCH), 1) endif endif endif - ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) - KOKKOS_CXXFLAGS += --expt-extended-lambda - endif endif # Figure out the architecture flag for ROCm. ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) # Lets start with adding architecture defines - ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VEGA900), 1) - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA900") - tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA") - KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx900 - endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_VEGA906), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA906") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA") @@ -1226,6 +1093,16 @@ ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_VEGA") KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx90a endif + ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NAVI1030), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NAVI1030") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NAVI") + KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx1030 + endif + ifeq ($(KOKKOS_INTERNAL_USE_ARCH_NAVI1100), 1) + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NAVI1100") + tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_NAVI") + KOKKOS_INTERNAL_HIP_ARCH_FLAG := --offload-arch=gfx1100 + endif KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/HIP/*.cpp) @@ -1282,12 +1159,12 @@ endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_XEHP), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_XEHP") - KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device xehp" + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device 12.50.4" endif ifeq ($(KOKKOS_INTERNAL_USE_ARCH_INTEL_PVC), 1) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_GPU") tmp := $(call kokkos_append_header,"$H""define KOKKOS_ARCH_INTEL_PVC") - KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device 12.4.0" + KOKKOS_INTERNAL_INTEL_ARCH_FLAG := -f${KOKKOS_INTERNAL_LC_BACKEND}-targets=spir64_gen -X${KOKKOS_INTERNAL_LC_BACKEND}-target-backend "-device 12.60.7" endif ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) @@ -1308,11 +1185,14 @@ endif ifeq ($(KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS), 0) tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_DESUL_ATOMICS") KOKKOS_CPPFLAGS+=-I$(KOKKOS_PATH)/tpls/desul/include -else - ifeq ($(KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS), 1) - $(error Contradictory Desul atomics options: KOKKOS_OPTIONS=$(KOKKOS_OPTIONS) ) - endif +else ifeq ($(KOKKOS_INTERNAL_ENABLE_DESUL_ATOMICS), 1) + $(error Contradictory Desul atomics options: KOKKOS_OPTIONS=$(KOKKOS_OPTIONS) ) +endif + +ifeq ($(KOKKOS_INTERNAL_DISABLE_BUNDLED_MDSPAN), 0) + KOKKOS_CPPFLAGS+=-I$(KOKKOS_PATH)/tpls/mdspan/include endif +tmp := $(call kokkos_append_header,"$H""define KOKKOS_ENABLE_IMPL_MDSPAN") KOKKOS_INTERNAL_LS_CONFIG := $(shell ls KokkosCore_config.h 2>&1) @@ -1341,9 +1221,6 @@ ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0) tmp := $(call kokkos_append_config_header,"$H""include <fwd/Kokkos_Fwd_CUDA.hpp>","KokkosCore_Config_FwdBackend.hpp") tmp := $(call kokkos_append_config_header,"$H""include <decl/Kokkos_Declare_CUDA.hpp>","KokkosCore_Config_DeclareBackend.hpp") tmp := $(call kokkos_append_config_header,"$H""include <setup/Kokkos_Setup_Cuda.hpp>","KokkosCore_Config_SetupBackend.hpp") - ifeq ($(KOKKOS_INTERNAL_CUDA_USE_UVM), 1) - else - endif endif ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) tmp := $(call kokkos_append_config_header,"$H""include <fwd/Kokkos_Fwd_OPENMPTARGET.hpp>","KokkosCore_Config_FwdBackend.hpp") @@ -1362,6 +1239,10 @@ ifneq ($(KOKKOS_INTERNAL_NEW_CONFIG), 0) tmp := $(call kokkos_append_config_header,"$H""include <fwd/Kokkos_Fwd_OPENMP.hpp>","KokkosCore_Config_FwdBackend.hpp") tmp := $(call kokkos_append_config_header,"$H""include <decl/Kokkos_Declare_OPENMP.hpp>","KokkosCore_Config_DeclareBackend.hpp") endif + ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) + tmp := $(call kokkos_append_config_header,"\#include <fwd/Kokkos_Fwd_OPENACC.hpp>","KokkosCore_Config_FwdBackend.hpp") + tmp := $(call kokkos_append_config_header,"\#include <decl/Kokkos_Declare_OPENACC.hpp>","KokkosCore_Config_DeclareBackend.hpp") + endif ifeq ($(KOKKOS_INTERNAL_USE_THREADS), 1) tmp := $(call kokkos_append_config_header,"$H""include <fwd/Kokkos_Fwd_THREADS.hpp>","KokkosCore_Config_FwdBackend.hpp") tmp := $(call kokkos_append_config_header,"$H""include <decl/Kokkos_Declare_THREADS.hpp>","KokkosCore_Config_DeclareBackend.hpp") @@ -1429,6 +1310,14 @@ ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) KOKKOS_LIBS += $(KOKKOS_INTERNAL_OPENMPTARGET_LIB) endif +ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) + KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/OpenACC/*.cpp) + KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/OpenACC/*.hpp) + KOKKOS_CXXFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG) + KOKKOS_LDFLAGS += $(KOKKOS_INTERNAL_OPENACC_FLAG) + KOKKOS_LIBS += $(KOKKOS_INTERNAL_OPENACC_LIB) +endif + ifeq ($(KOKKOS_INTERNAL_USE_OPENMP), 1) KOKKOS_SRC += $(wildcard $(KOKKOS_PATH)/core/src/OpenMP/*.cpp) KOKKOS_HEADERS += $(wildcard $(KOKKOS_PATH)/core/src/OpenMP/*.hpp) @@ -1499,11 +1388,64 @@ endif KOKKOS_EXTRA_LIBS := ${KOKKOS_LIBS} KOKKOS_LIBS := -lkokkos ${KOKKOS_LIBS} +# Generating the <desul/atomics/Config.hpp> header +DESUL_INTERNAL_CONFIG_TMP=Desul_Config.tmp +ifeq ($(KOKKOS_INTERNAL_DISABLE_DESUL_ATOMICS), 0) + DESUL_CONFIG_HEADER=desul/atomics/Config.hpp +else + DESUL_CONFIG_HEADER=NothingToSeeHereMoveAlong +endif +desul_append_header = $(shell echo $1 >> $(DESUL_INTERNAL_CONFIG_TMP)) +tmp := $(call desul_append_header, "// generated by on-demand build system by crtrott" > $(DESUL_INTERNAL_CONFIG_TMP)) +tmp := $(call desul_append_header, "$H""ifndef DESUL_ATOMICS_CONFIG_HPP_") +tmp := $(call desul_append_header, "$H""define DESUL_ATOMICS_CONFIG_HPP_") +tmp := $(call desul_append_header, "") +ifeq ($(KOKKOS_INTERNAL_USE_CUDA), 1) + tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_CUDA") +else + tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_CUDA */") +endif + +ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) + tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_HIP") +else + tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_HIP */") +endif + +ifeq ($(KOKKOS_INTERNAL_USE_SYCL), 1) + tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_SYCL") +else + tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_SYCL */") +endif + +ifeq ($(KOKKOS_INTERNAL_USE_OPENMPTARGET), 1) + tmp := $(call desul_append_header,"$H""define DESUL_ATOMICS_ENABLE_OPENMP") +else + tmp := $(call desul_append_header,"/* $H""undef DESUL_ATOMICS_ENABLE_OPENMP */") +endif +tmp := $(call desul_append_header, "") +tmp := $(call desul_append_header, "$H""endif") + +DESUL_INTERNAL_LS_CONFIG := $(shell ls $(DESUL_CONFIG_HEADER) 2>&1) + +ifeq ($(DESUL_INTERNAL_LS_CONFIG), $(DESUL_CONFIG_HEADER)) + DESUL_INTERNAL_NEW_CONFIG := $(strip $(shell diff $(DESUL_CONFIG_HEADER) $(DESUL_INTERNAL_CONFIG_TMP) | grep -c define)) +else + DESUL_INTERNAL_NEW_CONFIG := 1 +endif + +ifneq ($(DESUL_INTERNAL_NEW_CONFIG), 0) + tmp := $(shell mkdir -p desul/atomics) + tmp := $(shell cp $(DESUL_INTERNAL_CONFIG_TMP) $(DESUL_CONFIG_HEADER)) +endif + # Setting up dependencies. KokkosCore_config.h: -KOKKOS_CPP_DEPENDS := KokkosCore_config.h $(KOKKOS_HEADERS) +$(DESUL_CONFIG_HEADER): + +KOKKOS_CPP_DEPENDS := $(DESUL_CONFIG_HEADER) KokkosCore_config.h $(KOKKOS_HEADERS) KOKKOS_OBJ = $(KOKKOS_SRC:.cpp=.o) KOKKOS_OBJ_LINK = $(notdir $(KOKKOS_OBJ)) @@ -1511,7 +1453,7 @@ KOKKOS_OBJ_LINK = $(notdir $(KOKKOS_OBJ)) include $(KOKKOS_PATH)/Makefile.targets kokkos-clean: - rm -f $(KOKKOS_OBJ_LINK) KokkosCore_config.h KokkosCore_config.tmp libkokkos.a KokkosCore_Config_SetupBackend.hpp \ + rm -f $(KOKKOS_OBJ_LINK) $(DESUL_CONFIG_HEADER) $(DESUL_INTERNAL_CONFIG_TMP) KokkosCore_config.h KokkosCore_config.tmp libkokkos.a KokkosCore_Config_SetupBackend.hpp \ KokkosCore_Config_FwdBackend.hpp KokkosCore_Config_DeclareBackend.hpp KokkosCore_Config_DeclareBackend.tmp \ KokkosCore_Config_FwdBackend.tmp KokkosCore_Config_PostInclude.hpp KokkosCore_Config_PostInclude.tmp KokkosCore_Config_SetupBackend.tmp diff --git a/packages/kokkos/Makefile.targets b/packages/kokkos/Makefile.targets index 876726e9479966921f0774d4f365d07120d14e97..32b1fab2615dda91ab573de6166a157e3466fd1b 100644 --- a/packages/kokkos/Makefile.targets +++ b/packages/kokkos/Makefile.targets @@ -67,6 +67,12 @@ Kokkos_SYCL_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/SYCL/Kokko endif ifeq ($(KOKKOS_INTERNAL_USE_HIP), 1) +Kokkos_HIP.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP.cpp + $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP.cpp +Kokkos_HIP_SharedAllocationRecord.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp + $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp +Kokkos_HIP_DeepCopy.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_DeepCopy.cpp + $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_DeepCopy.cpp Kokkos_HIP_Space.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Space.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Space.cpp Kokkos_HIP_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/HIP/Kokkos_HIP_Instance.cpp @@ -107,5 +113,16 @@ Kokkos_OpenMPTarget_Task.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenMP $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp endif +ifeq ($(KOKKOS_INTERNAL_USE_OPENACC), 1) +Kokkos_OpenACC.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC.cpp + $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC.cpp +Kokkos_OpenACCSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACCSpace.cpp + $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACCSpace.cpp +Kokkos_OpenACC_Instance.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp + $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp +Kokkos_OpenACC_SharedAllocationRecord.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp + $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp +endif + Kokkos_HBWSpace.o: $(KOKKOS_CPP_DEPENDS) $(KOKKOS_PATH)/core/src/impl/Kokkos_HBWSpace.cpp $(CXX) $(KOKKOS_CPPFLAGS) $(KOKKOS_CXXFLAGS) $(CXXFLAGS) -c $(KOKKOS_PATH)/core/src/impl/Kokkos_HBWSpace.cpp diff --git a/packages/kokkos/algorithms/CMakeLists.txt b/packages/kokkos/algorithms/CMakeLists.txt index eb54db8a556453f4afed4c95cf20321e8cbe211e..f32363dc9acd5c1a972120f7309ea7745776e71d 100644 --- a/packages/kokkos/algorithms/CMakeLists.txt +++ b/packages/kokkos/algorithms/CMakeLists.txt @@ -5,7 +5,8 @@ KOKKOS_SUBPACKAGE(Algorithms) IF (NOT Kokkos_INSTALL_TESTING) ADD_SUBDIRECTORY(src) ENDIF() -IF(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)) +# FIXME_OPENACC: temporarily disabled due to unimplemented features +IF(NOT ((KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_OPENACC) AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC)) KOKKOS_ADD_TEST_DIRECTORIES(unit_tests) ENDIF() diff --git a/packages/kokkos/algorithms/src/CMakeLists.txt b/packages/kokkos/algorithms/src/CMakeLists.txt index 597626b11115db2d8c78e54c9cb5d24af21c2731..606d83d18b589183cb432ff65e576a674ec9dc6a 100644 --- a/packages/kokkos/algorithms/src/CMakeLists.txt +++ b/packages/kokkos/algorithms/src/CMakeLists.txt @@ -25,7 +25,7 @@ INSTALL ( # These will get ignored for standalone CMake and a true interface library made KOKKOS_ADD_INTERFACE_LIBRARY( kokkosalgorithms - HEADERS ${ALGO_HEADERS} + NOINSTALLHEADERS ${ALGO_HEADERS} SOURCES ${ALGO_SOURCES} ) KOKKOS_LIB_INCLUDE_DIRECTORIES(kokkosalgorithms diff --git a/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp b/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp index 9c08a088b0e108f78728fcc00742baaab441d4e2..ddd6374483ec30a3fa39043f7704e6e6f977ef62 100644 --- a/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp +++ b/packages/kokkos/algorithms/src/KokkosAlgorithms_dummy.cpp @@ -1 +1,17 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + void KOKKOS_ALGORITHMS_SRC_DUMMY_PREVENT_LINK_ERROR() {} diff --git a/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp b/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4c8be792d816a8032d3e2e3abbc0458b327ec26c --- /dev/null +++ b/packages/kokkos/algorithms/src/Kokkos_NestedSort.hpp @@ -0,0 +1,188 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_NESTEDSORT_HPP_ +#define KOKKOS_NESTEDSORT_HPP_ + +#include <Kokkos_Core.hpp> +#include <std_algorithms/impl/Kokkos_HelperPredicates.hpp> +#include <std_algorithms/Kokkos_Swap.hpp> + +namespace Kokkos { +namespace Experimental { +namespace Impl { + +// true for TeamVectorRange, false for ThreadVectorRange +template <bool teamLevel> +struct NestedRange {}; + +// Specialization for team-level +template <> +struct NestedRange<true> { + template <typename TeamMember, typename SizeType> + KOKKOS_FUNCTION static auto create(const TeamMember& t, SizeType len) { + return Kokkos::TeamVectorRange(t, len); + } + template <typename TeamMember> + KOKKOS_FUNCTION static void barrier(const TeamMember& t) { + t.team_barrier(); + } +}; + +// Specialization for thread-level +template <> +struct NestedRange<false> { + template <typename TeamMember, typename SizeType> + KOKKOS_FUNCTION static auto create(const TeamMember& t, SizeType len) { + return Kokkos::ThreadVectorRange(t, len); + } + // Barrier is no-op, as vector lanes of a thread are implicitly synchronized + // after parallel region + template <typename TeamMember> + KOKKOS_FUNCTION static void barrier(const TeamMember&) {} +}; + +// When just doing sort (not sort_by_key), use nullptr_t for ValueViewType. +// This only takes the NestedRange instance for template arg deduction. +template <class TeamMember, class KeyViewType, class ValueViewType, + class Comparator, bool useTeamLevel> +KOKKOS_INLINE_FUNCTION void sort_nested_impl( + const TeamMember& t, const KeyViewType& keyView, + [[maybe_unused]] const ValueViewType& valueView, const Comparator& comp, + const NestedRange<useTeamLevel>) { + using SizeType = typename KeyViewType::size_type; + using KeyType = typename KeyViewType::non_const_value_type; + using Range = NestedRange<useTeamLevel>; + SizeType n = keyView.extent(0); + SizeType npot = 1; + SizeType levels = 0; + // FIXME: ceiling power-of-two is a common thing to need - make it a utility + while (npot < n) { + levels++; + npot <<= 1; + } + for (SizeType i = 0; i < levels; i++) { + for (SizeType j = 0; j <= i; j++) { + // n/2 pairs of items are compared in parallel + Kokkos::parallel_for(Range::create(t, npot / 2), [=](const SizeType k) { + // How big are the brown/pink boxes? + // (Terminology comes from Wikipedia diagram) + // https://commons.wikimedia.org/wiki/File:BitonicSort.svg#/media/File:BitonicSort.svg + SizeType boxSize = SizeType(2) << (i - j); + // Which box contains this thread? + SizeType boxID = k >> (i - j); // k * 2 / boxSize; + SizeType boxStart = boxID << (1 + i - j); // boxID * boxSize + SizeType boxOffset = k - (boxStart >> 1); // k - boxID * boxSize / 2; + SizeType elem1 = boxStart + boxOffset; + // In first phase (j == 0, brown box): within a box, compare with the + // opposite value in the box. + // In later phases (j > 0, pink box): within a box, compare with fixed + // distance (boxSize / 2) apart. + SizeType elem2 = (j == 0) ? (boxStart + boxSize - 1 - boxOffset) + : (elem1 + boxSize / 2); + if (elem2 < n) { + KeyType key1 = keyView(elem1); + KeyType key2 = keyView(elem2); + if (comp(key2, key1)) { + keyView(elem1) = key2; + keyView(elem2) = key1; + if constexpr (!std::is_same_v<ValueViewType, std::nullptr_t>) { + Kokkos::Experimental::swap(valueView(elem1), valueView(elem2)); + } + } + } + }); + Range::barrier(t); + } + } +} + +} // namespace Impl + +template <class TeamMember, class ViewType> +KOKKOS_INLINE_FUNCTION void sort_team(const TeamMember& t, + const ViewType& view) { + Impl::sort_nested_impl(t, view, nullptr, + Experimental::Impl::StdAlgoLessThanBinaryPredicate< + typename ViewType::non_const_value_type>(), + Impl::NestedRange<true>()); +} + +template <class TeamMember, class ViewType, class Comparator> +KOKKOS_INLINE_FUNCTION void sort_team(const TeamMember& t, const ViewType& view, + const Comparator& comp) { + Impl::sort_nested_impl(t, view, nullptr, comp, Impl::NestedRange<true>()); +} + +template <class TeamMember, class KeyViewType, class ValueViewType> +KOKKOS_INLINE_FUNCTION void sort_by_key_team(const TeamMember& t, + const KeyViewType& keyView, + const ValueViewType& valueView) { + Impl::sort_nested_impl(t, keyView, valueView, + Experimental::Impl::StdAlgoLessThanBinaryPredicate< + typename KeyViewType::non_const_value_type>(), + Impl::NestedRange<true>()); +} + +template <class TeamMember, class KeyViewType, class ValueViewType, + class Comparator> +KOKKOS_INLINE_FUNCTION void sort_by_key_team(const TeamMember& t, + const KeyViewType& keyView, + const ValueViewType& valueView, + const Comparator& comp) { + Impl::sort_nested_impl(t, keyView, valueView, comp, + Impl::NestedRange<true>()); +} + +template <class TeamMember, class ViewType> +KOKKOS_INLINE_FUNCTION void sort_thread(const TeamMember& t, + const ViewType& view) { + Impl::sort_nested_impl(t, view, nullptr, + Experimental::Impl::StdAlgoLessThanBinaryPredicate< + typename ViewType::non_const_value_type>(), + Impl::NestedRange<false>()); +} + +template <class TeamMember, class ViewType, class Comparator> +KOKKOS_INLINE_FUNCTION void sort_thread(const TeamMember& t, + const ViewType& view, + const Comparator& comp) { + Impl::sort_nested_impl(t, view, nullptr, comp, Impl::NestedRange<false>()); +} + +template <class TeamMember, class KeyViewType, class ValueViewType> +KOKKOS_INLINE_FUNCTION void sort_by_key_thread(const TeamMember& t, + const KeyViewType& keyView, + const ValueViewType& valueView) { + Impl::sort_nested_impl(t, keyView, valueView, + Experimental::Impl::StdAlgoLessThanBinaryPredicate< + typename KeyViewType::non_const_value_type>(), + Impl::NestedRange<false>()); +} + +template <class TeamMember, class KeyViewType, class ValueViewType, + class Comparator> +KOKKOS_INLINE_FUNCTION void sort_by_key_thread(const TeamMember& t, + const KeyViewType& keyView, + const ValueViewType& valueView, + const Comparator& comp) { + Impl::sort_nested_impl(t, keyView, valueView, comp, + Impl::NestedRange<false>()); +} + +} // namespace Experimental +} // namespace Kokkos +#endif diff --git a/packages/kokkos/algorithms/src/Kokkos_Random.hpp b/packages/kokkos/algorithms/src/Kokkos_Random.hpp index 1d85ffdfb911f7dd4981ab1b2f98c903270e4628..91e9ce6fc84bcdeccfb9c40e4fca104d885f4b46 100644 --- a/packages/kokkos/algorithms/src/Kokkos_Random.hpp +++ b/packages/kokkos/algorithms/src/Kokkos_Random.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_RANDOM_HPP #define KOKKOS_RANDOM_HPP @@ -631,8 +603,7 @@ struct Random_XorShift1024_UseCArrayState<Kokkos::Cuda> : std::false_type {}; #endif #ifdef KOKKOS_ENABLE_HIP template <> -struct Random_XorShift1024_UseCArrayState<Kokkos::Experimental::HIP> - : std::false_type {}; +struct Random_XorShift1024_UseCArrayState<Kokkos::HIP> : std::false_type {}; #endif #ifdef KOKKOS_ENABLE_OPENMPTARGET template <> @@ -657,7 +628,7 @@ struct Random_UniqueIndex { #if defined(KOKKOS_ENABLE_CUDA) #define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::Cuda #elif defined(KOKKOS_ENABLE_HIP) -#define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::Experimental::HIP +#define KOKKOS_IMPL_EXECUTION_SPACE_CUDA_OR_HIP Kokkos::HIP #endif template <class MemorySpace> @@ -907,38 +878,32 @@ class Random_XorShift64_Pool { using execution_space = typename device_type::execution_space; using locks_type = View<int**, device_type>; using state_data_type = View<uint64_t**, device_type>; - locks_type locks_; - state_data_type state_; - int num_states_; - int padding_; + + locks_type locks_ = {}; + state_data_type state_ = {}; + int num_states_ = {}; + int padding_ = {}; public: using generator_type = Random_XorShift64<DeviceType>; - KOKKOS_INLINE_FUNCTION - Random_XorShift64_Pool() { - num_states_ = 0; - padding_ = 0; - } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool() = default; + + KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool( + Random_XorShift64_Pool const&) = default; + + KOKKOS_DEFAULTED_FUNCTION Random_XorShift64_Pool& operator=( + Random_XorShift64_Pool const&) = default; +#else + Random_XorShift64_Pool() = default; +#endif Random_XorShift64_Pool(uint64_t seed) { num_states_ = 0; init(seed, execution_space().concurrency()); } - KOKKOS_INLINE_FUNCTION - Random_XorShift64_Pool(const Random_XorShift64_Pool& src) - : locks_(src.locks_), state_(src.state_), num_states_(src.num_states_) {} - - KOKKOS_INLINE_FUNCTION - Random_XorShift64_Pool operator=(const Random_XorShift64_Pool& src) { - locks_ = src.locks_; - state_ = src.state_; - num_states_ = src.num_states_; - padding_ = src.padding_; - return *this; - } - void init(uint64_t seed, int num_states) { if (seed == 0) seed = uint64_t(1318319); // I only want to pad on CPU like archs (less than 1000 threads). 64 is a @@ -976,8 +941,8 @@ class Random_XorShift64_Pool { deep_copy(locks_, h_lock); } - KOKKOS_INLINE_FUNCTION - Random_XorShift64<DeviceType> get_state() const { + KOKKOS_INLINE_FUNCTION Random_XorShift64<DeviceType> get_state() const { + KOKKOS_EXPECTS(num_states_ > 0); const int i = Impl::Random_UniqueIndex<device_type>::get_state_idx(locks_); return Random_XorShift64<DeviceType>(state_(i, 0), i); } @@ -1158,43 +1123,35 @@ class Random_XorShift1024_Pool { using int_view_type = View<int**, device_type>; using state_data_type = View<uint64_t * [16], device_type>; - locks_type locks_; - state_data_type state_; - int_view_type p_; - int num_states_; - int padding_; + locks_type locks_ = {}; + state_data_type state_ = {}; + int_view_type p_ = {}; + int num_states_ = {}; + int padding_ = {}; friend class Random_XorShift1024<DeviceType>; public: using generator_type = Random_XorShift1024<DeviceType>; - KOKKOS_INLINE_FUNCTION - Random_XorShift1024_Pool() { num_states_ = 0; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool() = default; - inline Random_XorShift1024_Pool(uint64_t seed) { - num_states_ = 0; + KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool( + Random_XorShift1024_Pool const&) = default; - init(seed, execution_space().concurrency()); - } + KOKKOS_DEFAULTED_FUNCTION Random_XorShift1024_Pool& operator=( + Random_XorShift1024_Pool const&) = default; +#else + Random_XorShift1024_Pool() = default; +#endif - KOKKOS_INLINE_FUNCTION - Random_XorShift1024_Pool(const Random_XorShift1024_Pool& src) - : locks_(src.locks_), - state_(src.state_), - p_(src.p_), - num_states_(src.num_states_) {} + Random_XorShift1024_Pool(uint64_t seed) { + num_states_ = 0; - KOKKOS_INLINE_FUNCTION - Random_XorShift1024_Pool operator=(const Random_XorShift1024_Pool& src) { - locks_ = src.locks_; - state_ = src.state_; - p_ = src.p_; - num_states_ = src.num_states_; - padding_ = src.padding_; - return *this; + init(seed, execution_space().concurrency()); } - inline void init(uint64_t seed, int num_states) { + void init(uint64_t seed, int num_states) { if (seed == 0) seed = uint64_t(1318319); // I only want to pad on CPU like archs (less than 1000 threads). 64 is a // magic number, or random number I just wanted something not too large and @@ -1237,6 +1194,7 @@ class Random_XorShift1024_Pool { KOKKOS_INLINE_FUNCTION Random_XorShift1024<DeviceType> get_state() const { + KOKKOS_EXPECTS(num_states_ > 0); const int i = Impl::Random_UniqueIndex<device_type>::get_state_idx(locks_); return Random_XorShift1024<DeviceType>(state_, p_(i, 0), i); }; diff --git a/packages/kokkos/algorithms/src/Kokkos_Sort.hpp b/packages/kokkos/algorithms/src/Kokkos_Sort.hpp index c7be70e09a48eff3fb2bf3a7cb89be1cf1fe6664..033de221649659353e61c61313233a1805e8fd30 100644 --- a/packages/kokkos/algorithms/src/Kokkos_Sort.hpp +++ b/packages/kokkos/algorithms/src/Kokkos_Sort.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SORT_HPP_ #define KOKKOS_SORT_HPP_ @@ -50,9 +22,50 @@ #endif #include <Kokkos_Core.hpp> - +#include <Kokkos_NestedSort.hpp> +#include <std_algorithms/Kokkos_BeginEnd.hpp> #include <algorithm> +#if defined(KOKKOS_ENABLE_CUDA) + +// Workaround for `Instruction 'shfl' without '.sync' is not supported on +// .target sm_70 and higher from PTX ISA version 6.4`. +// Also see https://github.com/NVIDIA/cub/pull/170. +#if !defined(CUB_USE_COOPERATIVE_GROUPS) +#define CUB_USE_COOPERATIVE_GROUPS +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" + +#if defined(KOKKOS_COMPILER_CLANG) +// Some versions of Clang fail to compile Thrust, failing with errors like +// this: +// <snip>/thrust/system/cuda/detail/core/agent_launcher.h:557:11: +// error: use of undeclared identifier 'va_printf' +// The exact combination of versions for Clang and Thrust (or CUDA) for this +// failure was not investigated, however even very recent version combination +// (Clang 10.0.0 and Cuda 10.0) demonstrated failure. +// +// Defining _CubLog here locally allows us to avoid that code path, however +// disabling some debugging diagnostics +#pragma push_macro("_CubLog") +#ifdef _CubLog +#undef _CubLog +#endif +#define _CubLog +#include <thrust/device_ptr.h> +#include <thrust/sort.h> +#pragma pop_macro("_CubLog") +#else +#include <thrust/device_ptr.h> +#include <thrust/sort.h> +#endif + +#pragma GCC diagnostic pop + +#endif + namespace Kokkos { namespace Impl { @@ -559,24 +572,6 @@ struct BinOp3D { namespace Impl { -template <class ViewType, class ExecutionSpace> -bool try_std_sort(ViewType view, const ExecutionSpace& exec) { - bool possible = true; - size_t stride[8] = {view.stride_0(), view.stride_1(), view.stride_2(), - view.stride_3(), view.stride_4(), view.stride_5(), - view.stride_6(), view.stride_7()}; - possible = possible && - SpaceAccessibility<HostSpace, - typename ViewType::memory_space>::accessible; - possible = possible && (ViewType::Rank == 1); - possible = possible && (stride[0] == 1); - if (possible) { - exec.fence("Kokkos::sort: Fence before sorting on the host"); - std::sort(view.data(), view.data() + view.extent(0)); - } - return possible; -} - template <class ViewType> struct min_max_functor { using minmax_scalar = @@ -594,9 +589,14 @@ struct min_max_functor { } // namespace Impl -template <class ExecutionSpace, class ViewType> -std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort( - const ExecutionSpace& exec, ViewType const& view) { +template <class ExecutionSpace, class DataType, class... Properties> +std::enable_if_t<(Kokkos::is_execution_space<ExecutionSpace>::value) && + (!SpaceAccessibility< + HostSpace, typename Kokkos::View<DataType, Properties...>:: + memory_space>::accessible)> +sort(const ExecutionSpace& exec, + const Kokkos::View<DataType, Properties...>& view) { + using ViewType = Kokkos::View<DataType, Properties...>; using CompType = BinOp1D<ViewType>; Kokkos::MinMaxScalar<typename ViewType::non_const_value_type> result; @@ -634,18 +634,25 @@ std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort( bin_sort.sort(exec, view); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -template <class ExecutionSpace, class ViewType> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the overload not taking bool always_use_kokkos_sort") -std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort( - const ExecutionSpace& exec, ViewType const& view, - bool const always_use_kokkos_sort) { - if (!always_use_kokkos_sort && Impl::try_std_sort(view, exec)) { - return; - } else { - sort(exec, view); - } +template <class ExecutionSpace, class DataType, class... Properties> +std::enable_if_t<(Kokkos::is_execution_space<ExecutionSpace>::value) && + (SpaceAccessibility< + HostSpace, typename Kokkos::View<DataType, Properties...>:: + memory_space>::accessible)> +sort(const ExecutionSpace&, const Kokkos::View<DataType, Properties...>& view) { + auto first = Experimental::begin(view); + auto last = Experimental::end(view); + std::sort(first, last); +} + +#if defined(KOKKOS_ENABLE_CUDA) +template <class DataType, class... Properties> +void sort(const Cuda& space, + const Kokkos::View<DataType, Properties...>& view) { + const auto exec = thrust::cuda::par.on(space.cuda_stream()); + auto first = Experimental::begin(view); + auto last = Experimental::end(view); + thrust::sort(exec, first, last); } #endif @@ -657,17 +664,6 @@ void sort(ViewType const& view) { exec.fence("Kokkos::sort: fence after sorting"); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -template <class ViewType> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the overload not taking bool always_use_kokkos_sort") -void sort(ViewType const& view, bool const always_use_kokkos_sort) { - typename ViewType::execution_space exec; - sort(exec, view, always_use_kokkos_sort); - exec.fence("Kokkos::Sort: fence after sorting"); -} -#endif - template <class ExecutionSpace, class ViewType> std::enable_if_t<Kokkos::is_execution_space<ExecutionSpace>::value> sort( const ExecutionSpace& exec, ViewType view, size_t const begin, diff --git a/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp b/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp index 3e0f731cf0528a7145703a04004e0c1095003422..436ae0d10bf88bcd4643cf0255bb442fe1d1bec4 100644 --- a/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp +++ b/packages/kokkos/algorithms/src/Kokkos_StdAlgorithms.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_HPP #define KOKKOS_STD_ALGORITHMS_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp index 0a7cf06f5bdb166a566a1dd8ef517bbea47b6976..38dcd1a6743610fcd6859164133a04ebc56add4a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentDifference.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP #define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp index 332f9dd3693c6d14a77cc72700708d55681d8f5e..43c2b660107b6d27223f7004fb5d7c52babc3592 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AdjacentFind.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP #define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp index 66a49541f333b5f5048067898863c2aedb103b57..2ffec7e144a0c504e666757778b1e2960dd988ad 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AllOf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_HPP #define KOKKOS_STD_ALGORITHMS_ALL_OF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp index e50e90f6da3d480610af10d1cc421edfe322c995..019c466c6d2f3701b827e1a566e1ef1daaf71a2f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_AnyOf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ANY_OF_HPP #define KOKKOS_STD_ALGORITHMS_ANY_OF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp index 544919619204837921e6cac925c5f52b3c9c73fd..3836d4bf62c11ece3fdf2b86b8ca6a24245a0553 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_BeginEnd.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_BEGIN_END_HPP #define KOKKOS_BEGIN_END_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp index b3237041b7f3c64b1b74c66f63329c3169f1eb1a..028f3b66b2dce3fd61a823361eb60c899718cc57 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Copy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COPY_HPP #define KOKKOS_STD_ALGORITHMS_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp index 83efd96672b32b842f5296a22e8c156295ebccfc..deff6baf9a523dcdd880796483d94a5a5e506416 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP #define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp index c83cc29886ca9889697b4f76675f0071f92db1f3..3db2fc074f73bc5173cae7583717be9e96eb0152 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_HPP #define KOKKOS_STD_ALGORITHMS_COPY_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp index 7f3b9374c74d436670740609afd1490b04ab7d10..a64f99b5c01d2001f8c0151e842831ac7749e739 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CopyN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COPY_N_HPP #define KOKKOS_STD_ALGORITHMS_COPY_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp index a885ee4ad2f1546122a65eebe329ff523eaa7893..3ac63467ec9a0d1e50382952f093b4cf18289480 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Count.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COUNT_HPP #define KOKKOS_STD_ALGORITHMS_COUNT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp index 98b9d74c4c4e0fa369380d8533f53cd3a7790320..b9731d378a594a6177f83dbae51585dd59c053db 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_CountIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP #define KOKKOS_STD_ALGORITHMS_COUNT_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp index 4e148642b10e3e6d2bd68d6cca04fb58caf07839..8605606307ead6b579551c67ed21268994659a87 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Distance.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_DISTANCE_HPP #define KOKKOS_STD_ALGORITHMS_DISTANCE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp index 8634019fad23a7eaecc9faf13bcb951ff21bb372..37c0d75ef5bfb751883b8e3d0c086b4e732ea8b8 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Equal.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_EQUAL_HPP #define KOKKOS_STD_ALGORITHMS_EQUAL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp index b97710f24f2122c637f294b10fe79080266d80c8..4e05676c2c1971832de2ad55de6f66c6fe582642 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ExclusiveScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP #define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp index 200e03b9dcd2a6ea7d871820f8f6fb746e87a82c..1e300a4c2081694786ae021e04958a9d2e757c88 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Fill.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FILL_HPP #define KOKKOS_STD_ALGORITHMS_FILL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp index 2e814dc55f781c67ed8c6960a97605265c50ff94..02503dfd14324ea0d7b1043e453bbdc0f35f5672 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FillN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FILL_N_HPP #define KOKKOS_STD_ALGORITHMS_FILL_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp index 6758f00ce4e6572d8366acac028656b6f0831427..65b68cf931d28934d00560964586967d8264e93e 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Find.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FIND_HPP #define KOKKOS_STD_ALGORITHMS_FIND_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp index 61b54c822550a9e6d1043a9eaabac5bcb89bb1c6..f6a38855ebbcfb5c8db06ce961b5e5c1001f4060 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindEnd.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FIND_END_HPP #define KOKKOS_STD_ALGORITHMS_FIND_END_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp index b8c27cb272ea0d102714fb6c38c4b0087e194cfd..6b0e4993ee2461179f6ca467fbda060934dd32ae 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindFirstOf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP #define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp index 54896da1176155579a912220a739d22764fba113..911316a668dd33f52da9ccc105b7a77923e709e8 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_HPP #define KOKKOS_STD_ALGORITHMS_FIND_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp index cfe6bb84d8f50e18535e7ce07e8acac996b782e8..18294d7b7df963b96eb122fb09544905d6203741 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_FindIfNot.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP #define KOKKOS_STD_ALGORITHMS_FIND_IF_NOT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp index 8a2f90e82bf3faedef85cc21610259b98b80a3d2..d7b08e4842658cab72a73ed835ff3bba50780768 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEach.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP #define KOKKOS_STD_ALGORITHMS_FOR_EACH_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp index dd917a33e89790fa70384d4cc0b16905d37c6a32..f1769da05bd6aa90641433fd708c4910d59c325f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ForEachN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP #define KOKKOS_STD_ALGORITHMS_FOR_EACH_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp index 955cb42d4b18c4818316d995492f6d99b922a219..13e12783e0999ca5ff2fea384697989a6a21a56f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Generate.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_HPP #define KOKKOS_STD_ALGORITHMS_GENERATE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp index 470edb15966fb08adbc131df3347d7aac82a087d..4d17512228590195c74f9993bd52952943f4bb35 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_GenerateN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP #define KOKKOS_STD_ALGORITHMS_GENERATE_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp index c34b5f43c9d426b91be882b315e3675b2b6872ca..bcd731b850aa0d510ea2b2b4b2fece15f9a08970 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_InclusiveScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP #define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp index 8a2ca207ae6d01756498f24e8daa14fbed838a63..29d6be9e8b769e0982f06645b48f77ee27713a3c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsPartitioned.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP #define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp index 0ab466f3389564aeddd1b4f8482458c1baf644da..f036254a02cf5280b22493869efa81e2dd4033dc 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSorted.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP #define KOKKOS_STD_ALGORITHMS_IS_SORTED_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp index c480d9ee5a2e4335add84889862617c98cc5b9cf..276b3bb884269d43c87e38ef79aa38fae94b704c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IsSortedUntil.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP #define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp index 1174740a5b1ac1dca656a3663ce889bf773305fc..a796a306dda0af270977550a4095cd63be5e86b4 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_IterSwap.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP #define KOKKOS_STD_ALGORITHMS_ITER_SWAP_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp index 4704a9ec5664e3bc7d18559e65ee5d5f90157c71..0a77ef629f7baf3c25a35789fdf345c31ef939e5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_LexicographicalCompare.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP #define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp index 5f6e5cbf62e28bae181663f14e44bcf2ee16bdab..2c1374f700764c7761bc3c81da45534b9bd24b8c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MaxElement.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_MAX_ELEMENT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp index 63cc5489607a6f5b5f525ee9aa61dfe1ec8a1962..1d03b7c962f21df9f7523dcf7c7222ddb88dbb74 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinElement.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_MIN_ELEMENT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp index 07cdefcc05658ab5bd4edc8d47d592308a56aede..d481b499cc9932cd55a8f7eeb4d8487cbb9e2401 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MinMaxElement.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_MINMAX_ELEMENT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp index 3418e048a94f15a6ff01c5497f3281660049812e..13c994ca90b19a21956251f5748bb65cc1598080 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Mismatch.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MISMATCH_HPP #define KOKKOS_STD_ALGORITHMS_MISMATCH_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp index c2ce4655faa4631d48eaaafaec016c6e0fa65c4b..d49acd9f702d05897576f532b290dc6b965b220c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Move.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MOVE_HPP #define KOKKOS_STD_ALGORITHMS_MOVE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp index f7462d52d8a8cbb520b0985085b23c8e56c01879..60d50fa881a812cd68111f1b7f8b69607a57e0a5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_MoveBackward.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_HPP #define KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp index 30ffb52442e39f1fe33c3258194ebae5f249f060..cf5de3b72b961f306c7d670ce92b5f9c88395724 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_NoneOf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_NONE_OF_HPP #define KOKKOS_STD_ALGORITHMS_NONE_OF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp index 5b00669fd1bcc90cbcfeaf2dcaf609514cc566d8..38c0a35b6208e43b9bc78f0cba4cb05d1a3766bf 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_COPY_HPP #define KOKKOS_STD_ALGORITHMS_PARTITION_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp index b714d5a27163ff1d7fecbe6f2ad973cfd2d33da0..24798e377ef194c397f09b933e20988234ae0ea9 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_PartitionPoint.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_POINT_HPP #define KOKKOS_STD_ALGORITHMS_PARTITION_POINT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp index 3cf9153202a3339c9b96bd054c5fcf6ceeb79d3d..a31fa1497ab1690b14fb8d89c81b6ece3b939ec4 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reduce.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REDUCE_HPP #define KOKKOS_STD_ALGORITHMS_REDUCE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp index d8d7c999b6edc70d9e4d6bf702cc92c6fadfa358..c8602d2f53cf5b8c4e9f56de09f2254d0cd67aad 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Remove.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp index 7d5c163af95c0b8f804a064af4b13d1dd1940a97..c2c06f6202804f47760ebd8d07b2cd4ba9384cf5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp index 8a9a3e4c14cc441c3aa5d92843ad5e939b585aa3..6d642ed6f09b0ad82275fcc3c9dd7e1c842d54a8 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveCopyIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_COPY_IF_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_COPY_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp index e4171ca917855b3b45d35c9896035d0994a428af..4062e8d373e2be30681351ce86c30d55391c58c4 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RemoveIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_IF_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp index 10ca46af255d1f0e59347188e1901c11d54133d9..4d1490ded0c8ebe05fdba27f27cfe80b140fdd47 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Replace.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp index f5136eb438f4dc2b65aaa1f6fd8791f58ad6a6b3..e7f464e4bd7b7102839dcf38547a51ebd437f1da 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp index a3f3fe69abaf7cce17b72f69ca0ffdada733de6a..71ae8f845280d554f625815a80b3b0f0db9b00b3 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceCopyIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp index bdb59f28af1cee6be97d822f7d4b41ae47321f44..7f06540e068b76b38052adf94767b6603c9e4298 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReplaceIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IF_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_IF_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp index 4848b20f66973f22292da27ce97a68f886430870..9f2fc5f3ccffa493575d2d7bd745fb83094a4dad 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Reverse.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_HPP #define KOKKOS_STD_ALGORITHMS_REVERSE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp index bb4462bf41d55a43fe5358e6c0ea3538c0fb35ab..279bb220869940f55a2689d519b4708838572d88 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ReverseCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_REVERSE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp index 39975811a47c1b3124084e3f12ddb678b92d848f..738e9bf1374388dfc5be8600c2fb27cbb95edde0 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Rotate.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_HPP #define KOKKOS_STD_ALGORITHMS_ROTATE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp index f98686ab631ba031ab121cd0f7e224557c5d265c..f5d826c4bb4f32b1a3d0f66700cb22af5ae33134 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_RotateCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_ROTATE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp index ce656da31c8610fca42f4ec3c8e6405c1ea1c0d6..b1154b297edf01c76a3b791c8f1c50314d3f266b 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Search.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_HPP #define KOKKOS_STD_ALGORITHMS_SEARCH_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp index 854d911e7602c4917133582d197b2a9d6fb18bdc..a649c8f2053a0817bc6683900ff5825f3e4c1af4 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SearchN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_N_HPP #define KOKKOS_STD_ALGORITHMS_SEARCH_N_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp index cee111af98a0d3e759b29feeb55db278b7ed20d3..4b91a17ab838e5d5fedc16570100614e1e8e0eef 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftLeft.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_HPP #define KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp index f104d2bd7a67836ee826c7f0e44b0107c0443ee2..2ea50fd74e5c1910c77040af07dd5e56661ea716 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_ShiftRight.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_HPP #define KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp index 9006aa9167dd326d312b8c31cc0790d511245918..acd2a572c8c216fe1f953e2651533ecc08d99ddb 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Swap.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SWAP_HPP #define KOKKOS_STD_ALGORITHMS_SWAP_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp index 2997cdab4b5fa58c47bc65eb4ed3d4804868a492..5fbf04531885c22887d3d4cf0998f6e07da1a773 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_SwapRanges.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SWAP_RANGES_HPP #define KOKKOS_STD_ALGORITHMS_SWAP_RANGES_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp index 6dfb83a8c0ea531f76f9ce4460d1ee37ae0cc37b..27dee304261d14ebad1dd066d3cfe7655715bd2f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Transform.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp index d0073599b02eef5ed289a7afe3afbb46313297c5..9d85aee06f8e5fc2dbfb46792e3b4c9ab9643a1a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformExclusiveScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_TRASFORM_EXCLUSIVE_SCAN_HPP #define KOKKOS_STD_ALGORITHMS_TRASFORM_EXCLUSIVE_SCAN_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp index 088e162adba77d514d157099f1f06663d515db4f..7489af7e379b576bc38e555d425c65cd33c675a7 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformInclusiveScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp index 5caced59172b47fa69686ca93d65171addf41d94..b5ec9066d2e25709575e1dcd6e27795de9d00de8 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_TransformReduce.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp index aeb54a6ffe6fceaa7e8787e73527491e536b0686..b47ecffb20737ee439c0427c47510855d1f5d7af 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_Unique.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_HPP #define KOKKOS_STD_ALGORITHMS_UNIQUE_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp index 632b560fa8e2da17acf3eda9b16fc74b416f2362..bd2451c220dd06bdcaee1d8c4693af745e3771bb 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/Kokkos_UniqueCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_HPP #define KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp index 35c78b86bf257255bf239552f9b41b7c34592532..8a474508d73edfe06b14c7360cf513f4c2c988bd 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentDifference.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ADJACENT_DIFFERENCE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp index 155f6c7bb80c6879eb9bbf1d86fad4e222b69ee5..cc6b63f028760d02da7a0b46e250b1bd1ee8439a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AdjacentFind.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ADJACENT_FIND_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp index dd8ae4f5b4d992f3b2d4b9894fd113889dd68df0..ad562070a044f337970129f9e9a1c241cfaf4944 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_AllOfAnyOfNoneOf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ALL_OF_ANY_OF_NONE_OF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ALL_OF_ANY_OF_NONE_OF_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp index ec54cd1900d4edc2c347035dc7feeb1568df32f7..52e7625e4d2f0e55c89d8e42634a3083c8d2088a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_CONSTRAINTS_HPP_ #define KOKKOS_STD_ALGORITHMS_CONSTRAINTS_HPP_ diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp index 18f614094cff0588ee045e8d61c27aade705f374..b3adbc5e2dcf5f970bf3509944fc34c71131117d 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyBackward.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_COPY_BACKWARD_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp index 03b6fc6ecacc0fca8d9d457f4e6b2193a2fc9c81..1b120c46d0844da292652683b5234cfc7c8417d4 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyCopyN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_COPY_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp index aebb5a9a46111a3012e6d304d312ad77f14f42a3..3c0c4f7e9bce2f0ce3d11303566204db612739ec 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CopyIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COPY_IF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_COPY_IF_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp index 982ac4046426ceb20de1899e6c0fe700aa8382e0..18b8c463594f2c3da1268db5ac57c59b0f40fbef 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_CountCountIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_COUNT_IF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_COUNT_IF_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp index 9482917abb996498af8161b2ac3feb8300f3f5e2..e045080d4a6a3d8bf6a78f3041a31681c0491027 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Equal.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_EQUAL_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_EQUAL_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp index 0ae4651c6afa9beec90cf09b7cd7ccbc1b0c71ab..f2bfa23ccdcc1489d07ccb4af9db249dd19180cc 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ExclusiveScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_EXCLUSIVE_SCAN_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp index 843771b6b13c481b2859e8981a5b21e11ce6b229..316d865f316225528987b038a4b623816ffdfd76 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FillFillN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FILL_AND_FILL_N_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FILL_AND_FILL_N_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp index 35a6c4b4ac9b650655333e21579be707f72774f0..3fa41af8ea3271eddbe322a93f49395462463e2c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindEnd.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FIND_END_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FIND_END_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp index 6907bbdbc37c77182c86382b37a8d346c8174988..df10da2fd55e513112f9a2cf3ca0c710556e1adb 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindFirstOf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FIND_FIRST_OF_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp index c79c4b5216bed0d8b386ec4c0630834537d1c0e8..f7ec4b1110c48a616cc451b04edad2f69616bfe0 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_FindIfOrNot.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FIND_IF_AND_FIND_IF_NOT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FIND_IF_AND_FIND_IF_NOT_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp index 8bd37b13bc9a19f0b8cbe457913b3a34d0320c6b..f9a6ff2e99e6229cfa154585e9ae298c9622ad91 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ForEachForEachN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_FOR_EACH_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_FOR_EACH_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp index f01d9bfb55ebf3f2dd9fdd795e34b57ff8057a24..228390bdfff0f6dcbd20cd17912f6babc736daa0 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_GenerateGenerateN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_GENERATE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_GENERATE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp index 244bce48e436b3c8af3a7d70823baa436d9f9958..db0def6f227b0182bbbbc0c3c05a8eb762a4b160 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_HelperPredicates.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_HELPER_PREDICATES_HPP #define KOKKOS_STD_ALGORITHMS_HELPER_PREDICATES_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp index f41e567c9b09d43550fd1dd4d1f12da9b6589597..252511c5d0cfd22fb15fd3648408c7c91bcb75a4 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IdentityReferenceUnaryFunctor.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_NUMERIC_IDENTITY_REFERENCE_UNARY_FUNCTOR_HPP #define KOKKOS_STD_ALGORITHMS_NUMERIC_IDENTITY_REFERENCE_UNARY_FUNCTOR_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp index 2088ebd439325bff2273c0a5b5ee635590f40532..55e1a78695d0f39e7a9c3ea84eb785c92cb63a36 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_InclusiveScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_INCLUSIVE_SCAN_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp index 0f00bebb6ddd148b23bf266c7a12dddbc9abda19..92a22f3c3a82770491eaa8d08912d64f2e8c3ed6 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsPartitioned.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_IS_PARTITIONED_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp index 4e36ae3890f578533465eca0bc224cea439d4f52..469682158641f61793821c22f9735b4243dd135d 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSorted.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_IS_SORTED_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp index 4e99c301b26e2d8b238300945412de7038975d4b..fe52e18a33d070ce3406418c242357d2de785a5a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_IsSortedUntil.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_IS_SORTED_UNTIL_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp index c3dd13e6b5a15c54fef30c976135437fe400d0e0..170ec9f2911d6ad303f1262998dac1912b733c29 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_LexicographicalCompare.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_LEXICOGRAPHICAL_COMPARE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp index 0a9d41b9bb62e3f4c22eb6ece4745b1033bc00d7..048420f7a83dbc554cd491242021d933acc49f35 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MinMaxMinmaxElement.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MIN_MAX_MINMAX_ELEMENT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_MIN_MAX_MINMAX_ELEMENT_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp index 180afe925c1158760d37cfb7db4ace25a8858ef5..9d2e31f63fcf782284a60d3e5c0d23c7de987f04 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Mismatch.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MISMATCH_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_MISMATCH_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp index 6b1ed1da4c17804c811e746c8d4889f7b1ed3c5b..01086d1772aaa3c722c84e238f8d97a82812b4ec 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Move.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MOVE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_MOVE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp index c34ab679dbc927fcf42dfed420cc00add06dce58..9a28c3fb4a4df5f01b0e8cc7959297f2c4f46f2a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_MoveBackward.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_MOVE_BACKWARD_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp index 508e4baedf60f1fb46c69bdb3ee05d725ea716ab..5457ae25084867af6c2b07a15b1d5e7b4c333ab8 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_PARTITION_COPY_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp index 671e8d70f01d83f65d6c3173fe3753527b09c278..2d0ae2aac615ae6953bd5a3c8ea6c47810f598f7 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_PartitionPoint.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_PARTITION_POINT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_PARTITION_POINT_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp index 2457d9400a24bc962bae1726d4dc238ab7d4a637..5c9854b87d7044c1ed252ff09438fb91be33168c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RandomAccessIterator.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_RANDOM_ACCESS_ITERATOR_IMPL_HPP #define KOKKOS_RANDOM_ACCESS_ITERATOR_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp index 26e0795d8b1c1214b7bcf1a3dfe30d26aaf5aa0b..45a0de3727d8407e12d465d0bdd59943ea117490 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reduce.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REDUCE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REDUCE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp index d8e383b859218bd33b67efdd9f11c374372b8fb5..b460982d33484933e86b2dce33832105c9bbb9c2 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReducerWithArbitraryJoinerNoNeutralElement.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REDUCER_WITH_ARBITRARY_JOINER_NONEUTRAL_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_REDUCER_WITH_ARBITRARY_JOINER_NONEUTRAL_ELEMENT_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp index 742d4d776a8c755a76393ae38a375b8dd0d61ed6..bda647019959c519ab29b1aeb89058d777b2f2b1 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RemoveAllVariants.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REMOVE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REMOVE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp index 877ffa276faebd4b6368dc23f63946587751de05..e3a6b538f4b6810f1b758b79c6df8bc727c63b38 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Replace.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp index b75dde9cd804836e9fb39ee41393c84f0cb1fded..729cf8931155daf8ce2a130de6e97f123ac1b7bd 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp index 8f7c8140e6b9bb1099876171e4ecd07eed5530a2..dca7e7f6a5173d042d15930926f37ae0b52f32d6 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceCopyIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_COPY_IF_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp index 6fe33019c0b6703713c4b17e5c71cbe21cc444c2..54b6e1c5287d863eb58ad2aaf371397db806c328 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReplaceIf.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REPLACE_IF_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REPLACE_IF_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp index f84eb2c81ad4fbf218ecc8c67de8f1f9eabc39f9..a4aaba26b9866780fc127924c040954b13c3459a 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Reverse.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REVERSE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp index 88b6ed16b5ee326f9551aa2168884c4f52641992..6dd52813e050f717f6a2ce8cb03ef99fb9ee9530 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ReverseCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_REVERSE_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_REVERSE_COPY_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp index c08cf1aecbf25f6532810ab0ff4fe138309b5eff..3aa1ab5d405125bb13a820cc3ab17e3c552c52e1 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Rotate.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ROTATE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp index a8111a511f10512f31bcf201a7e5eddb47f26ced..28023cc4dfa4cd70b2dc71edac90605c97d560a5 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_RotateCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_ROTATE_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_ROTATE_COPY_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp index 2afb0a74f013574f852b178b0a7f505462a80feb..a612a57231f561b5556c8e4fcac315bb504ff099 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Search.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SEARCH_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp index cd8b394386c1432ee532ab15dd8b599342ff02e0..0d3b6bc7060f15bd6646479465687e4f618d6cf6 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SearchN.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SEARCH_N_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SEARCH_N_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp index 796864461f0824e43efe16632432e00d6144ac6a..7a33762f176062bbee756fafebeef0df5219541f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftLeft.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SHIFT_LEFT_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp index 0ffde42ab29abf13ab8ff113c94b8de9ca8bc9fd..2b0a4bb524ebea2f528001c0986b361a541d05c1 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ShiftRight.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SHIFT_RIGHT_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp index 3e6ca14697647d6eec2c5b2300a3d4c1ab7dbac1..438acb989f9fc924ebb7bf2308b43fa440c1e115 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_SwapRanges.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_SWAP_RANGES_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_SWAP_RANGES_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp index 5d2c0cc98240569a03646382967b19963401d0fa..840e9d205441a5d20692c347f5a3e6b1bddc2eaa 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Transform.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp index 9fb8cbcc3035c33b73197c7005e0a3d8c502dbe5..773e8c2f883556b53d85ed0750cc675422774d76 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformExclusiveScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_EXCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_EXCLUSIVE_SCAN_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp index 281eb6f8a14f6a878c929b06f409515562d800cc..9dde2b0fb125d3f88806e3bf4437d1bedc947617 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformInclusiveScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_INCLUSIVE_SCAN_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp index e3a780f4856c34cf15a6c5fa72f33f2d69c25607..03771056a27b0b82ff138d8f356ff9dd601a326c 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_TransformReduce.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_TRANSFORM_REDUCE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp index 5e4ea7d792a03551914f7c6e2cde8fa13a8a4fbf..4bab551563f17e863d8289695fabe56d2d3156e7 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_Unique.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_UNIQUE_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp index e4fd6f3ed8c5e36aa85c2305c89b540aa79c38b4..d0aa1ed1d0e0dcac7ddcc3454b9f7f72a96b54b9 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_UniqueCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_IMPL_HPP #define KOKKOS_STD_ALGORITHMS_UNIQUE_COPY_IMPL_HPP diff --git a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp index da9b6ef9a9ed0ec9c2c79f93eb55ac535be7c5ac..9b0d4d8244f28f5588274f870d7eed7b52eefc7f 100644 --- a/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp +++ b/packages/kokkos/algorithms/src/std_algorithms/impl/Kokkos_ValueWrapperForNoNeutralElement.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STD_ALGORITHMS_VALUE_WRAPPER_FOR_NO_NEUTRAL_ELEMENT_HPP #define KOKKOS_STD_ALGORITHMS_VALUE_WRAPPER_FOR_NO_NEUTRAL_ELEMENT_HPP diff --git a/packages/kokkos/algorithms/unit_tests/CMakeLists.txt b/packages/kokkos/algorithms/unit_tests/CMakeLists.txt index 0c50ff7a0805d63319f5d9857f313ff87ebafdb8..0fe9c2006ee2e526fac1e2018e82165e256215e7 100644 --- a/packages/kokkos/algorithms/unit_tests/CMakeLists.txt +++ b/packages/kokkos/algorithms/unit_tests/CMakeLists.txt @@ -28,16 +28,24 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget) ) endif() - set(file ${dir}/TestRandomAndSort.cpp) - # Write to a temporary intermediate file and call configure_file to avoid - # updating timestamps triggering unnecessary rebuilds on subsequent cmake runs. - file(WRITE ${dir}/dummy.cpp - "#include <Test${Tag}_Category.hpp>\n" - "#include <TestRandomCommon.hpp>\n" - "#include <TestSortCommon.hpp>\n" - ) - configure_file(${dir}/dummy.cpp ${file}) - list(APPEND SOURCES_A ${file}) + # Each of these inputs is an .hpp file. + # Generate a .cpp file for each one that runs it on the current backend (Tag), + # and add this .cpp file to the sources for UnitTest_RandomAndSort. + foreach(SOURCES_A_Input + TestRandomCommon + TestSortCommon + TestNestedSort + ) + set(file ${dir}/${SOURCES_A_Input}.cpp) + # Write to a temporary intermediate file and call configure_file to avoid + # updating timestamps triggering unnecessary rebuilds on subsequent cmake runs. + file(WRITE ${dir}/dummy.cpp + "#include <Test${Tag}_Category.hpp>\n" + "#include <${SOURCES_A_Input}.hpp>\n" + ) + configure_file(${dir}/dummy.cpp ${file}) + list(APPEND SOURCES_A ${file}) + endforeach() # ------------------------------------------ # std set A @@ -137,12 +145,31 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;HIP;SYCL;OpenMPTarget) endif() endforeach() -KOKKOS_ADD_EXECUTABLE_AND_TEST( - UnitTest_RandomAndSort - SOURCES - UnitTestMain.cpp - ${SOURCES_A} -) +# FIXME_OPENMPTARGET These tests cause internal compiler errors as of 09/01/22 +# when compiling for Intel's Xe-HP GPUs. +if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM) + list(REMOVE_ITEM STDALGO_SOURCES_D + TestStdAlgorithmsCopyIf.cpp + TestStdAlgorithmsRemoveCopy.cpp + TestStdAlgorithmsUnique.cpp + TestStdAlgorithmsUniqueCopy.cpp + ) + list(REMOVE_ITEM STDALGO_SOURCES_E + TestStdAlgorithmsExclusiveScan.cpp + TestStdAlgorithmsInclusiveScan.cpp + ) +endif() + +# FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22 +# when compiling for Intel's Xe-HP GPUs. +if(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM)) + KOKKOS_ADD_EXECUTABLE_AND_TEST( + UnitTest_RandomAndSort + SOURCES + UnitTestMain.cpp + ${SOURCES_A} + ) +endif() foreach(ID A;B;C;D;E) KOKKOS_ADD_EXECUTABLE_AND_TEST( @@ -153,7 +180,11 @@ foreach(ID A;B;C;D;E) ) endforeach() -KOKKOS_ADD_EXECUTABLE( - UnitTest_StdAlgoCompileOnly - SOURCES TestStdAlgorithmsCompileOnly.cpp -) +# FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22 +# when compiling for Intel's Xe-HP GPUs. +if(NOT (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM)) + KOKKOS_ADD_EXECUTABLE( + UnitTest_StdAlgoCompileOnly + SOURCES TestStdAlgorithmsCompileOnly.cpp + ) +endif() diff --git a/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp b/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp new file mode 100644 index 0000000000000000000000000000000000000000..37ee211b42a7681967ba17c40935e8a9d8699ba4 --- /dev/null +++ b/packages/kokkos/algorithms/unit_tests/TestNestedSort.hpp @@ -0,0 +1,408 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_NESTED_SORT_HPP +#define KOKKOS_ALGORITHMS_UNITTESTS_TEST_NESTED_SORT_HPP + +#include <unordered_set> +#include <random> +#include <Kokkos_Random.hpp> +#include <Kokkos_NestedSort.hpp> + +namespace Test { + +namespace Impl { + +// Comparator for sorting in descending order +template <typename Key> +struct GreaterThan { + KOKKOS_FUNCTION constexpr bool operator()(const Key& lhs, + const Key& rhs) const { + return lhs > rhs; + } +}; + +// Functor to test sort_team: each team responsible for sorting one array +template <typename ExecSpace, typename KeyViewType, typename OffsetViewType> +struct TeamSortFunctor { + using TeamMem = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + using SizeType = typename KeyViewType::size_type; + using KeyType = typename KeyViewType::non_const_value_type; + TeamSortFunctor(const KeyViewType& keys_, const OffsetViewType& offsets_, + bool sortDescending_) + : keys(keys_), offsets(offsets_), sortDescending(sortDescending_) {} + KOKKOS_INLINE_FUNCTION void operator()(const TeamMem& t) const { + int i = t.league_rank(); + SizeType begin = offsets(i); + SizeType end = offsets(i + 1); + if (sortDescending) + Kokkos::Experimental::sort_team( + t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)), + GreaterThan<KeyType>()); + else + Kokkos::Experimental::sort_team( + t, Kokkos::subview(keys, Kokkos::make_pair(begin, end))); + } + KeyViewType keys; + OffsetViewType offsets; + bool sortDescending; +}; + +// Functor to test sort_by_key_team: each team responsible for sorting one array +template <typename ExecSpace, typename KeyViewType, typename ValueViewType, + typename OffsetViewType> +struct TeamSortByKeyFunctor { + using TeamMem = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + using SizeType = typename KeyViewType::size_type; + using KeyType = typename KeyViewType::non_const_value_type; + TeamSortByKeyFunctor(const KeyViewType& keys_, const ValueViewType& values_, + const OffsetViewType& offsets_, bool sortDescending_) + : keys(keys_), + values(values_), + offsets(offsets_), + sortDescending(sortDescending_) {} + KOKKOS_INLINE_FUNCTION void operator()(const TeamMem& t) const { + int i = t.league_rank(); + SizeType begin = offsets(i); + SizeType end = offsets(i + 1); + if (sortDescending) { + Kokkos::Experimental::sort_by_key_team( + t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)), + Kokkos::subview(values, Kokkos::make_pair(begin, end)), + GreaterThan<KeyType>()); + } else { + Kokkos::Experimental::sort_by_key_team( + t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)), + Kokkos::subview(values, Kokkos::make_pair(begin, end))); + } + } + KeyViewType keys; + ValueViewType values; + OffsetViewType offsets; + bool sortDescending; +}; + +// Functor to test sort_thread: each thread (multiple vector lanes) responsible +// for sorting one array +template <typename ExecSpace, typename KeyViewType, typename OffsetViewType> +struct ThreadSortFunctor { + using TeamMem = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + using SizeType = typename KeyViewType::size_type; + using KeyType = typename KeyViewType::non_const_value_type; + ThreadSortFunctor(const KeyViewType& keys_, const OffsetViewType& offsets_, + bool sortDescending_) + : keys(keys_), offsets(offsets_), sortDescending(sortDescending_) {} + KOKKOS_INLINE_FUNCTION void operator()(const TeamMem& t) const { + int i = t.league_rank() * t.team_size() + t.team_rank(); + // Number of arrays to sort doesn't have to be divisible by team size, so + // some threads may be idle. + if (i < offsets.extent_int(0) - 1) { + SizeType begin = offsets(i); + SizeType end = offsets(i + 1); + if (sortDescending) + Kokkos::Experimental::sort_thread( + t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)), + GreaterThan<KeyType>()); + else + Kokkos::Experimental::sort_thread( + t, Kokkos::subview(keys, Kokkos::make_pair(begin, end))); + } + } + KeyViewType keys; + OffsetViewType offsets; + bool sortDescending; +}; + +// Functor to test sort_by_key_thread +template <typename ExecSpace, typename KeyViewType, typename ValueViewType, + typename OffsetViewType> +struct ThreadSortByKeyFunctor { + using TeamMem = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + using SizeType = typename KeyViewType::size_type; + using KeyType = typename KeyViewType::non_const_value_type; + ThreadSortByKeyFunctor(const KeyViewType& keys_, const ValueViewType& values_, + const OffsetViewType& offsets_, bool sortDescending_) + : keys(keys_), + values(values_), + offsets(offsets_), + sortDescending(sortDescending_) {} + KOKKOS_INLINE_FUNCTION void operator()(const TeamMem& t) const { + int i = t.league_rank() * t.team_size() + t.team_rank(); + // Number of arrays to sort doesn't have to be divisible by team size, so + // some threads may be idle. + if (i < offsets.extent_int(0) - 1) { + SizeType begin = offsets(i); + SizeType end = offsets(i + 1); + if (sortDescending) { + Kokkos::Experimental::sort_by_key_thread( + t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)), + Kokkos::subview(values, Kokkos::make_pair(begin, end)), + GreaterThan<KeyType>()); + } else { + Kokkos::Experimental::sort_by_key_thread( + t, Kokkos::subview(keys, Kokkos::make_pair(begin, end)), + Kokkos::subview(values, Kokkos::make_pair(begin, end))); + } + } + } + KeyViewType keys; + ValueViewType values; + OffsetViewType offsets; + bool sortDescending; +}; + +// Generate the offsets view for a set of n packed arrays, each with uniform +// random length in [0,k]. Array i will occupy the indices [offsets(i), +// offsets(i+1)), like a row in a CRS graph. Returns the total length of all the +// arrays. +template <typename OffsetViewType> +size_t randomPackedArrayOffsets(unsigned n, unsigned k, + OffsetViewType& offsets) { + offsets = OffsetViewType("Offsets", n + 1); + auto offsetsHost = Kokkos::create_mirror_view(Kokkos::HostSpace(), offsets); + std::mt19937 gen; + std::uniform_int_distribution<> distrib(0, k); + // This will leave offsetsHost(n) == 0. + std::generate(offsetsHost.data(), offsetsHost.data() + n, + [&]() { return distrib(gen); }); + // Exclusive prefix-sum to get offsets + size_t accum = 0; + for (unsigned i = 0; i <= n; i++) { + size_t num = offsetsHost(i); + offsetsHost(i) = accum; + accum += num; + } + Kokkos::deep_copy(offsets, offsetsHost); + return offsetsHost(n); +} + +template <typename ValueViewType> +ValueViewType uniformRandomViewFill(size_t totalLength, + typename ValueViewType::value_type minVal, + typename ValueViewType::value_type maxVal) { + ValueViewType vals("vals", totalLength); + Kokkos::Random_XorShift64_Pool<typename ValueViewType::execution_space> g( + 1931); + Kokkos::fill_random(vals, g, minVal, maxVal); + return vals; +} + +template <class ExecutionSpace, typename KeyType> +void test_nested_sort_impl(unsigned narray, unsigned n, bool useTeams, + bool customCompare, KeyType minKey, KeyType maxKey) { + using KeyViewType = Kokkos::View<KeyType*, ExecutionSpace>; + using OffsetViewType = Kokkos::View<unsigned*, ExecutionSpace>; + using TeamPol = Kokkos::TeamPolicy<ExecutionSpace>; + OffsetViewType offsets; + size_t totalLength = randomPackedArrayOffsets(narray, n, offsets); + KeyViewType keys = + uniformRandomViewFill<KeyViewType>(totalLength, minKey, maxKey); + // note: doing create_mirror because we always want this to be a separate + // copy, even if keys is already host-accessible. keysHost becomes the correct + // result to compare against. + auto keysHost = Kokkos::create_mirror(Kokkos::HostSpace(), keys); + Kokkos::deep_copy(keysHost, keys); + auto offsetsHost = + Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), offsets); + // Sort the same arrays on host to compare against + for (unsigned i = 0; i < narray; i++) { + KeyType* begin = keysHost.data() + offsetsHost(i); + KeyType* end = keysHost.data() + offsetsHost(i + 1); + if (customCompare) + std::sort(begin, end, + [](const KeyType& a, const KeyType& b) { return a > b; }); + else + std::sort(begin, end); + } + if (useTeams) { + int vectorLen = std::min<int>(4, TeamPol::vector_length_max()); + TeamPol policy(narray, Kokkos::AUTO(), vectorLen); + Kokkos::parallel_for( + policy, TeamSortFunctor<ExecutionSpace, KeyViewType, OffsetViewType>( + keys, offsets, customCompare)); + } else { + ThreadSortFunctor<ExecutionSpace, KeyViewType, OffsetViewType> functor( + keys, offsets, customCompare); + int vectorLen = std::min<int>(4, TeamPol::vector_length_max()); + TeamPol dummy(1, Kokkos::AUTO(), vectorLen); + int teamSize = + dummy.team_size_recommended(functor, Kokkos::ParallelForTag()); + int numTeams = (narray + teamSize - 1) / teamSize; + Kokkos::parallel_for(TeamPol(numTeams, teamSize, vectorLen), functor); + } + auto keysOut = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), keys); + std::string testLabel = useTeams ? "sort_team" : "sort_thread"; + for (unsigned i = 0; i < keys.extent(0); i++) { + EXPECT_EQ(keysOut(i), keysHost(i)) + << testLabel << ": after sorting, key at index " << i + << " is incorrect."; + } +} + +template <class ExecutionSpace, typename KeyType, typename ValueType> +void test_nested_sort_by_key_impl(unsigned narray, unsigned n, bool useTeams, + bool customCompare, KeyType minKey, + KeyType maxKey, ValueType minVal, + ValueType maxVal) { + using KeyViewType = Kokkos::View<KeyType*, ExecutionSpace>; + using ValueViewType = Kokkos::View<ValueType*, ExecutionSpace>; + using OffsetViewType = Kokkos::View<unsigned*, ExecutionSpace>; + using TeamPol = Kokkos::TeamPolicy<ExecutionSpace>; + OffsetViewType offsets; + size_t totalLength = randomPackedArrayOffsets(narray, n, offsets); + KeyViewType keys = + uniformRandomViewFill<KeyViewType>(totalLength, minKey, maxKey); + ValueViewType values = + uniformRandomViewFill<ValueViewType>(totalLength, minVal, maxVal); + // note: doing create_mirror because we always want this to be a separate + // copy, even if keys/vals are already host-accessible. keysHost and valsHost + // becomes the correct result to compare against. + auto keysHost = Kokkos::create_mirror(Kokkos::HostSpace(), keys); + auto valuesHost = Kokkos::create_mirror(Kokkos::HostSpace(), values); + Kokkos::deep_copy(keysHost, keys); + Kokkos::deep_copy(valuesHost, values); + auto offsetsHost = + Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), offsets); + // Sort the same arrays on host to compare against + for (unsigned i = 0; i < narray; i++) { + // std:: doesn't have a sort_by_key, so sort a vector of key-value pairs + // instead + using KV = std::pair<KeyType, ValueType>; + std::vector<KV> keysAndValues(offsetsHost(i + 1) - offsetsHost(i)); + for (unsigned j = 0; j < keysAndValues.size(); j++) { + keysAndValues[j].first = keysHost(offsetsHost(i) + j); + keysAndValues[j].second = valuesHost(offsetsHost(i) + j); + } + if (customCompare) { + std::sort(keysAndValues.begin(), keysAndValues.end(), + [](const KV& a, const KV& b) { return a.first > b.first; }); + } else { + std::sort(keysAndValues.begin(), keysAndValues.end(), + [](const KV& a, const KV& b) { return a.first < b.first; }); + } + // Copy back from pairs to views + for (unsigned j = 0; j < keysAndValues.size(); j++) { + keysHost(offsetsHost(i) + j) = keysAndValues[j].first; + valuesHost(offsetsHost(i) + j) = keysAndValues[j].second; + } + } + if (useTeams) { + int vectorLen = std::min<int>(4, TeamPol::vector_length_max()); + TeamPol policy(narray, Kokkos::AUTO(), vectorLen); + Kokkos::parallel_for( + policy, TeamSortByKeyFunctor<ExecutionSpace, KeyViewType, ValueViewType, + OffsetViewType>(keys, values, offsets, + customCompare)); + } else { + ThreadSortByKeyFunctor<ExecutionSpace, KeyViewType, ValueViewType, + OffsetViewType> + functor(keys, values, offsets, customCompare); + int vectorLen = std::min<int>(4, TeamPol::vector_length_max()); + TeamPol dummy(1, Kokkos::AUTO(), vectorLen); + int teamSize = + dummy.team_size_recommended(functor, Kokkos::ParallelForTag()); + int numTeams = (narray + teamSize - 1) / teamSize; + Kokkos::parallel_for(TeamPol(numTeams, teamSize, vectorLen), functor); + } + auto keysOut = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), keys); + auto valuesOut = + Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), values); + std::string testLabel = useTeams ? "sort_by_key_team" : "sort_by_key_thread"; + // First, compare keys since they will always match exactly + for (unsigned i = 0; i < keys.extent(0); i++) { + EXPECT_EQ(keysOut(i), keysHost(i)) + << testLabel << ": after sorting, key at index " << i + << " is incorrect."; + } + // Kokkos::sort_by_key_X is not stable, so if a key happens to + // appear more than once, the order of the values may not match exactly. + // But the set of values for a given key should be identical. + unsigned keyStart = 0; + while (keyStart < keys.extent(0)) { + KeyType key = keysHost(keyStart); + unsigned keyEnd = keyStart + 1; + while (keyEnd < keys.extent(0) && keysHost(keyEnd) == key) keyEnd++; + std::unordered_multiset<ValueType> correctVals; + std::unordered_multiset<ValueType> outputVals; + for (unsigned i = keyStart; i < keyEnd; i++) { + correctVals.insert(valuesHost(i)); + outputVals.insert(valuesOut(i)); + } + // Check one value at a time that they match + for (auto it = correctVals.begin(); it != correctVals.end(); it++) { + ValueType val = *it; + EXPECT_TRUE(outputVals.find(val) != outputVals.end()) + << testLabel << ": after sorting, value " << val + << " corresponding to key " << key << " is missing."; + EXPECT_EQ(correctVals.count(val), outputVals.count(val)) + << testLabel << ": after sorting, the number of occurences of value " + << val << " corresponding to key " << key << " changed."; + } + keyStart = keyEnd; + } +} + +template <class ExecutionSpace, typename KeyType> +void test_nested_sort(unsigned int N, KeyType minKey, KeyType maxKey) { + // 2nd arg: true = team-level, false = thread-level. + // 3rd arg: true = custom comparator, false = default comparator. + test_nested_sort_impl<ExecutionSpace, KeyType>(N, N, true, false, minKey, + maxKey); + test_nested_sort_impl<ExecutionSpace, KeyType>(N, N, true, true, minKey, + maxKey); + test_nested_sort_impl<ExecutionSpace, KeyType>(N, N, false, false, minKey, + maxKey); + test_nested_sort_impl<ExecutionSpace, KeyType>(N, N, false, true, minKey, + maxKey); +} + +template <class ExecutionSpace, typename KeyType, typename ValueType> +void test_nested_sort_by_key(unsigned int N, KeyType minKey, KeyType maxKey, + ValueType minVal, ValueType maxVal) { + // 2nd arg: true = team-level, false = thread-level. + // 3rd arg: true = custom comparator, false = default comparator. + test_nested_sort_by_key_impl<ExecutionSpace, KeyType, ValueType>( + N, N, true, false, minKey, maxKey, minVal, maxVal); + test_nested_sort_by_key_impl<ExecutionSpace, KeyType, ValueType>( + N, N, true, true, minKey, maxKey, minVal, maxVal); + test_nested_sort_by_key_impl<ExecutionSpace, KeyType, ValueType>( + N, N, false, false, minKey, maxKey, minVal, maxVal); + test_nested_sort_by_key_impl<ExecutionSpace, KeyType, ValueType>( + N, N, false, true, minKey, maxKey, minVal, maxVal); +} +} // namespace Impl + +TEST(TEST_CATEGORY, NestedSort) { + Impl::test_nested_sort<TEST_EXECSPACE, unsigned>(171, 0U, UINT_MAX); + Impl::test_nested_sort<TEST_EXECSPACE, float>(42, -1e6f, 1e6f); + Impl::test_nested_sort<TEST_EXECSPACE, char>(67, CHAR_MIN, CHAR_MAX); +} + +TEST(TEST_CATEGORY, NestedSortByKey) { + // Second/third template arguments are key and value respectively. + // In sort_by_key_X functions, a key view and a value view are both permuted + // to make the keys sorted. This means that the value type doesn't need to be + // ordered, unlike key + Impl::test_nested_sort_by_key<TEST_EXECSPACE, unsigned, unsigned>( + 161, 0U, UINT_MAX, 0U, UINT_MAX); + Impl::test_nested_sort_by_key<TEST_EXECSPACE, float, char>( + 267, -1e6f, 1e6f, CHAR_MIN, CHAR_MAX); + Impl::test_nested_sort_by_key<TEST_EXECSPACE, char, double>( + 11, CHAR_MIN, CHAR_MAX, 2.718, 3.14); +} + +} // namespace Test +#endif diff --git a/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort1D.cpp b/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort1D.cpp index 4a5839f0c80a5298c14ff91422d74664b9dd95bd..e06486618f38e13a709da4e6225f241cd323a494 100644 --- a/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort1D.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort1D.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> #ifdef KOKKOS_ENABLE_OPENMP diff --git a/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort3D.cpp b/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort3D.cpp index 127d911d7ca3856957646698b431089b5deb2caa..cd6e8e8cbf337eac3158eaa14f80dc5cd5e08a8a 100644 --- a/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort3D.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestOpenMP_Sort3D.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> #ifdef KOKKOS_ENABLE_OPENMP diff --git a/packages/kokkos/algorithms/unit_tests/TestOpenMP_SortDynamicView.cpp b/packages/kokkos/algorithms/unit_tests/TestOpenMP_SortDynamicView.cpp index 3dc88540443f7af219b18b85425408afbc1fda6e..549d09f1f247e24faf59944b6a2a0de9127d8bce 100644 --- a/packages/kokkos/algorithms/unit_tests/TestOpenMP_SortDynamicView.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestOpenMP_SortDynamicView.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> #ifdef KOKKOS_ENABLE_OPENMP diff --git a/packages/kokkos/algorithms/unit_tests/TestRandom.hpp b/packages/kokkos/algorithms/unit_tests/TestRandom.hpp index 19c82003cf3429714a17a262fe55d59907ec5ecf..607e94c7845ed9529a1b561cdbda13ea0d277f39 100644 --- a/packages/kokkos/algorithms/unit_tests/TestRandom.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestRandom.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_TEST_DUALVIEW_HPP @@ -189,50 +163,10 @@ struct test_random_functor { static_cast<uint64_t>(1.0 * HIST_DIM3D * tmp2 / theMax); const uint64_t ind3_3d = static_cast<uint64_t>(1.0 * HIST_DIM3D * tmp3 / theMax); -// Workaround Intel 17 compiler bug which sometimes add random -// instruction alignment which makes the lock instruction -// illegal. Seems to be mostly just for unsigned int atomics. -// Looking at the assembly the compiler -// appears to insert cache line alignment for the instruction. -// Isn't restricted to specific archs. Seen it on SNB and SKX, but for -// different code. Another occurrence was with Desul atomics in -// a different unit test. This one here happens without desul atomics. -// Inserting an assembly nop instruction changes the alignment and -// works round this. -// -// 17.0.4 for 64bit Random works with 1/1/1/2/1 -// 17.0.4 for 1024bit Random works with 1/1/1/1/1 -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif atomic_fetch_add(&density_1d(ind1_1d), 1); -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif atomic_fetch_add(&density_1d(ind2_1d), 1); -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif atomic_fetch_add(&density_1d(ind3_1d), 1); -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - if (std::is_same<rnd_type, Kokkos::Random_XorShift64<device_type>>::value) - asm volatile("nop\n"); - asm volatile("nop\n"); -#endif -#endif atomic_fetch_add(&density_3d(ind1_3d, ind2_3d, ind3_3d), 1); -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif } rand_pool.free_state(rand_gen); } diff --git a/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp b/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp index 5136ad434ba42b17292deeeb792a7d416fcc2ea6..439d171c8aec4a2ca6146e6e0963d515dd74b725 100644 --- a/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestRandomAccessIterator.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> diff --git a/packages/kokkos/algorithms/unit_tests/TestRandomCommon.hpp b/packages/kokkos/algorithms/unit_tests/TestRandomCommon.hpp index c6d3b59ae1f12422c448a13f5f91f2ed74cc58ff..c53d66f4d02cc2b3cbaf2ee3056615022eaa2446 100644 --- a/packages/kokkos/algorithms/unit_tests/TestRandomCommon.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestRandomCommon.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TESTRANDOM_COMMON_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TESTRANDOM_COMMON_HPP diff --git a/packages/kokkos/algorithms/unit_tests/TestSort.hpp b/packages/kokkos/algorithms/unit_tests/TestSort.hpp index 120a04bdb535a55b31516b047a0da4c347c581b9..d903888878c93af5a00dd2f2a864cc1f017ebf2f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestSort.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestSort.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TESTSORT_HPP @@ -130,19 +104,14 @@ struct sum3D { }; template <class ExecutionSpace, typename KeyType> -void test_1D_sort_impl(unsigned int n, bool force_kokkos) { +void test_1D_sort_impl(unsigned int n) { using KeyViewType = Kokkos::View<KeyType*, ExecutionSpace>; KeyViewType keys("Keys", n); // Test sorting array with all numbers equal ExecutionSpace exec; Kokkos::deep_copy(exec, keys, KeyType(1)); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - Kokkos::sort(exec, keys, force_kokkos); -#else - (void)force_kokkos; // suppress warnings about unused variable Kokkos::sort(exec, keys); -#endif Kokkos::Random_XorShift64_Pool<ExecutionSpace> g(1931); Kokkos::fill_random(keys, g, @@ -156,11 +125,7 @@ void test_1D_sort_impl(unsigned int n, bool force_kokkos) { Kokkos::parallel_reduce(Kokkos::RangePolicy<ExecutionSpace>(exec, 0, n), sum<ExecutionSpace, KeyType>(keys), sum_before); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - Kokkos::sort(exec, keys, force_kokkos); -#else Kokkos::sort(exec, keys); -#endif Kokkos::parallel_reduce(Kokkos::RangePolicy<ExecutionSpace>(exec, 0, n), sum<ExecutionSpace, KeyType>(keys), sum_after); @@ -415,10 +380,7 @@ void test_sort_integer_overflow() { template <class ExecutionSpace, typename KeyType> void test_1D_sort(unsigned int N) { - test_1D_sort_impl<ExecutionSpace, KeyType>(N * N * N, true); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - test_1D_sort_impl<ExecutionSpace, KeyType>(N * N * N, false); -#endif + test_1D_sort_impl<ExecutionSpace, KeyType>(N * N * N); } template <class ExecutionSpace, typename KeyType> @@ -444,12 +406,20 @@ void test_issue_4978_sort() { template <class ExecutionSpace, typename KeyType> void test_sort(unsigned int N) { test_1D_sort<ExecutionSpace, KeyType>(N); - test_3D_sort<ExecutionSpace, KeyType>(N); +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if (!std::is_same_v<ExecutionSpace, Kokkos::Cuda>) +#endif + test_3D_sort<ExecutionSpace, KeyType>(N); // FIXME_OPENMPTARGET: OpenMPTarget doesn't support DynamicView yet. #ifndef KOKKOS_ENABLE_OPENMPTARGET test_dynamic_view_sort<ExecutionSpace, KeyType>(N); #endif - test_issue_1160_sort<ExecutionSpace>(); +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if (!std::is_same_v<ExecutionSpace, Kokkos::Cuda>) +#endif + test_issue_1160_sort<ExecutionSpace>(); test_issue_4978_sort<ExecutionSpace>(); test_sort_integer_overflow<ExecutionSpace, long long>(); test_sort_integer_overflow<ExecutionSpace, unsigned long long>(); diff --git a/packages/kokkos/algorithms/unit_tests/TestSortCommon.hpp b/packages/kokkos/algorithms/unit_tests/TestSortCommon.hpp index 56657b6574b865419a1f93e01a49aa2a3e648736..b8e2e17e4f353994a013d3cd9b8305135d2b84ca 100644 --- a/packages/kokkos/algorithms/unit_tests/TestSortCommon.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestSortCommon.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TESTSORT_COMMON_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TESTSORT_COMMON_HPP diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp index d37f657f57599e1029cf32e59f6bb9775b57a224..d414d524b61d21828808e3cf7e540ea377df85ec 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentDifference.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <std_algorithms/Kokkos_BeginEnd.hpp> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp index 874748193e366b1921a870100c4baadb16fe2a82..ee34761265021e404b3848d00e3a2871e752be14 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <std_algorithms/Kokkos_BeginEnd.hpp> @@ -315,6 +287,12 @@ void run_all_scenarios() { } TEST(std_algorithms_nonmod_seq_ops, adjacent_find) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_all_scenarios<DynamicTag, int>(); run_all_scenarios<DynamicTag, double>(); run_all_scenarios<StridedThreeTag, int>(); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp index a1307d4c23cb0dabd093155841a4589a64d0f3f3..1c39a4735e62576fe9ebfb8a3a702f6e9436ed5c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsAllAnyNoneOf.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <std_algorithms/Kokkos_BeginEnd.hpp> @@ -175,6 +147,12 @@ void run_all_scenarios() { } TEST(std_algorithms_all_any_none_of_test, test) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_all_scenarios<DynamicTag, double>(); run_all_scenarios<StridedTwoTag, int>(); run_all_scenarios<StridedThreeTag, unsigned>(); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp index 871cce155b4d43239a1306f051f439359ad3b99b..39a508bb8feacfdf872bd7f0614b74970524d441 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp index a06f9c61c03adef2950c3074a38b07757cfaa120..694676a878a2a9c601b5fcc70febe6207903f742 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCommon.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_COMMON_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_COMMON_HPP diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp index 037dac36ed9de12a37b36d060a42c37c91cc40f6..9324db12f2874a6445f0e4581fd2bc0a68698620 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCompileOnly.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_StdAlgorithms.hpp> @@ -123,18 +95,20 @@ struct TrivialTransformReduceBinaryTransformer { } }; -// put all code here and don't call from main -// so that even if one runs the executable, -// nothing is run anyway +namespace KE = Kokkos::Experimental; + +struct TestStruct { + // put all code here and don't call from main + // so that even if one runs the executable, + // nothing is run anyway -namespace KE = Kokkos::Experimental; -using count_type = std::size_t; -using T = double; -Kokkos::View<T *> in1("in1", 10); -Kokkos::View<T *> in2("in2", 10); -Kokkos::View<T *> in3("in3", 10); -Kokkos::DefaultExecutionSpace exe_space; -std::string const label = "trivial"; + using count_type = std::size_t; + using T = double; + Kokkos::View<T *> in1 = Kokkos::View<T *>("in1", 10); + Kokkos::View<T *> in2 = Kokkos::View<T *>("in2", 10); + Kokkos::View<T *> in3 = Kokkos::View<T *>("in3", 10); + Kokkos::DefaultExecutionSpace exe_space; + std::string const label = "trivial"; // // just iterators @@ -239,293 +213,299 @@ std::string const label = "trivial"; (void)KE::ALGO(exe_space, /*--*/ in1, ARG, in2); \ (void)KE::ALGO(label, exe_space, in1, ARG, in2); -void non_modifying_seq_ops() { - TEST_ALGO_MACRO_B1E1_VARIAD(find, T{}); - TEST_ALGO_MACRO_V1_VARIAD(find, T{}); + void non_modifying_seq_ops() { + TEST_ALGO_MACRO_B1E1_VARIAD(find, T{}); + TEST_ALGO_MACRO_V1_VARIAD(find, T{}); - TEST_ALGO_MACRO_B1E1_VARIAD(find_if, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(find_if, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(find_if, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(find_if, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(find_if_not, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(find_if_not, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(find_if_not, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(find_if_not, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(for_each, TimesTwoFunctor<T>()); - TEST_ALGO_MACRO_V1_VARIAD(for_each, TimesTwoFunctor<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(for_each, TimesTwoFunctor<T>()); + TEST_ALGO_MACRO_V1_VARIAD(for_each, TimesTwoFunctor<T>()); - TEST_ALGO_MACRO_B1_VARIAD(for_each_n, count_type{}, TimesTwoFunctor<T>()); - TEST_ALGO_MACRO_V1_VARIAD(for_each_n, count_type{}, TimesTwoFunctor<T>()); + TEST_ALGO_MACRO_B1_VARIAD(for_each_n, count_type{}, TimesTwoFunctor<T>()); + TEST_ALGO_MACRO_V1_VARIAD(for_each_n, count_type{}, TimesTwoFunctor<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(count_if, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(count_if, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(count_if, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(count_if, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(count, T{}); - TEST_ALGO_MACRO_V1_VARIAD(count, T{}); + TEST_ALGO_MACRO_B1E1_VARIAD(count, T{}); + TEST_ALGO_MACRO_V1_VARIAD(count, T{}); - TEST_ALGO_MACRO_B1E1B2E2(mismatch); - TEST_ALGO_MACRO_B1E1B2E2_VARIAD(mismatch, TrivialBinaryPredicate<T>()); - TEST_ALGO_MACRO_V1V2(mismatch); - TEST_ALGO_MACRO_V1V2_VARIAD(mismatch, TrivialBinaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1B2E2(mismatch); + TEST_ALGO_MACRO_B1E1B2E2_VARIAD(mismatch, TrivialBinaryPredicate<T>()); + TEST_ALGO_MACRO_V1V2(mismatch); + TEST_ALGO_MACRO_V1V2_VARIAD(mismatch, TrivialBinaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(all_of, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(all_of, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(all_of, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(all_of, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(any_of, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(any_of, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(any_of, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(any_of, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(none_of, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(none_of, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(none_of, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(none_of, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1B2(equal); - TEST_ALGO_MACRO_B1E1B2_VARIAD(equal, TrivialBinaryPredicate<T>()); - TEST_ALGO_MACRO_V1V2(equal); - TEST_ALGO_MACRO_V1V2_VARIAD(equal, TrivialBinaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1B2E2(equal); - TEST_ALGO_MACRO_B1E1B2E2_VARIAD(equal, TrivialBinaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1B2(equal); + TEST_ALGO_MACRO_B1E1B2_VARIAD(equal, TrivialBinaryPredicate<T>()); + TEST_ALGO_MACRO_V1V2(equal); + TEST_ALGO_MACRO_V1V2_VARIAD(equal, TrivialBinaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1B2E2(equal); + TEST_ALGO_MACRO_B1E1B2E2_VARIAD(equal, TrivialBinaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1B2E2(lexicographical_compare); - TEST_ALGO_MACRO_B1E1B2E2_VARIAD(lexicographical_compare, - TrivialComparator<T>()); - TEST_ALGO_MACRO_V1V2(lexicographical_compare); - TEST_ALGO_MACRO_V1V2_VARIAD(lexicographical_compare, TrivialComparator<T>()); + TEST_ALGO_MACRO_B1E1B2E2(lexicographical_compare); + TEST_ALGO_MACRO_B1E1B2E2_VARIAD(lexicographical_compare, + TrivialComparator<T>()); + TEST_ALGO_MACRO_V1V2(lexicographical_compare); + TEST_ALGO_MACRO_V1V2_VARIAD(lexicographical_compare, + TrivialComparator<T>()); - TEST_ALGO_MACRO_B1E1(adjacent_find); - TEST_ALGO_MACRO_V1(adjacent_find); - TEST_ALGO_MACRO_B1E1_VARIAD(adjacent_find, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_V1_VARIAD(adjacent_find, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_B1E1(adjacent_find); + TEST_ALGO_MACRO_V1(adjacent_find); + TEST_ALGO_MACRO_B1E1_VARIAD(adjacent_find, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_V1_VARIAD(adjacent_find, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_B1E1B2E2(search); - TEST_ALGO_MACRO_V1V2(search); - TEST_ALGO_MACRO_B1E1B2E2_VARIAD(search, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(search, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_B1E1B2E2(search); + TEST_ALGO_MACRO_V1V2(search); + TEST_ALGO_MACRO_B1E1B2E2_VARIAD(search, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(search, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_B1E1B2E2(find_first_of); - TEST_ALGO_MACRO_V1V2(find_first_of); - TEST_ALGO_MACRO_B1E1B2E2_VARIAD(find_first_of, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(find_first_of, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_B1E1B2E2(find_first_of); + TEST_ALGO_MACRO_V1V2(find_first_of); + TEST_ALGO_MACRO_B1E1B2E2_VARIAD(find_first_of, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(find_first_of, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(search_n, count_type{}, T{}); - TEST_ALGO_MACRO_V1_VARIAD(search_n, count_type{}, T{}); - TEST_ALGO_MACRO_B1E1_VARIAD(search_n, count_type{}, T{}, + TEST_ALGO_MACRO_B1E1_VARIAD(search_n, count_type{}, T{}); + TEST_ALGO_MACRO_V1_VARIAD(search_n, count_type{}, T{}); + TEST_ALGO_MACRO_B1E1_VARIAD(search_n, count_type{}, T{}, + TrivialBinaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(search_n, count_type{}, T{}, TrivialBinaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(search_n, count_type{}, T{}, - TrivialBinaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1B2E2(find_end); - TEST_ALGO_MACRO_V1V2(find_end); - TEST_ALGO_MACRO_B1E1B2E2_VARIAD(find_end, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(find_end, TrivialBinaryFunctor<T>()); -} + TEST_ALGO_MACRO_B1E1B2E2(find_end); + TEST_ALGO_MACRO_V1V2(find_end); + TEST_ALGO_MACRO_B1E1B2E2_VARIAD(find_end, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(find_end, TrivialBinaryFunctor<T>()); + } -void modifying_seq_ops() { - TEST_ALGO_MACRO_B1E1B2_VARIAD(replace_copy, T{}, T{}); - TEST_ALGO_MACRO_V1V2_VARIAD(replace_copy, T{}, T{}); + void modifying_seq_ops() { + TEST_ALGO_MACRO_B1E1B2_VARIAD(replace_copy, T{}, T{}); + TEST_ALGO_MACRO_V1V2_VARIAD(replace_copy, T{}, T{}); - TEST_ALGO_MACRO_B1E1B2_VARIAD(replace_copy_if, TrivialUnaryPredicate<T>(), + TEST_ALGO_MACRO_B1E1B2_VARIAD(replace_copy_if, TrivialUnaryPredicate<T>(), + T{}); + TEST_ALGO_MACRO_V1V2_VARIAD(replace_copy_if, TrivialUnaryPredicate<T>(), T{}); - TEST_ALGO_MACRO_V1V2_VARIAD(replace_copy_if, TrivialUnaryPredicate<T>(), T{}); - TEST_ALGO_MACRO_B1E1_VARIAD(replace, T{}, T{}); - TEST_ALGO_MACRO_V1_VARIAD(replace, T{}, T{}); + TEST_ALGO_MACRO_B1E1_VARIAD(replace, T{}, T{}); + TEST_ALGO_MACRO_V1_VARIAD(replace, T{}, T{}); - TEST_ALGO_MACRO_B1E1_VARIAD(replace_if, TrivialUnaryPredicate<T>(), T{}); - TEST_ALGO_MACRO_V1_VARIAD(replace_if, TrivialUnaryPredicate<T>(), T{}); + TEST_ALGO_MACRO_B1E1_VARIAD(replace_if, TrivialUnaryPredicate<T>(), T{}); + TEST_ALGO_MACRO_V1_VARIAD(replace_if, TrivialUnaryPredicate<T>(), T{}); - TEST_ALGO_MACRO_B1E1B2(copy); - TEST_ALGO_MACRO_V1V2(copy); + TEST_ALGO_MACRO_B1E1B2(copy); + TEST_ALGO_MACRO_V1V2(copy); - TEST_ALGO_MACRO_B1_ARG_B2(copy_n, count_type{}); - TEST_ALGO_MACRO_V1_ARG_V2(copy_n, count_type{}); + TEST_ALGO_MACRO_B1_ARG_B2(copy_n, count_type{}); + TEST_ALGO_MACRO_V1_ARG_V2(copy_n, count_type{}); - TEST_ALGO_MACRO_B1E1B2(copy_backward); - TEST_ALGO_MACRO_V1V2(copy_backward); + TEST_ALGO_MACRO_B1E1B2(copy_backward); + TEST_ALGO_MACRO_V1V2(copy_backward); - TEST_ALGO_MACRO_B1E1B2_VARIAD(copy_if, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(copy_if, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1B2_VARIAD(copy_if, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(copy_if, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(fill, T{}); - TEST_ALGO_MACRO_V1_VARIAD(fill, T{}); + TEST_ALGO_MACRO_B1E1_VARIAD(fill, T{}); + TEST_ALGO_MACRO_V1_VARIAD(fill, T{}); - TEST_ALGO_MACRO_B1_VARIAD(fill_n, count_type{}, T{}); - TEST_ALGO_MACRO_V1_VARIAD(fill_n, count_type{}, T{}); + TEST_ALGO_MACRO_B1_VARIAD(fill_n, count_type{}, T{}); + TEST_ALGO_MACRO_V1_VARIAD(fill_n, count_type{}, T{}); - TEST_ALGO_MACRO_B1E1B2_VARIAD(transform, TrivialUnaryFunctor<T>{}); - TEST_ALGO_MACRO_V1V2_VARIAD(transform, TrivialUnaryFunctor<T>{}); + TEST_ALGO_MACRO_B1E1B2_VARIAD(transform, TrivialUnaryFunctor<T>{}); + TEST_ALGO_MACRO_V1V2_VARIAD(transform, TrivialUnaryFunctor<T>{}); - TEST_ALGO_MACRO_B1E1B2_VARIAD(transform, TrivialUnaryFunctor<T>{}); - TEST_ALGO_MACRO_B1E1B2B3_VARIAD(transform, TrivialBinaryFunctor<T>{}); - TEST_ALGO_MACRO_V1V2_VARIAD(transform, TrivialUnaryFunctor<T>{}); - TEST_ALGO_MACRO_V1V2V3_VARIAD(transform, TrivialBinaryFunctor<T>{}); + TEST_ALGO_MACRO_B1E1B2_VARIAD(transform, TrivialUnaryFunctor<T>{}); + TEST_ALGO_MACRO_B1E1B2B3_VARIAD(transform, TrivialBinaryFunctor<T>{}); + TEST_ALGO_MACRO_V1V2_VARIAD(transform, TrivialUnaryFunctor<T>{}); + TEST_ALGO_MACRO_V1V2V3_VARIAD(transform, TrivialBinaryFunctor<T>{}); - TEST_ALGO_MACRO_B1E1_VARIAD(generate, TrivialGenerator<T>{}); - TEST_ALGO_MACRO_V1_VARIAD(generate, TrivialGenerator<T>{}); + TEST_ALGO_MACRO_B1E1_VARIAD(generate, TrivialGenerator<T>{}); + TEST_ALGO_MACRO_V1_VARIAD(generate, TrivialGenerator<T>{}); - TEST_ALGO_MACRO_B1_VARIAD(generate_n, count_type{}, TrivialGenerator<T>{}); - TEST_ALGO_MACRO_V1_VARIAD(generate_n, count_type{}, TrivialGenerator<T>{}); + TEST_ALGO_MACRO_B1_VARIAD(generate_n, count_type{}, TrivialGenerator<T>{}); + TEST_ALGO_MACRO_V1_VARIAD(generate_n, count_type{}, TrivialGenerator<T>{}); - TEST_ALGO_MACRO_B1E1B2(reverse_copy); - TEST_ALGO_MACRO_V1V2(reverse_copy); + TEST_ALGO_MACRO_B1E1B2(reverse_copy); + TEST_ALGO_MACRO_V1V2(reverse_copy); - TEST_ALGO_MACRO_B1E1(reverse); - TEST_ALGO_MACRO_V1(reverse); + TEST_ALGO_MACRO_B1E1(reverse); + TEST_ALGO_MACRO_V1(reverse); - TEST_ALGO_MACRO_B1E1B2(move); - TEST_ALGO_MACRO_V1V2(move); + TEST_ALGO_MACRO_B1E1B2(move); + TEST_ALGO_MACRO_V1V2(move); - TEST_ALGO_MACRO_B1E1E2(move_backward); - TEST_ALGO_MACRO_V1V2(move_backward); + TEST_ALGO_MACRO_B1E1E2(move_backward); + TEST_ALGO_MACRO_V1V2(move_backward); - TEST_ALGO_MACRO_B1E1B2(swap_ranges); - TEST_ALGO_MACRO_V1V2(swap_ranges); + TEST_ALGO_MACRO_B1E1B2(swap_ranges); + TEST_ALGO_MACRO_V1V2(swap_ranges); - TEST_ALGO_MACRO_B1E1(unique); - TEST_ALGO_MACRO_V1(unique); - TEST_ALGO_MACRO_B1E1_VARIAD(unique, TrivialBinaryPredicate<T>{}); - TEST_ALGO_MACRO_V1_VARIAD(unique, TrivialBinaryPredicate<T>{}); + TEST_ALGO_MACRO_B1E1(unique); + TEST_ALGO_MACRO_V1(unique); + TEST_ALGO_MACRO_B1E1_VARIAD(unique, TrivialBinaryPredicate<T>{}); + TEST_ALGO_MACRO_V1_VARIAD(unique, TrivialBinaryPredicate<T>{}); - TEST_ALGO_MACRO_B1E1B2(unique_copy); - TEST_ALGO_MACRO_V1V2(unique_copy); - TEST_ALGO_MACRO_B1E1B2_VARIAD(unique_copy, TrivialBinaryPredicate<T>{}); - TEST_ALGO_MACRO_V1V2_VARIAD(unique_copy, TrivialBinaryPredicate<T>{}); + TEST_ALGO_MACRO_B1E1B2(unique_copy); + TEST_ALGO_MACRO_V1V2(unique_copy); + TEST_ALGO_MACRO_B1E1B2_VARIAD(unique_copy, TrivialBinaryPredicate<T>{}); + TEST_ALGO_MACRO_V1V2_VARIAD(unique_copy, TrivialBinaryPredicate<T>{}); - TEST_ALGO_MACRO_B1E1E2(rotate); - TEST_ALGO_MACRO_V1_VARIAD(rotate, count_type{}); + TEST_ALGO_MACRO_B1E1E2(rotate); + TEST_ALGO_MACRO_V1_VARIAD(rotate, count_type{}); - TEST_ALGO_MACRO_B1E1E1B2(rotate_copy); - TEST_ALGO_MACRO_V1_ARG_V2(rotate_copy, count_type{}); + TEST_ALGO_MACRO_B1E1E1B2(rotate_copy); + TEST_ALGO_MACRO_V1_ARG_V2(rotate_copy, count_type{}); - TEST_ALGO_MACRO_B1E1_VARIAD(remove_if, TrivialUnaryPredicate<T>{}); - TEST_ALGO_MACRO_V1_VARIAD(remove_if, TrivialUnaryPredicate<T>{}); + TEST_ALGO_MACRO_B1E1_VARIAD(remove_if, TrivialUnaryPredicate<T>{}); + TEST_ALGO_MACRO_V1_VARIAD(remove_if, TrivialUnaryPredicate<T>{}); - TEST_ALGO_MACRO_B1E1_VARIAD(remove, T{}); - TEST_ALGO_MACRO_V1_VARIAD(remove, T{}); + TEST_ALGO_MACRO_B1E1_VARIAD(remove, T{}); + TEST_ALGO_MACRO_V1_VARIAD(remove, T{}); - TEST_ALGO_MACRO_B1E1B2_VARIAD(remove_copy, T{}); - TEST_ALGO_MACRO_V1V2_VARIAD(remove_copy, T{}); + TEST_ALGO_MACRO_B1E1B2_VARIAD(remove_copy, T{}); + TEST_ALGO_MACRO_V1V2_VARIAD(remove_copy, T{}); - TEST_ALGO_MACRO_B1E1B2_VARIAD(remove_copy_if, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(remove_copy_if, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1B2_VARIAD(remove_copy_if, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(remove_copy_if, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(shift_left, count_type{}); - TEST_ALGO_MACRO_V1_VARIAD(shift_left, count_type{}); + TEST_ALGO_MACRO_B1E1_VARIAD(shift_left, count_type{}); + TEST_ALGO_MACRO_V1_VARIAD(shift_left, count_type{}); - TEST_ALGO_MACRO_B1E1_VARIAD(shift_right, count_type{}); - TEST_ALGO_MACRO_V1_VARIAD(shift_right, count_type{}); -} + TEST_ALGO_MACRO_B1E1_VARIAD(shift_right, count_type{}); + TEST_ALGO_MACRO_V1_VARIAD(shift_right, count_type{}); + } -void sorting_ops() { - TEST_ALGO_MACRO_B1E1(is_sorted_until); - TEST_ALGO_MACRO_V1(is_sorted_until); + void sorting_ops() { + TEST_ALGO_MACRO_B1E1(is_sorted_until); + TEST_ALGO_MACRO_V1(is_sorted_until); #ifndef KOKKOS_ENABLE_OPENMPTARGET - TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted_until, TrivialComparator<T>()); - TEST_ALGO_MACRO_V1_VARIAD(is_sorted_until, TrivialComparator<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted_until, TrivialComparator<T>()); + TEST_ALGO_MACRO_V1_VARIAD(is_sorted_until, TrivialComparator<T>()); #endif - TEST_ALGO_MACRO_B1E1(is_sorted); - TEST_ALGO_MACRO_V1(is_sorted); + TEST_ALGO_MACRO_B1E1(is_sorted); + TEST_ALGO_MACRO_V1(is_sorted); #ifndef KOKKOS_ENABLE_OPENMPTARGET - TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted, TrivialComparator<T>()); - TEST_ALGO_MACRO_V1_VARIAD(is_sorted, TrivialComparator<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(is_sorted, TrivialComparator<T>()); + TEST_ALGO_MACRO_V1_VARIAD(is_sorted, TrivialComparator<T>()); #endif -} + } -void minmax_ops() { - TEST_ALGO_MACRO_B1E1(min_element); - TEST_ALGO_MACRO_V1(min_element); - TEST_ALGO_MACRO_B1E1(max_element); - TEST_ALGO_MACRO_V1(max_element); - TEST_ALGO_MACRO_B1E1(minmax_element); - TEST_ALGO_MACRO_V1(minmax_element); + void minmax_ops() { + TEST_ALGO_MACRO_B1E1(min_element); + TEST_ALGO_MACRO_V1(min_element); + TEST_ALGO_MACRO_B1E1(max_element); + TEST_ALGO_MACRO_V1(max_element); + TEST_ALGO_MACRO_B1E1(minmax_element); + TEST_ALGO_MACRO_V1(minmax_element); #ifndef KOKKOS_ENABLE_OPENMPTARGET - TEST_ALGO_MACRO_B1E1_VARIAD(min_element, TrivialComparator<T>()); - TEST_ALGO_MACRO_V1_VARIAD(min_element, TrivialComparator<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(max_element, TrivialComparator<T>()); - TEST_ALGO_MACRO_V1_VARIAD(max_element, TrivialComparator<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(minmax_element, TrivialComparator<T>()); - TEST_ALGO_MACRO_V1_VARIAD(minmax_element, TrivialComparator<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(min_element, TrivialComparator<T>()); + TEST_ALGO_MACRO_V1_VARIAD(min_element, TrivialComparator<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(max_element, TrivialComparator<T>()); + TEST_ALGO_MACRO_V1_VARIAD(max_element, TrivialComparator<T>()); + TEST_ALGO_MACRO_B1E1_VARIAD(minmax_element, TrivialComparator<T>()); + TEST_ALGO_MACRO_V1_VARIAD(minmax_element, TrivialComparator<T>()); #endif -} + } -void partitionig_ops() { - TEST_ALGO_MACRO_B1E1_VARIAD(is_partitioned, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(is_partitioned, TrivialUnaryPredicate<T>()); + void partitionig_ops() { + TEST_ALGO_MACRO_B1E1_VARIAD(is_partitioned, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(is_partitioned, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1B2B3_VARIAD(partition_copy, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1V2V3_VARIAD(partition_copy, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_B1E1B2B3_VARIAD(partition_copy, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1V2V3_VARIAD(partition_copy, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(partition_point, TrivialUnaryPredicate<T>()); - TEST_ALGO_MACRO_V1_VARIAD(partition_point, TrivialUnaryPredicate<T>()); -} + TEST_ALGO_MACRO_B1E1_VARIAD(partition_point, TrivialUnaryPredicate<T>()); + TEST_ALGO_MACRO_V1_VARIAD(partition_point, TrivialUnaryPredicate<T>()); + } -void numeric() { - TEST_ALGO_MACRO_B1E1B2(adjacent_difference); - TEST_ALGO_MACRO_B1E1B2_VARIAD(adjacent_difference, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_V1V2(adjacent_difference); - TEST_ALGO_MACRO_V1V2_VARIAD(adjacent_difference, TrivialBinaryFunctor<T>()); + void numeric() { + TEST_ALGO_MACRO_B1E1B2(adjacent_difference); + TEST_ALGO_MACRO_B1E1B2_VARIAD(adjacent_difference, + TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_V1V2(adjacent_difference); + TEST_ALGO_MACRO_V1V2_VARIAD(adjacent_difference, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{}); - TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{}); + TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{}); + TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{}); #ifndef KOKKOS_ENABLE_OPENMPTARGET - TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{}, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{}, TrivialBinaryFunctor<T>()); - - TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_exclusive_scan, T{}, + TEST_ALGO_MACRO_B1E1B2_VARIAD(exclusive_scan, T{}, + TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(exclusive_scan, T{}, TrivialBinaryFunctor<T>()); + + TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_exclusive_scan, T{}, + TrivialBinaryFunctor<T>(), + TrivialUnaryFunctor<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(transform_exclusive_scan, T{}, TrivialBinaryFunctor<T>(), TrivialUnaryFunctor<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(transform_exclusive_scan, T{}, - TrivialBinaryFunctor<T>(), - TrivialUnaryFunctor<T>()); #endif - TEST_ALGO_MACRO_B1E1B2(inclusive_scan); - TEST_ALGO_MACRO_V1V2(inclusive_scan); + TEST_ALGO_MACRO_B1E1B2(inclusive_scan); + TEST_ALGO_MACRO_V1V2(inclusive_scan); #ifndef KOKKOS_ENABLE_OPENMPTARGET - TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>()); - TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>(), T{}); - TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>(), T{}); - - TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_inclusive_scan, + TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>()); + TEST_ALGO_MACRO_B1E1B2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>(), + T{}); + TEST_ALGO_MACRO_V1V2_VARIAD(inclusive_scan, TrivialBinaryFunctor<T>(), T{}); + + TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_inclusive_scan, + TrivialBinaryFunctor<T>(), + TrivialUnaryFunctor<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan, TrivialBinaryFunctor<T>(), TrivialUnaryFunctor<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan, - TrivialBinaryFunctor<T>(), - TrivialUnaryFunctor<T>()); - TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_inclusive_scan, + TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_inclusive_scan, + TrivialBinaryFunctor<T>(), + TrivialUnaryFunctor<T>(), T{}); + TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan, TrivialBinaryFunctor<T>(), TrivialUnaryFunctor<T>(), T{}); - TEST_ALGO_MACRO_V1V2_VARIAD(transform_inclusive_scan, - TrivialBinaryFunctor<T>(), - TrivialUnaryFunctor<T>(), T{}); #endif #ifndef KOKKOS_ENABLE_OPENMPTARGET - TEST_ALGO_MACRO_B1E1(reduce); - TEST_ALGO_MACRO_V1(reduce); - TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{}); - TEST_ALGO_MACRO_V1_VARIAD(reduce, T{}); - TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{}, TrivialReduceJoinFunctor<T>()); - TEST_ALGO_MACRO_V1_VARIAD(reduce, T{}, TrivialReduceJoinFunctor<T>()); - - TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_reduce, T{}); - TEST_ALGO_MACRO_V1V2_VARIAD(transform_reduce, T{}); - TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_reduce, T{}, + TEST_ALGO_MACRO_B1E1(reduce); + TEST_ALGO_MACRO_V1(reduce); + TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{}); + TEST_ALGO_MACRO_V1_VARIAD(reduce, T{}); + TEST_ALGO_MACRO_B1E1_VARIAD(reduce, T{}, TrivialReduceJoinFunctor<T>()); + TEST_ALGO_MACRO_V1_VARIAD(reduce, T{}, TrivialReduceJoinFunctor<T>()); + + TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_reduce, T{}); + TEST_ALGO_MACRO_V1V2_VARIAD(transform_reduce, T{}); + TEST_ALGO_MACRO_B1E1B2_VARIAD(transform_reduce, T{}, + TrivialReduceJoinFunctor<T>(), + TrivialTransformReduceBinaryTransformer<T>()); + TEST_ALGO_MACRO_V1V2_VARIAD(transform_reduce, T{}, TrivialReduceJoinFunctor<T>(), TrivialTransformReduceBinaryTransformer<T>()); - TEST_ALGO_MACRO_V1V2_VARIAD(transform_reduce, T{}, - TrivialReduceJoinFunctor<T>(), - TrivialTransformReduceBinaryTransformer<T>()); - TEST_ALGO_MACRO_B1E1_VARIAD(transform_reduce, T{}, + TEST_ALGO_MACRO_B1E1_VARIAD(transform_reduce, T{}, + TrivialReduceJoinFunctor<T>(), + TrivialTransformReduceUnaryTransformer<T>()); + TEST_ALGO_MACRO_V1_VARIAD(transform_reduce, T{}, TrivialReduceJoinFunctor<T>(), TrivialTransformReduceUnaryTransformer<T>()); - TEST_ALGO_MACRO_V1_VARIAD(transform_reduce, T{}, - TrivialReduceJoinFunctor<T>(), - TrivialTransformReduceUnaryTransformer<T>()); #endif -} + } +}; } // namespace compileonly } // namespace stdalgos diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp index 3eb13c98c4577c315ac2d7232b9b69969f541c1a..5d55199801217f0a43ce8d53e94e90d11c8ff445 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsConstraints.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp index d5758e2438bac69d146068b36b110be72b5d263a..e21d50f69b9e001685aa62e45f023e6b2ac62782 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCopyIf.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp index 4c92a990595bb6a4ef5dced69531fa4f22da49d2..9423d2e15a46fe550282bf2b2106037610c18b6c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsCount.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <algorithm> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp index e5b1e8514db8b175fa7b1c4ff078c5516099680c..ef0209b345920121c2c94c5f43aa715f07b22d4c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsEqual.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <algorithm> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp index e470ee86204bde1098d1064dd0713090dbc7a907..4969541a023bed06076120ff09e6187048041bdb 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsExclusiveScan.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp index 35b232e94fb9baf6ce832c26e5815cf0b8fd40e9..3b8b5e85af408a023e1ad0033288270496646d3f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFind.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <iterator> @@ -179,6 +151,12 @@ void run_all_scenarios() { } TEST(std_algorithms_find_test, test) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_all_scenarios<DynamicTag, double>(); run_all_scenarios<StridedTwoTag, int>(); run_all_scenarios<StridedThreeTag, unsigned>(); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp index 2a6d271856a978366aa8c052583219fe3b22fac3..ddc4bc1ba676e62b6fc04b07b092b1a39a4a9d49 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindEnd.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> @@ -376,6 +348,12 @@ void run_all_scenarios() { } TEST(std_algorithms_non_mod_seq_ops, find_end) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_all_scenarios<DynamicTag, int>(); run_all_scenarios<StridedThreeTag, int>(); } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp index 84892bc37645407a4e0c9895782f3a51c65354f0..c2f7a2fdb8f8287040013a375d7ec52fe9202e1b 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsFindFirstOf.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> @@ -292,6 +264,12 @@ void run_all_scenarios() { } TEST(std_algorithms_non_mod_seq_ops, find_first_of) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_all_scenarios<DynamicTag, int>(); run_all_scenarios<StridedThreeTag, int>(); } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp index 79badc7c4f75b1dcd3f52f3abf87e6615ee198e3..83b44f01aa7d825acc1ec72c0945cbedd32a91a8 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsForEach.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <algorithm> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp index 882a6012ebb27afd9bf2e81991e33ae3776168cb..a2a31f1f65a11b78f41adfc491359c034c183cff 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsHelperFunctors.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_HELPERS_FUNCTORS_HPP #define KOKKOS_ALGORITHMS_UNITTESTS_TEST_STD_ALGOS_HELPERS_FUNCTORS_HPP diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp index 173fbed660f4b50d8ef8f7968fb3e20ef9f1f560..510f1d195a19b412abfb4baa522f416e5ca6f796 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsInclusiveScan.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp index b0df935392f8bd39ea49fb7d2614fc3f75cae10d..f31d49e06b4ad297d2de370b08bb6967a292d90d 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSorted.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp index 7f0071e248b952db0e3f8630a45cb8bf7d16a640..ce8669a84f237ec519a310c657e5d14128ca1ab4 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsIsSortedUntil.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> @@ -213,6 +185,12 @@ void run_is_sorted_until_all_scenarios() { } TEST(std_algorithms_sorting_ops_test, is_sorted_until) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_is_sorted_until_all_scenarios<DynamicTag, double>(); run_is_sorted_until_all_scenarios<StridedTwoTag, double>(); run_is_sorted_until_all_scenarios<StridedThreeTag, double>(); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp index 8bfa51b4f54b6413855e3bac527ec0d90e9e4032..2acd4934accf621a01e820c9b7c398dee91faf13 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsLexicographicalCompare.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <algorithm> @@ -168,6 +140,12 @@ void run_all_scenarios() { } TEST(std_algorithms_lexicographical_compare_test, test) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif // FIXME: should this disable only custom comparator tests? #if !defined KOKKOS_ENABLE_OPENMPTARGET run_all_scenarios<DynamicTag, double>(); diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp index 56819de8c100f88958d9aafaa43b24017801fffb..f8634ffafe2818b4138927e812e326c5cd9e172f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMinMaxElementOps.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp index 4bc4e018b498eaffa9d9db88db8a84e82e9f254f..bb4b6fb2a2ac1ecbb078962012d17295c3a421c4 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMismatch.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <iterator> @@ -217,6 +189,12 @@ void run_all_scenarios() { } TEST(std_algorithms_mismatch_test, test) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_all_scenarios<DynamicTag, double>(); run_all_scenarios<StridedThreeTag, int>(); } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp index 8d4f604037d302327961c82b2020ef99bacef24e..4fce044bcf76a4cbe380196f00f50e50ac55f87d 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModOps.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp index 1e3960c5e690dd7b7b13cb1b7946d847d0912438..6b806d7bc5c05bc4250389ee43f4a6cb81e06c3c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsModSeqOps.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp index 002d35466127470ff78616de34497da2e1ac3c98..635714eb5451f52bbbcfbe5867b555ee826a4db3 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsMoveBackward.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp index 0ea5fcc99ad319eb337cc992c75a829660801c37..288a67c36956d7c939210bd70d6fb30bf1d9d46b 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsNumerics.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp index a461f275154e06b4f39c414787309f464a3a4529..0399e9eee4d42290299e254a0cbd40ba941efc1e 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitionCopy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp index 0d46151559031937fac59bf9e18effac9a4c6604..1bfb536c2c750d582116e840d9a663bfbee8fff3 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsPartitioningOps.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> @@ -176,6 +148,12 @@ struct std_algorithms_partitioning_test : public std_algorithms_test { }; TEST_F(std_algorithms_partitioning_test, is_partitioned_trivial) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif IsNegativeFunctor<value_type> p; const auto result1 = KE::is_partitioned(exespace(), KE::cbegin(m_static_view), KE::cbegin(m_static_view), p); @@ -191,6 +169,12 @@ TEST_F(std_algorithms_partitioning_test, is_partitioned_trivial) { } TEST_F(std_algorithms_partitioning_test, is_partitioned_accepting_iterators) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif const IsNegativeFunctor<value_type> p; for (int id = 0; id < FixtureViews::Count; ++id) { @@ -212,6 +196,12 @@ TEST_F(std_algorithms_partitioning_test, is_partitioned_accepting_iterators) { } TEST_F(std_algorithms_partitioning_test, is_partitioned_accepting_view) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif const IsNegativeFunctor<value_type> p; for (int id = 0; id < FixtureViews::Count; ++id) { @@ -230,6 +220,12 @@ TEST_F(std_algorithms_partitioning_test, is_partitioned_accepting_view) { } TEST_F(std_algorithms_partitioning_test, partition_point) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif const IsNegativeFunctor<value_type> p; for (int id = 0; id < FixtureViews::Count; ++id) { diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp index 8f345f044e437ca65ab9938f7da58423fe9e0ab4..8832d71f9537163d4bb5697888202ee98f5504e3 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemove.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp index bb7d0b52bd387d4d3e3237a63536f77ecde1f153..949f8f60c938cfe315ea32ea4f04941551a2ac77 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp index b209b88ea968cb672f76f1827742aa9bac22f415..9dc1e4a7e164299693f83407b0736cdcd4e2909d 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveCopyIf.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp index f1f232369b87f8757292d3d8c54fa55a700eb92d..e9d15f29d88415c03c9d66866375fa781e371ecb 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRemoveIf.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp index f044d975a7ce47402b6a4bb92f94158e4a86d4e9..b226de5535fee97c9f1679407a27c02fc06f5f52 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplace.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp index 682622cc13cd97e53e4a710c17d1cde89cc695ea..16b181fdd220a026ad5e62646e2e6af7e9e6cab5 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp index c2ba66e920da8dd61a091fe3d842427c352a2ce7..a402e30ad9c02066ef2a7f7e263bc430fc709512 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceCopyIf.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp index 7237e29555afbda7e595cdfbb7f8750428942c5d..f481144e1ce36a4884a0b83f295681c8ed27b29b 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReplaceIf.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp index f8c81dc105a8986791e79316f3b36fc5bca92c35..7d16e54029d35885bec3e71108d463812aee57e7 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsReverse.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp index bbf273970efe23d61f960c963369740ba91e5890..a5a6f99bac36f2f1e30f44831bbfab47a1a61a5c 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotate.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp index 2012fde00860636d084cf096471589eae8a25751..27451a1d04953384b488b06ea0086db343f088a5 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsRotateCopy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp index e57385a8be6d17db10178f343bfe7026d199633b..ab4bf50713633a81b98d5745f054225644200cc6 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> @@ -353,6 +325,12 @@ void run_all_scenarios() { } TEST(std_algorithms_non_mod_seq_ops, search) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_all_scenarios<DynamicTag, int>(); run_all_scenarios<StridedThreeTag, int>(); } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp index 31446046a597d2593fa20e106975ca06d141abd2..a6fe9c1e896c5f92055dfed6230dea00999c3dd7 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsSearch_n.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> @@ -325,6 +297,12 @@ void run_all_scenarios() { } TEST(std_algorithms_non_mod_seq_ops, search_n) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<exespace, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif run_all_scenarios<DynamicTag, int>(); run_all_scenarios<StridedThreeTag, int>(); } diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp index 0c97f255e9cc8552757652e2d40e5f45f921aaeb..8e4ced963584b1afc7650bcbd0a5241902f3f212 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftLeft.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp index d8aa350f1dd822cf8cd7a6de7ee5d879757ca270..a1614be027b474537199975052965929ab3016af 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsShiftRight.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp index e415eff06cff08a3bacf3e5c02e3f0564b83f4cb..70c04dbafa2979938091dd8a8268715c9601d1c1 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformExclusiveScan.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp index 21ce01fb10428cf16af5c7576c7503fba6e699a1..80ff8132519b22b56b24f8e26b96a525f6495364 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformInclusiveScan.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp index 35c293adcfff0947910ef09b633c15fbb9bb1bc3..dab81b8f1e3bb536a3635bde98b072909a1e31cc 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsTransformUnaryOp.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp index 88dd4d259926c5f078188d2974c920c57249f508..a810d31d820266294a9cdf57121d7606c9588d07 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUnique.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp index fdede951701de39c0e55635667b90688e8fb867a..f609d8517e642fa5b1a2cff420475468e0a1099f 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdAlgorithmsUniqueCopy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestStdAlgorithmsCommon.hpp> #include <utility> diff --git a/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp b/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp index a88860749c8a8b8ff41a2b62b09ca596ef96aabb..3847e1e6a3663c0aca1418638dd111e3e787fea3 100644 --- a/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp +++ b/packages/kokkos/algorithms/unit_tests/TestStdReducers.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp b/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp index e245aad35fc33a595a16f711dbd4a63a0c7f8948..11a1cb717a3414b42aec8cda20e13be5ab99ce09 100644 --- a/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp +++ b/packages/kokkos/algorithms/unit_tests/UnitTestMain.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/appveyor.yml b/packages/kokkos/appveyor.yml index e63fec718ae74e3c935de791e2ce099ab12ccca8..ceb33bf4410f44fcb4be98d9c029122a7168df5a 100644 --- a/packages/kokkos/appveyor.yml +++ b/packages/kokkos/appveyor.yml @@ -5,6 +5,6 @@ build_script: - cmd: >- mkdir build && cd build && - cmake c:\projects\source -DKokkos_ENABLE_TESTS=ON -DCMAKE_CXX_FLAGS="/W0 /EHsc" -DKokkos_ENABLE_DEPRECATED_CODE_3=ON -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF -DKokkos_ARCH_NATIVE=ON && + cmake c:\projects\source -DKokkos_ENABLE_TESTS=ON -DKokkos_ENABLE_BENCHMARKS=ON -DCMAKE_CXX_FLAGS="/W0 /EHsc" -DKokkos_ENABLE_DEPRECATED_CODE_4=ON -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF && cmake --build . --target install && ctest -C Debug --output-on-failure diff --git a/packages/kokkos/benchmarks/atomic/main.cpp b/packages/kokkos/benchmarks/atomic/main.cpp index 6e32c6fe641a1c6f2c78c3bc6a5755149aa3ade2..af1b96f27dd169f6615178a3b92591995952d8a8 100644 --- a/packages/kokkos/benchmarks/atomic/main.cpp +++ b/packages/kokkos/benchmarks/atomic/main.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <Kokkos_Core.hpp> #include <Kokkos_Timer.hpp> #include <Kokkos_Random.hpp> diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp index be190e868ea06ac60f57a30ca29cb9aa71e6f97f..2589fd7309b29244c764b61b0335f3a0f2d756f9 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Timer.hpp> diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp index 73ad21b05cee90d8e55a0a1aa8af4cf5ef42812f..f955c996660a9ccefa3b0084f12ff140d3bfcebd 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_double.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <bench.hpp> diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp index 3964df3fa8e15fd9274b208de40dfc085632a3b2..137ff67d40408f0ff19ef7ed174adf1b7cbd0194 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_float.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <bench.hpp> diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp index d63c3080775c5c9d5bc39e3416fc783a3270749d..29ccec014149592652247e33bf9e864a50f67bb3 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_int32_t.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <bench.hpp> diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp index 51a31b16f0a88187e725fced27ff05baa367d318..c153d5eff3974fb63b84121346ea20ff96ae9361 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_int64_t.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <bench.hpp> diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp index c29f2a18c34bfc66ae04762e123fcb0f0b6d0931..b63d486fc9e40a9b327be6316cf0e44387adee64 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_stride.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #define UNROLL 1 #include <bench_unroll_stride.hpp> diff --git a/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp b/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp index 58bf17b0bb8dc0f5a71b469d5c40aa82f4195c31..0f7a298c1bb66758e991727b1f021247a7b133ec 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/bench_unroll_stride.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ template <class Scalar> struct Run<Scalar, UNROLL, STRIDE> { @@ -66,25 +38,25 @@ struct Run<Scalar, UNROLL, STRIDE> { Scalar a1 = A(n, i, 0); const Scalar b = B(n, i, 0); #if (UNROLL > 1) - Scalar a2 = a1 * 1.3; + Scalar a2 = a1 * static_cast<Scalar>(1.3); #endif #if (UNROLL > 2) - Scalar a3 = a2 * 1.1; + Scalar a3 = a2 * static_cast<Scalar>(1.1); #endif #if (UNROLL > 3) - Scalar a4 = a3 * 1.1; + Scalar a4 = a3 * static_cast<Scalar>(1.1); #endif #if (UNROLL > 4) - Scalar a5 = a4 * 1.3; + Scalar a5 = a4 * static_cast<Scalar>(1.3); #endif #if (UNROLL > 5) - Scalar a6 = a5 * 1.1; + Scalar a6 = a5 * static_cast<Scalar>(1.1); #endif #if (UNROLL > 6) - Scalar a7 = a6 * 1.1; + Scalar a7 = a6 * static_cast<Scalar>(1.1); #endif #if (UNROLL > 7) - Scalar a8 = a7 * 1.1; + Scalar a8 = a7 * static_cast<Scalar>(1.1); #endif for (int f = 0; f < F; f++) { diff --git a/packages/kokkos/benchmarks/bytes_and_flops/main.cpp b/packages/kokkos/benchmarks/bytes_and_flops/main.cpp index b26b8ef5ed83fa4a8fae302a7664013e049e69bc..20077757d1ffa4557bf404ee8be4976edcf79cf8 100644 --- a/packages/kokkos/benchmarks/bytes_and_flops/main.cpp +++ b/packages/kokkos/benchmarks/bytes_and_flops/main.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Timer.hpp> diff --git a/packages/kokkos/benchmarks/gather/gather.hpp b/packages/kokkos/benchmarks/gather/gather.hpp index 239614184ba13aad35fe54190ce5eaf507c61fde..d83461702c7863130803be76276a3d15abab571d 100644 --- a/packages/kokkos/benchmarks/gather/gather.hpp +++ b/packages/kokkos/benchmarks/gather/gather.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ template <class Scalar, int UNROLL> struct RunGather { diff --git a/packages/kokkos/benchmarks/gather/gather_unroll.hpp b/packages/kokkos/benchmarks/gather/gather_unroll.hpp index 4dc046f99c33125f86d7674f61b38b77caff99c2..5ee5742a3f72f7baa76936ace5e863275700c104 100644 --- a/packages/kokkos/benchmarks/gather/gather_unroll.hpp +++ b/packages/kokkos/benchmarks/gather/gather_unroll.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Random.hpp> diff --git a/packages/kokkos/benchmarks/gather/main.cpp b/packages/kokkos/benchmarks/gather/main.cpp index dd502faaa480c1c7ab9936e4f032095094e714bb..7f4fc9ede6ce1c1c7b2dced824a19b984a4bc421 100644 --- a/packages/kokkos/benchmarks/gather/main.cpp +++ b/packages/kokkos/benchmarks/gather/main.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Timer.hpp> diff --git a/packages/kokkos/benchmarks/gups/gups-kokkos.cpp b/packages/kokkos/benchmarks/gups/gups-kokkos.cpp index 5a3ad23800f8f20d7a66eaad4c509938fc23c778..97c339d09d8bb052251919d15b8690c040e14924 100644 --- a/packages/kokkos/benchmarks/gups/gups-kokkos.cpp +++ b/packages/kokkos/benchmarks/gups/gups-kokkos.cpp @@ -1,44 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// ************************************************************************ //@HEADER -*/ #include "Kokkos_Core.hpp" #include <cstdio> diff --git a/packages/kokkos/benchmarks/policy_performance/main.cpp b/packages/kokkos/benchmarks/policy_performance/main.cpp index da49cdb019a86eeb193555fdc383df800b31bcfe..28cfde552a59c987efe83d140de379dd893b2891 100644 --- a/packages/kokkos/benchmarks/policy_performance/main.cpp +++ b/packages/kokkos/benchmarks/policy_performance/main.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include "policy_perf_test.hpp" diff --git a/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp b/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp index 8e6cd7447dbbdde87911d88cf4b0d0c6f9ca3a75..cc2cc40257b86cf0813b8dca6d64733b14ae2ba8 100644 --- a/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp +++ b/packages/kokkos/benchmarks/policy_performance/policy_perf_test.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/benchmarks/stream/stream-kokkos.cpp b/packages/kokkos/benchmarks/stream/stream-kokkos.cpp index 311947c197cba64e8354dc63743baa99b0bfa782..24c598ffad83afd155bfaf6caf407c139c850da9 100644 --- a/packages/kokkos/benchmarks/stream/stream-kokkos.cpp +++ b/packages/kokkos/benchmarks/stream/stream-kokkos.cpp @@ -1,44 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// ************************************************************************ //@HEADER -*/ #include "Kokkos_Core.hpp" #include <cstdio> diff --git a/packages/kokkos/bin/hpcbind b/packages/kokkos/bin/hpcbind index 9da3d994698ebe6554cc21222e153098a8d39d83..cb2af2c4b51ef1f25f8fd9c615b8c7f065d49457 100755 --- a/packages/kokkos/bin/hpcbind +++ b/packages/kokkos/bin/hpcbind @@ -586,8 +586,6 @@ if [[ ${HPCBIND_TEE} -eq 0 || ${HPCBIND_VERBOSE} -eq 0 ]]; then echo "${TMP_ENV}" | grep -E "^GOMP_" >> ${HPCBIND_LOG} echo "[KMP] (icc, icpc, and ifort)" >> ${HPCBIND_LOG} echo "${TMP_ENV}" | grep -E "^KMP_" >> ${HPCBIND_LOG} - echo "[XLSMPOPTS] (xlc, xlc++, and xlf)" >> ${HPCBIND_LOG} - echo "${TMP_ENV}" | grep -E "^XLSMPOPTS" >> ${HPCBIND_LOG} if [[ ${HPCBIND_HAS_HWLOC} -eq 1 ]]; then echo "[BINDINGS]" >> ${HPCBIND_LOG} @@ -610,8 +608,6 @@ else echo "${TMP_ENV}" | grep -E "^GOMP_" > >(tee -a ${HPCBIND_LOG}) echo "[KMP] (icc, icpc, and ifort)" > >(tee -a ${HPCBIND_LOG}) echo "${TMP_ENV}" | grep -E "^KMP_" > >(tee -a ${HPCBIND_LOG}) - echo "[XLSMPOPTS] (xlc, xlc++, and xlf)" > >(tee -a ${HPCBIND_LOG}) - echo "${TMP_ENV}" | grep -E "^XLSMPOPTS" > >(tee -a ${HPCBIND_LOG}) if [[ ${HPCBIND_HAS_HWLOC} -eq 1 ]]; then echo "[BINDINGS]" > >(tee -a ${HPCBIND_LOG}) diff --git a/packages/kokkos/bin/nvcc_wrapper b/packages/kokkos/bin/nvcc_wrapper index e1a208813863515b88cce5399f53c79239d4c0fe..0c55651460ad9570fd0815c078e833e39c6d99aa 100755 --- a/packages/kokkos/bin/nvcc_wrapper +++ b/packages/kokkos/bin/nvcc_wrapper @@ -10,10 +10,12 @@ # Default settings: change those according to your machine. For # example, you may have have two different wrappers with either icpc # or g++ as their back-end compiler. The defaults can be overwritten -# by using the usual arguments (e.g., -arch=sm_30 -ccbin icpc). +# by using the usual arguments (e.g., -arch=sm_80 -ccbin icpc). +# sm_70 is supported by every CUDA version from 9-12 and is thus +# chosen as default -default_arch="sm_35" -#default_arch="sm_50" +default_arch="sm_70" +#default_arch="sm_80" # # The default C++ compiler. @@ -227,11 +229,11 @@ do fi ;; #Handle known nvcc args - --dryrun|--verbose|--keep|--source-in-ptx|-src-in-ptx|--keep-dir*|-G|-lineinfo|-expt-extended-lambda|-expt-relaxed-constexpr|--resource-usage|--fmad=*|--use_fast_math|--Wext-lambda-captures-this|-Wext-lambda-captures-this) + --dryrun|--verbose|--keep|--source-in-ptx|-src-in-ptx|--keep-dir*|-G|-lineinfo|-extended-lambda|-expt-extended-lambda|-expt-relaxed-constexpr|--resource-usage|--fmad=*|--use_fast_math|--Wext-lambda-captures-this|-Wext-lambda-captures-this) cuda_args="$cuda_args $1" ;; #Handle more known nvcc args - --expt-extended-lambda|--expt-relaxed-constexpr|--Wno-deprecated-gpu-targets|-Wno-deprecated-gpu-targets|-allow-unsupported-compiler|--allow-unsupported-compiler) + --extended-lambda|--expt-extended-lambda|--expt-relaxed-constexpr|--Wno-deprecated-gpu-targets|-Wno-deprecated-gpu-targets|-allow-unsupported-compiler|--allow-unsupported-compiler) cuda_args="$cuda_args $1" ;; #Handle known nvcc args that have an argument @@ -336,6 +338,24 @@ do std_flag=$corrected_std_flag shared_args="$shared_args $std_flag" ;; + --std=c++20|-std=c++20) + if [ -n "$std_flag" ]; then + warn_std_flag + shared_args=${shared_args/ $std_flag/} + fi + # NVCC only has C++20 from version 12 on + cuda_main_version=$([[ $(${nvcc_compiler} --version) =~ V([0-9]+) ]] && echo ${BASH_REMATCH[1]}) + if [ ${cuda_main_version} -lt 12 ]; then + fallback_std_flag="-std=c++14" + # this is hopefully just occurring in a downstream project during CMake feature tests + # we really have no choice here but to accept the flag and change to an accepted C++ standard + echo "nvcc_wrapper does not accept standard flags $1 since partial standard flags and standards after C++14 are not supported. nvcc_wrapper will use $fallback_std_flag instead. It is undefined behavior to use this flag. This should only be occurring during CMake configuration." + std_flag=$fallback_std_flag + else + std_flag=$1 + fi + shared_args="$shared_args $std_flag" + ;; --std=c++17|-std=c++17) if [ -n "$std_flag" ]; then warn_std_flag diff --git a/packages/kokkos/cmake/Dependencies.cmake b/packages/kokkos/cmake/Dependencies.cmake index 10df9fe45694f7ed74e75fac1127af4b72bc3c02..23b473ce2471c44c67d2fc4b004500b293dd9ef5 100644 --- a/packages/kokkos/cmake/Dependencies.cmake +++ b/packages/kokkos/cmake/Dependencies.cmake @@ -1,14 +1,3 @@ -IF (CMAKE_CXX_STANDARD GREATER_EQUAL 17) - SET(KOKKOS_SIMD_TEST_CLASS PT) -ELSE() - SET(KOKKOS_SIMD_TEST_CLASS EX) - IF (${PROJECT_NAME}_ENABLE_KokkosSimd) - MESSAGE(WARNING "KokkosSimd is explicitly enabled but C++17 is not available") - ELSE() - MESSAGE(STATUS "Disabling KokkosSimd by default because C++17 is not available") - ENDIF() -ENDIF() - TRIBITS_PACKAGE_DEFINE_DEPENDENCIES( SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS #SubPackageName Directory Class Req/Opt @@ -17,5 +6,5 @@ TRIBITS_PACKAGE_DEFINE_DEPENDENCIES( Core core PS REQUIRED Containers containers PS OPTIONAL Algorithms algorithms PS OPTIONAL - Simd simd ${KOKKOS_SIMD_TEST_CLASS} OPTIONAL + Simd simd PT OPTIONAL ) diff --git a/packages/kokkos/cmake/KokkosConfigCommon.cmake.in b/packages/kokkos/cmake/KokkosConfigCommon.cmake.in index 23bc86cc8417080d718f01753ffa5f896d6ab8d5..bb5ce5ff8191fc9f3d75a92d4c1aee3df4258141 100644 --- a/packages/kokkos/cmake/KokkosConfigCommon.cmake.in +++ b/packages/kokkos/cmake/KokkosConfigCommon.cmake.in @@ -14,10 +14,6 @@ ENDFOREACH() IF(NOT Kokkos_FIND_QUIETLY) MESSAGE(STATUS "Enabled Kokkos devices: ${Kokkos_DEVICES}") ENDIF() -IF(Kokkos_ENABLE_THREADS AND NOT DEPRECATED_CODE_3 IN_LIST Kokkos_OPTIONS) # for backward compatibility - SET(Kokkos_ENABLE_PTHREAD ON) - LIST(APPEND Kokkos_DEVICES PTHREAD) -ENDIF() IF (Kokkos_ENABLE_CUDA) # If we are building CUDA, we have tricked CMake because we declare a CXX project diff --git a/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in b/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in index 8d1eee31b2a78754e599acc4de4b80ca32dd9d06..73fa0b736c6dd2d52aa2c291a07298780b995f4f 100644 --- a/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in +++ b/packages/kokkos/cmake/KokkosCore_Config_HeaderSet.in @@ -2,45 +2,20 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER */ + #ifndef @HEADER_GUARD_TAG@ #define @HEADER_GUARD_TAG@ diff --git a/packages/kokkos/cmake/KokkosCore_config.h.in b/packages/kokkos/cmake/KokkosCore_config.h.in index 88ddc483786112ca0e70f418921d89ae102b9dde..cb1affa24c3ee257585e7b3de00a9409e39c9226 100644 --- a/packages/kokkos/cmake/KokkosCore_config.h.in +++ b/packages/kokkos/cmake/KokkosCore_config.h.in @@ -9,7 +9,10 @@ // KOKKOS_VERSION % 100 is the patch level // KOKKOS_VERSION / 100 % 100 is the minor version // KOKKOS_VERSION / 10000 is the major version -#cmakedefine KOKKOS_VERSION @KOKKOS_VERSION@ +#define KOKKOS_VERSION @KOKKOS_VERSION@ +#define KOKKOS_VERSION_MAJOR @KOKKOS_VERSION_MAJOR@ +#define KOKKOS_VERSION_MINOR @KOKKOS_VERSION_MINOR@ +#define KOKKOS_VERSION_PATCH @KOKKOS_VERSION_PATCH@ /* Execution Spaces */ #cmakedefine KOKKOS_ENABLE_SERIAL @@ -25,15 +28,14 @@ #cmakedefine KOKKOS_ENABLE_SYCL /* General Settings */ -#cmakedefine KOKKOS_ENABLE_CXX14 #cmakedefine KOKKOS_ENABLE_CXX17 #cmakedefine KOKKOS_ENABLE_CXX20 +#cmakedefine KOKKOS_ENABLE_CXX23 #cmakedefine KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE #cmakedefine KOKKOS_ENABLE_CUDA_UVM #cmakedefine KOKKOS_ENABLE_CUDA_LAMBDA #cmakedefine KOKKOS_ENABLE_CUDA_CONSTEXPR -#cmakedefine KOKKOS_ENABLE_CUDA_LDG_INTRINSIC #cmakedefine KOKKOS_ENABLE_IMPL_CUDA_MALLOC_ASYNC #cmakedefine KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE #cmakedefine KOKKOS_ENABLE_HIP_MULTIPLE_KERNEL_INSTANTIATIONS @@ -44,12 +46,14 @@ #cmakedefine KOKKOS_ENABLE_PROFILING_LOAD_PRINT #cmakedefine KOKKOS_ENABLE_TUNING #cmakedefine KOKKOS_ENABLE_DEPRECATED_CODE_3 +#cmakedefine KOKKOS_ENABLE_DEPRECATED_CODE_4 #cmakedefine KOKKOS_ENABLE_DEPRECATION_WARNINGS #cmakedefine KOKKOS_ENABLE_LARGE_MEM_TESTS #cmakedefine KOKKOS_ENABLE_COMPLEX_ALIGN #cmakedefine KOKKOS_ENABLE_IMPL_DESUL_ATOMICS #cmakedefine KOKKOS_OPT_RANGE_AGGRESSIVE_VECTORIZATION // deprecated #cmakedefine KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION +#cmakedefine KOKKOS_ENABLE_IMPL_MDSPAN /* TPL Settings */ #cmakedefine KOKKOS_ENABLE_HWLOC @@ -59,8 +63,6 @@ #cmakedefine KOKKOS_ENABLE_LIBQUADMATH #cmakedefine KOKKOS_IMPL_CUDA_CLANG_WORKAROUND -#cmakedefine KOKKOS_COMPILER_CUDA_VERSION @KOKKOS_COMPILER_CUDA_VERSION@ - #cmakedefine KOKKOS_ARCH_SSE42 #cmakedefine KOKKOS_ARCH_ARMV80 #cmakedefine KOKKOS_ARCH_ARMV8_THUNDERX @@ -82,6 +84,7 @@ #cmakedefine KOKKOS_ARCH_INTEL_GEN11 #cmakedefine KOKKOS_ARCH_INTEL_GEN12LP #cmakedefine KOKKOS_ARCH_INTEL_XEHP +#cmakedefine KOKKOS_ARCH_INTEL_PVC #cmakedefine KOKKOS_ARCH_INTEL_GPU #cmakedefine KOKKOS_ARCH_KEPLER #cmakedefine KOKKOS_ARCH_KEPLER30 @@ -102,11 +105,16 @@ #cmakedefine KOKKOS_ARCH_AMPERE #cmakedefine KOKKOS_ARCH_AMPERE80 #cmakedefine KOKKOS_ARCH_AMPERE86 +#cmakedefine KOKKOS_ARCH_ADA89 +#cmakedefine KOKKOS_ARCH_HOPPER +#cmakedefine KOKKOS_ARCH_HOPPER90 #cmakedefine KOKKOS_ARCH_AMD_ZEN #cmakedefine KOKKOS_ARCH_AMD_ZEN2 #cmakedefine KOKKOS_ARCH_AMD_ZEN3 #cmakedefine KOKKOS_ARCH_VEGA -#cmakedefine KOKKOS_ARCH_VEGA900 #cmakedefine KOKKOS_ARCH_VEGA906 #cmakedefine KOKKOS_ARCH_VEGA908 #cmakedefine KOKKOS_ARCH_VEGA90A +#cmakedefine KOKKOS_ARCH_NAVI +#cmakedefine KOKKOS_ARCH_NAVI1030 +#cmakedefine KOKKOS_ARCH_NAVI1100 diff --git a/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in b/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in new file mode 100644 index 0000000000000000000000000000000000000000..e9fabe8177e67d76c53f422e36e3057a9880a0fa --- /dev/null +++ b/packages/kokkos/cmake/Kokkos_Version_Info.cpp.in @@ -0,0 +1,30 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include "Kokkos_Version_Info.hpp" + +namespace Kokkos { +namespace Impl { + +std::string GIT_BRANCH = "@GIT_BRANCH@"; +std::string GIT_COMMIT_HASH = "@GIT_COMMIT_HASH@"; +std::string GIT_CLEAN_STATUS = "@GIT_CLEAN_STATUS@"; +std::string GIT_COMMIT_DESCRIPTION = "@GIT_COMMIT_DESCRIPTION@"; +std::string GIT_COMMIT_DATE = "@GIT_COMMIT_DATE@"; + +} // namespace Impl + +} // namespace Kokkos diff --git a/packages/kokkos/cmake/Kokkos_Version_Info.hpp b/packages/kokkos/cmake/Kokkos_Version_Info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ba605a301db4a7e3858c181781a6d331ef7c4517 --- /dev/null +++ b/packages/kokkos/cmake/Kokkos_Version_Info.hpp @@ -0,0 +1,34 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef GIT_VERSION_H +#define GIT_VERSION_H + +#include <string> + +namespace Kokkos { +namespace Impl { + +extern std::string GIT_BRANCH; +extern std::string GIT_COMMIT_HASH; +extern std::string GIT_CLEAN_STATUS; +extern std::string GIT_COMMIT_DESCRIPTION; +extern std::string GIT_COMMIT_DATE; + +} // namespace Impl +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake b/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake index be70b711e0f92ac9d99e3c3fdd2770430f6c2b68..70e0d6c454ad86bf9262495f9658253d79aa42ef 100644 --- a/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake +++ b/packages/kokkos/cmake/Modules/FindTPLLIBQUADMATH.cmake @@ -1 +1,18 @@ -KOKKOS_FIND_IMPORTED(LIBQUADMATH HEADER quadmath.h LIBRARY quadmath) +# gcc bundles libquadmath and doesn't need any extra link or include directories +# (which would not be contained in CMake's search paths anyway). +# Hence, try if the compiler supports libquadmath natively first before doing +# the standard package search. +SET(CMAKE_REQUIRED_LIBRARIES "quadmath") +INCLUDE(CheckCXXSourceCompiles) +CHECK_CXX_SOURCE_COMPILES(" + #include <quadmath.h> + int main(void){ + __float128 foo = ::sqrtq(123.456); + return foo; + }" + KOKKOS_QUADMATH_COMPILER_SUPPORT) +IF (KOKKOS_QUADMATH_COMPILER_SUPPORT) + KOKKOS_CREATE_IMPORTED_TPL(LIBQUADMATH INTERFACE LINK_LIBRARIES quadmath) +ELSE() + KOKKOS_FIND_IMPORTED(LIBQUADMATH HEADER quadmath.h LIBRARY quadmath) +ENDIF() diff --git a/packages/kokkos/cmake/Modules/FindTPLROCM.cmake b/packages/kokkos/cmake/Modules/FindTPLROCM.cmake index 512ad6ceb283dcd27f8db1dfb45f045f998d7875..aacdfcaf19cbb77dba00067bb818d9c065dbfe8b 100644 --- a/packages/kokkos/cmake/Modules/FindTPLROCM.cmake +++ b/packages/kokkos/cmake/Modules/FindTPLROCM.cmake @@ -3,9 +3,19 @@ include(FindPackageHandleStandardArgs) FIND_LIBRARY(AMD_HIP_LIBRARY amdhip64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib) FIND_LIBRARY(HSA_RUNTIME_LIBRARY hsa-runtime64 PATHS ENV ROCM_PATH PATH_SUFFIXES lib) -find_package_handle_standard_args(TPLROCM DEFAULT_MSG AMD_HIP_LIBRARY HSA_RUNTIME_LIBRARY) +# clang_rt.builtins is necessary to use half precision. The following code to +# find clang_rt.buitins is based on +# https://github.com/ROCm-Developer-Tools/HIP/blob/develop/hip-lang-config.cmake.in#L99-L111 +file(GLOB_RECURSE CLANG_RT_DIR "$ENV{ROCM_PATH}/llvm/lib/clang/*/lib/*/*clang_rt.builtins*") +FIND_LIBRARY(CLANG_RT_LIBRARY + NAMES + clang_rt.builtins + clang_rt.builtins-x86_64 + PATHS "${CLANG_RT_DIR}/..") + +find_package_handle_standard_args(TPLROCM DEFAULT_MSG AMD_HIP_LIBRARY HSA_RUNTIME_LIBRARY CLANG_RT_LIBRARY) kokkos_create_imported_tpl(ROCM INTERFACE - LINK_LIBRARIES ${HSA_RUNTIME_LIBRARY} ${AMD_HIP_LIBRARY} + LINK_LIBRARIES ${HSA_RUNTIME_LIBRARY} ${AMD_HIP_LIBRARY} ${CLANG_RT_LIBRARY} COMPILE_DEFINITIONS __HIP_ROCclr__ ) diff --git a/packages/kokkos/cmake/Modules/FindTPLTHREADS.cmake b/packages/kokkos/cmake/Modules/FindTPLTHREADS.cmake index 0e3c9f8dd6f978d9a43a8b88f7b0fd4aa3f9a352..ff0db5123f8e982806d92f62dae9da82413ba6ec 100644 --- a/packages/kokkos/cmake/Modules/FindTPLTHREADS.cmake +++ b/packages/kokkos/cmake/Modules/FindTPLTHREADS.cmake @@ -1,5 +1,5 @@ INCLUDE(FindPackageHandleStandardArgs) -INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/tpls/FindTPLPthread.cmake") +FIND_PACKAGE(Threads) IF (TARGET Threads::Threads) SET(FOUND_THREADS TRUE) @@ -11,5 +11,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TPLTHREADS DEFAULT_MSG FOUND_THREADS) #Only create the TPL if we succeed IF (FOUND_THREADS) KOKKOS_CREATE_IMPORTED_TPL(THREADS INTERFACE LINK_OPTIONS - ${TPL_Pthread_LIBRARIES}) + ${CMAKE_THREAD_LIBS_INIT}) ENDIF() diff --git a/packages/kokkos/cmake/build_env_info.cmake b/packages/kokkos/cmake/build_env_info.cmake new file mode 100644 index 0000000000000000000000000000000000000000..2cd169cba417e9194f8208a59cd8f590f0b0612f --- /dev/null +++ b/packages/kokkos/cmake/build_env_info.cmake @@ -0,0 +1,121 @@ +# https://jonathanhamberg.com/post/cmake-embedding-git-hash/ + +find_package(Git QUIET) + +SET(CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}) +SET(pre_configure_dir ${CMAKE_CURRENT_LIST_DIR}) +SET(post_configure_dir ${CMAKE_BINARY_DIR}/generated) + +SET(pre_configure_file ${pre_configure_dir}/Kokkos_Version_Info.cpp.in) +SET(post_configure_file ${post_configure_dir}/Kokkos_Version_Info.cpp) + +FUNCTION(check_git_write git_hash git_clean_status) + FILE( + WRITE + ${CMAKE_BINARY_DIR}/git-state.txt + "${git_hash}-${git_clean_status}") +ENDFUNCTION() + +FUNCTION(check_git_read git_hash) + IF(EXISTS ${CMAKE_BINARY_DIR}/git-state.txt) + FILE(STRINGS ${CMAKE_BINARY_DIR}/git-state.txt CONTENT) + LIST(GET CONTENT 0 var) + + message(DEBUG "Cached Git hash: ${var}") + SET(${git_hash} ${var} PARENT_SCOPE) + else() + SET(${git_hash} "INVALID" PARENT_SCOPE) + ENDIF() +ENDFUNCTION() + +FUNCTION(check_git_version) + IF(NOT EXISTS ${post_configure_dir}/Kokkos_Version_Info.hpp) + FILE( + COPY ${pre_configure_dir}/Kokkos_Version_Info.hpp + DESTINATION ${post_configure_dir}) + ENDIF() + + IF(NOT Git_FOUND OR NOT EXISTS ${KOKKOS_SOURCE_DIR}/.git) + configure_file(${pre_configure_file} ${post_configure_file} @ONLY) + return() + ENDIF() + + # Get the current working branch + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Get the latest commit description + execute_process( + COMMAND ${GIT_EXECUTABLE} show -s --format=%s + WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_DESCRIPTION + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Get the latest commit date + execute_process( + COMMAND ${GIT_EXECUTABLE} log -1 --format=%cI + WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Check if repo is dirty / clean + execute_process( + COMMAND ${GIT_EXECUTABLE} diff-index --quiet HEAD -- + WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} + RESULT_VARIABLE IS_DIRTY + OUTPUT_STRIP_TRAILING_WHITESPACE) + + IF(IS_DIRTY EQUAL 0) + SET(GIT_CLEAN_STATUS "CLEAN") + else() + SET(GIT_CLEAN_STATUS "DIRTY") + ENDIF() + + # Get the latest abbreviated commit hash of the working branch + execute_process( + COMMAND ${GIT_EXECUTABLE} log -1 --format=%h + WORKING_DIRECTORY ${KOKKOS_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE) + + check_git_read(GIT_HASH_CACHE) + + IF(NOT EXISTS ${post_configure_dir}) + file(MAKE_DIRECTORY ${post_configure_dir}) + ENDIF() + + # Only update the git_version.cpp if the hash has changed. This will + # prevent us from rebuilding the project more than we need to. + IF(NOT "${GIT_COMMIT_HASH}-${GIT_CLEAN_STATUS}" STREQUAL ${GIT_HASH_CACHE} + OR NOT EXISTS ${post_configure_file}) + # Set the GIT_HASH_CACHE variable so the next build won't have + # to regenerate the source file. + check_git_write(${GIT_COMMIT_HASH} ${GIT_CLEAN_STATUS}) + + configure_file(${pre_configure_file} ${post_configure_file} @ONLY) + message(STATUS "Configured git information in ${post_configure_file}") + ENDIF() +ENDFUNCTION() + +FUNCTION(check_git_setup) + add_custom_target( + AlwaysCheckGit COMMAND ${CMAKE_COMMAND} + -DRUN_CHECK_GIT_VERSION=1 + -DKOKKOS_SOURCE_DIR=${Kokkos_SOURCE_DIR} + -P ${CURRENT_LIST_DIR}/build_env_info.cmake + BYPRODUCTS ${post_configure_file}) + + add_library(impl_git_version ${CMAKE_BINARY_DIR}/generated/Kokkos_Version_Info.cpp) + target_include_directories(impl_git_version PUBLIC ${CMAKE_BINARY_DIR}/generated) + add_dependencies(impl_git_version AlwaysCheckGit) + + check_git_version() +ENDFUNCTION() + +# This is used to run this function from an external cmake process. +IF(RUN_CHECK_GIT_VERSION) + check_git_version() +ENDIF() diff --git a/packages/kokkos/cmake/compile_tests/clang_omp.cpp b/packages/kokkos/cmake/compile_tests/clang_omp.cpp index 60a5c522820cdb03cbde8a2cf3a796c57292b46b..153130f968edd0a4565cc477c636bc0dcdd9c261 100644 --- a/packages/kokkos/cmake/compile_tests/clang_omp.cpp +++ b/packages/kokkos/cmake/compile_tests/clang_omp.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <omp.h> int main(int, char**) { diff --git a/packages/kokkos/cmake/compile_tests/cplusplus14.cpp b/packages/kokkos/cmake/compile_tests/cplusplus14.cpp deleted file mode 100644 index 52ec9885ec3ed5f4e7c0871f59de3d651df33efe..0000000000000000000000000000000000000000 --- a/packages/kokkos/cmake/compile_tests/cplusplus14.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include <type_traits> - -int main() { - // _t versions of type traits were added in C++14 - std::remove_cv_t<int> i = 0; - - return i; -} diff --git a/packages/kokkos/cmake/compile_tests/cplusplus17.cpp b/packages/kokkos/cmake/compile_tests/cplusplus17.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b425d23adf81d443b8554291db1678a704737455 --- /dev/null +++ b/packages/kokkos/cmake/compile_tests/cplusplus17.cpp @@ -0,0 +1,25 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <type_traits> + +int main() { + // _v versions of type traits were added in C++17 + if constexpr (std::is_same_v<double, int>) + return 0; + else + return 1; +} diff --git a/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc b/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc index f56cef16510df4e1b49f13765b4306d2c2fe9420..b81c4218a91f6dc42d71ed98d4439af606db2af9 100644 --- a/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc +++ b/packages/kokkos/cmake/compile_tests/cuda_compute_capability.cc @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include <cuda_runtime_api.h> @@ -74,6 +46,8 @@ int main() { case 75: std::cout << "Set -DKokkos_ARCH_TURING75=ON ." << std::endl; break; case 80: std::cout << "Set -DKokkos_ARCH_AMPERE80=ON ." << std::endl; break; case 86: std::cout << "Set -DKokkos_ARCH_AMPERE86=ON ." << std::endl; break; + case 89: std::cout << "Set -DKokkos_ARCH_ADA89=ON ." << std::endl; break; + case 90: std::cout << "Set -DKokkos_ARCH_HOPPER90=ON ." << std::endl; break; default: std::cout << "Compute capability " << compute_capability << " is not supported" << std::endl; diff --git a/packages/kokkos/cmake/compile_tests/pthread.cpp b/packages/kokkos/cmake/compile_tests/pthread.cpp deleted file mode 100644 index 3f83bf6a5f7fe399fc4a44547792e738177facfb..0000000000000000000000000000000000000000 --- a/packages/kokkos/cmake/compile_tests/pthread.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include <pthread.h> - -void* kokkos_test(void* args) { return args; } - -int main() { - pthread_t thread; - /* Use NULL to avoid C++11. Some compilers - do not have C++11 by default. Forcing C++11 - in the compile tests can be done, but is unnecessary - */ - pthread_create(&thread, NULL, kokkos_test, NULL); - pthread_join(thread, NULL); - return 0; -} diff --git a/packages/kokkos/cmake/deps/CUDA.cmake b/packages/kokkos/cmake/deps/CUDA.cmake index beaf4e6d6cd922e5916dd5f1e35bf43f58bee7da..68bf5b3d5798266c784ee7586751a5ae9d24cd0e 100644 --- a/packages/kokkos/cmake/deps/CUDA.cmake +++ b/packages/kokkos/cmake/deps/CUDA.cmake @@ -1,41 +1,16 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ************************************************************************ # @HEADER diff --git a/packages/kokkos/cmake/deps/CUSPARSE.cmake b/packages/kokkos/cmake/deps/CUSPARSE.cmake index 073c40d8140157bb95aac681bf084da2aeadaf5d..b016971ab915021a31981d931e53fff9e483ce00 100644 --- a/packages/kokkos/cmake/deps/CUSPARSE.cmake +++ b/packages/kokkos/cmake/deps/CUSPARSE.cmake @@ -1,41 +1,16 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ************************************************************************ # @HEADER diff --git a/packages/kokkos/cmake/deps/HWLOC.cmake b/packages/kokkos/cmake/deps/HWLOC.cmake index f8402db00a7287e3a2526c7569ebd7387941da1b..77d5a9b83a649eea2204ae7a3a6be6c4207c27ef 100644 --- a/packages/kokkos/cmake/deps/HWLOC.cmake +++ b/packages/kokkos/cmake/deps/HWLOC.cmake @@ -1,41 +1,16 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ************************************************************************ # @HEADER diff --git a/packages/kokkos/cmake/deps/Pthread.cmake b/packages/kokkos/cmake/deps/Pthread.cmake index 639e4ef6975167f717c7de114b36d6642badd67d..e879bff3741db50ec13b2d71f89d1212015550ff 100644 --- a/packages/kokkos/cmake/deps/Pthread.cmake +++ b/packages/kokkos/cmake/deps/Pthread.cmake @@ -1,41 +1,16 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ************************************************************************ # @HEADER diff --git a/packages/kokkos/cmake/deps/quadmath.cmake b/packages/kokkos/cmake/deps/quadmath.cmake index 826f5021d359e99c2aed8b695de7b601dabaf453..6aef08e8812fe23de9cc9802a3f7c46730b4c60f 100644 --- a/packages/kokkos/cmake/deps/quadmath.cmake +++ b/packages/kokkos/cmake/deps/quadmath.cmake @@ -1,41 +1,16 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ************************************************************************ # @HEADER diff --git a/packages/kokkos/cmake/fake_tribits.cmake b/packages/kokkos/cmake/fake_tribits.cmake index f39457205735d1b94fd04382e98289d1c6ec54dd..71e85e915c6160ea5dee9c9d6a32c9852a0c39ba 100644 --- a/packages/kokkos/cmake/fake_tribits.cmake +++ b/packages/kokkos/cmake/fake_tribits.cmake @@ -117,7 +117,7 @@ FUNCTION(KOKKOS_ADD_TEST) if(TEST_TOOL) add_dependencies(${EXE} ${TEST_TOOL}) #make sure the exe has to build the tool foreach(TEST_ADDED ${ALL_TESTS_ADDED}) - set_property(TEST ${TEST_ADDED} APPEND PROPERTY ENVIRONMENT "KOKKOS_PROFILE_LIBRARY=$<TARGET_FILE:${TEST_TOOL}>") + set_property(TEST ${TEST_ADDED} APPEND PROPERTY ENVIRONMENT "KOKKOS_TOOLS_LIBS=$<TARGET_FILE:${TEST_TOOL}>") endforeach() endif() endif() diff --git a/packages/kokkos/cmake/kokkos_arch.cmake b/packages/kokkos/cmake/kokkos_arch.cmake index ef16aad047a96cfb31f3ae6c5ecaa93ff8175539..eb7c271b156e7345de39331968ef27d243fe250d 100644 --- a/packages/kokkos/cmake/kokkos_arch.cmake +++ b/packages/kokkos/cmake/kokkos_arch.cmake @@ -68,7 +68,7 @@ DECLARE_AND_CHECK_HOST_ARCH(ZEN "AMD Zen architecture") DECLARE_AND_CHECK_HOST_ARCH(ZEN2 "AMD Zen2 architecture") DECLARE_AND_CHECK_HOST_ARCH(ZEN3 "AMD Zen3 architecture") -IF(Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_OPENMPTARGET OR Kokkos_ENABLE_OPENACC OR Kokkos_ENABLE_UNSUPPORTED_ARCHS) +IF(Kokkos_ENABLE_CUDA OR Kokkos_ENABLE_OPENMPTARGET OR Kokkos_ENABLE_OPENACC OR Kokkos_ENABLE_SYCL) SET(KOKKOS_SHOW_CUDA_ARCHS ON) ENDIF() @@ -86,17 +86,27 @@ KOKKOS_ARCH_OPTION(VOLTA72 GPU "NVIDIA Volta generation CC 7.2" "KOKK KOKKOS_ARCH_OPTION(TURING75 GPU "NVIDIA Turing generation CC 7.5" "KOKKOS_SHOW_CUDA_ARCHS") KOKKOS_ARCH_OPTION(AMPERE80 GPU "NVIDIA Ampere generation CC 8.0" "KOKKOS_SHOW_CUDA_ARCHS") KOKKOS_ARCH_OPTION(AMPERE86 GPU "NVIDIA Ampere generation CC 8.6" "KOKKOS_SHOW_CUDA_ARCHS") +KOKKOS_ARCH_OPTION(ADA89 GPU "NVIDIA Ada generation CC 8.9" "KOKKOS_SHOW_CUDA_ARCHS") +KOKKOS_ARCH_OPTION(HOPPER90 GPU "NVIDIA Hopper generation CC 9.0" "KOKKOS_SHOW_CUDA_ARCHS") -IF(Kokkos_ENABLE_HIP OR Kokkos_ENABLE_OPENMPTARGET OR Kokkos_ENABLE_UNSUPPORTED_ARCHS) +IF(Kokkos_ENABLE_HIP OR Kokkos_ENABLE_OPENMPTARGET) SET(KOKKOS_SHOW_HIP_ARCHS ON) ENDIF() -KOKKOS_ARCH_OPTION(VEGA900 GPU "AMD GPU MI25 GFX900" "KOKKOS_SHOW_HIP_ARCHS") -KOKKOS_ARCH_OPTION(VEGA906 GPU "AMD GPU MI50/MI60 GFX906" "KOKKOS_SHOW_HIP_ARCHS") -KOKKOS_ARCH_OPTION(VEGA908 GPU "AMD GPU MI100 GFX908" "KOKKOS_SHOW_HIP_ARCHS") -KOKKOS_ARCH_OPTION(VEGA90A GPU "AMD GPU MI200 GFX90A" "KOKKOS_SHOW_HIP_ARCHS") +# AMD archs ordered in decreasing priority of autodetection +LIST(APPEND SUPPORTED_AMD_GPUS MI200 MI100 MI50/60 RX7900XTX V620/W6800) +LIST(APPEND SUPPORTED_AMD_ARCHS VEGA90A VEGA908 VEGA906 NAVI1100 NAVI1030) +LIST(APPEND CORRESPONDING_AMD_FLAGS gfx90a gfx908 gfx906 gfx1100 gfx1030) -IF(Kokkos_ENABLE_SYCL OR Kokkos_ENABLE_OPENMPTARGET OR Kokkos_ENABLE_UNSUPPORTED_ARCHS) +#FIXME CAN BE REPLACED WITH LIST_ZIP IN CMAKE 3.17 +FOREACH(ARCH IN LISTS SUPPORTED_AMD_ARCHS) + LIST(FIND SUPPORTED_AMD_ARCHS ${ARCH} LIST_INDEX) + LIST(GET SUPPORTED_AMD_GPUS ${LIST_INDEX} GPU) + LIST(GET CORRESPONDING_AMD_FLAGS ${LIST_INDEX} FLAG) + KOKKOS_ARCH_OPTION(${ARCH} GPU "AMD GPU ${GPU} ${FLAG}" "KOKKOS_SHOW_HIP_ARCHS") +ENDFOREACH() + +IF(Kokkos_ENABLE_SYCL OR Kokkos_ENABLE_OPENMPTARGET) SET(KOKKOS_SHOW_SYCL_ARCHS ON) ENDIF() @@ -137,7 +147,7 @@ IF(KOKKOS_ENABLE_COMPILER_WARNINGS) SET(GNU_WARNINGS "-Wempty-body" "-Wclobbered" "-Wignored-qualifiers" ${COMMON_WARNINGS}) - IF(KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7) + IF(KOKKOS_CXX_COMPILER_ID STREQUAL GNU) LIST(APPEND GNU_WARNINGS "-Wimplicit-fallthrough") ENDIF() @@ -160,9 +170,7 @@ GLOBAL_SET(KOKKOS_CUDA_OPTIONS) IF (KOKKOS_ENABLE_CUDA_LAMBDA) IF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA) GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-expt-extended-lambda") - IF(KOKKOS_COMPILER_CUDA_VERSION GREATER_EQUAL 110) - GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-Wext-lambda-captures-this") - ENDIF() + GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS "-Wext-lambda-captures-this") ENDIF() ENDIF() @@ -200,9 +208,6 @@ IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA) GLOBAL_APPEND(KOKKOS_CUDA_OPTIONS -lineinfo) ENDIF() UNSET(_UPPERCASE_CMAKE_BUILD_TYPE) - IF (KOKKOS_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0 AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 10.0) - GLOBAL_APPEND(KOKKOS_CUDAFE_OPTIONS --diag_suppress=esa_on_defaulted_function_ignored) - ENDIF() ENDIF() @@ -221,6 +226,10 @@ ENDIF() IF(KOKKOS_ARCH_NATIVE) + IF(KOKKOS_CXX_HOST_COMPILER_ID STREQUAL "MSVC") + MESSAGE(FATAL_ERROR "MSVC doesn't support ARCH_NATIVE!") + ENDIF() + COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID DEFAULT -march=native -mtune=native @@ -231,6 +240,7 @@ IF (KOKKOS_ARCH_ARMV80) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID Cray NO-VALUE-SPECIFIED + MSVC /arch:armv8.0 NVHPC NO-VALUE-SPECIFIED DEFAULT -march=armv8-a ) @@ -240,6 +250,7 @@ IF (KOKKOS_ARCH_ARMV81) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID Cray NO-VALUE-SPECIFIED + MSVC /arch:armv8.1 NVHPC NO-VALUE-SPECIFIED DEFAULT -march=armv8.1-a ) @@ -250,6 +261,7 @@ IF (KOKKOS_ARCH_ARMV8_THUNDERX) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID Cray NO-VALUE-SPECIFIED + MSVC /arch:armv8.0 NVHPC NO-VALUE-SPECIFIED DEFAULT -march=armv8-a -mtune=thunderx ) @@ -260,6 +272,7 @@ IF (KOKKOS_ARCH_ARMV8_THUNDERX2) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID Cray NO-VALUE-SPECIFIED + MSVC /arch:armv8.1 NVHPC NO-VALUE-SPECIFIED DEFAULT -mcpu=thunderx2t99 -mtune=thunderx2t99 ) @@ -268,10 +281,11 @@ ENDIF() IF (KOKKOS_ARCH_A64FX) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID - NVHPC NO-VALUE-SPECIFIED - DEFAULT -march=armv8.2-a+sve Clang -march=armv8.2-a+sve -msve-vector-bits=512 GNU -march=armv8.2-a+sve -msve-vector-bits=512 + MSVC NO-VALUE-SPECIFIED + NVHPC NO-VALUE-SPECIFIED + DEFAULT -march=armv8.2-a+sve ) ENDIF() @@ -279,6 +293,7 @@ IF (KOKKOS_ARCH_ZEN) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID Intel -mavx2 + MSVC /arch:AVX2 NVHPC -tp=zen DEFAULT -march=znver1 -mtune=znver1 ) @@ -290,6 +305,7 @@ IF (KOKKOS_ARCH_ZEN2) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID Intel -mavx2 + MSVC /arch:AVX2 NVHPC -tp=zen2 DEFAULT -march=znver2 -mtune=znver2 ) @@ -301,6 +317,7 @@ IF (KOKKOS_ARCH_ZEN3) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID Intel -mavx2 + MSVC /arch:AVX2 NVHPC -tp=zen2 DEFAULT -march=znver3 -mtune=znver3 ) @@ -311,9 +328,10 @@ ENDIF() IF (KOKKOS_ARCH_WSM) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + Cray NO-VALUE-SPECIFIED Intel -xSSE4.2 + MSVC NO-VALUE-SPECIFIED NVHPC -tp=px - Cray NO-VALUE-SPECIFIED DEFAULT -msse4.2 ) SET(KOKKOS_ARCH_SSE42 ON) @@ -323,9 +341,10 @@ IF (KOKKOS_ARCH_SNB OR KOKKOS_ARCH_AMDAVX) SET(KOKKOS_ARCH_AVX ON) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + Cray NO-VALUE-SPECIFIED Intel -mavx + MSVC /arch:AVX NVHPC -tp=sandybridge - Cray NO-VALUE-SPECIFIED DEFAULT -mavx ) ENDIF() @@ -334,9 +353,10 @@ IF (KOKKOS_ARCH_HSW) SET(KOKKOS_ARCH_AVX2 ON) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + Cray NO-VALUE-SPECIFIED Intel -xCORE-AVX2 + MSVC /arch:AVX2 NVHPC -tp=haswell - Cray NO-VALUE-SPECIFIED DEFAULT -march=core-avx2 -mtune=core-avx2 ) ENDIF() @@ -345,9 +365,10 @@ IF (KOKKOS_ARCH_BDW) SET(KOKKOS_ARCH_AVX2 ON) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + Cray NO-VALUE-SPECIFIED Intel -xCORE-AVX2 + MSVC /arch:AVX2 NVHPC -tp=haswell - Cray NO-VALUE-SPECIFIED DEFAULT -march=core-avx2 -mtune=core-avx2 -mrtm ) ENDIF() @@ -357,9 +378,10 @@ IF (KOKKOS_ARCH_KNL) SET(KOKKOS_ARCH_AVX512MIC ON) #not a cache variable COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + Cray NO-VALUE-SPECIFIED Intel -xMIC-AVX512 + MSVC /arch:AVX512 NVHPC -tp=knl - Cray NO-VALUE-SPECIFIED DEFAULT -march=knl -mtune=knl ) ENDIF() @@ -367,6 +389,7 @@ ENDIF() IF (KOKKOS_ARCH_KNC) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + MSVC NO-VALUE-SPECIFIED DEFAULT -mmic ) ENDIF() @@ -374,9 +397,10 @@ ENDIF() IF (KOKKOS_ARCH_SKL) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + Cray NO-VALUE-SPECIFIED Intel -xSKYLAKE + MSVC /arch:AVX2 NVHPC -tp=skylake - Cray NO-VALUE-SPECIFIED DEFAULT -march=skylake -mtune=skylake ) ENDIF() @@ -386,9 +410,10 @@ IF (KOKKOS_ARCH_SKX) SET(KOKKOS_ARCH_AVX512XEON ON) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + Cray NO-VALUE-SPECIFIED Intel -xCORE-AVX512 + MSVC /arch:AVX512 NVHPC -tp=skylake - Cray NO-VALUE-SPECIFIED DEFAULT -march=skylake-avx512 -mtune=skylake-avx512 ) ENDIF() @@ -397,6 +422,7 @@ IF (KOKKOS_ARCH_ICL) SET(KOKKOS_ARCH_AVX512XEON ON) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + MSVC /arch:AVX512 DEFAULT -march=icelake-client -mtune=icelake-client ) ENDIF() @@ -405,6 +431,7 @@ IF (KOKKOS_ARCH_ICX) SET(KOKKOS_ARCH_AVX512XEON ON) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + MSVC /arch:AVX512 DEFAULT -march=icelake-server -mtune=icelake-server ) ENDIF() @@ -413,6 +440,7 @@ IF (KOKKOS_ARCH_SPR) SET(KOKKOS_ARCH_AVX512XEON ON) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + MSVC /arch:AVX512 DEFAULT -march=sapphirerapids -mtune=sapphirerapids ) ENDIF() @@ -420,6 +448,7 @@ ENDIF() IF (KOKKOS_ARCH_POWER7) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + MSVC NO-VALUE-SPECIFIED NVHPC NO-VALUE-SPECIFIED DEFAULT -mcpu=power7 -mtune=power7 ) @@ -428,6 +457,7 @@ ENDIF() IF (KOKKOS_ARCH_POWER8) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + MSVC NO-VALUE-SPECIFIED NVHPC -tp=pwr8 DEFAULT -mcpu=power8 -mtune=power8 ) @@ -436,21 +466,24 @@ ENDIF() IF (KOKKOS_ARCH_POWER9) COMPILER_SPECIFIC_FLAGS( COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID + MSVC NO-VALUE-SPECIFIED NVHPC -tp=pwr9 DEFAULT -mcpu=power9 -mtune=power9 ) ENDIF() -IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE) - COMPILER_SPECIFIC_FLAGS( - Clang -fcuda-rdc - NVIDIA --relocatable-device-code=true - NVHPC -gpu=rdc - ) -ELSEIF(KOKKOS_ENABLE_CUDA) - COMPILER_SPECIFIC_FLAGS( - NVHPC -gpu=nordc - ) +IF (NOT KOKKOS_COMPILE_LANGUAGE STREQUAL CUDA) + IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE) + COMPILER_SPECIFIC_FLAGS( + Clang -fcuda-rdc + NVIDIA --relocatable-device-code=true + NVHPC -gpu=rdc + ) + ELSEIF(KOKKOS_ENABLE_CUDA) + COMPILER_SPECIFIC_FLAGS( + NVHPC -gpu=nordc + ) + ENDIF() ENDIF() # Clang needs mcx16 option enabled for Windows atomic functions @@ -461,7 +494,7 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND WIN32) ENDIF() # MSVC ABI has many deprecation warnings, so ignore them -IF (CMAKE_CXX_COMPILER_ID STREQUAL MSVC OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") +IF (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") COMPILER_SPECIFIC_DEFS( Clang _CRT_SECURE_NO_WARNINGS ) @@ -544,6 +577,8 @@ CHECK_CUDA_ARCH(VOLTA72 sm_72) CHECK_CUDA_ARCH(TURING75 sm_75) CHECK_CUDA_ARCH(AMPERE80 sm_80) CHECK_CUDA_ARCH(AMPERE86 sm_86) +CHECK_CUDA_ARCH(ADA89 sm_89) +CHECK_CUDA_ARCH(HOPPER90 sm_90) SET(AMDGPU_ARCH_ALREADY_SPECIFIED "") FUNCTION(CHECK_AMDGPU_ARCH ARCH FLAG) @@ -567,26 +602,17 @@ ENDFUNCTION() #These will define KOKKOS_AMDGPU_ARCH_FLAG #to the corresponding flag name if ON -CHECK_AMDGPU_ARCH(VEGA900 gfx900) # Radeon Instinct MI25 -CHECK_AMDGPU_ARCH(VEGA906 gfx906) # Radeon Instinct MI50 and MI60 -CHECK_AMDGPU_ARCH(VEGA908 gfx908) # Radeon Instinct MI100 -CHECK_AMDGPU_ARCH(VEGA90A gfx90a) # Radeon Instinct MI200 +FOREACH(ARCH IN LISTS SUPPORTED_AMD_ARCHS) + LIST(FIND SUPPORTED_AMD_ARCHS ${ARCH} LIST_INDEX) + LIST(GET CORRESPONDING_AMD_FLAGS ${LIST_INDEX} FLAG) + CHECK_AMDGPU_ARCH(${ARCH} ${FLAG}) +ENDFOREACH() -IF(KOKKOS_ENABLE_HIP AND NOT AMDGPU_ARCH_ALREADY_SPECIFIED) - IF(KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC) - FIND_PROGRAM(ROCM_ENUMERATOR rocm_agent_enumerator) - EXECUTE_PROCESS(COMMAND ${ROCM_ENUMERATOR} OUTPUT_VARIABLE GPU_ARCHS) - STRING(LENGTH "${GPU_ARCHS}" len_str) - # enumerator always output gfx000 as the first line - IF(${len_str} LESS 8) - MESSAGE(SEND_ERROR "HIP enabled but no AMD GPU architecture currently enabled. " - "Please enable one AMD GPU architecture via -DKokkos_ARCH_{..}=ON'.") - ENDIF() - ELSE() - MESSAGE(SEND_ERROR "HIP enabled but no AMD GPU architecture currently enabled. " - "Please enable one AMD GPU architecture via -DKokkos_ARCH_{..}=ON'.") - ENDIF() -ENDIF() +MACRO(SET_AND_CHECK_AMD_ARCH ARCH FLAG) + KOKKOS_SET_OPTION(ARCH_${ARCH} ON) + CHECK_AMDGPU_ARCH(${ARCH} ${FLAG}) + LIST(APPEND KOKKOS_ENABLED_ARCH_LIST ${ARCH}) +ENDMACRO() MACRO(CHECK_MULTIPLE_INTEL_ARCH) IF(KOKKOS_ARCH_INTEL_GPU) @@ -623,7 +649,6 @@ IF (KOKKOS_ENABLE_OPENMPTARGET) STRING(REPLACE "sm_" "cc" NVHPC_CUDA_ARCH ${CLANG_CUDA_ARCH}) COMPILER_SPECIFIC_FLAGS( Clang -Xopenmp-target -march=${CLANG_CUDA_ARCH} -fopenmp-targets=nvptx64 - XL -qtgtarch=${KOKKOS_CUDA_ARCH_FLAG} NVHPC -gpu=${NVHPC_CUDA_ARCH} ) ENDIF() @@ -655,11 +680,11 @@ IF (KOKKOS_ENABLE_OPENMPTARGET) ) ELSEIF(KOKKOS_ARCH_INTEL_XEHP) COMPILER_SPECIFIC_FLAGS( - IntelLLVM -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device xehp" -D__STRICT_ANSI__ + IntelLLVM -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device 12.50.4" -D__STRICT_ANSI__ ) ELSEIF(KOKKOS_ARCH_INTEL_PVC) COMPILER_SPECIFIC_FLAGS( - IntelLLVM -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device 12.4.0" -D__STRICT_ANSI__ + IntelLLVM -fopenmp-targets=spir64_gen -Xopenmp-target-backend "-device 12.60.7" -D__STRICT_ANSI__ ) ENDIF() ENDIF() @@ -708,11 +733,11 @@ IF (KOKKOS_ENABLE_SYCL) ) ELSEIF(KOKKOS_ARCH_INTEL_XEHP) COMPILER_SPECIFIC_FLAGS( - DEFAULT -fsycl-targets=spir64_gen -Xsycl-target-backend "-device xehp" + DEFAULT -fsycl-targets=spir64_gen -Xsycl-target-backend "-device 12.50.4" ) ELSEIF(KOKKOS_ARCH_INTEL_PVC) COMPILER_SPECIFIC_FLAGS( - DEFAULT -fsycl-targets=spir64_gen -Xsycl-target-backend "-device 12.4.0" + DEFAULT -fsycl-targets=spir64_gen -Xsycl-target-backend "-device 12.60.7" ) ENDIF() ENDIF() @@ -752,8 +777,8 @@ IF(KOKKOS_ENABLE_CUDA AND NOT CUDA_ARCH_ALREADY_SPECIFIED) IF(CMAKE_CUDA_COMPILER) # copy our test to .cu so cmake compiles as CUDA CONFIGURE_FILE( - ${PROJECT_SOURCE_DIR}/cmake/compile_tests/cuda_compute_capability.cc - ${PROJECT_BINARY_DIR}/compile_tests/cuda_compute_capability.cu + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compile_tests/cuda_compute_capability.cc + ${CMAKE_CURRENT_BINARY_DIR}/compile_tests/cuda_compute_capability.cu COPYONLY ) # run test again @@ -761,7 +786,7 @@ IF(KOKKOS_ENABLE_CUDA AND NOT CUDA_ARCH_ALREADY_SPECIFIED) _RESULT _COMPILE_RESULT ${_BINARY_TEST_DIR} - ${PROJECT_BINARY_DIR}/compile_tests/cuda_compute_capability.cu + ${CMAKE_CURRENT_BINARY_DIR}/compile_tests/cuda_compute_capability.cu COMPILE_DEFINITIONS -DSM_ONLY RUN_OUTPUT_VARIABLE _CUDA_COMPUTE_CAPABILITY) ENDIF() @@ -806,11 +831,62 @@ IF (KOKKOS_ARCH_AMPERE80 OR KOKKOS_ARCH_AMPERE86) SET(KOKKOS_ARCH_AMPERE ON) ENDIF() -#Regardless of version, make sure we define the general architecture name -IF (KOKKOS_ARCH_VEGA900 OR KOKKOS_ARCH_VEGA906 OR KOKKOS_ARCH_VEGA908 OR KOKKOS_ARCH_VEGA90A) - SET(KOKKOS_ARCH_VEGA ON) +IF (KOKKOS_ARCH_HOPPER90) + SET(KOKKOS_ARCH_HOPPER ON) ENDIF() +#HIP detection of gpu arch +IF(KOKKOS_ENABLE_HIP AND NOT AMDGPU_ARCH_ALREADY_SPECIFIED) + FIND_PROGRAM(ROCM_ENUMERATOR rocm_agent_enumerator) + IF(NOT ROCM_ENUMERATOR) + MESSAGE(FATAL_ERROR "Autodetection of AMD GPU architecture not possible as " + "rocm_agent_enumerator could not be found. " + "Please specify an arch manually via -DKokkos_ARCH_{..}=ON") + ELSE() + EXECUTE_PROCESS(COMMAND ${ROCM_ENUMERATOR} OUTPUT_VARIABLE GPU_ARCHS) + STRING(LENGTH "${GPU_ARCHS}" len_str) + # enumerator always output gfx000 as the first line + IF(${len_str} LESS 8) + MESSAGE(SEND_ERROR "HIP enabled but no AMD GPU architecture could be automatically detected. " + "Please manually specify one AMD GPU architecture via -DKokkos_ARCH_{..}=ON'.") + # check for known gpu archs, otherwise error out + ELSE() + SET(AMD_ARCH_DETECTED "") + FOREACH(ARCH IN LISTS SUPPORTED_AMD_ARCHS) + LIST(FIND SUPPORTED_AMD_ARCHS ${ARCH} LIST_INDEX) + LIST(GET CORRESPONDING_AMD_FLAGS ${LIST_INDEX} FLAG) + STRING(REGEX MATCH "(${FLAG})" DETECTED_GPU_ARCH ${GPU_ARCHS}) + IF("${DETECTED_GPU_ARCH}" STREQUAL "${FLAG}") + SET_AND_CHECK_AMD_ARCH(${ARCH} ${FLAG}) + SET(AMD_ARCH_DETECTED ${ARCH}) + BREAK() + ENDIF() + ENDFOREACH() + IF("${AMD_ARCH_DETECTED}" STREQUAL "") + MESSAGE(FATAL_ERROR "HIP enabled but no automatically detected AMD GPU architecture " + "is supported. " + "Please manually specify one AMD GPU architecture via -DKokkos_ARCH_{..}=ON'.") + ENDIF() + ENDIF() + ENDIF() +ENDIF() + +#Regardless of version, make sure we define the general architecture name +FOREACH(ARCH IN LISTS SUPPORTED_AMD_ARCHS) + IF (KOKKOS_ARCH_${ARCH}) + STRING(REGEX MATCH "(VEGA)" IS_VEGA ${ARCH}) + IF(IS_VEGA) + SET(KOKKOS_ARCH_VEGA ON) + BREAK() + ENDIF() + STRING(REGEX MATCH "(NAVI)" IS_NAVI ${ARCH}) + IF(IS_NAVI) + SET(KOKKOS_ARCH_NAVI ON) + BREAK() + ENDIF() + ENDIF() +ENDFOREACH() + #CMake verbose is kind of pointless #Let's just always print things MESSAGE(STATUS "Built-in Execution Spaces:") @@ -826,11 +902,19 @@ FOREACH (_BACKEND Cuda OpenMPTarget HIP SYCL OpenACC) ENDIF() IF (${_BACKEND} STREQUAL "Cuda") IF(KOKKOS_ENABLE_CUDA_UVM) - SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::${_BACKEND}UVMSpace") + MESSAGE(DEPRECATION "Setting Kokkos_ENABLE_CUDA_UVM is deprecated - use the portable Kokkos::SharedSpace as an explicit memory space in your code instead") + IF(KOKKOS_ENABLE_DEPRECATED_CODE_4) + SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::${_BACKEND}UVMSpace") + ELSE() + MESSAGE(FATAL_ERROR "Kokkos_ENABLE_DEPRECATED_CODE_4 must be set to use Kokkos_ENABLE_CUDA_UVM") + ENDIF() ELSE() SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::${_BACKEND}Space") ENDIF() SET(_DEVICE_PARALLEL "Kokkos::${_BACKEND}") + ELSEIF(${_BACKEND} STREQUAL "HIP") + SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::${_BACKEND}Space") + SET(_DEVICE_PARALLEL "Kokkos::${_BACKEND}") ELSE() SET(_DEFAULT_DEVICE_MEMSPACE "Kokkos::Experimental::${_BACKEND}Space") SET(_DEVICE_PARALLEL "Kokkos::Experimental::${_BACKEND}") diff --git a/packages/kokkos/cmake/kokkos_compiler_id.cmake b/packages/kokkos/cmake/kokkos_compiler_id.cmake index b9fe2ffab0bd200a497f4a504ee24ed7f6990a67..27a3102a6b524fbecb83c21fef477a234a32fec1 100644 --- a/packages/kokkos/cmake/kokkos_compiler_id.cmake +++ b/packages/kokkos/cmake/kokkos_compiler_id.cmake @@ -147,49 +147,66 @@ ENDIF() # Enforce the minimum compilers supported by Kokkos. SET(KOKKOS_MESSAGE_TEXT "Compiler not supported by Kokkos. Required compiler versions:") -SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n Clang 4.0.0 or higher") -SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n GCC 5.3.0 or higher") -SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n Intel 17.0.0 or higher") -SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n IntelLLVM 2022.0.0 or higher") -SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n NVCC 9.2.88 or higher") -SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n HIPCC 4.5.0 or higher") -SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n PGI 17.4 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n Clang(CPU) 8.0.0 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n Clang(CUDA) 10.0.0 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n GCC 8.2.0 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n Intel 19.0.5 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n IntelLLVM(CPU) 2021.1.1 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n IntelLLVM(SYCL) 2022.0.0 or higher") #FIXME +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n NVCC 11.0.0 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n HIPCC 5.2.0 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n NVHPC/PGI 22.3 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n MSVC 19.29 or higher") +SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\n XL/XLClang not supported") SET(KOKKOS_MESSAGE_TEXT "${KOKKOS_MESSAGE_TEXT}\nCompiler: ${KOKKOS_CXX_COMPILER_ID} ${KOKKOS_CXX_COMPILER_VERSION}\n") -IF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang) - IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 4.0.0) +IF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND NOT Kokkos_ENABLE_CUDA) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 8.0.0) + MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") + ENDIF() +ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND Kokkos_ENABLE_CUDA) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 10.0.0) MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") ENDIF() ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL GNU) - IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 5.3.0) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 8.2.0) MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") ENDIF() ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL Intel) - IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 17.0.0) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 19.0.5) + MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") + ENDIF() +ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM AND NOT Kokkos_ENABLE_SYCL) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 2021.1.1) MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") ENDIF() ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM AND Kokkos_ENABLE_SYCL) - IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 2022.0.0) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 2022.0.0) #FIXME 2022.2.0 MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") ENDIF() ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA) - IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 9.2.88) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 11.0.0) MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") ENDIF() SET(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Kokkos turns off CXX extensions" FORCE) ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC) - # Note that ROCm 4.5 reports as version 4.4 - IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 4.4.0) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 5.2.0) MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") ENDIF() -ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL PGI) - IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 17.4) +ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL PGI OR KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 22.3) MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") ENDIF() # Treat PGI internally as NVHPC to simplify handling both compilers. # Before CMake 3.20 NVHPC was identified as PGI, nvc++ is # backward-compatible to pgc++. SET(KOKKOS_CXX_COMPILER_ID NVHPC CACHE STRING INTERNAL FORCE) +ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL "MSVC") + IF(KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 19.29) + MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") + ENDIF() +ELSEIF(KOKKOS_CXX_COMPILER_ID STREQUAL XL OR KOKKOS_CXX_COMPILER_ID STREQUAL XLClang) + MESSAGE(FATAL_ERROR "${KOKKOS_MESSAGE_TEXT}") ENDIF() IF(NOT DEFINED KOKKOS_CXX_HOST_COMPILER_ID) @@ -201,4 +218,12 @@ ENDIF() STRING(REPLACE "." ";" VERSION_LIST ${KOKKOS_CXX_COMPILER_VERSION}) LIST(GET VERSION_LIST 0 KOKKOS_COMPILER_VERSION_MAJOR) LIST(GET VERSION_LIST 1 KOKKOS_COMPILER_VERSION_MINOR) -LIST(GET VERSION_LIST 2 KOKKOS_COMPILER_VERSION_PATCH) +LIST(LENGTH VERSION_LIST LIST_LENGTH) + +# On Android, the compiler doesn't have a patch version, just a major/minor +IF(LIST_LENGTH GREATER 2) + LIST(GET VERSION_LIST 2 KOKKOS_COMPILER_VERSION_PATCH) +ELSE() + SET(KOKKOS_COMPILER_VERSION_PATCH 0) +ENDIF() + diff --git a/packages/kokkos/cmake/kokkos_corner_cases.cmake b/packages/kokkos/cmake/kokkos_corner_cases.cmake index a84ac2b63027e7112cb3a7b76e5e9a7b8fc892e3..ede2b4e0caf8661ece061c19eb81ae501082b73e 100644 --- a/packages/kokkos/cmake/kokkos_corner_cases.cmake +++ b/packages/kokkos/cmake/kokkos_corner_cases.cmake @@ -1,62 +1,4 @@ -IF(KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKKOS_ENABLE_OPENMP AND NOT KOKKOS_CLANG_IS_CRAY AND NOT KOKKOS_COMPILER_CLANG_MSVC) - # The clang "version" doesn't actually tell you what runtimes and tools - # were built into Clang. We should therefore make sure that libomp - # was actually built into Clang. Otherwise the user will get nonsensical - # errors when they try to build. - - #Try compile is the height of CMake nonsense - #I can't just give it compiler and link flags - #I have to hackily pretend that compiler flags are compiler definitions - #and that linker flags are libraries - #also - this is easier to use than CMakeCheckCXXSourceCompiles - TRY_COMPILE(CLANG_HAS_OMP - ${KOKKOS_TOP_BUILD_DIR}/corner_cases - ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/clang_omp.cpp - COMPILE_DEFINITIONS -fopenmp=libomp - LINK_LIBRARIES -fopenmp=libomp - ) - IF (NOT CLANG_HAS_OMP) - UNSET(CLANG_HAS_OMP CACHE) #make sure CMake always re-runs this - MESSAGE(FATAL_ERROR "Clang failed OpenMP check. You have requested -DKokkos_ENABLE_OPENMP=ON, but the Clang compiler does not appear to have been built with OpenMP support") - ENDIF() - UNSET(CLANG_HAS_OMP CACHE) #make sure CMake always re-runs this -ENDIF() - -IF(KOKKOS_CXX_COMPILER_ID STREQUAL AppleClang AND KOKKOS_ENABLE_OPENMP) - # The clang "version" doesn't actually tell you what runtimes and tools - # were built into Clang. We should therefore make sure that libomp - # was actually built into Clang. Otherwise the user will get nonsensical - # errors when they try to build. - - #Try compile is the height of CMake nonsense - #I can't just give it compiler and link flags - #I have to hackily pretend that compiler flags are compiler definitions - #and that linker flags are libraries - #also - this is easier to use than CMakeCheckCXXSourceCompiles - TRY_COMPILE(APPLECLANG_HAS_OMP - ${KOKKOS_TOP_BUILD_DIR}/corner_cases - ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/clang_omp.cpp - COMPILE_DEFINITIONS -Xpreprocessor -fopenmp - LINK_LIBRARIES -lomp - ) - IF (NOT APPLECLANG_HAS_OMP) - UNSET(APPLECLANG_HAS_OMP CACHE) #make sure CMake always re-runs this - MESSAGE(FATAL_ERROR "AppleClang failed OpenMP check. You have requested -DKokkos_ENABLE_OPENMP=ON, but the AppleClang compiler does not appear to have been built with OpenMP support") - ENDIF() - UNSET(APPLECLANG_HAS_OMP CACHE) #make sure CMake always re-runs this -ENDIF() - - -IF (KOKKOS_CXX_STANDARD STREQUAL 17) - IF (KOKKOS_CXX_COMPILER_ID STREQUAL GNU AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 7) - MESSAGE(FATAL_ERROR "You have requested C++17 support for GCC ${KOKKOS_CXX_COMPILER_VERSION}. Although CMake has allowed this and GCC accepts -std=c++1z/c++17, GCC < 7 does not properly support *this capture. Please reduce the C++ standard to 14 or upgrade the compiler if you do need C++17 support.") - ENDIF() - - IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 11) - MESSAGE(FATAL_ERROR "You have requested C++17 support for NVCC ${KOKKOS_CXX_COMPILER_VERSION}. NVCC only supports C++17 from version 11 on. Please reduce the C++ standard to 14 or upgrade the compiler if you need C++17 support.") - ENDIF() - IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_ENABLE_CUDA_CONSTEXPR) - MESSAGE(WARNING "You have requested -DKokkos_ENABLE_CUDA_CONSTEXPR=ON with C++17 support for NVCC ${KOKKOS_CXX_COMPILER_VERSION} which is known to trigger compiler bugs. See https://github.com/kokkos/kokkos/issues/3496") - ENDIF() +IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND KOKKOS_ENABLE_CUDA_CONSTEXPR AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 11.2) + MESSAGE(WARNING "You have requested -DKokkos_ENABLE_CUDA_CONSTEXPR=ON for NVCC ${KOKKOS_CXX_COMPILER_VERSION} which is known to trigger compiler bugs before NVCC version 11.2. See https://github.com/kokkos/kokkos/issues/3496") ENDIF() diff --git a/packages/kokkos/cmake/kokkos_enable_devices.cmake b/packages/kokkos/cmake/kokkos_enable_devices.cmake index c7a454c214b0f974d357cb16324e9f4659e11d5f..d4a7744eb59b74a89059dfb421f470fca62e0b9e 100644 --- a/packages/kokkos/cmake/kokkos_enable_devices.cmake +++ b/packages/kokkos/cmake/kokkos_enable_devices.cmake @@ -20,13 +20,6 @@ KOKKOS_DEPRECATED_LIST(DEVICES ENABLE) KOKKOS_DEVICE_OPTION(THREADS OFF HOST "Whether to build C++ threads backend") -IF(Kokkos_ENABLE_PTHREAD) # for backward compatibility - SET(Kokkos_ENABLE_THREADS ON CACHE BOOL "Whether to build C++ threads backend" FORCE) - SET(KOKKOS_ENABLE_THREADS ON) - LIST(APPEND KOKKOS_ENABLED_DEVICES THREADS) - SET(KOKKOS_HAS_HOST ON) - MESSAGE(DEPRECATION "The Kokkos_ENABLE_PTHREAD option is deprecated. Use Kokkos_ENABLE_THREADS instead!") -ENDIF() # detect clang++ / cl / clang-cl clashes IF (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") @@ -46,45 +39,6 @@ ELSE() SET(OMP_DEFAULT OFF) ENDIF() KOKKOS_DEVICE_OPTION(OPENMP ${OMP_DEFAULT} HOST "Whether to build OpenMP backend") -IF(KOKKOS_ENABLE_OPENMP) - SET(ClangOpenMPFlag -fopenmp=libomp) - IF(KOKKOS_CLANG_IS_CRAY) - SET(ClangOpenMPFlag -fopenmp) - ENDIF() - IF(KOKKOS_COMPILER_CLANG_MSVC) - #for clang-cl expression /openmp yields an error, so directly add the specific Clang flag - SET(ClangOpenMPFlag /clang:-fopenmp=libomp) - ENDIF() - IF(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) - #link omp library from LLVM lib dir, no matter if it is clang-cl or clang++ - get_filename_component(LLVM_BIN_DIR ${CMAKE_CXX_COMPILER_AR} DIRECTORY) - COMPILER_SPECIFIC_LIBS(Clang "${LLVM_BIN_DIR}/../lib/libomp.lib") - ENDIF() - IF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA) - COMPILER_SPECIFIC_FLAGS( - COMPILER_ID KOKKOS_CXX_HOST_COMPILER_ID - Clang -Xcompiler ${ClangOpenMPFlag} - IntelLLVM -Xcompiler -fiopenmp - NVHPC -Xcompiler -mp - Cray NO-VALUE-SPECIFIED - XL -Xcompiler -qsmp=omp - DEFAULT -Xcompiler -fopenmp - ) - ELSE() - COMPILER_SPECIFIC_FLAGS( - Clang ${ClangOpenMPFlag} - IntelLLVM -fiopenmp - AppleClang -Xpreprocessor -fopenmp - NVHPC -mp - Cray NO-VALUE-SPECIFIED - XL -qsmp=omp - DEFAULT -fopenmp - ) - COMPILER_SPECIFIC_LIBS( - AppleClang -lomp - ) - ENDIF() -ENDIF() KOKKOS_DEVICE_OPTION(OPENACC OFF DEVICE "Whether to build the OpenACC backend") @@ -98,12 +52,10 @@ IF (KOKKOS_ENABLE_OPENMPTARGET) COMPILER_SPECIFIC_FLAGS( Clang ${ClangOpenMPFlag} -Wno-openmp-mapping IntelLLVM -fiopenmp -Wno-openmp-mapping - XL -qsmp=omp -qoffload -qnoeh NVHPC -mp=gpu DEFAULT -fopenmp ) COMPILER_SPECIFIC_DEFS( - XL KOKKOS_IBM_XL_OMP45_WORKAROUND Clang KOKKOS_WORKAROUND_OPENMPTARGET_CLANG ) # Are there compilers which identify as Clang and need this library? diff --git a/packages/kokkos/cmake/kokkos_enable_options.cmake b/packages/kokkos/cmake/kokkos_enable_options.cmake index ea606bb0c96c0051ef08c4d49de578a1ddca72c1..f9f1bc5a8b5170028de88341a9b3398823618629 100644 --- a/packages/kokkos/cmake/kokkos_enable_options.cmake +++ b/packages/kokkos/cmake/kokkos_enable_options.cmake @@ -34,11 +34,13 @@ KOKKOS_ENABLE_OPTION(CUDA_UVM OFF "Whether to use unified memory (UM KOKKOS_ENABLE_OPTION(CUDA_LDG_INTRINSIC OFF "Whether to use CUDA LDG intrinsics") # As of 08/12/2021 CudaMallocAsync causes issues if UCX is used as MPI communication layer. KOKKOS_ENABLE_OPTION(IMPL_CUDA_MALLOC_ASYNC OFF "Whether to enable CudaMallocAsync (requires CUDA Toolkit 11.2)") -KOKKOS_ENABLE_OPTION(DEPRECATED_CODE_3 ON "Whether code deprecated in major release 3 is available" ) +KOKKOS_ENABLE_OPTION(DEPRECATED_CODE_3 OFF "Whether code deprecated in major release 3 is available" ) +KOKKOS_ENABLE_OPTION(DEPRECATED_CODE_4 ON "Whether code deprecated in major release 4 is available" ) KOKKOS_ENABLE_OPTION(DEPRECATION_WARNINGS ON "Whether to emit deprecation warnings" ) KOKKOS_ENABLE_OPTION(HIP_RELOCATABLE_DEVICE_CODE OFF "Whether to enable relocatable device code (RDC) for HIP") KOKKOS_ENABLE_OPTION(HPX_ASYNC_DISPATCH OFF "Whether HPX supports asynchronous dispatch") KOKKOS_ENABLE_OPTION(TESTS OFF "Whether to build the unit tests") +KOKKOS_ENABLE_OPTION(BENCHMARKS OFF "Whether to build the benchmarks") KOKKOS_ENABLE_OPTION(EXAMPLES OFF "Whether to build the examples") STRING(TOUPPER "${CMAKE_BUILD_TYPE}" UPPERCASE_CMAKE_BUILD_TYPE) IF(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL "DEBUG") @@ -63,13 +65,16 @@ KOKKOS_ENABLE_OPTION(HIP_MULTIPLE_KERNEL_INSTANTIATIONS OFF "Whether multiple ke KOKKOS_ENABLE_OPTION(IMPL_DESUL_ATOMICS ON "Whether to use desul based atomics - option only during beta") KOKKOS_ENABLE_OPTION(DESUL_ATOMICS_EXTERNAL OFF "Whether to use an external desul installation") -IF (KOKKOS_ENABLE_CUDA) - SET(KOKKOS_COMPILER_CUDA_VERSION "${KOKKOS_COMPILER_VERSION_MAJOR}${KOKKOS_COMPILER_VERSION_MINOR}") -ENDIF() +KOKKOS_ENABLE_OPTION(IMPL_MDSPAN OFF "Whether to enable experimental mdspan support") +KOKKOS_ENABLE_OPTION(MDSPAN_EXTERNAL OFF BOOL "Whether to use an external version of mdspan") +KOKKOS_ENABLE_OPTION(IMPL_SKIP_COMPILER_MDSPAN OFF BOOL "Whether to use an internal version of mdspan even if the compiler supports mdspan") +mark_as_advanced(Kokkos_ENABLE_IMPL_MDSPAN) +mark_as_advanced(Kokkos_ENABLE_MDSPAN_EXTERNAL) +mark_as_advanced(Kokkos_ENABLE_IMPL_SKIP_COMPILER_MDSPAN) IF (Trilinos_ENABLE_Kokkos AND TPL_ENABLE_CUDA) SET(CUDA_LAMBDA_DEFAULT ON) -ELSEIF (KOKKOS_ENABLE_CUDA AND (KOKKOS_CXX_COMPILER_ID STREQUAL Clang)) +ELSEIF (KOKKOS_ENABLE_CUDA) SET(CUDA_LAMBDA_DEFAULT ON) ELSE() SET(CUDA_LAMBDA_DEFAULT OFF) @@ -125,6 +130,23 @@ IF (KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION) SET(KOKKOS_OPT_RANGE_AGGRESSIVE_VECTORIZATION ON) ENDIF() +# Force consistency of KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE +# and CMAKE_CUDA_SEPARABLE_COMPILATION when we are compiling +# using the CMake CUDA language support. +# Either one being on will turn the other one on. +IF (KOKKOS_COMPILE_LANGUAGE STREQUAL CUDA) + IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE) + IF (NOT CMAKE_CUDA_SEPARABLE_COMPILATION) + MESSAGE(STATUS "Setting CMAKE_CUDA_SEPARABLE_COMPILATION=ON since Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE is true. When compiling Kokkos with CMake language CUDA, please use CMAKE_CUDA_SEPARABLE_COMPILATION to control RDC support") + SET(CMAKE_CUDA_SEPARABLE_COMPILATION ON) + ENDIF() + ELSE() + IF (CMAKE_CUDA_SEPARABLE_COMPILATION) + SET(KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE ON) + ENDIF() + ENDIF() +ENDIF() + # This is known to occur with Clang 9. We would need to use nvcc as the linker # http://lists.llvm.org/pipermail/cfe-dev/2018-June/058296.html # TODO: Through great effort we can use a different linker by hacking @@ -136,3 +158,11 @@ ENDIF() IF (KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE AND BUILD_SHARED_LIBS) MESSAGE(FATAL_ERROR "Relocatable device code requires static libraries.") ENDIF() + +IF(Kokkos_ENABLE_CUDA_LDG_INTRINSIC) + IF(KOKKOS_ENABLE_DEPRECATED_CODE_4) + MESSAGE(DEPRECATION "Setting Kokkos_ENABLE_CUDA_LDG_INTRINSIC is deprecated. LDG intrinsics are always enabled.") + ELSE() + MESSAGE(FATAL_ERROR "Kokkos_ENABLE_CUDA_LDG_INTRINSIC has been removed. LDG intrinsics are always enabled.") + ENDIF() +ENDIF() diff --git a/packages/kokkos/cmake/kokkos_functions.cmake b/packages/kokkos/cmake/kokkos_functions.cmake index 11fa9b302cc239939b792610543ad72cfd5befbd..55b1ebbf818ea0a972c069324c1f08d29010a51b 100644 --- a/packages/kokkos/cmake/kokkos_functions.cmake +++ b/packages/kokkos/cmake/kokkos_functions.cmake @@ -5,6 +5,9 @@ # Validate options are given with correct case and define an internal # upper-case version for use within +set(Kokkos_OPTIONS_NOT_TO_EXPORT + Kokkos_ENABLE_TESTS Kokkos_ENABLE_EXAMPLES) + # # # @FUNCTION: kokkos_deprecated_list @@ -57,6 +60,12 @@ FUNCTION(kokkos_option CAMEL_SUFFIX DEFAULT TYPE DOCSTRING) # Make sure this appears in the cache with the appropriate DOCSTRING SET(${CAMEL_NAME} ${DEFAULT} CACHE ${TYPE} ${DOCSTRING}) + IF (KOKKOS_HAS_TRILINOS) + IF (NOT CAMEL_NAME IN_LIST Kokkos_OPTIONS_NOT_TO_EXPORT) + TRIBITS_PKG_EXPORT_CACHE_VAR(${CAMEL_NAME}) + ENDIF() + ENDIF() + #I don't love doing it this way because it's N^2 in number options, but c'est la vie FOREACH(opt ${KOKKOS_GIVEN_VARIABLES}) STRING(TOUPPER ${opt} OPT_UC) @@ -281,7 +290,11 @@ MACRO(kokkos_import_tpl NAME) MESSAGE(FATAL_ERROR "Find module succeeded for ${NAME}, but did not produce valid target ${TPL_IMPORTED_NAME}") ENDIF() IF(NOT TPL_NO_EXPORT) - KOKKOS_EXPORT_IMPORTED_TPL(${TPL_IMPORTED_NAME}) + GET_TARGET_PROPERTY(TPL_ORIGINAL_NAME ${TPL_IMPORTED_NAME} ALIASED_TARGET) + IF (NOT TPL_ORIGINAL_NAME) + SET(TPL_ORIGINAL_NAME ${TPL_IMPORTED_NAME}) + ENDIF() + KOKKOS_EXPORT_IMPORTED_TPL(${TPL_ORIGINAL_NAME}) ENDIF() LIST(APPEND KOKKOS_ENABLED_TPLS ${NAME}) ENDIF() @@ -823,7 +836,7 @@ FUNCTION(kokkos_link_tpl TARGET) ENDFUNCTION() FUNCTION(COMPILER_SPECIFIC_OPTIONS_HELPER) - SET(COMPILERS NVIDIA NVHPC XL XLClang DEFAULT Cray Intel Clang AppleClang IntelLLVM GNU HIPCC Fujitsu) + SET(COMPILERS NVIDIA NVHPC DEFAULT Cray Intel Clang AppleClang IntelLLVM GNU HIPCC Fujitsu MSVC) CMAKE_PARSE_ARGUMENTS( PARSE "LINK_OPTIONS;COMPILE_OPTIONS;COMPILE_DEFINITIONS;LINK_LIBRARIES" diff --git a/packages/kokkos/cmake/kokkos_install.cmake b/packages/kokkos/cmake/kokkos_install.cmake index ff66d015fb421632bd59a7ccc47a5db3de86a3c7..fb658239d8d82c568eff465f8d8839151896ff3b 100644 --- a/packages/kokkos/cmake/kokkos_install.cmake +++ b/packages/kokkos/cmake/kokkos_install.cmake @@ -19,7 +19,7 @@ IF (NOT KOKKOS_HAS_TRILINOS AND NOT Kokkos_INSTALL_TESTING) WRITE_BASIC_PACKAGE_VERSION_FILE("${Kokkos_BINARY_DIR}/KokkosConfigVersion.cmake" VERSION "${Kokkos_VERSION}" - COMPATIBILITY SameMajorVersion) + COMPATIBILITY AnyNewerVersion) # Install the KokkosConfig*.cmake files install(FILES @@ -38,7 +38,7 @@ ELSE() WRITE_BASIC_PACKAGE_VERSION_FILE("${CMAKE_CURRENT_BINARY_DIR}/KokkosConfigVersion.cmake" VERSION "${Kokkos_VERSION}" - COMPATIBILITY SameMajorVersion) + COMPATIBILITY AnyNewerVersion) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KokkosConfigVersion.cmake DESTINATION "${${PROJECT_NAME}_INSTALL_LIB_DIR}/cmake/${PACKAGE_NAME}") diff --git a/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake b/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake index 03f1a0d18a9a47d96d9ef8926165f40df8a4856c..d4eca651d423fd7567b25ac8fdf8af6985dee050 100644 --- a/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake +++ b/packages/kokkos/cmake/kokkos_pick_cxx_std.cmake @@ -1,46 +1,19 @@ # From CMake 3.10 documentation #This can run at any time -KOKKOS_OPTION(CXX_STANDARD "" STRING "[[DEPRECATED - USE CMAKE_CXX_STANDARD INSTEAD]] The C++ standard for Kokkos to use: 14, 17, or 20. If empty, this will default to CMAKE_CXX_STANDARD. If both CMAKE_CXX_STANDARD and Kokkos_CXX_STANDARD are empty, this will default to 14") +KOKKOS_OPTION(CXX_STANDARD "" STRING "[[DEPRECATED - USE CMAKE_CXX_STANDARD INSTEAD]] The C++ standard for Kokkos to use: 17 or 20. If empty, this will default to CMAKE_CXX_STANDARD. If both CMAKE_CXX_STANDARD and Kokkos_CXX_STANDARD are empty, this will default to 17") # Set CXX standard flags -SET(KOKKOS_ENABLE_CXX14 OFF) SET(KOKKOS_ENABLE_CXX17 OFF) SET(KOKKOS_ENABLE_CXX20 OFF) +SET(KOKKOS_ENABLE_CXX23 OFF) IF (KOKKOS_CXX_STANDARD) - MESSAGE(DEPRECATION "Setting the variable Kokkos_CXX_STANDARD in configuration is deprecated - set CMAKE_CXX_STANDARD directly instead") - - IF (${KOKKOS_CXX_STANDARD} STREQUAL "c++98") - MESSAGE(FATAL_ERROR "Kokkos no longer supports C++98 - minimum C++14") - ELSEIF (${KOKKOS_CXX_STANDARD} STREQUAL "c++11") - MESSAGE(FATAL_ERROR "Kokkos no longer supports C++11 - minimum C++14") - ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++14") - MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++14'. Use '14' instead.") - SET(KOKKOS_CXX_STANDARD "14") - ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++17") - MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++17'. Use '17' instead.") - SET(KOKKOS_CXX_STANDARD "17") - ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++1y") - MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++1y'. Use '1Y' instead.") - SET(KOKKOS_CXX_STANDARD "1Y") - ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++1z") - MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++1z'. Use '1Z' instead.") - SET(KOKKOS_CXX_STANDARD "1Z") - ELSEIF(${KOKKOS_CXX_STANDARD} STREQUAL "c++2a") - MESSAGE(WARNING "Deprecated Kokkos C++ standard set as 'c++2a'. Use '2A' instead.") - SET(KOKKOS_CXX_STANDARD "2A") - ENDIF() + MESSAGE(FATAL_ERROR "Setting the variable Kokkos_CXX_STANDARD in configuration is deprecated - set CMAKE_CXX_STANDARD directly instead") ENDIF() -IF (NOT KOKKOS_CXX_STANDARD AND NOT CMAKE_CXX_STANDARD) - MESSAGE(STATUS "Setting default Kokkos CXX standard to 14") - SET(KOKKOS_CXX_STANDARD "14") -ELSEIF(NOT KOKKOS_CXX_STANDARD) - MESSAGE(STATUS "Setting default Kokkos CXX standard to ${CMAKE_CXX_STANDARD}") +IF (NOT CMAKE_CXX_STANDARD) + SET(KOKKOS_CXX_STANDARD "17") +ELSE() SET(KOKKOS_CXX_STANDARD ${CMAKE_CXX_STANDARD}) ENDIF() - - - - - +MESSAGE(STATUS "Setting default Kokkos CXX standard to ${KOKKOS_CXX_STANDARD}") diff --git a/packages/kokkos/cmake/kokkos_test_cxx_std.cmake b/packages/kokkos/cmake/kokkos_test_cxx_std.cmake index a5a8f40af813e3edf926eb00bafbb84fcc9c0311..5f8e15cd67373688d39338e630b82e74223ece77 100644 --- a/packages/kokkos/cmake/kokkos_test_cxx_std.cmake +++ b/packages/kokkos/cmake/kokkos_test_cxx_std.cmake @@ -29,7 +29,11 @@ FUNCTION(kokkos_set_cxx_standard_feature standard) ELSEIF(NOT KOKKOS_USE_CXX_EXTENSIONS AND ${STANDARD_NAME}) MESSAGE(STATUS "Using ${${STANDARD_NAME}} for C++${standard} standard as feature") IF (KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA AND (KOKKOS_CXX_HOST_COMPILER_ID STREQUAL GNU OR KOKKOS_CXX_HOST_COMPILER_ID STREQUAL Clang)) - SET(SUPPORTED_NVCC_FLAGS "-std=c++14;-std=c++17") + IF(${KOKKOS_CXX_COMPILER_VERSION} VERSION_LESS 12.0.0) + SET(SUPPORTED_NVCC_FLAGS "-std=c++17") + ELSE() + SET(SUPPORTED_NVCC_FLAGS "-std=c++17" "-std=c++20") + ENDIF() IF (NOT ${${STANDARD_NAME}} IN_LIST SUPPORTED_NVCC_FLAGS) MESSAGE(FATAL_ERROR "CMake wants to use ${${STANDARD_NAME}} which is not supported by NVCC. Using a more recent host compiler or a more recent CMake version might help.") ENDIF() @@ -58,21 +62,7 @@ FUNCTION(kokkos_set_cxx_standard_feature standard) ENDIF() ENDFUNCTION() - -IF (KOKKOS_CXX_STANDARD AND CMAKE_CXX_STANDARD) - #make sure these are consistent - IF (NOT KOKKOS_CXX_STANDARD STREQUAL CMAKE_CXX_STANDARD) - MESSAGE(WARNING "Specified both CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} and KOKKOS_CXX_STANDARD=${KOKKOS_CXX_STANDARD}, but they don't match") - SET(CMAKE_CXX_STANDARD ${KOKKOS_CXX_STANDARD} CACHE STRING "C++ standard" FORCE) - ENDIF() -ENDIF() - - -IF(KOKKOS_CXX_STANDARD STREQUAL "14") - kokkos_set_cxx_standard_feature(14) - SET(KOKKOS_CXX_INTERMEDIATE_STANDARD "1Y") - SET(KOKKOS_ENABLE_CXX14 ON) -ELSEIF(KOKKOS_CXX_STANDARD STREQUAL "17") +IF(KOKKOS_CXX_STANDARD STREQUAL "17") kokkos_set_cxx_standard_feature(17) SET(KOKKOS_CXX_INTERMEDIATE_STANDARD "1Z") SET(KOKKOS_ENABLE_CXX17 ON) @@ -80,34 +70,36 @@ ELSEIF(KOKKOS_CXX_STANDARD STREQUAL "20") kokkos_set_cxx_standard_feature(20) SET(KOKKOS_CXX_INTERMEDIATE_STANDARD "2A") SET(KOKKOS_ENABLE_CXX20 ON) -ELSEIF(KOKKOS_CXX_STANDARD STREQUAL "98" OR KOKKOS_CXX_STANDARD STREQUAL "11") - MESSAGE(FATAL_ERROR "Kokkos requires C++14 or newer!") +ELSEIF(KOKKOS_CXX_STANDARD STREQUAL "23") + kokkos_set_cxx_standard_feature(23) + SET(KOKKOS_CXX_INTERMEDIATE_STANDARD "2B") + SET(KOKKOS_ENABLE_CXX23 ON) ELSE() - MESSAGE(FATAL_ERROR "Unknown C++ standard ${KOKKOS_CXX_STANDARD} - must be 14, 17, or 20") + MESSAGE(FATAL_ERROR "Kokkos requires C++17 or newer but requested ${KOKKOS_CXX_STANDARD}!") ENDIF() -# Enforce that we can compile a simple C++14 program +# Enforce that we can compile a simple C++17 program -TRY_COMPILE(CAN_COMPILE_CPP14 +TRY_COMPILE(CAN_COMPILE_CPP17 ${KOKKOS_TOP_BUILD_DIR}/corner_cases - ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/cplusplus14.cpp + ${KOKKOS_SOURCE_DIR}/cmake/compile_tests/cplusplus17.cpp OUTPUT_VARIABLE ERROR_MESSAGE - CXX_STANDARD 14 + CXX_STANDARD 17 ) -if (NOT CAN_COMPILE_CPP14) - UNSET(CAN_COMPILE_CPP14 CACHE) #make sure CMake always re-runs this - MESSAGE(FATAL_ERROR "C++${KOKKOS_CXX_STANDARD}-compliant compiler detected, but unable to compile C++14 or later program. Verify that ${CMAKE_CXX_COMPILER_ID}:${CMAKE_CXX_COMPILER_VERSION} is set up correctly (e.g., check that correct library headers are being used).\nFailing output:\n ${ERROR_MESSAGE}") +if (NOT CAN_COMPILE_CPP17) + UNSET(CAN_COMPILE_CPP17 CACHE) #make sure CMake always re-runs this + MESSAGE(FATAL_ERROR "C++${KOKKOS_CXX_STANDARD}-compliant compiler detected, but unable to compile C++17 or later program. Verify that ${CMAKE_CXX_COMPILER_ID}:${CMAKE_CXX_COMPILER_VERSION} is set up correctly (e.g., check that correct library headers are being used).\nFailing output:\n ${ERROR_MESSAGE}") ENDIF() -UNSET(CAN_COMPILE_CPP14 CACHE) #make sure CMake always re-runs this +UNSET(CAN_COMPILE_CPP17 CACHE) #make sure CMake always re-runs this # Enforce that extensions are turned off for nvcc_wrapper. # For compiling CUDA code using nvcc_wrapper, we will use the host compiler's -# flags for turning on C++14. Since for compiler ID and versioning purposes +# flags for turning on C++17. Since for compiler ID and versioning purposes # CMake recognizes the host compiler when calling nvcc_wrapper, this just -# works. Both NVCC and nvcc_wrapper only recognize '-std=c++14' which means +# works. Both NVCC and nvcc_wrapper only recognize '-std=c++17' which means # that we can only use host compilers for CUDA builds that use those flags. -# It also means that extensions (gnu++14) can't be turned on for CUDA builds. +# It also means that extensions (gnu++17) can't be turned on for CUDA builds. IF(KOKKOS_CXX_COMPILER_ID STREQUAL NVIDIA) IF(NOT DEFINED CMAKE_CXX_EXTENSIONS) diff --git a/packages/kokkos/cmake/kokkos_tpls.cmake b/packages/kokkos/cmake/kokkos_tpls.cmake index 2c712a519bd734c1c020818a8c61d264347ccc1e..ba66ee4d38dcfa5cd3f7e3b12c2bc7acb2de5eb4 100644 --- a/packages/kokkos/cmake/kokkos_tpls.cmake +++ b/packages/kokkos/cmake/kokkos_tpls.cmake @@ -39,7 +39,8 @@ IF(KOKKOS_ENABLE_MEMKIND) ENDIF() KOKKOS_TPL_OPTION(CUDA ${Kokkos_ENABLE_CUDA} TRIBITS CUDA) KOKKOS_TPL_OPTION(LIBRT Off) -IF(KOKKOS_ENABLE_HIP AND NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC) +IF(KOKKOS_ENABLE_HIP AND NOT KOKKOS_CXX_COMPILER_ID STREQUAL HIPCC AND NOT + KOKKOS_HAS_TRILINOS) SET(ROCM_DEFAULT ON) ELSE() SET(ROCM_DEFAULT OFF) @@ -82,7 +83,9 @@ KOKKOS_IMPORT_TPL(MEMKIND) IF (NOT WIN32) KOKKOS_IMPORT_TPL(THREADS INTERFACE) ENDIF() -KOKKOS_IMPORT_TPL(ROCM INTERFACE) +IF (NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) + KOKKOS_IMPORT_TPL(ROCM INTERFACE) +ENDIF() KOKKOS_IMPORT_TPL(LIBQUADMATH) IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND Kokkos_ENABLE_DESUL_ATOMICS_EXTERNAL) @@ -90,6 +93,22 @@ IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND Kokkos_ENABLE_DESUL_ATOMICS_EXTERNAL) KOKKOS_EXPORT_CMAKE_TPL(desul REQUIRED COMPONENTS atomics) ENDIF() +if (Kokkos_ENABLE_IMPL_MDSPAN AND Kokkos_ENABLE_MDSPAN_EXTERNAL) + find_package(mdspan REQUIRED) + KOKKOS_EXPORT_CMAKE_TPL(mdspan REQUIRED) +endif() + +IF (Kokkos_ENABLE_OPENMP) + find_package(OpenMP REQUIRED) + # FIXME_TRILINOS Trilinos doesn't allow for Kokkos to use find_dependency + # so we just append the flags here instead of linking with the OpenMP target. + IF(KOKKOS_HAS_TRILINOS) + COMPILER_SPECIFIC_FLAGS(DEFAULT ${OpenMP_CXX_FLAGS}) + ELSE() + KOKKOS_EXPORT_CMAKE_TPL(OpenMP REQUIRED) + ENDIF() +ENDIF() + #Convert list to newlines (which CMake doesn't always like in cache variables) STRING(REPLACE ";" "\n" KOKKOS_TPL_EXPORT_TEMP "${KOKKOS_TPL_EXPORTS}") #Convert to a regular variable diff --git a/packages/kokkos/cmake/kokkos_tribits.cmake b/packages/kokkos/cmake/kokkos_tribits.cmake index 34e45ecf7247af3095ca52d7d034eddd5cd03d24..0f39551423fb1e731de7efbc5499fe4803493c7f 100644 --- a/packages/kokkos/cmake/kokkos_tribits.cmake +++ b/packages/kokkos/cmake/kokkos_tribits.cmake @@ -8,8 +8,10 @@ MESSAGE(STATUS "The project name is: ${PROJECT_NAME}") IF(GTest_FOUND) SET(KOKKOS_GTEST_LIB GTest::gtest) + MESSAGE(STATUS "Using gtest found in ${GTest_DIR}") ELSE() # fallback to internal gtest SET(KOKKOS_GTEST_LIB kokkos_gtest) + MESSAGE(STATUS "Using internal gtest for testing") ENDIF() FUNCTION(VERIFY_EMPTY CONTEXT) @@ -88,9 +90,7 @@ MACRO(KOKKOS_PROCESS_SUBPACKAGES) ADD_SUBDIRECTORY(core) ADD_SUBDIRECTORY(containers) ADD_SUBDIRECTORY(algorithms) - if (KOKKOS_CXX_STANDARD GREATER_EQUAL 17) - ADD_SUBDIRECTORY(simd) - endif() + ADD_SUBDIRECTORY(simd) ADD_SUBDIRECTORY(example) endif() ENDMACRO() @@ -217,6 +217,7 @@ MACRO(KOKKOS_SETUP_BUILD_ENVIRONMENT) SET(Kokkos_INSTALL_TESTING OFF CACHE INTERNAL "Whether to build tests and examples against installation") IF (Kokkos_INSTALL_TESTING) SET(KOKKOS_ENABLE_TESTS ON) + SET(KOKKOS_ENABLE_BENCHMARKS ON) SET(KOKKOS_ENABLE_EXAMPLES ON) # This looks a little weird, but what we are doing # is to NOT build Kokkos but instead look for an @@ -281,11 +282,7 @@ MACRO(KOKKOS_CONFIGURE_CORE) LIST(APPEND FWD_BACKEND_LIST ${MEMSPACE}) ENDFOREACH() FOREACH(BACKEND_ ${KOKKOS_ENABLED_DEVICES}) - IF( ${BACKEND_} STREQUAL "PTHREAD") - LIST(APPEND FWD_BACKEND_LIST THREADS) - ELSE() - LIST(APPEND FWD_BACKEND_LIST ${BACKEND_}) - ENDIF() + LIST(APPEND FWD_BACKEND_LIST ${BACKEND_}) ENDFOREACH() MESSAGE(STATUS "Kokkos Devices: ${KOKKOS_ENABLED_DEVICES}, Kokkos Backends: ${FWD_BACKEND_LIST}") KOKKOS_CONFIG_HEADER( KokkosCore_Config_HeaderSet.in KokkosCore_Config_FwdBackend.hpp "KOKKOS_FWD" "fwd/Kokkos_Fwd" "${FWD_BACKEND_LIST}") @@ -356,6 +353,7 @@ MACRO(KOKKOS_INSTALL_ADDITIONAL_FILES) DESTINATION ${KOKKOS_HEADER_DIR}) ENDMACRO() + FUNCTION(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME) CMAKE_PARSE_ARGUMENTS(PARSE "PLAIN_STYLE" @@ -444,6 +442,7 @@ FUNCTION(KOKKOS_SET_LIBRARY_PROPERTIES LIBRARY_NAME) ENDIF() ENDFUNCTION() + FUNCTION(KOKKOS_INTERNAL_ADD_LIBRARY LIBRARY_NAME) CMAKE_PARSE_ARGUMENTS(PARSE "STATIC;SHARED" @@ -506,19 +505,11 @@ FUNCTION(KOKKOS_ADD_LIBRARY LIBRARY_NAME) # preserving the directory structure, e.g. impl # If headers got installed in both locations, it breaks some # downstream packages - TRIBITS_ADD_LIBRARY(${LIBRARY_NAME} ${PARSE_UNPARSED_ARGUMENTS}) - #Stolen from Tribits - it can add prefixes - SET(TRIBITS_LIBRARY_NAME_PREFIX "${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}") - SET(TRIBITS_LIBRARY_NAME ${TRIBITS_LIBRARY_NAME_PREFIX}${LIBRARY_NAME}) - #Tribits has way too much techinical debt and baggage to even - #allow PUBLIC target_compile_options to be used. It forces C++ flags on projects - #as a giant blob of space-separated strings. We end up with duplicated - #flags between the flags implicitly forced on Kokkos-dependent and those Kokkos - #has in its public INTERFACE_COMPILE_OPTIONS. - #These do NOT get de-deduplicated because Tribits - #creates flags as a giant monolithic space-separated string - #Do not set any transitive properties and keep everything working as before - #KOKKOS_SET_LIBRARY_PROPERTIES(${TRIBITS_LIBRARY_NAME} PLAIN_STYLE) + TRIBITS_ADD_LIBRARY(${LIBRARY_NAME} ${PARSE_UNPARSED_ARGUMENTS} + ADDED_LIB_TARGET_NAME_OUT ${LIBRARY_NAME}_TARGET_NAME ) + IF (PARSE_ADD_BUILD_OPTIONS) + KOKKOS_SET_LIBRARY_PROPERTIES(${${LIBRARY_NAME}_TARGET_NAME}) + ENDIF() ELSE() # Forward the headers, we want to know about all headers # to make sure they appear correctly in IDEs @@ -530,22 +521,17 @@ FUNCTION(KOKKOS_ADD_LIBRARY LIBRARY_NAME) ENDIF() ENDFUNCTION() -FUNCTION(KOKKOS_ADD_INTERFACE_LIBRARY NAME) -IF (KOKKOS_HAS_TRILINOS) - TRIBITS_ADD_LIBRARY(${NAME} ${ARGN}) -ELSE() - CMAKE_PARSE_ARGUMENTS(PARSE - "" - "" - "HEADERS;SOURCES" - ${ARGN} - ) - ADD_LIBRARY(${NAME} INTERFACE) - KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME}) -ENDIF() +FUNCTION(KOKKOS_ADD_INTERFACE_LIBRARY NAME) + IF (KOKKOS_HAS_TRILINOS) + TRIBITS_ADD_LIBRARY(${NAME} ${ARGN}) + ELSE() + ADD_LIBRARY(${NAME} INTERFACE) + KOKKOS_INTERNAL_ADD_LIBRARY_INSTALL(${NAME}) + ENDIF() ENDFUNCTION() + FUNCTION(KOKKOS_LIB_INCLUDE_DIRECTORIES TARGET) IF(KOKKOS_HAS_TRILINOS) #ignore the target, tribits doesn't do anything directly with targets @@ -559,13 +545,8 @@ FUNCTION(KOKKOS_LIB_INCLUDE_DIRECTORIES TARGET) ENDFUNCTION() FUNCTION(KOKKOS_LIB_COMPILE_OPTIONS TARGET) - IF(KOKKOS_HAS_TRILINOS) - #don't trust tribits to do this correctly - KOKKOS_TARGET_COMPILE_OPTIONS(${TARGET} ${ARGN}) - ELSE() - KOKKOS_LIB_TYPE(${TARGET} INCTYPE) - KOKKOS_TARGET_COMPILE_OPTIONS(${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${TARGET} ${INCTYPE} ${ARGN}) - ENDIF() + KOKKOS_LIB_TYPE(${TARGET} INCTYPE) + KOKKOS_TARGET_COMPILE_OPTIONS(${${PROJECT_NAME}_LIBRARY_NAME_PREFIX}${TARGET} ${INCTYPE} ${ARGN}) ENDFUNCTION() MACRO(KOKKOS_ADD_TEST_DIRECTORIES) diff --git a/packages/kokkos/cmake/tpls/FindTPLCUSPARSE.cmake b/packages/kokkos/cmake/tpls/FindTPLCUSPARSE.cmake index 1ae4f19dd4036df21d22c758a7e535f432734415..4709f8002b11923f1f20801e077ea98172b58c7c 100644 --- a/packages/kokkos/cmake/tpls/FindTPLCUSPARSE.cmake +++ b/packages/kokkos/cmake/tpls/FindTPLCUSPARSE.cmake @@ -1,44 +1,18 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) -# -# ************************************************************************ -# @HEADER +#@HEADER # Check for CUDA support diff --git a/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake b/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake index 467635083f2bdf83db722d51e4eea1ead1b604b4..4e05d22534893961c6ba16e8a1664d312de5fc31 100644 --- a/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake +++ b/packages/kokkos/cmake/tpls/FindTPLHWLOC.cmake @@ -1,41 +1,16 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ************************************************************************ # @HEADER diff --git a/packages/kokkos/cmake/tpls/FindTPLPthread.cmake b/packages/kokkos/cmake/tpls/FindTPLPthread.cmake index c78630b7f19108da4c730c24b7151dfec57204b7..3d5b03805d4d9bd299af7d6ffda62440b223cdce 100644 --- a/packages/kokkos/cmake/tpls/FindTPLPthread.cmake +++ b/packages/kokkos/cmake/tpls/FindTPLPthread.cmake @@ -1,46 +1,20 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ************************************************************************ # @HEADER - SET(USE_THREADS FALSE) IF(NOT TPL_Pthread_INCLUDE_DIRS AND NOT TPL_Pthread_LIBRARY_DIRS AND NOT TPL_Pthread_LIBRARIES) diff --git a/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake b/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake index 1f7587da808fd587f6380079f9a672f124b3a25b..8560ec60f1b52ae2bab9c0c9c9c754c85da373af 100644 --- a/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake +++ b/packages/kokkos/cmake/tpls/FindTPLquadmath.cmake @@ -1,41 +1,16 @@ -# @HEADER +#@HEADER # ************************************************************************ # -# Kokkos v. 3.0 -# Copyright (2020) National Technology & Engineering +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering # Solutions of Sandia, LLC (NTESS). # # Under the terms of Contract DE-NA0003525 with NTESS, # the U.S. Government retains certain rights in this software. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the Corporation nor the names of the -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. # -# Questions? Contact Christian R. Trott (crtrott@sandia.gov) +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ************************************************************************ # @HEADER diff --git a/packages/kokkos/containers/CMakeLists.txt b/packages/kokkos/containers/CMakeLists.txt index b0e0c4eadea7f64ac2cf8a5cf4d56fec786ff416..b450c2720993752460aa07035fed38415440e739 100644 --- a/packages/kokkos/containers/CMakeLists.txt +++ b/packages/kokkos/containers/CMakeLists.txt @@ -6,7 +6,10 @@ IF (NOT Kokkos_INSTALL_TESTING) ADD_SUBDIRECTORY(src) ENDIF() +# FIXME_OPENACC: temporarily disabled due to unimplemented features +IF(NOT KOKKOS_ENABLE_OPENACC) KOKKOS_ADD_TEST_DIRECTORIES(unit_tests) KOKKOS_ADD_TEST_DIRECTORIES(performance_tests) +ENDIF() KOKKOS_SUBPACKAGE_POSTPROCESS() diff --git a/packages/kokkos/containers/performance_tests/TestCuda.cpp b/packages/kokkos/containers/performance_tests/TestCuda.cpp index 8874590e2acad12369989d87b78670fa004b2086..e98595a41e4d5d3c30bc7ee3ee3efed6aa1c70a4 100644 --- a/packages/kokkos/containers/performance_tests/TestCuda.cpp +++ b/packages/kokkos/containers/performance_tests/TestCuda.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> @@ -72,6 +44,10 @@ TEST(TEST_CATEGORY, dynrankview_perf) { } TEST(TEST_CATEGORY, global_2_local) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + GTEST_SKIP() << "errors reported for all sizes"; +#endif std::cout << "Cuda" << std::endl; std::cout << "size, create, generate, fill, find" << std::endl; for (unsigned i = Performance::begin_id_size; i <= Performance::end_id_size; diff --git a/packages/kokkos/containers/performance_tests/TestDynRankView.hpp b/packages/kokkos/containers/performance_tests/TestDynRankView.hpp index 7ed9a0271a51db453ff29a982e57cd17d70a642d..48c5defeb79669f9a33ab24f7d4ae7605ed1c238 100644 --- a/packages/kokkos/containers/performance_tests/TestDynRankView.hpp +++ b/packages/kokkos/containers/performance_tests/TestDynRankView.hpp @@ -1,44 +1,17 @@ - //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_TEST_DYNRANKVIEW_HPP diff --git a/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp b/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp index 77451bb9e8f7ae99d84fbcb3fac05ad58a80850b..ac11d2493ffd33da7c181594ec5bbd75f872b85e 100644 --- a/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp +++ b/packages/kokkos/containers/performance_tests/TestGlobal2LocalIds.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_TEST_GLOBAL_TO_LOCAL_IDS_HPP diff --git a/packages/kokkos/containers/performance_tests/TestHIP.cpp b/packages/kokkos/containers/performance_tests/TestHIP.cpp index 8033c76be6cfaf491ba7ff9abd63856aca589c89..56680f7d64897df456d22a071fc44c99e08fd6fa 100644 --- a/packages/kokkos/containers/performance_tests/TestHIP.cpp +++ b/packages/kokkos/containers/performance_tests/TestHIP.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> @@ -68,7 +40,7 @@ namespace Performance { TEST(TEST_CATEGORY, dynrankview_perf) { std::cout << "HIP" << std::endl; std::cout << " DynRankView vs View: Initialization Only " << std::endl; - test_dynrankview_op_perf<Kokkos::Experimental::HIP>(40960); + test_dynrankview_op_perf<Kokkos::HIP>(40960); } TEST(TEST_CATEGORY, global_2_local) { @@ -76,15 +48,15 @@ TEST(TEST_CATEGORY, global_2_local) { std::cout << "size, create, generate, fill, find" << std::endl; for (unsigned i = Performance::begin_id_size; i <= Performance::end_id_size; i *= Performance::id_step) - test_global_to_local_ids<Kokkos::Experimental::HIP>(i); + test_global_to_local_ids<Kokkos::HIP>(i); } TEST(TEST_CATEGORY, unordered_map_performance_near) { - Perf::run_performance_tests<Kokkos::Experimental::HIP, true>("hip-near"); + Perf::run_performance_tests<Kokkos::HIP, true>("hip-near"); } TEST(TEST_CATEGORY, unordered_map_performance_far) { - Perf::run_performance_tests<Kokkos::Experimental::HIP, false>("hip-far"); + Perf::run_performance_tests<Kokkos::HIP, false>("hip-far"); } } // namespace Performance diff --git a/packages/kokkos/containers/performance_tests/TestHPX.cpp b/packages/kokkos/containers/performance_tests/TestHPX.cpp index f229901dcc421f964d731380172690986b65163a..b3bfb2140b2c1595dd69ad2059d4354ec55a3535 100644 --- a/packages/kokkos/containers/performance_tests/TestHPX.cpp +++ b/packages/kokkos/containers/performance_tests/TestHPX.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> diff --git a/packages/kokkos/containers/performance_tests/TestMain.cpp b/packages/kokkos/containers/performance_tests/TestMain.cpp index 140ba418fdac4eda95ed362a9b5bf64e50676cc2..0bf647012ac64a64fde6218e4f49aad0b47e2f89 100644 --- a/packages/kokkos/containers/performance_tests/TestMain.cpp +++ b/packages/kokkos/containers/performance_tests/TestMain.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <cstdlib> diff --git a/packages/kokkos/containers/performance_tests/TestOpenMP.cpp b/packages/kokkos/containers/performance_tests/TestOpenMP.cpp index f414b0d8282b62c01b64d7c1275c2bc1bf7bbdf4..0e16200961da5194d03a43115be02140ec04dbda 100644 --- a/packages/kokkos/containers/performance_tests/TestOpenMP.cpp +++ b/packages/kokkos/containers/performance_tests/TestOpenMP.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> diff --git a/packages/kokkos/containers/performance_tests/TestScatterView.hpp b/packages/kokkos/containers/performance_tests/TestScatterView.hpp index bd06be9667be33f81ad607903ac97dbd1b65895c..a74f833b9f524a524a2a1bd09b49d1a71940cd7f 100644 --- a/packages/kokkos/containers/performance_tests/TestScatterView.hpp +++ b/packages/kokkos/containers/performance_tests/TestScatterView.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SCATTER_VIEW_HPP #define KOKKOS_TEST_SCATTER_VIEW_HPP diff --git a/packages/kokkos/containers/performance_tests/TestThreads.cpp b/packages/kokkos/containers/performance_tests/TestThreads.cpp index 72bef1a3ad027a2ba780230fb39e742f6a335327..d32b09702af6bdd14094e3bf37e659dc284a5a29 100644 --- a/packages/kokkos/containers/performance_tests/TestThreads.cpp +++ b/packages/kokkos/containers/performance_tests/TestThreads.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> diff --git a/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp b/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp index 8ff208d6a867bc424334a953723d21235f09bac0..6d3764a989d1d39de8a4a1a54450fad789eb6c1d 100644 --- a/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp +++ b/packages/kokkos/containers/performance_tests/TestUnorderedMapPerformance.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_TEST_UNORDERED_MAP_PERFORMANCE_HPP diff --git a/packages/kokkos/containers/src/Kokkos_Bitset.hpp b/packages/kokkos/containers/src/Kokkos_Bitset.hpp index 05121b4e51195651c3bd05d01529f311beaa5863..35f691ecf4e0db1e4d77dfeb364ce4726a0ab124 100644 --- a/packages/kokkos/containers/src/Kokkos_Bitset.hpp +++ b/packages/kokkos/containers/src/Kokkos_Bitset.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_BITSET_HPP #define KOKKOS_BITSET_HPP diff --git a/packages/kokkos/containers/src/Kokkos_DualView.hpp b/packages/kokkos/containers/src/Kokkos_DualView.hpp index 916c54d605545ef8fe8a39f5e98a36d000bfa85a..07256b446426f9a0024df1755a8dd42045eaf65e 100644 --- a/packages/kokkos/containers/src/Kokkos_DualView.hpp +++ b/packages/kokkos/containers/src/Kokkos_DualView.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_DualView.hpp /// \brief Declaration and definition of Kokkos::DualView. @@ -939,20 +911,9 @@ class DualView : public ViewTraits<DataType, Arg1Type, Arg2Type, Arg3Type> { typename t_host::memory_space(), d_view); } } else if (alloc_prop_input::initialize) { - if (alloc_prop_input::has_execution_space) { - // Add execution_space if not provided to avoid need for if constexpr - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 2>, - typename t_dev::execution_space>>; - alloc_prop arg_prop_copy(arg_prop); - using execution_space_type = typename alloc_prop::execution_space; - const execution_space_type& exec_space = - static_cast< - Kokkos::Impl::ViewCtorProp<void, execution_space_type> const&>( - arg_prop_copy) - .value; + if constexpr (alloc_prop_input::has_execution_space) { + const auto& exec_space = + Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop); ::Kokkos::deep_copy(exec_space, d_view, typename t_dev::value_type{}); } else ::Kokkos::deep_copy(d_view, typename t_dev::value_type{}); @@ -1032,10 +993,11 @@ class DualView : public ViewTraits<DataType, Arg1Type, Arg2Type, Arg3Type> { if (modified_flags.data() == nullptr) { modified_flags = t_modified_flags("DualView::modified_flags"); } - if (modified_flags(1) >= modified_flags(0)) { + + [[maybe_unused]] auto resize_on_device = [&](const auto& properties) { /* Resize on Device */ if (sizeMismatch) { - ::Kokkos::resize(arg_prop, d_view, n0, n1, n2, n3, n4, n5, n6, n7); + ::Kokkos::resize(properties, d_view, n0, n1, n2, n3, n4, n5, n6, n7); if (alloc_prop_input::initialize) { h_view = create_mirror_view(typename t_host::memory_space(), d_view); } else { @@ -1046,10 +1008,12 @@ class DualView : public ViewTraits<DataType, Arg1Type, Arg2Type, Arg3Type> { /* Mark Device copy as modified */ ++modified_flags(1); } - } else { + }; + + [[maybe_unused]] auto resize_on_host = [&](const auto& properties) { /* Resize on Host */ if (sizeMismatch) { - ::Kokkos::resize(arg_prop, h_view, n0, n1, n2, n3, n4, n5, n6, n7); + ::Kokkos::resize(properties, h_view, n0, n1, n2, n3, n4, n5, n6, n7); if (alloc_prop_input::initialize) { d_view = create_mirror_view(typename t_dev::memory_space(), h_view); @@ -1061,6 +1025,37 @@ class DualView : public ViewTraits<DataType, Arg1Type, Arg2Type, Arg3Type> { /* Mark Host copy as modified */ ++modified_flags(0); } + }; + + constexpr bool has_execution_space = alloc_prop_input::has_execution_space; + + if constexpr (has_execution_space) { + using ExecSpace = typename alloc_prop_input::execution_space; + const auto& exec_space = + Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop); + constexpr bool exec_space_can_access_device = + SpaceAccessibility<ExecSpace, + typename t_dev::memory_space>::accessible; + constexpr bool exec_space_can_access_host = + SpaceAccessibility<ExecSpace, + typename t_host::memory_space>::accessible; + static_assert(exec_space_can_access_device || exec_space_can_access_host); + if constexpr (exec_space_can_access_device) { + sync<typename t_dev::memory_space>(exec_space); + resize_on_device(arg_prop); + return; + } + if constexpr (exec_space_can_access_host) { + sync<typename t_host::memory_space>(exec_space); + resize_on_host(arg_prop); + return; + } + } else { + if (modified_flags(1) >= modified_flags(0)) { + resize_on_device(arg_prop); + } else { + resize_on_host(arg_prop); + } } } diff --git a/packages/kokkos/containers/src/Kokkos_DynRankView.hpp b/packages/kokkos/containers/src/Kokkos_DynRankView.hpp index 059ce8a610d26c9072b1cd15a282364855130d9a..ce433b0bfc088a0cea29cd15ff3cbde0c9af5acb 100644 --- a/packages/kokkos/containers/src/Kokkos_DynRankView.hpp +++ b/packages/kokkos/containers/src/Kokkos_DynRankView.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_DynRankView.hpp /// \brief Declaration and definition of Kokkos::DynRankView. @@ -1099,21 +1071,11 @@ class DynRankView : public ViewTraits<DataType, Properties...> { m_rank(Impl::DynRankDimTraits<typename traits::specialize>:: template computeRank<typename traits::array_layout, P...>( arg_prop, arg_layout)) { - // Append layout and spaces if not input - using alloc_prop_input = Kokkos::Impl::ViewCtorProp<P...>; - - // use 'std::integral_constant<unsigned,I>' for non-types - // to avoid duplicate class error. - using alloc_prop = Kokkos::Impl::ViewCtorProp< - P..., - std::conditional_t<alloc_prop_input::has_label, - std::integral_constant<unsigned, 0>, std::string>, - std::conditional_t<alloc_prop_input::has_memory_space, - std::integral_constant<unsigned, 1>, - typename traits::device_type::memory_space>, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned, 2>, - typename traits::device_type::execution_space>>; + // Copy the input allocation properties with possibly defaulted properties + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string{}, typename traits::device_type::memory_space{}, + typename traits::device_type::execution_space{}); + using alloc_prop = decltype(prop_copy); static_assert(traits::is_managed, "View allocation constructor requires managed memory"); @@ -1127,9 +1089,6 @@ class DynRankView : public ViewTraits<DataType, Properties...> { "execution space"); } - // Copy the input allocation properties with possibly defaulted properties - alloc_prop prop_copy(arg_prop); - //------------------------------------------------------------ #if defined(KOKKOS_ENABLE_CUDA) // If allocating in CudaUVMSpace must fence before and after @@ -2011,10 +1970,8 @@ inline typename DynRankView<T, P...>::HostMirror create_mirror( "The view constructor arguments passed to Kokkos::create_mirror must " "not explicitly allow padding!"); - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - std::string(src.label()).append("_mirror"); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string(src.label()).append("_mirror")); return dst_type(prop_copy, Impl::reconstructLayout(src.layout(), src.rank())); } @@ -2044,10 +2001,8 @@ inline auto create_mirror( "The view constructor arguments passed to Kokkos::create_mirror must " "not explicitly allow padding!"); - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - std::string(src.label()).append("_mirror"); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string(src.label()).append("_mirror")); return dst_type(prop_copy, Impl::reconstructLayout(src.layout(), src.rank())); } @@ -2308,30 +2263,17 @@ auto create_mirror_view_and_copy( using Space = typename alloc_prop_input::memory_space; using Mirror = typename Impl::MirrorDRViewType<Space, T, P...>::view_type; - // Add some properties if not provided to avoid need for if constexpr - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., - std::conditional_t<alloc_prop_input::has_label, - std::integral_constant<unsigned int, 12>, std::string>, - std::conditional_t<!alloc_prop_input::initialize, - std::integral_constant<unsigned int, 13>, - Impl::WithoutInitializing_t>, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 14>, - typename Space::execution_space>>; - alloc_prop arg_prop_copy(arg_prop); - - std::string& label = - static_cast<Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy).value; + auto arg_prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string{}, WithoutInitializing, + typename Space::execution_space{}); + + std::string& label = Impl::get_property<Impl::LabelTag>(arg_prop_copy); if (label.empty()) label = src.label(); auto mirror = typename Mirror::non_const_type{ arg_prop_copy, Impl::reconstructLayout(src.layout(), src.rank())}; - if (alloc_prop_input::has_execution_space) { - using ExecutionSpace = typename alloc_prop::execution_space; - deep_copy( - static_cast<Impl::ViewCtorProp<void, ExecutionSpace>&>(arg_prop_copy) - .value, - mirror, src); + if constexpr (alloc_prop_input::has_execution_space) { + deep_copy(Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop_copy), + mirror, src); } else deep_copy(mirror, src); return mirror; @@ -2374,24 +2316,14 @@ inline void impl_resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop, "The view constructor arguments passed to Kokkos::resize must " "not include a memory space instance!"); - // Add execution space here to avoid the need for if constexpr below - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., std::string, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 10>, - typename drview_type::execution_space>>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - v.label(); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, v.label(), typename drview_type::execution_space{}); drview_type v_resized(prop_copy, n0, n1, n2, n3, n4, n5, n6, n7); - if (alloc_prop_input::has_execution_space) + if constexpr (alloc_prop_input::has_execution_space) Kokkos::Impl::DynRankViewRemap<drview_type, drview_type>( - static_cast<const Impl::ViewCtorProp< - void, typename alloc_prop::execution_space>&>(prop_copy) - .value, - v_resized, v); + Impl::get_property<Impl::ExecutionSpaceTag>(prop_copy), v_resized, v); else Kokkos::Impl::DynRankViewRemap<drview_type, drview_type>(v_resized, v); @@ -2462,10 +2394,7 @@ inline void impl_realloc(DynRankView<T, P...>& v, const size_t n0, "The view constructor arguments passed to Kokkos::realloc must " "not include a memory space instance!"); - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop arg_prop_copy(arg_prop); - static_cast<Kokkos::Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy) - .value = v.label(); + auto arg_prop_copy = Impl::with_properties_if_unset(arg_prop, v.label()); v = drview_type(); // Deallocate first, if the only view to allocation v = drview_type(arg_prop_copy, n0, n1, n2, n3, n4, n5, n6, n7); diff --git a/packages/kokkos/containers/src/Kokkos_DynamicView.hpp b/packages/kokkos/containers/src/Kokkos_DynamicView.hpp index a2b68064de13bd2b8988b6a2025bc3c9ef2c2685..f8636b6212fdcf32d525d12ae1e1d0e3521441a8 100644 --- a/packages/kokkos/containers/src/Kokkos_DynamicView.hpp +++ b/packages/kokkos/containers/src/Kokkos_DynamicView.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DYNAMIC_VIEW_HPP #define KOKKOS_DYNAMIC_VIEW_HPP @@ -535,9 +507,7 @@ class DynamicView : public Kokkos::ViewTraits<DataType, P...> { m_chunks = device_accessor(m_chunk_max, m_chunk_size); const std::string& label = - static_cast<Kokkos::Impl::ViewCtorProp<void, std::string> const&>( - arg_prop) - .value; + Kokkos::Impl::get_property<Kokkos::Impl::LabelTag>(arg_prop); if (device_accessor::template IsAccessibleFrom<host_space>::value) { m_chunks.template allocate_with_destroy<device_space>(label); @@ -552,17 +522,14 @@ class DynamicView : public Kokkos::ViewTraits<DataType, P...> { label, m_chunks.get_ptr()); m_chunks_host.initialize(); - // Add some properties if not provided to avoid need for if constexpr using alloc_prop_input = Kokkos::Impl::ViewCtorProp<Prop...>; - using alloc_prop = Kokkos::Impl::ViewCtorProp< - Prop..., std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 15>, - typename device_space::execution_space>>; - alloc_prop arg_prop_copy(arg_prop); - - const auto& exec = static_cast<const Kokkos::Impl::ViewCtorProp< - void, typename alloc_prop::execution_space>&>(arg_prop_copy) - .value; + + auto arg_prop_copy = ::Kokkos::Impl::with_properties_if_unset( + arg_prop, typename device_space::execution_space{}); + + const auto& exec = + Kokkos::Impl::get_property<Kokkos::Impl::ExecutionSpaceTag>( + arg_prop_copy); m_chunks_host.deep_copy_to(exec, m_chunks); if (!alloc_prop_input::has_execution_space) exec.fence( @@ -641,10 +608,8 @@ inline auto create_mirror( "The view constructor arguments passed to Kokkos::create_mirror must " "not explicitly allow padding!"); - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - std::string(src.label()).append("_mirror"); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string(src.label()).append("_mirror")); auto ret = typename Kokkos::Experimental::DynamicView<T, P...>::HostMirror( prop_copy, src.chunk_size(), src.chunk_max() * src.chunk_size()); @@ -676,10 +641,8 @@ inline auto create_mirror( "not explicitly allow padding!"); using MemorySpace = typename alloc_prop_input::memory_space; - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - std::string(src.label()).append("_mirror"); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string(src.label()).append("_mirror")); auto ret = typename Kokkos::Impl::MirrorDynamicViewType< MemorySpace, T, P...>::view_type(prop_copy, src.chunk_size(), @@ -915,8 +878,8 @@ inline void deep_copy(const View<T, DP...>& dst, template <class T, class... DP, class... SP> inline void deep_copy(const Kokkos::Experimental::DynamicView<T, DP...>& dst, const View<T, SP...>& src) { - using dst_type = Kokkos::Experimental::DynamicView<T, SP...>; - using src_type = View<T, DP...>; + using dst_type = Kokkos::Experimental::DynamicView<T, DP...>; + using src_type = View<T, SP...>; using dst_execution_space = typename ViewTraits<T, DP...>::execution_space; using src_memory_space = typename ViewTraits<T, SP...>::memory_space; @@ -1075,31 +1038,18 @@ auto create_mirror_view_and_copy( using Mirror = typename Impl::MirrorDynamicViewType<Space, T, P...>::view_type; - // Add some properties if not provided to avoid need for if constexpr - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., - std::conditional_t<alloc_prop_input::has_label, - std::integral_constant<unsigned int, 12>, std::string>, - std::conditional_t<!alloc_prop_input::initialize, - std::integral_constant<unsigned int, 13>, - Impl::WithoutInitializing_t>, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 14>, - typename Space::execution_space>>; - alloc_prop arg_prop_copy(arg_prop); - - std::string& label = - static_cast<Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy).value; + auto arg_prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string{}, WithoutInitializing, + typename Space::execution_space{}); + + std::string& label = Impl::get_property<Impl::LabelTag>(arg_prop_copy); if (label.empty()) label = src.label(); auto mirror = typename Mirror::non_const_type( arg_prop_copy, src.chunk_size(), src.chunk_max() * src.chunk_size()); mirror.resize_serial(src.extent(0)); - if (alloc_prop_input::has_execution_space) { - using ExecutionSpace = typename alloc_prop::execution_space; - deep_copy( - static_cast<Impl::ViewCtorProp<void, ExecutionSpace>&>(arg_prop_copy) - .value, - mirror, src); + if constexpr (alloc_prop_input::has_execution_space) { + deep_copy(Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop_copy), + mirror, src); } else deep_copy(mirror, src); return mirror; diff --git a/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp b/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp index 8affa0bac4f87a95df1e5200540ac191b1f817a3..0482bb6fb38b022df9ec83fe450811ac26a3fe59 100644 --- a/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp +++ b/packages/kokkos/containers/src/Kokkos_ErrorReporter.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXPERIMENTAL_ERROR_REPORTER_HPP #define KOKKOS_EXPERIMENTAL_ERROR_REPORTER_HPP diff --git a/packages/kokkos/containers/src/Kokkos_Functional.hpp b/packages/kokkos/containers/src/Kokkos_Functional.hpp index 478a087d0c32185f87da8b9f8cc664bdcb7fa170..4d39716cc3f118953c317fe2a4e8a5e2e01f1d59 100644 --- a/packages/kokkos/containers/src/Kokkos_Functional.hpp +++ b/packages/kokkos/containers/src/Kokkos_Functional.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_FUNCTIONAL_HPP @@ -56,13 +30,6 @@ namespace Kokkos { template <typename T> struct pod_hash { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using argument_type KOKKOS_DEPRECATED = T; - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = uint32_t; - using result_type KOKKOS_DEPRECATED = uint32_t; -#endif - KOKKOS_FORCEINLINE_FUNCTION uint32_t operator()(T const& t) const { return Impl::MurmurHash3_x86_32(&t, sizeof(T), 0); @@ -76,12 +43,6 @@ struct pod_hash { template <typename T> struct pod_equal_to { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = T; - using result_type KOKKOS_DEPRECATED = bool; -#endif - KOKKOS_FORCEINLINE_FUNCTION bool operator()(T const& a, T const& b) const { return Impl::bitwise_equal(&a, &b); @@ -90,12 +51,6 @@ struct pod_equal_to { template <typename T> struct pod_not_equal_to { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = T; - using result_type KOKKOS_DEPRECATED = bool; -#endif - KOKKOS_FORCEINLINE_FUNCTION bool operator()(T const& a, T const& b) const { return !Impl::bitwise_equal(&a, &b); @@ -104,72 +59,36 @@ struct pod_not_equal_to { template <typename T> struct equal_to { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = T; - using result_type KOKKOS_DEPRECATED = bool; -#endif - KOKKOS_FORCEINLINE_FUNCTION bool operator()(T const& a, T const& b) const { return a == b; } }; template <typename T> struct not_equal_to { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = T; - using result_type KOKKOS_DEPRECATED = bool; -#endif - KOKKOS_FORCEINLINE_FUNCTION bool operator()(T const& a, T const& b) const { return a != b; } }; template <typename T> struct greater { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = T; - using result_type KOKKOS_DEPRECATED = bool; -#endif - KOKKOS_FORCEINLINE_FUNCTION bool operator()(T const& a, T const& b) const { return a > b; } }; template <typename T> struct less { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = T; - using result_type KOKKOS_DEPRECATED = bool; -#endif - KOKKOS_FORCEINLINE_FUNCTION bool operator()(T const& a, T const& b) const { return a < b; } }; template <typename T> struct greater_equal { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = T; - using result_type KOKKOS_DEPRECATED = bool; -#endif - KOKKOS_FORCEINLINE_FUNCTION bool operator()(T const& a, T const& b) const { return a >= b; } }; template <typename T> struct less_equal { -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - using first_argument_type KOKKOS_DEPRECATED = T; - using second_argument_type KOKKOS_DEPRECATED = T; - using result_type KOKKOS_DEPRECATED = bool; -#endif - KOKKOS_FORCEINLINE_FUNCTION bool operator()(T const& a, T const& b) const { return a <= b; } }; diff --git a/packages/kokkos/containers/src/Kokkos_OffsetView.hpp b/packages/kokkos/containers/src/Kokkos_OffsetView.hpp index 5027763a0297a00c2b9dfb28734da628e763d7dc..35b28999c1ddb077162535cdbd7a8f92f30ace75 100644 --- a/packages/kokkos/containers/src/Kokkos_OffsetView.hpp +++ b/packages/kokkos/containers/src/Kokkos_OffsetView.hpp @@ -1,9 +1,18 @@ -/* - * Kokkos_OffsetView.hpp - * - * Created on: Apr 23, 2018 - * Author: swbova - */ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER #ifndef KOKKOS_OFFSETVIEW_HPP_ #define KOKKOS_OFFSETVIEW_HPP_ @@ -196,17 +205,17 @@ class OffsetView : public ViewTraits<DataType, Properties...> { template <typename iType, std::enable_if_t<std::is_integral<iType>::value, iType> = 0> - KOKKOS_INLINE_FUNCTION int64_t begin(const iType local_dimension) const { + KOKKOS_FUNCTION int64_t begin(const iType local_dimension) const { return local_dimension < Rank ? m_begins[local_dimension] : KOKKOS_INVALID_OFFSET; } - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION begins_type begins() const { return m_begins; } template <typename iType, std::enable_if_t<std::is_integral<iType>::value, iType> = 0> - KOKKOS_INLINE_FUNCTION int64_t end(const iType local_dimension) const { + KOKKOS_FUNCTION int64_t end(const iType local_dimension) const { return begin(local_dimension) + m_map.extent(local_dimension); } @@ -245,63 +254,46 @@ class OffsetView : public ViewTraits<DataType, Properties...> { /** \brief rank() to be implemented */ - // KOKKOS_INLINE_FUNCTION + // KOKKOS_FUNCTION // static // constexpr unsigned rank() { return map_type::Rank; } template <typename iType> - KOKKOS_INLINE_FUNCTION constexpr std::enable_if_t< - std::is_integral<iType>::value, size_t> + KOKKOS_FUNCTION constexpr std::enable_if_t<std::is_integral<iType>::value, + size_t> extent(const iType& r) const { return m_map.extent(r); } template <typename iType> - KOKKOS_INLINE_FUNCTION constexpr std::enable_if_t< - std::is_integral<iType>::value, int> + KOKKOS_FUNCTION constexpr std::enable_if_t<std::is_integral<iType>::value, + int> extent_int(const iType& r) const { return static_cast<int>(m_map.extent(r)); } - KOKKOS_INLINE_FUNCTION constexpr typename traits::array_layout layout() - const { + KOKKOS_FUNCTION constexpr typename traits::array_layout layout() const { return m_map.layout(); } - KOKKOS_INLINE_FUNCTION constexpr size_t size() const { + KOKKOS_FUNCTION constexpr size_t size() const { return m_map.dimension_0() * m_map.dimension_1() * m_map.dimension_2() * m_map.dimension_3() * m_map.dimension_4() * m_map.dimension_5() * m_map.dimension_6() * m_map.dimension_7(); } - KOKKOS_INLINE_FUNCTION constexpr size_t stride_0() const { - return m_map.stride_0(); - } - KOKKOS_INLINE_FUNCTION constexpr size_t stride_1() const { - return m_map.stride_1(); - } - KOKKOS_INLINE_FUNCTION constexpr size_t stride_2() const { - return m_map.stride_2(); - } - KOKKOS_INLINE_FUNCTION constexpr size_t stride_3() const { - return m_map.stride_3(); - } - KOKKOS_INLINE_FUNCTION constexpr size_t stride_4() const { - return m_map.stride_4(); - } - KOKKOS_INLINE_FUNCTION constexpr size_t stride_5() const { - return m_map.stride_5(); - } - KOKKOS_INLINE_FUNCTION constexpr size_t stride_6() const { - return m_map.stride_6(); - } - KOKKOS_INLINE_FUNCTION constexpr size_t stride_7() const { - return m_map.stride_7(); - } + KOKKOS_FUNCTION constexpr size_t stride_0() const { return m_map.stride_0(); } + KOKKOS_FUNCTION constexpr size_t stride_1() const { return m_map.stride_1(); } + KOKKOS_FUNCTION constexpr size_t stride_2() const { return m_map.stride_2(); } + KOKKOS_FUNCTION constexpr size_t stride_3() const { return m_map.stride_3(); } + KOKKOS_FUNCTION constexpr size_t stride_4() const { return m_map.stride_4(); } + KOKKOS_FUNCTION constexpr size_t stride_5() const { return m_map.stride_5(); } + KOKKOS_FUNCTION constexpr size_t stride_6() const { return m_map.stride_6(); } + KOKKOS_FUNCTION constexpr size_t stride_7() const { return m_map.stride_7(); } template <typename iType> - KOKKOS_INLINE_FUNCTION constexpr std::enable_if_t< - std::is_integral<iType>::value, size_t> + KOKKOS_FUNCTION constexpr std::enable_if_t<std::is_integral<iType>::value, + size_t> stride(iType r) const { return ( r == 0 @@ -322,7 +314,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> { } template <typename iType> - KOKKOS_INLINE_FUNCTION void stride(iType* const s) const { + KOKKOS_FUNCTION void stride(iType* const s) const { m_map.stride(s); } @@ -337,21 +329,19 @@ class OffsetView : public ViewTraits<DataType, Properties...> { std::is_lvalue_reference<reference_type>::value }; - KOKKOS_INLINE_FUNCTION constexpr size_t span() const { return m_map.span(); } - KOKKOS_INLINE_FUNCTION bool span_is_contiguous() const { + KOKKOS_FUNCTION constexpr size_t span() const { return m_map.span(); } + KOKKOS_FUNCTION bool span_is_contiguous() const { return m_map.span_is_contiguous(); } - KOKKOS_INLINE_FUNCTION constexpr bool is_allocated() const { + KOKKOS_FUNCTION constexpr bool is_allocated() const { return m_map.data() != nullptr; } - KOKKOS_INLINE_FUNCTION constexpr pointer_type data() const { - return m_map.data(); - } + KOKKOS_FUNCTION constexpr pointer_type data() const { return m_map.data(); } //---------------------------------------- // Allow specializations to query their specialized map - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION const Kokkos::Impl::ViewMapping<traits, void>& implementation_map() const { return m_map; } @@ -782,24 +772,24 @@ class OffsetView : public ViewTraits<DataType, Properties...> { KOKKOS_DEFAULTED_FUNCTION ~OffsetView() = default; - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView() : m_track(), m_map() { for (size_t i = 0; i < Rank; ++i) m_begins[i] = KOKKOS_INVALID_OFFSET; } - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView(const OffsetView& rhs) : m_track(rhs.m_track, traits::is_managed), m_map(rhs.m_map), m_begins(rhs.m_begins) {} - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView(OffsetView&& rhs) : m_track(std::move(rhs.m_track)), m_map(std::move(rhs.m_map)), m_begins(std::move(rhs.m_begins)) {} - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView& operator=(const OffsetView& rhs) { m_track = rhs.m_track; m_map = rhs.m_map; @@ -807,7 +797,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> { return *this; } - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView& operator=(OffsetView&& rhs) { m_track = std::move(rhs.m_track); m_map = std::move(rhs.m_map); @@ -822,14 +812,14 @@ class OffsetView : public ViewTraits<DataType, Properties...> { typename traits::device_type, typename traits::memory_traits>; public: - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION view_type view() const { view_type v(m_track, m_map); return v; } template <class RT, class... RP> - KOKKOS_INLINE_FUNCTION OffsetView(const View<RT, RP...>& aview) + KOKKOS_FUNCTION OffsetView(const View<RT, RP...>& aview) : m_track(aview.impl_track()), m_map() { using SrcTraits = typename OffsetView<RT, RP...>::traits; using Mapping = Kokkos::Impl::ViewMapping<traits, SrcTraits, void>; @@ -843,8 +833,8 @@ class OffsetView : public ViewTraits<DataType, Properties...> { } template <class RT, class... RP> - KOKKOS_INLINE_FUNCTION OffsetView(const View<RT, RP...>& aview, - const index_list_type& minIndices) + KOKKOS_FUNCTION OffsetView(const View<RT, RP...>& aview, + const index_list_type& minIndices) : m_track(aview.impl_track()), m_map() { using SrcTraits = typename OffsetView<RT, RP...>::traits; using Mapping = Kokkos::Impl::ViewMapping<traits, SrcTraits, void>; @@ -863,8 +853,8 @@ class OffsetView : public ViewTraits<DataType, Properties...> { } } template <class RT, class... RP> - KOKKOS_INLINE_FUNCTION OffsetView(const View<RT, RP...>& aview, - const begins_type& beg) + KOKKOS_FUNCTION OffsetView(const View<RT, RP...>& aview, + const begins_type& beg) : m_track(aview.impl_track()), m_map(), m_begins(beg) { using SrcTraits = typename OffsetView<RT, RP...>::traits; using Mapping = Kokkos::Impl::ViewMapping<traits, SrcTraits, void>; @@ -876,7 +866,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> { // may assign unmanaged from managed. template <class RT, class... RP> - KOKKOS_INLINE_FUNCTION OffsetView(const OffsetView<RT, RP...>& rhs) + KOKKOS_FUNCTION OffsetView(const OffsetView<RT, RP...>& rhs) : m_track(rhs.m_track, traits::is_managed), m_map(), m_begins(rhs.m_begins) { @@ -895,8 +885,8 @@ class OffsetView : public ViewTraits<DataType, Properties...> { }; // Subtraction should return a non-negative number and not overflow - KOKKOS_INLINE_FUNCTION static subtraction_failure check_subtraction( - int64_t lhs, int64_t rhs) { + KOKKOS_FUNCTION static subtraction_failure check_subtraction(int64_t lhs, + int64_t rhs) { if (lhs < rhs) return subtraction_failure::negative; if (static_cast<uint64_t>(-1) / static_cast<uint64_t>(2) < @@ -910,10 +900,10 @@ class OffsetView : public ViewTraits<DataType, Properties...> { // which doesn't have iterators) and index_list_type (aka // std::initializer_list which doesn't have .data() or operator[]). // Returns by value - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION static int64_t at(const begins_type& a, size_t pos) { return a[pos]; } - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION static int64_t at(index_list_type a, size_t pos) { return *(a.begin() + pos); } @@ -994,8 +984,8 @@ class OffsetView : public ViewTraits<DataType, Properties...> { // Check the begins < ends for all elements template <typename B, typename E> - KOKKOS_INLINE_FUNCTION static subtraction_failure - runtime_check_begins_ends_device(const B& begins, const E& ends) { + KOKKOS_FUNCTION static subtraction_failure runtime_check_begins_ends_device( + const B& begins, const E& ends) { if (begins.size() != Rank) Kokkos::abort( "Kokkos::Experimental::OffsetView ERROR: for unmanaged " @@ -1025,7 +1015,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> { } template <typename B, typename E> - KOKKOS_INLINE_FUNCTION static subtraction_failure runtime_check_begins_ends( + KOKKOS_FUNCTION static subtraction_failure runtime_check_begins_ends( const B& begins, const E& ends) { KOKKOS_IF_ON_HOST((return runtime_check_begins_ends_host(begins, ends);)) KOKKOS_IF_ON_DEVICE( @@ -1037,9 +1027,9 @@ class OffsetView : public ViewTraits<DataType, Properties...> { // Each of B, E can be begins_type and/or index_list_type // Precondition: begins.size() == ends.size() == m_begins.size() == Rank template <typename B, typename E> - KOKKOS_INLINE_FUNCTION OffsetView(const pointer_type& p, const B& begins_, - const E& ends_, - subtraction_failure) + KOKKOS_FUNCTION OffsetView(const pointer_type& p, const B& begins_, + const E& ends_, + subtraction_failure) : m_track() // no tracking , m_map(Kokkos::Impl::ViewCtorProp<pointer_type>(p), @@ -1061,25 +1051,25 @@ class OffsetView : public ViewTraits<DataType, Properties...> { // Constructor around unmanaged data // Four overloads, as both begins and ends can be either // begins_type or index_list_type - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView(const pointer_type& p, const begins_type& begins_, const begins_type& ends_) : OffsetView(p, begins_, ends_, runtime_check_begins_ends(begins_, ends_)) {} - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView(const pointer_type& p, const begins_type& begins_, index_list_type ends_) : OffsetView(p, begins_, ends_, runtime_check_begins_ends(begins_, ends_)) {} - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView(const pointer_type& p, index_list_type begins_, const begins_type& ends_) : OffsetView(p, begins_, ends_, runtime_check_begins_ends(begins_, ends_)) {} - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION OffsetView(const pointer_type& p, index_list_type begins_, index_list_type ends_) : OffsetView(p, begins_, ends_, @@ -1087,10 +1077,10 @@ class OffsetView : public ViewTraits<DataType, Properties...> { //---------------------------------------- // Allocation tracking properties - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION int use_count() const { return m_track.use_count(); } - inline const std::string label() const { + const std::string label() const { return m_track.template get_label<typename traits::memory_space>(); } @@ -1101,7 +1091,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> { // std::get<{0,1}>(RangeType const&) with std::tuple_size<RangeType>::value==2 // but this wouldn't allow using the syntax in the example above. template <typename Label> - explicit inline OffsetView( + explicit OffsetView( const Label& arg_label, std::enable_if_t<Kokkos::Impl::is_view_label<Label>::value, const std::pair<int64_t, int64_t>> @@ -1128,38 +1118,32 @@ class OffsetView : public ViewTraits<DataType, Properties...> { {range0.first, range1.first, range2.first, range3.first, range4.first, range5.first, range6.first, range7.first}) {} -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - template <typename Label> - KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the constructor taking std::pair<int64_t, int64_t> arguments " - "instead!") - explicit inline OffsetView( - const Label& arg_label, - std::enable_if_t<Kokkos::Impl::is_view_label<Label>::value, - const index_list_type> - range0, - const index_list_type range1 = KOKKOS_INVALID_INDEX_RANGE, - const index_list_type range2 = KOKKOS_INVALID_INDEX_RANGE, - const index_list_type range3 = KOKKOS_INVALID_INDEX_RANGE, - const index_list_type range4 = KOKKOS_INVALID_INDEX_RANGE, - const index_list_type range5 = KOKKOS_INVALID_INDEX_RANGE, - const index_list_type range6 = KOKKOS_INVALID_INDEX_RANGE, - const index_list_type range7 = KOKKOS_INVALID_INDEX_RANGE) + template <class... P> + explicit OffsetView( + const Kokkos::Impl::ViewCtorProp<P...>& arg_prop, + const std::pair<int64_t, int64_t> range0 = KOKKOS_INVALID_INDEX_RANGE, + const std::pair<int64_t, int64_t> range1 = KOKKOS_INVALID_INDEX_RANGE, + const std::pair<int64_t, int64_t> range2 = KOKKOS_INVALID_INDEX_RANGE, + const std::pair<int64_t, int64_t> range3 = KOKKOS_INVALID_INDEX_RANGE, + const std::pair<int64_t, int64_t> range4 = KOKKOS_INVALID_INDEX_RANGE, + const std::pair<int64_t, int64_t> range5 = KOKKOS_INVALID_INDEX_RANGE, + const std::pair<int64_t, int64_t> range6 = KOKKOS_INVALID_INDEX_RANGE, + const std::pair<int64_t, int64_t> range7 = KOKKOS_INVALID_INDEX_RANGE) : OffsetView( - arg_label, - std::pair<int64_t, int64_t>(range0.begin()[0], range0.begin()[1]), - std::pair<int64_t, int64_t>(range1.begin()[0], range1.begin()[1]), - std::pair<int64_t, int64_t>(range2.begin()[0], range2.begin()[1]), - std::pair<int64_t, int64_t>(range3.begin()[0], range3.begin()[1]), - std::pair<int64_t, int64_t>(range4.begin()[0], range4.begin()[1]), - std::pair<int64_t, int64_t>(range5.begin()[0], range5.begin()[1]), - std::pair<int64_t, int64_t>(range6.begin()[0], range6.begin()[1]), - std::pair<int64_t, int64_t>(range7.begin()[0], range7.begin()[1])) { - } -#endif + arg_prop, + typename traits::array_layout(range0.second - range0.first + 1, + range1.second - range1.first + 1, + range2.second - range2.first + 1, + range3.second - range3.first + 1, + range4.second - range4.first + 1, + range5.second - range5.first + 1, + range6.second - range6.first + 1, + range7.second - range7.first + 1), + {range0.first, range1.first, range2.first, range3.first, + range4.first, range5.first, range6.first, range7.first}) {} template <class... P> - explicit KOKKOS_INLINE_FUNCTION OffsetView( + explicit KOKKOS_FUNCTION OffsetView( const Kokkos::Impl::ViewCtorProp<P...>& arg_prop, std::enable_if_t<Kokkos::Impl::ViewCtorProp<P...>::has_pointer, typename traits::array_layout> const& arg_layout, @@ -1178,7 +1162,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> { } template <class... P> - explicit inline OffsetView( + explicit OffsetView( const Kokkos::Impl::ViewCtorProp<P...>& arg_prop, std::enable_if_t<!Kokkos::Impl::ViewCtorProp<P...>::has_pointer, typename traits::array_layout> const& arg_layout, @@ -1189,21 +1173,11 @@ class OffsetView : public ViewTraits<DataType, Properties...> { { for (size_t i = 0; i < Rank; ++i) m_begins[i] = minIndices.begin()[i]; - // Append layout and spaces if not input - using alloc_prop_input = Kokkos::Impl::ViewCtorProp<P...>; - - // use 'std::integral_constant<unsigned,I>' for non-types - // to avoid duplicate class error. - using alloc_prop = Kokkos::Impl::ViewCtorProp< - P..., - std::conditional_t<alloc_prop_input::has_label, - std::integral_constant<unsigned, 0>, std::string>, - std::conditional_t<alloc_prop_input::has_memory_space, - std::integral_constant<unsigned, 1>, - typename traits::device_type::memory_space>, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned, 2>, - typename traits::device_type::execution_space>>; + // Copy the input allocation properties with possibly defaulted properties + auto prop_copy = Kokkos::Impl::with_properties_if_unset( + arg_prop, std::string{}, typename traits::device_type::memory_space{}, + typename traits::device_type::execution_space{}); + using alloc_prop = decltype(prop_copy); static_assert(traits::is_managed, "OffsetView allocation constructor requires managed memory"); @@ -1217,9 +1191,6 @@ class OffsetView : public ViewTraits<DataType, Properties...> { "execution space"); } - // Copy the input allocation properties with possibly defaulted properties - alloc_prop prop_copy(arg_prop); - //------------------------------------------------------------ #if defined(KOKKOS_ENABLE_CUDA) // If allocating in CudaUVMSpace must fence before and after @@ -1931,10 +1902,8 @@ inline auto create_mirror(const Kokkos::Experimental::OffsetView<T, P...>& src, "The view constructor arguments passed to Kokkos::create_mirror must " "not explicitly allow padding!"); - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - std::string(src.label()).append("_mirror"); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string(src.label()).append("_mirror")); return typename Kokkos::Impl::MirrorOffsetType<Space, T, P...>::view_type( prop_copy, src.layout(), diff --git a/packages/kokkos/containers/src/Kokkos_ScatterView.hpp b/packages/kokkos/containers/src/Kokkos_ScatterView.hpp index a9529d1c87c4f13dcb5d0054f5cd79ba1d2d3bfd..3b30996ad635a886142a12f75dd8ce8285191296 100644 --- a/packages/kokkos/containers/src/Kokkos_ScatterView.hpp +++ b/packages/kokkos/containers/src/Kokkos_ScatterView.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_ScatterView.hpp /// \brief Declaration and definition of Kokkos::ScatterView. @@ -195,16 +167,16 @@ struct DefaultContribution<Kokkos::Cuda, #ifdef KOKKOS_ENABLE_HIP template <> -struct DefaultDuplication<Kokkos::Experimental::HIP> { +struct DefaultDuplication<Kokkos::HIP> { using type = Kokkos::Experimental::ScatterNonDuplicated; }; template <> -struct DefaultContribution<Kokkos::Experimental::HIP, +struct DefaultContribution<Kokkos::HIP, Kokkos::Experimental::ScatterNonDuplicated> { using type = Kokkos::Experimental::ScatterAtomic; }; template <> -struct DefaultContribution<Kokkos::Experimental::HIP, +struct DefaultContribution<Kokkos::HIP, Kokkos::Experimental::ScatterDuplicated> { using type = Kokkos::Experimental::ScatterAtomic; }; @@ -1027,10 +999,8 @@ class ScatterView<DataType, Kokkos::LayoutRight, DeviceType, Op, check_scatter_view_allocation_properties_argument; check_scatter_view_allocation_properties_argument(arg_prop); - auto const exec_space = - static_cast<::Kokkos::Impl::ViewCtorProp<void, execution_space> const&>( - arg_prop) - .value; + auto const& exec_space = + Kokkos::Impl::get_property<Kokkos::Impl::ExecutionSpaceTag>(arg_prop); reset(exec_space); } @@ -1289,18 +1259,14 @@ class ScatterView<DataType, Kokkos::LayoutLeft, DeviceType, Op, Kokkos::Impl::Experimental::args_to_array(arg_N, 0, dims...); arg_N[internal_view_type::rank - 1] = unique_token.size(); - auto const name = - static_cast<::Kokkos::Impl::ViewCtorProp<void, std::string> const&>( - arg_prop) - .value; + auto const& name = + Kokkos::Impl::get_property<Kokkos::Impl::LabelTag>(arg_prop); internal_view = internal_view_type(view_alloc(WithoutInitializing, name), arg_N[0], arg_N[1], arg_N[2], arg_N[3], arg_N[4], arg_N[5], arg_N[6], arg_N[7]); - auto const exec_space = - static_cast<::Kokkos::Impl::ViewCtorProp<void, execution_space> const&>( - arg_prop) - .value; + auto const& exec_space = + Kokkos::Impl::get_property<Kokkos::Impl::ExecutionSpaceTag>(arg_prop); reset(exec_space); } diff --git a/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp b/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp index 219b08b4b40cd8c9f9788a36fb31d488c52f7af3..8ce868cac2172b417d2bde8e1f18bc390ed78fc1 100644 --- a/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp +++ b/packages/kokkos/containers/src/Kokkos_StaticCrsGraph.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STATICCRSGRAPH_HPP #define KOKKOS_STATICCRSGRAPH_HPP diff --git a/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp b/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp index 6c112644c9bc289d1758cd620d06ce4ffaf77331..058b6626c40cb13a8c6352a86a7914b9aa785ed2 100644 --- a/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp +++ b/packages/kokkos/containers/src/Kokkos_UnorderedMap.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_UnorderedMap.hpp /// \brief Declaration and definition of Kokkos::UnorderedMap. @@ -311,13 +283,8 @@ class UnorderedMap { capacity() + 1) // +1 so that the *_at functions can // always return a valid reference , -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - m_keys("UnorderedMap keys", capacity() + 1), - m_values("UnorderedMap values", (is_set ? 1 : capacity() + 1)), -#else m_keys("UnorderedMap keys", capacity()), m_values("UnorderedMap values", (is_set ? 0 : capacity())), -#endif m_scalars("UnorderedMap scalars") { if (!is_insertable_map) { Kokkos::Impl::throw_runtime_exception( @@ -347,24 +314,13 @@ class UnorderedMap { const key_type tmp = key_type(); Kokkos::deep_copy(m_keys, tmp); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - if (is_set) { - const impl_value_type tmp = impl_value_type(); - Kokkos::deep_copy(m_values, tmp); - } -#endif Kokkos::deep_copy(m_scalars, 0); m_size = 0; } KOKKOS_INLINE_FUNCTION constexpr bool is_allocated() const { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - return (m_keys.is_allocated() && m_values.is_allocated() && - m_scalars.is_allocated()); -#else return (m_keys.is_allocated() && (is_set || m_values.is_allocated()) && m_scalars.is_allocated()); -#endif } /// \brief Change the capacity of the the map @@ -702,26 +658,10 @@ class UnorderedMap { !std::is_void<Dummy>::value, // !is_set std::conditional_t<has_const_value, impl_value_type, impl_value_type &>> value_at(size_type i) const { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - return m_values[i < capacity() ? i : capacity()]; -#else KOKKOS_EXPECTS(i < capacity()); return m_values[i]; -#endif } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - template <typename Dummy = value_type> - KOKKOS_DEPRECATED_WITH_COMMENT( - "Calling value_at for value_type==void is deprecated!") - KOKKOS_FORCEINLINE_FUNCTION std::enable_if_t< - std::is_void<Dummy>::value, // is_set - std::conditional_t<has_const_value, impl_value_type, - impl_value_type &>> value_at(size_type /*i*/) const { - return m_values[0]; - } -#endif - /// \brief Get the key with \c i as its direct index. /// /// \param i [in] Index directly into the array of entries. @@ -730,12 +670,8 @@ class UnorderedMap { /// kernel. KOKKOS_FORCEINLINE_FUNCTION key_type key_at(size_type i) const { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - return m_keys[i < capacity() ? i : capacity()]; -#else KOKKOS_EXPECTS(i < capacity()); return m_keys[i]; -#endif } KOKKOS_FORCEINLINE_FUNCTION diff --git a/packages/kokkos/containers/src/Kokkos_Vector.hpp b/packages/kokkos/containers/src/Kokkos_Vector.hpp index 8dd080737b49b52a63704611fc86cb71eee5491b..29bb15f5eab84ea32522889417d34806b525edce 100644 --- a/packages/kokkos/containers/src/Kokkos_Vector.hpp +++ b/packages/kokkos/containers/src/Kokkos_Vector.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_VECTOR_HPP #define KOKKOS_VECTOR_HPP @@ -183,8 +155,8 @@ class vector : public DualView<Scalar*, LayoutLeft, Arg1Type> { private: template <class T> struct impl_is_input_iterator - : /* TODO replace this */ std::integral_constant< - bool, !std::is_convertible<T, size_type>::value> {}; + : /* TODO replace this */ std::bool_constant< + !std::is_convertible<T, size_type>::value> {}; public: // TODO: can use detection idiom to generate better error message here later diff --git a/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp index 134b30769fb1d8a65e6e5d779a39c93f255268ad..c598e4b67b26596cbec7dc261860f8fdc7231825 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp +++ b/packages/kokkos/containers/src/impl/Kokkos_Bitset_impl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_BITSET_IMPL_HPP #define KOKKOS_BITSET_IMPL_HPP diff --git a/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp index 5fe3ab0df563db75a0ee6f34128fe16745a1258c..d77c673e813c407fb644adda104b6d5d5b657402 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp +++ b/packages/kokkos/containers/src/impl/Kokkos_Functional_impl.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_FUNCTIONAL_IMPL_HPP @@ -106,8 +80,8 @@ uint32_t MurmurHash3_x86_32(const void* key, int len, uint32_t seed) { uint32_t k1 = 0; switch (len & 3) { - case 3: k1 ^= tail[2] << 16; KOKKOS_IMPL_FALLTHROUGH - case 2: k1 ^= tail[1] << 8; KOKKOS_IMPL_FALLTHROUGH + case 3: k1 ^= tail[2] << 16; [[fallthrough]]; + case 2: k1 ^= tail[1] << 8; [[fallthrough]]; case 1: k1 ^= tail[0]; k1 *= c1; diff --git a/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp b/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp index b81b1eee1e2475c2966e7aaa517611452ea37a9d..468e617d50657622d01421277b339e088d700a13 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp +++ b/packages/kokkos/containers/src/impl/Kokkos_StaticCrsGraph_factory.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_STATICCRSGRAPH_FACTORY_HPP #define KOKKOS_IMPL_STATICCRSGRAPH_FACTORY_HPP diff --git a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp index fc861992f0e6d4f9f5ee2ccab96ee9bb31072444..5a22bf31f37d0dd6036566d306b1db65bf4f4278 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp +++ b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp index 5acba244f60801f3541ef85e31896180685181eb..2c431d1579276606a97fd92bf2688a73a70dba7b 100644 --- a/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp +++ b/packages/kokkos/containers/src/impl/Kokkos_UnorderedMap_impl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_UNORDERED_MAP_IMPL_HPP #define KOKKOS_UNORDERED_MAP_IMPL_HPP @@ -76,16 +48,13 @@ struct UnorderedMapRehash { *this); } - template <typename Dummy = typename map_type::value_type> - KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_void<Dummy>::value> - operator()(size_type i) const { - if (m_src.valid_at(i)) m_dst.insert(m_src.key_at(i)); - } - - template <typename Dummy = typename map_type::value_type> - KOKKOS_INLINE_FUNCTION std::enable_if_t<!std::is_void<Dummy>::value> - operator()(size_type i) const { - if (m_src.valid_at(i)) m_dst.insert(m_src.key_at(i), m_src.value_at(i)); + KOKKOS_INLINE_FUNCTION + void operator()(size_type i) const { + if constexpr (std::is_void_v<typename map_type::value_type>) { + if (m_src.valid_at(i)) m_dst.insert(m_src.key_at(i)); + } else { + if (m_src.valid_at(i)) m_dst.insert(m_src.key_at(i), m_src.value_at(i)); + } } }; diff --git a/packages/kokkos/containers/unit_tests/TestBitset.hpp b/packages/kokkos/containers/unit_tests/TestBitset.hpp index 6cb03d6c5648556e97ca7e794742948cb15f7530..d97bdf9679f18ffad68903a4bc419788f93a444c 100644 --- a/packages/kokkos/containers/unit_tests/TestBitset.hpp +++ b/packages/kokkos/containers/unit_tests/TestBitset.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_TEST_BITSET_HPP @@ -216,8 +190,19 @@ void test_bitset() { { Impl::TestBitsetTest<const_bitset_type> f(bitset); uint32_t count = f.testit(); +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (!std::is_same_v<typename Device::execution_space, + Kokkos::Cuda>) { + EXPECT_EQ(bitset.size(), count); + EXPECT_EQ(count, bitset.count()); + } else { + (void)count; + } +#else EXPECT_EQ(bitset.size(), count); EXPECT_EQ(count, bitset.count()); +#endif } // std::cout << " Check reset() " << std::endl; diff --git a/packages/kokkos/containers/unit_tests/TestCompileMain.cpp b/packages/kokkos/containers/unit_tests/TestCompileMain.cpp index 237c8ce181774d991a9dbdd8cacf1a5fb9f199f1..fe164b5ba81e800e28eeba16670a9463de53cacb 100644 --- a/packages/kokkos/containers/unit_tests/TestCompileMain.cpp +++ b/packages/kokkos/containers/unit_tests/TestCompileMain.cpp @@ -1 +1,17 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + int main() {} diff --git a/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp b/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp index 0e43be4364154393b30cd349a563d7984a5ca2f0..8556f756b0bc7379c0038cf5cd2ed3fd6b4e2787 100644 --- a/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp +++ b/packages/kokkos/containers/unit_tests/TestCreateMirror.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_DynamicView.hpp> @@ -49,8 +21,7 @@ template <typename TestView, typename MemorySpace> void check_memory_space(TestView, MemorySpace) { - static_assert( - std::is_same<typename TestView::memory_space, MemorySpace>::value, ""); + static_assert(std::is_same_v<typename TestView::memory_space, MemorySpace>); } template <class View> @@ -69,70 +40,58 @@ void test_create_mirror_properties(const View& view) { // clang-format off // create_mirror -#ifndef KOKKOS_ENABLE_CXX14 // FIXME DynamicView: HostMirror is the same type if constexpr (!is_dynamic_view<View>::value) { check_memory_space(create_mirror(WithoutInitializing, view), host_mirror_test_space(view)); check_memory_space(create_mirror( view), host_mirror_test_space(view)); } -#endif check_memory_space(create_mirror(WithoutInitializing, DefaultExecutionSpace{}, view), DeviceMemorySpace{}); check_memory_space(create_mirror( DefaultExecutionSpace{}, view), DeviceMemorySpace{}); // create_mirror_view -#ifndef KOKKOS_ENABLE_CXX14 // FIXME DynamicView: HostMirror is the same type if constexpr (!is_dynamic_view<View>::value) { check_memory_space(create_mirror_view(WithoutInitializing, view), host_mirror_test_space(view)); check_memory_space(create_mirror_view( view), host_mirror_test_space(view)); } -#endif check_memory_space(create_mirror_view(WithoutInitializing, DefaultExecutionSpace{}, view), DeviceMemorySpace{}); check_memory_space(create_mirror_view( DefaultExecutionSpace{}, view), DeviceMemorySpace{}); // create_mirror view_alloc -#ifndef KOKKOS_ENABLE_CXX14 // FIXME DynamicView: HostMirror is the same type if constexpr (!is_dynamic_view<View>::value) { check_memory_space(create_mirror(view_alloc(WithoutInitializing), view), host_mirror_test_space(view)); check_memory_space(create_mirror(view_alloc(), view), host_mirror_test_space(view)); } -#endif check_memory_space(create_mirror(view_alloc(WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); check_memory_space(create_mirror(view_alloc( DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror_view view_alloc -#ifndef KOKKOS_ENABLE_CXX14 // FIXME DynamicView: HostMirror is the same type if constexpr (!is_dynamic_view<View>::value) { check_memory_space(create_mirror_view(view_alloc(WithoutInitializing), view), host_mirror_test_space(view)); check_memory_space(create_mirror_view(view_alloc(), view), host_mirror_test_space(view)); } -#endif check_memory_space(create_mirror_view(view_alloc(WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); check_memory_space(create_mirror_view(view_alloc( DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror view_alloc + execution space -#ifndef KOKKOS_ENABLE_CXX14 // FIXME DynamicView: HostMirror is the same type if constexpr (!is_dynamic_view<View>::value) { - check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); - check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); + check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); + check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); } -#endif - check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); - check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); + check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); + check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror_view view_alloc + execution space -#ifndef KOKKOS_ENABLE_CXX14 // FIXME DynamicView: HostMirror is the same type if constexpr (!is_dynamic_view<View>::value) { - check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); - check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); + check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); + check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); } -#endif - check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); - check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); + check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); + check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror_view_and_copy check_memory_space(create_mirror_view_and_copy(HostSpace{}, view), HostSpace{}); diff --git a/packages/kokkos/containers/unit_tests/TestDualView.hpp b/packages/kokkos/containers/unit_tests/TestDualView.hpp index 3085f091cee81672f048903b3242d2fc49d24399..6e2e56c5cf7864ba9897bbb3f29bf0f2a8e326d7 100644 --- a/packages/kokkos/containers/unit_tests/TestDualView.hpp +++ b/packages/kokkos/containers/unit_tests/TestDualView.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_DUALVIEW_HPP #define KOKKOS_TEST_DUALVIEW_HPP @@ -492,8 +464,8 @@ struct UVMSpaceFor<Kokkos::Experimental::SYCL> { #ifdef KOKKOS_ENABLE_HIP // specific to HIP template <> -struct UVMSpaceFor<Kokkos::Experimental::HIP> { - using type = Kokkos::Experimental::HIPManagedSpace; +struct UVMSpaceFor<Kokkos::HIP> { + using type = Kokkos::HIPManagedSpace; }; #endif diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp index 5fbd32956053e097c62247cc0a366866c34d8983..c7a5b13dbbecd3f07a83269c446e61fc63aa8259 100644 --- a/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp index 90ca5df194d5c33f53446125470ab7f464085095..d4747538d9b254a1d322a3b8e2f5718fe8b6372f 100644 --- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_generic.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestDynViewAPI.hpp> namespace Test { diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp index 050ebbe35cab5e85b726b7ad5f9a10f3170607bb..d6019e823960852ae681b0b7d984503ea78ae8fe 100644 --- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank12345.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestDynViewAPI.hpp> diff --git a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp index eb8df60a89d204fee4e454956304e48026a7c120..703811e0f4b4cfaf0f6b4ce65915514c9f7330a6 100644 --- a/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynViewAPI_rank67.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestDynViewAPI.hpp> namespace Test { diff --git a/packages/kokkos/containers/unit_tests/TestDynamicView.hpp b/packages/kokkos/containers/unit_tests/TestDynamicView.hpp index 5345f8ea2459f69df6ba5074216db0a594407d5d..cd1511276f46785b04a33ae08c77214ac806fff8 100644 --- a/packages/kokkos/containers/unit_tests/TestDynamicView.hpp +++ b/packages/kokkos/containers/unit_tests/TestDynamicView.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_DYNAMICVIEW_HPP #define KOKKOS_TEST_DYNAMICVIEW_HPP @@ -240,6 +212,83 @@ struct TestDynamicView { ASSERT_EQ(new_result_sum, (value_type)(da_resize * (da_resize - 1) / 2)); #endif } // end scope + + // Test: Reproducer to demonstrate compile-time error of deep_copy + // of DynamicView to/from on-host View. + // Case 4: + { + using device_view_type = Kokkos::View<Scalar*, Space>; + using host_view_type = typename Kokkos::View<Scalar*, Space>::HostMirror; + + view_type device_dynamic_view("on-device DynamicView", 1024, + arg_total_size); + device_view_type device_view("on-device View", arg_total_size); + host_view_type host_view("on-host View", arg_total_size); + + unsigned da_size = arg_total_size / 8; + device_dynamic_view.resize_serial(da_size); + + // Use parallel_for to populate device_dynamic_view and verify values +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + Kokkos::parallel_for( + Kokkos::RangePolicy<execution_space>(0, da_size), + KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(i); }); + + value_type result_sum = 0.0; + Kokkos::parallel_reduce( + Kokkos::RangePolicy<execution_space>(0, da_size), + KOKKOS_LAMBDA(const int i, value_type& partial_sum) { + partial_sum += (value_type)device_dynamic_view(i); + }, + result_sum); + + ASSERT_EQ(result_sum, (value_type)(da_size * (da_size - 1) / 2)); +#endif + + // Use an on-device View as intermediate to deep_copy the + // device_dynamic_view to host, zero out the device_dynamic_view, + // deep_copy from host back to the device_dynamic_view and verify + Kokkos::deep_copy(device_view, device_dynamic_view); + Kokkos::deep_copy(host_view, device_view); + Kokkos::deep_copy(device_view, host_view); +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + Kokkos::parallel_for( + Kokkos::RangePolicy<execution_space>(0, da_size), + KOKKOS_LAMBDA(const int i) { device_dynamic_view(i) = Scalar(0); }); +#endif + Kokkos::deep_copy(device_dynamic_view, device_view); +#if defined(KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA) + value_type new_result_sum = 0.0; + Kokkos::parallel_reduce( + Kokkos::RangePolicy<execution_space>(0, da_size), + KOKKOS_LAMBDA(const int i, value_type& partial_sum) { + partial_sum += (value_type)device_dynamic_view(i); + }, + new_result_sum); + + ASSERT_EQ(new_result_sum, (value_type)(da_size * (da_size - 1) / 2)); +#endif + + // Try to deep_copy device_dynamic_view directly to/from host. + // host-to-device currently fails to compile because DP and SP are + // swapped in the deep_copy implementation. + // Once that's fixed, both deep_copy's will fail at runtime because the + // destination execution space cannot access the source memory space. + try { + Kokkos::deep_copy(host_view, device_dynamic_view); + } catch (std::runtime_error const& error) { + std::string msg = error.what(); + std::cerr << "Copy from on-device DynamicView to on-host View failed:\n" + << msg << std::endl; + } + try { + Kokkos::deep_copy(device_dynamic_view, host_view); + } catch (std::runtime_error const& error) { + std::string msg = error.what(); + std::cerr << "Copy from on-host View to on-device DynamicView failed:\n" + << msg << std::endl; + } + } } }; diff --git a/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp b/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp index c5394d81a613bbd7fa1c42ea17eb392d3fd95693..0003a29468c5b430e863f27a52e2ec4379ba3c67 100644 --- a/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp +++ b/packages/kokkos/containers/unit_tests/TestErrorReporter.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_EXPERIMENTAL_ERROR_REPORTER_HPP #define KOKKOS_TEST_EXPERIMENTAL_ERROR_REPORTER_HPP @@ -170,16 +142,14 @@ struct ErrorReporterDriver : public ErrorReporterDriverBase<DeviceType> { KOKKOS_INLINE_FUNCTION void operator()(const int work_idx) const { if (driver_base::error_condition(work_idx)) { - double val = - Kokkos::Experimental::pi_v<double> * static_cast<double>(work_idx); + double val = Kokkos::numbers::pi * static_cast<double>(work_idx); typename driver_base::report_type report = {work_idx, -2 * work_idx, val}; driver_base::m_errorReporter.add_report(work_idx, report); } } }; -#if defined(KOKKOS_CLASS_LAMBDA) && \ - (!defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_LAMBDA)) +#if !defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_LAMBDA) template <typename DeviceType> struct ErrorReporterDriverUseLambda : public ErrorReporterDriverBase<DeviceType> { @@ -195,10 +165,10 @@ struct ErrorReporterDriverUseLambda void execute(int reporter_capacity, int test_size) { Kokkos::parallel_for( Kokkos::RangePolicy<execution_space>(0, test_size), + // NOLINTNEXTLINE(kokkos-implicit-this-capture) KOKKOS_CLASS_LAMBDA(const int work_idx) { if (driver_base::error_condition(work_idx)) { - double val = Kokkos::Experimental::pi_v<double> * - static_cast<double>(work_idx); + double val = Kokkos::numbers::pi * static_cast<double>(work_idx); typename driver_base::report_type report = {work_idx, -2 * work_idx, val}; driver_base::m_errorReporter.add_report(work_idx, report); @@ -222,8 +192,7 @@ struct ErrorReporterDriverNativeOpenMP #pragma omp parallel for for (int work_idx = 0; work_idx < test_size; ++work_idx) { if (driver_base::error_condition(work_idx)) { - double val = - Kokkos::Experimental::pi_v<double> * static_cast<double>(work_idx); + double val = Kokkos::numbers::pi * static_cast<double>(work_idx); typename driver_base::report_type report = {work_idx, -2 * work_idx, val}; driver_base::m_errorReporter.add_report(work_idx, report); @@ -234,7 +203,9 @@ struct ErrorReporterDriverNativeOpenMP }; #endif -#if defined(KOKKOS_CLASS_LAMBDA) && \ +// FIXME_MSVC MSVC just gets confused when using the base class in the +// KOKKOS_CLASS_LAMBDA +#if !defined(KOKKOS_COMPILER_MSVC) && \ (!defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_LAMBDA)) TEST(TEST_CATEGORY, ErrorReporterViaLambda) { TestErrorReporter<ErrorReporterDriverUseLambda<TEST_EXECSPACE>>(); diff --git a/packages/kokkos/containers/unit_tests/TestOffsetView.hpp b/packages/kokkos/containers/unit_tests/TestOffsetView.hpp index 9e9edc80b51236b6bbed60a59f6c66e501f8fe03..c133922e3defb049d50ee8b13cc74229d83f98d6 100644 --- a/packages/kokkos/containers/unit_tests/TestOffsetView.hpp +++ b/packages/kokkos/containers/unit_tests/TestOffsetView.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER /* @@ -63,13 +37,8 @@ void test_offsetview_construction() { using offset_view_type = Kokkos::Experimental::OffsetView<Scalar**, Device>; using view_type = Kokkos::View<Scalar**, Device>; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - Kokkos::Experimental::index_list_type range0 = {-1, 3}; - Kokkos::Experimental::index_list_type range1 = {-2, 2}; -#else std::pair<int64_t, int64_t> range0 = {-1, 3}; std::pair<int64_t, int64_t> range1 = {-2, 2}; -#endif { offset_view_type o1; diff --git a/packages/kokkos/containers/unit_tests/TestScatterView.hpp b/packages/kokkos/containers/unit_tests/TestScatterView.hpp index b2f5c5a91309d2514505b2c8817410a837091d14..347e914ea50b0c809085762b93817e5e1c0e27c0 100644 --- a/packages/kokkos/containers/unit_tests/TestScatterView.hpp +++ b/packages/kokkos/containers/unit_tests/TestScatterView.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SCATTER_VIEW_HPP #define KOKKOS_TEST_SCATTER_VIEW_HPP @@ -106,51 +78,11 @@ struct test_scatter_view_impl_cls<DeviceType, Layout, Duplication, Contribution, scatter_access(k, 3)++; scatter_access(k, 4)--; scatter_access(k, 5) -= 5; -// Workaround Intel 17 compiler bug which sometimes add random -// instruction alignment which makes the lock instruction -// illegal. Seems to be mostly just for unsigned int atomics. -// Looking at the assembly the compiler -// appears to insert cache line alignment for the instruction. -// Isn't restricted to specific archs. Seen it on SNB and SKX, but for -// different code. Another occurrence was with Desul atomics in -// a different unit test. This one here happens without desul atomics. -// Inserting an assembly nop instruction changes the alignment and -// works round this. -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif scatter_access_atomic(k, 6) += 2; -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif scatter_access_atomic(k, 7)++; -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif scatter_access_atomic(k, 8)--; -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif --scatter_access_atomic(k, 9); -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif ++scatter_access_atomic(k, 10); -#ifdef KOKKOS_COMPILER_INTEL -#if (KOKKOS_COMPILER_INTEL < 1800) - asm volatile("nop\n"); -#endif -#endif scatter_access(k, 11) -= 3; } } @@ -872,9 +804,9 @@ TEST(TEST_CATEGORY, scatterview_devicetype) { using device_memory_space = Kokkos::CudaSpace; using host_accessible_space = Kokkos::CudaUVMSpace; #else - using device_execution_space = Kokkos::Experimental::HIP; - using device_memory_space = Kokkos::Experimental::HIPSpace; - using host_accessible_space = Kokkos::Experimental::HIPManagedSpace; + using device_execution_space = Kokkos::HIP; + using device_memory_space = Kokkos::HIPSpace; + using host_accessible_space = Kokkos::HIPManagedSpace; #endif if (std::is_same<TEST_EXECSPACE, device_execution_space>::value) { using device_device_type = diff --git a/packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp b/packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp index 907a2d61d6d07cce48e2a6a6d937d783f09516c7..acff5d0be04bf6d1c9afeeb95f550844986c4fc3 100644 --- a/packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp +++ b/packages/kokkos/containers/unit_tests/TestStaticCrsGraph.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp b/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp index 3f5f97d6bbae887f7e6084cb6f5cdf5705ed3299..989779b53a0320f39520ecd099f9a5c9e3a5416e 100644 --- a/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp +++ b/packages/kokkos/containers/unit_tests/TestUnorderedMap.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_TEST_UNORDERED_MAP_HPP @@ -293,6 +267,12 @@ void test_deep_copy(uint32_t num_nodes) { #if !defined(_WIN32) TEST(TEST_CATEGORY, UnorderedMap_insert) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) { + GTEST_SKIP() << "unit test is hanging from index 0"; + } +#endif for (int i = 0; i < 500; ++i) { test_insert<TEST_EXECSPACE>(100000, 90000, 100, true); test_insert<TEST_EXECSPACE>(100000, 90000, 100, false); @@ -305,6 +285,12 @@ TEST(TEST_CATEGORY, UnorderedMap_failed_insert) { } TEST(TEST_CATEGORY, UnorderedMap_deep_copy) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) { + GTEST_SKIP() << "unit test is hanging from index 0"; + } +#endif for (int i = 0; i < 2; ++i) test_deep_copy<TEST_EXECSPACE>(10000); } diff --git a/packages/kokkos/containers/unit_tests/TestVector.hpp b/packages/kokkos/containers/unit_tests/TestVector.hpp index efb21fe131e4d90abc1551e9340b814659986115..fa59607484663a80d2b76bb2bef572dc89297f4d 100644 --- a/packages/kokkos/containers/unit_tests/TestVector.hpp +++ b/packages/kokkos/containers/unit_tests/TestVector.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_TEST_VECTOR_HPP diff --git a/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp b/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp index d402160ef4bafb176647bf309b507129265de514..0246f11ddfe7ba4fc557e10ce6a15592341e3068 100644 --- a/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp +++ b/packages/kokkos/containers/unit_tests/TestViewCtorPropEmbeddedDim.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> diff --git a/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp b/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp index 174773f19886ad48779756859cce504ffb7b9221..d3bb05195cc5f7900ea29f35eec60e4b461670f8 100644 --- a/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp +++ b/packages/kokkos/containers/unit_tests/TestWithoutInitializing.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> @@ -442,12 +414,16 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynrankview) { [&]() { auto mirror_device = Kokkos::create_mirror(Kokkos::WithoutInitializing, device_view); + ASSERT_EQ(device_view.size(), mirror_device.size()); auto mirror_host = Kokkos::create_mirror(Kokkos::WithoutInitializing, TEST_EXECSPACE{}, host_view); + ASSERT_EQ(host_view.size(), mirror_host.size()); auto mirror_device_view = Kokkos::create_mirror_view( Kokkos::WithoutInitializing, device_view); + ASSERT_EQ(device_view.size(), mirror_device_view.size()); auto mirror_host_view = Kokkos::create_mirror_view( Kokkos::WithoutInitializing, TEST_EXECSPACE{}, host_view); + ASSERT_EQ(host_view.size(), mirror_host_view.size()); }, [&](BeginParallelForEvent) { return MatchDiagnostic{true, {"Found begin event"}}; @@ -469,16 +445,20 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynrankview_viewctor) { [&]() { auto mirror_device = Kokkos::create_mirror( Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view); + ASSERT_EQ(device_view.size(), mirror_device.size()); auto mirror_host = Kokkos::create_mirror( Kokkos::view_alloc(Kokkos::WithoutInitializing, - Kokkos::DefaultExecutionSpace{}), + Kokkos::DefaultHostExecutionSpace{}), host_view); + ASSERT_EQ(host_view.size(), mirror_host.size()); auto mirror_device_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view); + ASSERT_EQ(device_view.size(), mirror_device_view.size()); auto mirror_host_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::WithoutInitializing, Kokkos::DefaultExecutionSpace{}), host_view); + ASSERT_EQ(host_view.size(), mirror_host_view.size()); }, [&](BeginParallelForEvent) { return MatchDiagnostic{true, {"Found begin event"}}; @@ -509,6 +489,7 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynrankview) { Kokkos::view_alloc(TEST_EXECSPACE{}, typename TEST_EXECSPACE::memory_space{}), host_view); + ASSERT_EQ(host_view.size(), mirror_device.size()); // Avoid fences for deallocation when mirror_device goes out of scope. device_view = mirror_device; }, @@ -531,14 +512,24 @@ TEST(TEST_CATEGORY, create_mirror_no_init_offsetview) { auto success = validate_absence( [&]() { + device_view = Kokkos::Experimental::OffsetView<int*, TEST_EXECSPACE>( + Kokkos::view_alloc(Kokkos::WithoutInitializing, "device view"), + {0, 10}); + auto mirror_device = Kokkos::create_mirror(Kokkos::WithoutInitializing, device_view); - auto mirror_host = Kokkos::create_mirror(Kokkos::WithoutInitializing, - TEST_EXECSPACE{}, host_view); + ASSERT_EQ(device_view.size(), mirror_device.size()); + auto mirror_host = Kokkos::create_mirror( + Kokkos::WithoutInitializing, Kokkos::DefaultHostExecutionSpace{}, + host_view); + ASSERT_EQ(host_view.size(), mirror_host.size()); auto mirror_device_view = Kokkos::create_mirror_view( Kokkos::WithoutInitializing, device_view); + ASSERT_EQ(device_view.size(), mirror_device_view.size()); auto mirror_host_view = Kokkos::create_mirror_view( - Kokkos::WithoutInitializing, TEST_EXECSPACE{}, host_view); + Kokkos::WithoutInitializing, Kokkos::DefaultHostExecutionSpace{}, + host_view); + ASSERT_EQ(host_view.size(), mirror_host_view.size()); }, [&](BeginParallelForEvent) { return MatchDiagnostic{true, {"Found begin event"}}; @@ -561,16 +552,20 @@ TEST(TEST_CATEGORY, create_mirror_no_init_offsetview_view_ctor) { [&]() { auto mirror_device = Kokkos::create_mirror( Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view); + ASSERT_EQ(device_view.size(), mirror_device.size()); auto mirror_host = Kokkos::create_mirror( Kokkos::view_alloc(Kokkos::WithoutInitializing, - Kokkos::DefaultExecutionSpace{}), + Kokkos::DefaultHostExecutionSpace{}), host_view); + ASSERT_EQ(host_view.size(), mirror_host.size()); auto mirror_device_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view); + ASSERT_EQ(device_view.size(), mirror_device_view.size()); auto mirror_host_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::WithoutInitializing, - Kokkos::DefaultExecutionSpace{}), + Kokkos::DefaultHostExecutionSpace{}), host_view); + ASSERT_EQ(host_view.size(), mirror_host_view.size()); }, [&](BeginParallelForEvent) { return MatchDiagnostic{true, {"Found begin event"}}; @@ -602,12 +597,14 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_offsetview) { Kokkos::view_alloc(TEST_EXECSPACE{}, typename TEST_EXECSPACE::memory_space{}), host_view); + ASSERT_EQ(host_view.size(), mirror_device.size()); // Avoid fences for deallocation when mirror_device goes out of scope. device_view = mirror_device; auto mirror_device_mirror = Kokkos::create_mirror_view_and_copy( Kokkos::view_alloc(TEST_EXECSPACE{}, typename TEST_EXECSPACE::memory_space{}), mirror_device); + ASSERT_EQ(mirror_device_mirror.size(), mirror_device.size()); }, [&](BeginParallelForEvent) { return MatchDiagnostic{true, {"Found parallel_for event"}}; @@ -625,19 +622,25 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynamicview) { listen_tool_events(Config::DisableAll(), Config::EnableKernels()); Kokkos::Experimental::DynamicView<int*, TEST_EXECSPACE> device_view( "device view", 2, 10); + device_view.resize_serial(10); Kokkos::Experimental::DynamicView<int*, Kokkos::HostSpace> host_view( "host view", 2, 10); + host_view.resize_serial(10); auto success = validate_absence( [&]() { auto mirror_device = Kokkos::create_mirror(Kokkos::WithoutInitializing, device_view); + ASSERT_EQ(device_view.size(), mirror_device.size()); auto mirror_host = Kokkos::create_mirror(Kokkos::WithoutInitializing, TEST_EXECSPACE{}, host_view); + ASSERT_EQ(host_view.size(), mirror_host.size()); auto mirror_device_view = Kokkos::create_mirror_view( Kokkos::WithoutInitializing, device_view); + ASSERT_EQ(device_view.size(), mirror_device_view.size()); auto mirror_host_view = Kokkos::create_mirror_view( Kokkos::WithoutInitializing, TEST_EXECSPACE{}, host_view); + ASSERT_EQ(host_view.size(), mirror_host_view.size()); }, [&](BeginParallelForEvent) { return MatchDiagnostic{true, {"Found begin event"}}; @@ -660,6 +663,7 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynamicview) { Kokkos::Experimental::DynamicView<int*, Kokkos::HostSpace> host_view( "host view", 2, 10); + host_view.resize_serial(10); decltype(Kokkos::create_mirror_view_and_copy(TEST_EXECSPACE{}, host_view)) device_view; @@ -669,12 +673,14 @@ TEST(TEST_CATEGORY, create_mirror_view_and_copy_dynamicview) { Kokkos::view_alloc(TEST_EXECSPACE{}, typename TEST_EXECSPACE::memory_space{}), host_view); + ASSERT_EQ(host_view.size(), mirror_device.size()); // Avoid fences for deallocation when mirror_device goes out of scope. device_view = mirror_device; auto mirror_device_mirror = Kokkos::create_mirror_view_and_copy( Kokkos::view_alloc(TEST_EXECSPACE{}, typename TEST_EXECSPACE::memory_space{}), mirror_device); + ASSERT_EQ(mirror_device_mirror.size(), mirror_device.size()); }, [&](BeginFenceEvent event) { if (event.descriptor().find("DynamicView::resize_serial: Fence after " @@ -698,23 +704,29 @@ TEST(TEST_CATEGORY, create_mirror_no_init_dynamicview_view_ctor) { listen_tool_events(Config::DisableAll(), Config::EnableKernels()); Kokkos::Experimental::DynamicView<int*, Kokkos::DefaultExecutionSpace> device_view("device view", 2, 10); + device_view.resize_serial(10); Kokkos::Experimental::DynamicView<int*, Kokkos::HostSpace> host_view( "host view", 2, 10); + host_view.resize_serial(10); auto success = validate_absence( [&]() { auto mirror_device = Kokkos::create_mirror( Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view); + ASSERT_EQ(device_view.size(), mirror_device.size()); auto mirror_host = Kokkos::create_mirror( Kokkos::view_alloc(Kokkos::WithoutInitializing, Kokkos::DefaultExecutionSpace{}), host_view); + ASSERT_EQ(host_view.size(), mirror_host.size()); auto mirror_device_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::WithoutInitializing), device_view); + ASSERT_EQ(device_view.size(), mirror_device_view.size()); auto mirror_host_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::WithoutInitializing, Kokkos::DefaultExecutionSpace{}), host_view); + ASSERT_EQ(host_view.size(), mirror_host_view.size()); }, [&](BeginFenceEvent event) { if (event.descriptor().find("DynamicView::resize_serial: Fence after " diff --git a/packages/kokkos/containers/unit_tests/UnitTestMain.cpp b/packages/kokkos/containers/unit_tests/UnitTestMain.cpp index e245aad35fc33a595a16f711dbd4a63a0c7f8948..11a1cb717a3414b42aec8cda20e13be5ab99ce09 100644 --- a/packages/kokkos/containers/unit_tests/UnitTestMain.cpp +++ b/packages/kokkos/containers/unit_tests/UnitTestMain.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/CMakeLists.txt b/packages/kokkos/core/CMakeLists.txt index bb60c368f7ce7e6bd935dcd277426571fd863d6f..5d9fde56d202685f05a5e5db49608489986dcbc3 100644 --- a/packages/kokkos/core/CMakeLists.txt +++ b/packages/kokkos/core/CMakeLists.txt @@ -7,6 +7,9 @@ IF (NOT Kokkos_INSTALL_TESTING) ENDIF() KOKKOS_ADD_TEST_DIRECTORIES(unit_test) -KOKKOS_ADD_TEST_DIRECTORIES(perf_test) +IF (NOT KOKKOS_HAS_TRILINOS) + # We are using the githash etc in here, which does not work correct in Trilinos + KOKKOS_ADD_TEST_DIRECTORIES(perf_test) +ENDIF() KOKKOS_SUBPACKAGE_POSTPROCESS() diff --git a/packages/kokkos/core/perf_test/BenchmarkMain.cpp b/packages/kokkos/core/perf_test/BenchmarkMain.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bba2bca36d89277da1690c97e56d5bd75e7de301 --- /dev/null +++ b/packages/kokkos/core/perf_test/BenchmarkMain.cpp @@ -0,0 +1,33 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <benchmark/benchmark.h> + +#include <Benchmark_Context.hpp> +#include <Kokkos_Core.hpp> + +int main(int argc, char** argv) { + Kokkos::initialize(argc, argv); + benchmark::Initialize(&argc, argv); + benchmark::SetDefaultTimeUnit(benchmark::kSecond); + KokkosBenchmark::add_benchmark_context(true); + + benchmark::RunSpecifiedBenchmarks(); + + benchmark::Shutdown(); + Kokkos::finalize(); + return 0; +} diff --git a/packages/kokkos/core/perf_test/Benchmark_Context.hpp b/packages/kokkos/core/perf_test/Benchmark_Context.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ba6eff6646c85e3beefab1bb2a3ba8ae15ed017f --- /dev/null +++ b/packages/kokkos/core/perf_test/Benchmark_Context.hpp @@ -0,0 +1,89 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_CORE_PERFTEST_BENCHMARK_CONTEXT_HPP +#define KOKKOS_CORE_PERFTEST_BENCHMARK_CONTEXT_HPP + +#include <string> + +#include <benchmark/benchmark.h> + +#include <Kokkos_Core.hpp> +#include <Kokkos_Version_Info.hpp> + +namespace KokkosBenchmark { + +/// \brief Remove unwanted spaces and colon signs from input string. In case of +/// invalid input it will return an empty string. +std::string remove_unwanted_characters(std::string str) { + auto from = str.find_first_not_of(" :"); + auto to = str.find_last_not_of(" :"); + + if (from == std::string::npos || to == std::string::npos) { + return ""; + } + + // return extracted part of string without unwanted spaces and colon signs + return str.substr(from, to + 1); +} + +/// \brief Extract all key:value pairs from kokkos configuration and add it to +/// the benchmark context +void add_kokkos_configuration(bool verbose) { + std::ostringstream msg; + Kokkos::print_configuration(msg, verbose); + + // Iterate over lines returned from kokkos and extract key:value pairs + std::stringstream ss{msg.str()}; + for (std::string line; std::getline(ss, line, '\n');) { + auto found = line.find_first_of(':'); + if (found != std::string::npos) { + auto val = remove_unwanted_characters(line.substr(found + 1)); + // Ignore line without value, for example a category name + if (!val.empty()) { + benchmark::AddCustomContext( + remove_unwanted_characters(line.substr(0, found)), val); + } + } + } +} + +/// \brief Add all data related to git to benchmark context +void add_git_info() { + if (!Kokkos::Impl::GIT_BRANCH.empty()) { + benchmark::AddCustomContext("GIT_BRANCH", Kokkos::Impl::GIT_BRANCH); + benchmark::AddCustomContext("GIT_COMMIT_HASH", + Kokkos::Impl::GIT_COMMIT_HASH); + benchmark::AddCustomContext("GIT_CLEAN_STATUS", + Kokkos::Impl::GIT_CLEAN_STATUS); + benchmark::AddCustomContext("GIT_COMMIT_DESCRIPTION", + Kokkos::Impl::GIT_COMMIT_DESCRIPTION); + benchmark::AddCustomContext("GIT_COMMIT_DATE", + Kokkos::Impl::GIT_COMMIT_DATE); + } +} + +/// \brief Gather all context information and add it to benchmark context data +void add_benchmark_context(bool verbose = false) { + // Add Kokkos configuration to benchmark context data + add_kokkos_configuration(verbose); + // Add git information to benchmark context data + add_git_info(); +} + +} // namespace KokkosBenchmark + +#endif diff --git a/packages/kokkos/core/perf_test/CMakeLists.txt b/packages/kokkos/core/perf_test/CMakeLists.txt index 7ba97dbfbb9c2c20bf7457534cdcf468c91772d9..814102975f5a5d7bd39b013a7de4380dc25fb08d 100644 --- a/packages/kokkos/core/perf_test/CMakeLists.txt +++ b/packages/kokkos/core/perf_test/CMakeLists.txt @@ -10,7 +10,8 @@ #INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../../algorithms/src") # FIXME_OPENMPTARGET - the NVIDIA HPC compiler nvc++ in the OpenMPTarget backend does not pass the perf_tests. -IF (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) +# FIXME_OPENACC - temporarily disabled due to unimplemented features +IF ((KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_OPENACC) AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) RETURN() ENDIF() @@ -21,26 +22,6 @@ SET(SOURCES PerfTestHexGrad.cpp PerfTest_CustomReduction.cpp PerfTest_ExecSpacePartitioning.cpp - PerfTest_ViewCopy_a123.cpp - PerfTest_ViewCopy_b123.cpp - PerfTest_ViewCopy_c123.cpp - PerfTest_ViewCopy_d123.cpp - PerfTest_ViewCopy_a45.cpp - PerfTest_ViewCopy_b45.cpp - PerfTest_ViewCopy_c45.cpp - PerfTest_ViewCopy_d45.cpp - PerfTest_ViewCopy_a6.cpp - PerfTest_ViewCopy_b6.cpp - PerfTest_ViewCopy_c6.cpp - PerfTest_ViewCopy_d6.cpp - PerfTest_ViewCopy_a7.cpp - PerfTest_ViewCopy_b7.cpp - PerfTest_ViewCopy_c7.cpp - PerfTest_ViewCopy_d7.cpp - PerfTest_ViewCopy_a8.cpp - PerfTest_ViewCopy_b8.cpp - PerfTest_ViewCopy_c8.cpp - PerfTest_ViewCopy_d8.cpp PerfTest_ViewAllocate.cpp PerfTest_ViewFill_123.cpp PerfTest_ViewFill_45.cpp @@ -63,6 +44,13 @@ IF(Kokkos_ENABLE_OPENMPTARGET) ) ENDIF() +IF(KOKKOS_ENABLE_CUDA OR KOKKOS_ENABLE_HIP OR KOKKOS_ENABLE_SYCL) + KOKKOS_ADD_EXECUTABLE ( + PerformanceTest_SharedSpace + SOURCES test_sharedSpace.cpp + ) +ENDIF() + # Per #374, we always want to build this test, but we only want to run # it as a PERFORMANCE test. That's why we separate building the test # from running the test. @@ -113,3 +101,118 @@ IF(NOT Kokkos_ENABLE_OPENMPTARGET) CATEGORIES PERFORMANCE ) ENDIF() + + +IF(NOT Kokkos_ENABLE_BENCHMARKS) + RETURN() +ENDIF() + +IF (KOKKOS_HAS_TRILINOS) + message(FATAL_ERROR "Benchmarks are not supported when building as part of Trilinos") +ENDIF() + +find_package(benchmark QUIET) +IF(benchmark_FOUND) + MESSAGE(STATUS "Using google benchmark found in ${benchmark_DIR}") +ELSE() + message(STATUS "No installed google benchmark found, fetching from GitHub") + include(FetchContent) + SET(BENCHMARK_ENABLE_TESTING OFF) + + list(APPEND CMAKE_MESSAGE_INDENT " ") + FetchContent_Declare( + googlebenchmark + URL https://github.com/google/benchmark/archive/refs/tags/v1.6.2.tar.gz + URL_HASH MD5=14d14849e075af116143a161bc3b927b + ) + FetchContent_MakeAvailable(googlebenchmark) + list(POP_BACK CMAKE_MESSAGE_INDENT) + + include_directories(${benchmark_SOURCE_DIR}/include) + + # Suppress clang-tidy diagnostics on code that we do not have control over + IF(CMAKE_CXX_CLANG_TIDY) + SET_TARGET_PROPERTIES(benchmark PROPERTIES CXX_CLANG_TIDY "") + ENDIF() + + target_compile_options(benchmark PRIVATE -w) + target_compile_options(benchmark_main PRIVATE -w) +ENDIF() + + +FUNCTION(KOKKOS_ADD_BENCHMARK NAME) + CMAKE_PARSE_ARGUMENTS( + BENCHMARK + "" + "" + "SOURCES" + ${ARGN} + ) + IF(DEFINED BENCHMARK_UNPARSED_ARGUMENTS) + MESSAGE( + WARNING + "Unexpected arguments when adding a benchmark: " + ${BENCHMARK_UNPARSED_ARGUMENTS} + ) + ENDIF() + + SET(BENCHMARK_NAME ${PACKAGE_NAME}_${NAME}) + + ADD_EXECUTABLE( + ${BENCHMARK_NAME} + ${BENCHMARK_SOURCES} + ) + TARGET_LINK_LIBRARIES( + ${BENCHMARK_NAME} + PRIVATE benchmark::benchmark Kokkos::kokkos impl_git_version + ) + FOREACH(SOURCE_FILE ${BENCHMARK_SOURCES}) + SET_SOURCE_FILES_PROPERTIES( + ${SOURCE_FILE} + PROPERTIES LANGUAGE ${KOKKOS_COMPILE_LANGUAGE} + ) + ENDFOREACH() + + STRING(TIMESTAMP BENCHMARK_TIME "%Y-%m-%d_T%H-%M-%S" UTC) + SET( + BENCHMARK_ARGS + --benchmark_counters_tabular=true + --benchmark_out=${BENCHMARK_NAME}_${BENCHMARK_TIME}.json + ) + + ADD_TEST( + NAME ${BENCHMARK_NAME} + COMMAND ${BENCHMARK_NAME} ${BENCHMARK_ARGS} + ) +ENDFUNCTION() + +SET( + BENCHMARK_SOURCES + BenchmarkMain.cpp + PerfTest_ViewCopy_a123.cpp + PerfTest_ViewCopy_b123.cpp + PerfTest_ViewCopy_c123.cpp + PerfTest_ViewCopy_d123.cpp + PerfTest_ViewCopy_a45.cpp + PerfTest_ViewCopy_b45.cpp + PerfTest_ViewCopy_c45.cpp + PerfTest_ViewCopy_d45.cpp + PerfTest_ViewCopy_a6.cpp + PerfTest_ViewCopy_b6.cpp + PerfTest_ViewCopy_c6.cpp + PerfTest_ViewCopy_d6.cpp + PerfTest_ViewCopy_a7.cpp + PerfTest_ViewCopy_b7.cpp + PerfTest_ViewCopy_c7.cpp + PerfTest_ViewCopy_d7.cpp + PerfTest_ViewCopy_a8.cpp + PerfTest_ViewCopy_b8.cpp + PerfTest_ViewCopy_c8.cpp + PerfTest_ViewCopy_d8.cpp + PerfTest_ViewCopy_Raw.cpp +) + +KOKKOS_ADD_BENCHMARK( + PerformanceTest_Benchmark + SOURCES ${BENCHMARK_SOURCES} +) diff --git a/packages/kokkos/core/perf_test/Makefile b/packages/kokkos/core/perf_test/Makefile index ac06c89757d243ae6af6de755cae749bdd959e5b..396387c622f112d81cadcc75dc59bd1403a5cc28 100644 --- a/packages/kokkos/core/perf_test/Makefile +++ b/packages/kokkos/core/perf_test/Makefile @@ -34,11 +34,6 @@ OBJ_PERF += PerfTest_ExecSpacePartitioning.o OBJ_PERF += PerfTestGramSchmidt.o OBJ_PERF += PerfTestHexGrad.o OBJ_PERF += PerfTest_CustomReduction.o -OBJ_PERF += PerfTest_ViewCopy_a123.o PerfTest_ViewCopy_b123.o PerfTest_ViewCopy_c123.o PerfTest_ViewCopy_d123.o -OBJ_PERF += PerfTest_ViewCopy_a45.o PerfTest_ViewCopy_b45.o PerfTest_ViewCopy_c45.o PerfTest_ViewCopy_d45.o -OBJ_PERF += PerfTest_ViewCopy_a6.o PerfTest_ViewCopy_b6.o PerfTest_ViewCopy_c6.o PerfTest_ViewCopy_d6.o -OBJ_PERF += PerfTest_ViewCopy_a7.o PerfTest_ViewCopy_b7.o PerfTest_ViewCopy_c7.o PerfTest_ViewCopy_d7.o -OBJ_PERF += PerfTest_ViewCopy_a8.o PerfTest_ViewCopy_b8.o PerfTest_ViewCopy_c8.o PerfTest_ViewCopy_d8.o OBJ_PERF += PerfTest_ViewAllocate.o OBJ_PERF += PerfTest_ViewFill_123.o PerfTest_ViewFill_45.o PerfTest_ViewFill_6.o PerfTest_ViewFill_7.o PerfTest_ViewFill_8.o OBJ_PERF += PerfTest_ViewResize_123.o PerfTest_ViewResize_45.o PerfTest_ViewResize_6.o PerfTest_ViewResize_7.o PerfTest_ViewResize_8.o diff --git a/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp b/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp index 5be29e65d724e28b5d4990ff905f10bfe25f2dc7..1d7073fe5a5f334e5833b0206a89f81992bee4d6 100644 --- a/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp +++ b/packages/kokkos/core/perf_test/PerfTestBlasKernels.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_BLAS_KERNELS_HPP #define KOKKOS_BLAS_KERNELS_HPP diff --git a/packages/kokkos/core/perf_test/PerfTestDriver.hpp b/packages/kokkos/core/perf_test/PerfTestDriver.hpp index 95d5128abf312086edd055b5cce158178d5e3cac..ea54f31902b5e5a222279f85ca06f71a615c8c4b 100644 --- a/packages/kokkos/core/perf_test/PerfTestDriver.hpp +++ b/packages/kokkos/core/perf_test/PerfTestDriver.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include <string> diff --git a/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp b/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp index 31a01184c17cf167def6e614fcb68a7050d58f79..c8f8487ffc9f6f6cad816f97136034eb18f840ee 100644 --- a/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp +++ b/packages/kokkos/core/perf_test/PerfTestGramSchmidt.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp b/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp index 24c1898e0a16a4149c21df08e82c3da54ef0a25a..ef92de7ce1095a18be29ed58352193e01dd0db9c 100644 --- a/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp +++ b/packages/kokkos/core/perf_test/PerfTestHexGrad.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/perf_test/PerfTestMDRange.hpp b/packages/kokkos/core/perf_test/PerfTestMDRange.hpp index ec0452d5f197888d1cdbdf2c189e2c614e1b66d8..7ec1cd6996a73a1a3fc4c4db07ed11aef52de9bf 100644 --- a/packages/kokkos/core/perf_test/PerfTestMDRange.hpp +++ b/packages/kokkos/core/perf_test/PerfTestMDRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ namespace Test { template <class DeviceType, typename ScalarType = double, diff --git a/packages/kokkos/core/perf_test/PerfTestMain.cpp b/packages/kokkos/core/perf_test/PerfTestMain.cpp index 8f4d48d57bf3f2c21ed78054a22abc6c4694bdcb..2729432adc32d727d305606bf024b94dd4ad235d 100644 --- a/packages/kokkos/core/perf_test/PerfTestMain.cpp +++ b/packages/kokkos/core/perf_test/PerfTestMain.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <cstdlib> diff --git a/packages/kokkos/core/perf_test/PerfTest_Category.hpp b/packages/kokkos/core/perf_test/PerfTest_Category.hpp index 0f24490bfeb77df3e86b4af14e9dcfdf5680efbb..126c9611479b453df799a17b9592e7675f312086 100644 --- a/packages/kokkos/core/perf_test/PerfTest_Category.hpp +++ b/packages/kokkos/core/perf_test/PerfTest_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_PERFTEST_CAT_HPP #define KOKKOS_TEST_PERFTEST_CAT_HPP diff --git a/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp b/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp index 1ab76d6e543996be34b40800c8da31022cd625cd..049301f9a712cac5fced36fed114d3135e0b5a59 100644 --- a/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_CustomReduction.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> @@ -58,8 +30,8 @@ void custom_reduction_test(int N, int R, int num_trials) { Scalar max; int team_size = 32; - if (team_size > Kokkos::DefaultExecutionSpace::concurrency()) - team_size = Kokkos::DefaultExecutionSpace::concurrency(); + if (team_size > Kokkos::DefaultExecutionSpace().concurrency()) + team_size = Kokkos::DefaultExecutionSpace().concurrency(); // Warm up Kokkos::parallel_reduce( Kokkos::TeamPolicy<>(N / 1024, team_size), diff --git a/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp b/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp index b1a7bf1e8376d3f4402820207387231ecb9252a8..48419c7ec681be818183e66eb89a78a8337dd877 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ExecSpacePartitioning.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <Kokkos_Core.hpp> #include <gtest/gtest.h> #include <PerfTest_Category.hpp> @@ -26,8 +42,7 @@ bool is_overlapping<Kokkos::Cuda>(const Kokkos::Cuda&) { #ifdef KOKKOS_ENABLE_HIP template <> -bool is_overlapping<Kokkos::Experimental::HIP>( - const Kokkos::Experimental::HIP&) { +bool is_overlapping<Kokkos::HIP>(const Kokkos::HIP&) { // FIXME_HIP This doesn't pass yet in CI. return false; // bool value = true; diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp index 555a05ea279cd2280c510a03976dd75e8ee171f2..c1d98958476429b6a37c5568c449d189904019eb 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewAllocate.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp index 8e7bf25e809cf7649574c332af9bc35dfb0e1d94..b0216ca6fc4ce2436c2e5246ae1acce7ca45b6fa 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy.hpp @@ -1,261 +1,168 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ + +#ifndef KOKKOS_CORE_PERFTEST_BENCHMARK_VIEW_COPY_HPP +#define KOKKOS_CORE_PERFTEST_BENCHMARK_VIEW_COPY_HPP #include <Kokkos_Core.hpp> -#include <gtest/gtest.h> -#include <cstdio> -#include <PerfTest_Category.hpp> +#include <benchmark/benchmark.h> +#include <cmath> namespace Test { +/** + * \brief Mark the label as a figure of merit. + */ +inline std::string benchmark_fom(const std::string& label) { + return "FOM: " + label; +} + +inline void report_results(benchmark::State& state, std::size_t num_elems, + double time) { + state.SetIterationTime(time); + + // data size in megabytes + const auto size = 1.0 * num_elems * sizeof(double) / 1000 / 1000; + // data processed in gigabytes + const auto data_processed = 2 * size / 1000; + + state.counters["MB"] = + benchmark::Counter(size, benchmark::Counter::kDefaults); + state.counters[benchmark_fom("GB/s")] = benchmark::Counter( + data_processed, benchmark::Counter::kIsIterationInvariantRate); +} + template <class ViewTypeA, class ViewTypeB> -double deepcopy_view(ViewTypeA& a, ViewTypeB& b, int repeat) { - Kokkos::Timer timer; - for (int i = 0; i < repeat; i++) { +void deepcopy_view(ViewTypeA& a, ViewTypeB& b, benchmark::State& state) { + for (auto _ : state) { + Kokkos::fence(); + Kokkos::Timer timer; Kokkos::deep_copy(a, b); + report_results(state, a.size(), timer.seconds()); } - Kokkos::fence(); - return timer.seconds(); } template <class LayoutA, class LayoutB> -void run_deepcopyview_tests123(int N, int R) { - const int N1 = N; +static void ViewDeepCopy_Rank1(benchmark::State& state) { + const int N8 = std::pow(state.range(0), 8); + + Kokkos::View<double*, LayoutA> a("A1", N8); + Kokkos::View<double*, LayoutB> b("B1", N8); + + deepcopy_view(a, b, state); +} + +template <class LayoutA, class LayoutB> +static void ViewDeepCopy_Rank2(benchmark::State& state) { + const int N1 = state.range(0); const int N2 = N1 * N1; - const int N3 = N2 * N1; const int N4 = N2 * N2; - const int N8 = N4 * N4; - double time1, time2, time3, time_raw = 100000.0; - { - Kokkos::View<double*, LayoutA> a("A1", N8); - Kokkos::View<double*, LayoutB> b("B1", N8); - time1 = deepcopy_view(a, b, R) / R; - } - { - Kokkos::View<double**, LayoutA> a("A2", N4, N4); - Kokkos::View<double**, LayoutB> b("B2", N4, N4); - time2 = deepcopy_view(a, b, R) / R; - } - { - Kokkos::View<double***, LayoutA> a("A3", N3, N3, N2); - Kokkos::View<double***, LayoutB> b("B3", N3, N3, N2); - time3 = deepcopy_view(a, b, R) / R; - } -#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA) - { - Kokkos::View<double*, LayoutA> a("A1", N8); - Kokkos::View<double*, LayoutB> b("B1", N8); - double* const a_ptr = a.data(); - const double* const b_ptr = b.data(); - Kokkos::Timer timer; - for (int r = 0; r < R; r++) { - Kokkos::parallel_for( - N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; }); - } - Kokkos::fence(); - time_raw = timer.seconds() / R; - } -#endif - double size = 1.0 * N8 * 8 / 1024 / 1024; - printf(" Raw: %lf s %lf MB %lf GB/s\n", time_raw, size, - 2.0 * size / 1024 / time_raw); - printf(" Rank1: %lf s %lf MB %lf GB/s\n", time1, size, - 2.0 * size / 1024 / time1); - printf(" Rank2: %lf s %lf MB %lf GB/s\n", time2, size, - 2.0 * size / 1024 / time2); - printf(" Rank3: %lf s %lf MB %lf GB/s\n", time3, size, - 2.0 * size / 1024 / time3); + Kokkos::View<double**, LayoutA> a("A2", N4, N4); + Kokkos::View<double**, LayoutB> b("B2", N4, N4); + + deepcopy_view(a, b, state); } template <class LayoutA, class LayoutB> -void run_deepcopyview_tests45(int N, int R) { - const int N1 = N; +static void ViewDeepCopy_Rank3(benchmark::State& state) { + const int N1 = state.range(0); const int N2 = N1 * N1; - const int N4 = N2 * N2; - const int N8 = N4 * N4; + const int N3 = N2 * N1; - double time4, time5, time_raw = 100000.0; - { - Kokkos::View<double****, LayoutA> a("A4", N2, N2, N2, N2); - Kokkos::View<double****, LayoutB> b("B4", N2, N2, N2, N2); - time4 = deepcopy_view(a, b, R) / R; - } - { - Kokkos::View<double*****, LayoutA> a("A5", N2, N2, N1, N1, N2); - Kokkos::View<double*****, LayoutB> b("B5", N2, N2, N1, N1, N2); - time5 = deepcopy_view(a, b, R) / R; - } -#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA) - { - Kokkos::View<double*, LayoutA> a("A1", N8); - Kokkos::View<double*, LayoutB> b("B1", N8); - double* const a_ptr = a.data(); - const double* const b_ptr = b.data(); - Kokkos::Timer timer; - for (int r = 0; r < R; r++) { - Kokkos::parallel_for( - N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; }); - } - Kokkos::fence(); - time_raw = timer.seconds() / R; - } -#endif - double size = 1.0 * N8 * 8 / 1024 / 1024; - printf(" Raw: %lf s %lf MB %lf GB/s\n", time_raw, size, - 2.0 * size / 1024 / time_raw); - printf(" Rank4: %lf s %lf MB %lf GB/s\n", time4, size, - 2.0 * size / 1024 / time4); - printf(" Rank5: %lf s %lf MB %lf GB/s\n", time5, size, - 2.0 * size / 1024 / time5); + Kokkos::View<double***, LayoutA> a("A3", N3, N3, N2); + Kokkos::View<double***, LayoutB> b("B3", N3, N3, N2); + + deepcopy_view(a, b, state); } template <class LayoutA, class LayoutB> -void run_deepcopyview_tests6(int N, int R) { - const int N1 = N; +static void ViewDeepCopy_Rank4(benchmark::State& state) { + const int N1 = state.range(0); const int N2 = N1 * N1; - const int N4 = N2 * N2; - const int N8 = N4 * N4; - double time6, time_raw = 100000.0; - { - Kokkos::View<double******, LayoutA> a("A6", N2, N1, N1, N1, N1, N2); - Kokkos::View<double******, LayoutB> b("B6", N2, N1, N1, N1, N1, N2); - time6 = deepcopy_view(a, b, R) / R; - } -#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA) - { - Kokkos::View<double*, LayoutA> a("A1", N8); - Kokkos::View<double*, LayoutB> b("B1", N8); - double* const a_ptr = a.data(); - const double* const b_ptr = b.data(); - Kokkos::Timer timer; - for (int r = 0; r < R; r++) { - Kokkos::parallel_for( - N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; }); - } - Kokkos::fence(); - time_raw = timer.seconds() / R; - } -#endif - double size = 1.0 * N8 * 8 / 1024 / 1024; - printf(" Raw: %lf s %lf MB %lf GB/s\n", time_raw, size, - 2.0 * size / 1024 / time_raw); - printf(" Rank6: %lf s %lf MB %lf GB/s\n", time6, size, - 2.0 * size / 1024 / time6); + Kokkos::View<double****, LayoutA> a("A4", N2, N2, N2, N2); + Kokkos::View<double****, LayoutB> b("B4", N2, N2, N2, N2); + + deepcopy_view(a, b, state); } template <class LayoutA, class LayoutB> -void run_deepcopyview_tests7(int N, int R) { - const int N1 = N; +static void ViewDeepCopy_Rank5(benchmark::State& state) { + const int N1 = state.range(0); const int N2 = N1 * N1; - const int N4 = N2 * N2; - const int N8 = N4 * N4; - double time7, time_raw = 100000.0; - { - Kokkos::View<double*******, LayoutA> a("A7", N2, N1, N1, N1, N1, N1, N1); - Kokkos::View<double*******, LayoutB> b("B7", N2, N1, N1, N1, N1, N1, N1); - time7 = deepcopy_view(a, b, R) / R; - } -#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA) - { - Kokkos::View<double*, LayoutA> a("A1", N8); - Kokkos::View<double*, LayoutB> b("B1", N8); - double* const a_ptr = a.data(); - const double* const b_ptr = b.data(); - Kokkos::Timer timer; - for (int r = 0; r < R; r++) { - Kokkos::parallel_for( - N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; }); - } - Kokkos::fence(); - time_raw = timer.seconds() / R; - } -#endif - double size = 1.0 * N8 * 8 / 1024 / 1024; - printf(" Raw: %lf s %lf MB %lf GB/s\n", time_raw, size, - 2.0 * size / 1024 / time_raw); - printf(" Rank7: %lf s %lf MB %lf GB/s\n", time7, size, - 2.0 * size / 1024 / time7); + Kokkos::View<double*****, LayoutA> a("A5", N2, N2, N1, N1, N2); + Kokkos::View<double*****, LayoutB> b("B5", N2, N2, N1, N1, N2); + + deepcopy_view(a, b, state); } template <class LayoutA, class LayoutB> -void run_deepcopyview_tests8(int N, int R) { - const int N1 = N; +static void ViewDeepCopy_Rank6(benchmark::State& state) { + const int N1 = state.range(0); const int N2 = N1 * N1; - const int N4 = N2 * N2; - const int N8 = N4 * N4; - - double time8, time_raw = 100000.0; - { - Kokkos::View<double********, LayoutA> a("A8", N1, N1, N1, N1, N1, N1, N1, - N1); - Kokkos::View<double********, LayoutB> b("B8", N1, N1, N1, N1, N1, N1, N1, - N1); - time8 = deepcopy_view(a, b, R) / R; - } -#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA) - { - Kokkos::View<double*, LayoutA> a("A1", N8); - Kokkos::View<double*, LayoutB> b("B1", N8); - double* const a_ptr = a.data(); - const double* const b_ptr = b.data(); + + Kokkos::View<double******, LayoutA> a("A6", N2, N1, N1, N1, N1, N2); + Kokkos::View<double******, LayoutB> b("B6", N2, N1, N1, N1, N1, N2); + + deepcopy_view(a, b, state); +} + +template <class LayoutA, class LayoutB> +static void ViewDeepCopy_Rank7(benchmark::State& state) { + const int N1 = state.range(0); + const int N2 = N1 * N1; + + Kokkos::View<double*******, LayoutA> a("A7", N2, N1, N1, N1, N1, N1, N1); + Kokkos::View<double*******, LayoutB> b("B7", N2, N1, N1, N1, N1, N1, N1); + + deepcopy_view(a, b, state); +} + +template <class LayoutA, class LayoutB> +static void ViewDeepCopy_Rank8(benchmark::State& state) { + const int N1 = state.range(0); + + Kokkos::View<double********, LayoutA> a("A8", N1, N1, N1, N1, N1, N1, N1, N1); + Kokkos::View<double********, LayoutB> b("B8", N1, N1, N1, N1, N1, N1, N1, N1); + + deepcopy_view(a, b, state); +} + +template <class LayoutA, class LayoutB> +static void ViewDeepCopy_Raw(benchmark::State& state) { + const int N8 = std::pow(state.range(0), 8); + + Kokkos::View<double*, LayoutA> a("A1", N8); + Kokkos::View<double*, LayoutB> b("B1", N8); + double* const a_ptr = a.data(); + const double* const b_ptr = b.data(); + + for (auto _ : state) { + Kokkos::fence(); Kokkos::Timer timer; - for (int r = 0; r < R; r++) { - Kokkos::parallel_for( - N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; }); - } + Kokkos::parallel_for( + N8, KOKKOS_LAMBDA(const int& i) { a_ptr[i] = b_ptr[i]; }); Kokkos::fence(); - time_raw = timer.seconds() / R; + + report_results(state, a.size(), timer.seconds()); } -#endif - double size = 1.0 * N8 * 8 / 1024 / 1024; - printf(" Raw: %lf s %lf MB %lf GB/s\n", time_raw, size, - 2.0 * size / 1024 / time_raw); - printf(" Rank8: %lf s %lf MB %lf GB/s\n", time8, size, - 2.0 * size / 1024 / time8); } } // namespace Test + +#endif diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp new file mode 100644 index 0000000000000000000000000000000000000000..976f800487878f2ee40a94cf7982577de390e66c --- /dev/null +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_Raw.cpp @@ -0,0 +1,43 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <PerfTest_ViewCopy.hpp> + +namespace Test { + +#if defined(KOKKOS_ENABLE_CUDA_LAMBDA) || !defined(KOKKOS_ENABLE_CUDA) +BENCHMARK(ViewDeepCopy_Raw<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Raw<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Raw<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Raw<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); +#endif + +} // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp index dceef801aa8bc295403505c16e8d664d61541bf7..3fc1c2480cf2c95e1c68993967c9eb86025b2237 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a123.cpp @@ -1,51 +1,36 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftLeft_Rank123) { - printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n"); - run_deepcopyview_tests123<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank1<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank2<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank3<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp index 3f9b694461211933cf4fffc7424b6fa38c47af02..542f5534be7ef0a01a419bf8d8b31a9fdc3684aa 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a45.cpp @@ -1,51 +1,31 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftLeft_Rank45) { - printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n"); - run_deepcopyview_tests45<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank4<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank5<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp index ac364c31cbc53a002334811817220558cbc225be..782628072db34bd0aa3cc44c5eec430e8e4b99ca 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a6.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftLeft_Rank6) { - printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n"); - run_deepcopyview_tests6<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank6<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp index 94f30bac9fb529de334344a48dd20539751a4a6e..000c8b401c97f4b56ec8a9dfe442a20afe08844b 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a7.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftLeft_Rank7) { - printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n"); - run_deepcopyview_tests7<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank7<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp index b916169f1b732843d2070232885cfeb87b2e64e1..f7d7c6040a61ad242797d4f64df66eed31787a50 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_a8.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftLeft_Rank8) { - printf("DeepCopy Performance for LayoutLeft to LayoutLeft:\n"); - run_deepcopyview_tests8<Kokkos::LayoutLeft, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank8<Kokkos::LayoutLeft, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp index f314cb0ff43c4d1e68e81574e273b7411c25118a..7820e8997314824ab870dcef926e611c89182854 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b123.cpp @@ -1,51 +1,36 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightRight_Rank123) { - printf("DeepCopy Performance for LayoutRight to LayoutRight:\n"); - run_deepcopyview_tests123<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank1<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank2<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank3<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp index 5d06f060afa91d7be89c140613f1ef93f9e1d46a..58f58314b093b8ce0788705d3d352ccd0947a866 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b45.cpp @@ -1,51 +1,31 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightRight_Rank45) { - printf("DeepCopy Performance for LayoutRight to LayoutRight:\n"); - run_deepcopyview_tests45<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank4<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank5<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp index 0e28fee631eb29ec1d70a38b834fc0744d45bb04..920bf1222f140d0a716d9a845e7af5e9bebb5b98 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b6.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightRight_Rank6) { - printf("DeepCopy Performance for LayoutRight to LayoutRight:\n"); - run_deepcopyview_tests6<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank6<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp index 37e1325fc4c0b1928dcc160e8c0a12cd364830ec..11b7a0d0d1caa04966896c165a551efed7d59835 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b7.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightRight_Rank7) { - printf("DeepCopy Performance for LayoutRight to LayoutRight:\n"); - run_deepcopyview_tests7<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank7<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp index 986c39aaf447d4f6fc04e54b06e5222007e4ace9..56a3d8d4c3221d8d84213dbd1b2ed839c29c8168 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_b8.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightRight_Rank8) { - printf("DeepCopy Performance for LayoutRight to LayoutRight:\n"); - run_deepcopyview_tests8<Kokkos::LayoutRight, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank8<Kokkos::LayoutRight, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp index b98563ee429564d1944a45426f3fd5afbc7e2e3d..375f7c8985b2f560553a06ae762178a4a10b8908 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c123.cpp @@ -1,51 +1,36 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftRight_Rank123) { - printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n"); - run_deepcopyview_tests123<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank1<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank2<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank3<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp index a0ef11e09b8736009afcebb6fe5e3070fadcbbe0..3625631617d86429b67e771c9773ea581e7b2b3c 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c45.cpp @@ -1,51 +1,31 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftRight_Rank45) { - printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n"); - run_deepcopyview_tests45<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank4<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank5<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp index fea5dde73adf69ec45bd8d6549882102dd4cbddc..bcb70b6764196e8ba7fc445156b390879fdfe121 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c6.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftRight_Rank6) { - printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n"); - run_deepcopyview_tests6<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank6<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp index a8c8d866f927a40f7d6b29a759a6fadeda7c96e4..055d0e344c8bbbc7aae154f2b0288dafcc20884a 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c7.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftRight_Rank7) { - printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n"); - run_deepcopyview_tests7<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank7<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp index e5abdaa5d81f9e147a9180b54a0a897b40ee08a0..1e5342ef5217ee53231e9bbdb2f2a9f7af8ddea7 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_c8.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_LeftRight_Rank8) { - printf("DeepCopy Performance for LayoutLeft to LayoutRight:\n"); - run_deepcopyview_tests8<Kokkos::LayoutLeft, Kokkos::LayoutRight>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank8<Kokkos::LayoutLeft, Kokkos::LayoutRight>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp index 2b58f8dd1f6b2554f2aeaa89052e0d52403da118..d61e01f9f6a9ea0d7f1ed1cdde2d94b6a7c097f8 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d123.cpp @@ -1,51 +1,36 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightLeft_Rank123) { - printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n"); - run_deepcopyview_tests123<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank1<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank2<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank3<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp index fe34e4fd1a84a1960a37893bc0e8dfd26ed0a42f..385d5b48ae96c39a4c6656bf34ca62a57bd69476 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d45.cpp @@ -1,51 +1,31 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightLeft_Rank45) { - printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n"); - run_deepcopyview_tests45<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank4<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + +BENCHMARK(ViewDeepCopy_Rank5<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp index 115b223e68b88b297d96cfe9fe6db7fdd9c5591c..0ae16012d6a65a1128757facef98df8eaeeffd96 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d6.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightLeft_Rank6) { - printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n"); - run_deepcopyview_tests6<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank6<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp index 51e88795e73a9b802c6410a99e63190c1cdb91eb..4ebbb6359b59cc1ea475a206c7ff855d9c2a5276 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d7.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightLeft_Rank7) { - printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n"); - run_deepcopyview_tests7<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank7<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp index 2a53cdef213079833e3c1c4b48b760e643dc7f23..3a888b6155737819f263e0fae7faee5cf9dc9c84 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewCopy_d8.cpp @@ -1,51 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewCopy.hpp> + namespace Test { -TEST(default_exec, ViewDeepCopy_RightLeft_Rank8) { - printf("DeepCopy Performance for LayoutRight to LayoutLeft:\n"); - run_deepcopyview_tests8<Kokkos::LayoutRight, Kokkos::LayoutLeft>(10, 1); -} + +BENCHMARK(ViewDeepCopy_Rank8<Kokkos::LayoutRight, Kokkos::LayoutLeft>) + ->ArgName("N") + ->Arg(10) + ->UseManualTime(); + } // namespace Test diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp index 38be4bb212c8527ccb246712dc5c2d8b32d53a56..7f76ed0ff70f41faf44f6c3999a9ec68ffbe7ae1 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp index 0bf8a28329e8993282e407955fe96b5caaabb5e3..1e050e2311fdd2b2e046be663ee77210ec7384b3 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_123.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewFill.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp index 53ac509da804c3fa6766f956fe9e2eabdbc27e01..2bf93b2048bee4b15edbd932fd3945f13bd81f21 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_45.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewFill.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp index f0a2e248f238542084917497dec7c203a254a6fc..588a1e2293cac76cacfde24db1bc0e9f7570af68 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_6.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewFill.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp index 675d9e636f27577b1deaa9202de5f21770163f8d..fffeb951c94c345871613272f58614d5113bc67d 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_7.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewFill.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp index 35e1e81c43dbc6e36f6760694529d3b175b8d7d1..b2188af1a3a54917dee7865592693b38a170de86 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewFill_8.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewFill.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp index 66a631e3890359bb32fa6f0e2055e1f8d9bb9309..dfcd3f1347f74dd022af61d952d47a552aa0e8fb 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp index 1dc4f285f56479b4987a0e3adf39664d8590ddc0..ed2e58192c9bc498dbd988c5a4bba3c82d5cc2ba 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_123.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewResize.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp index 3754a5bb147b8d5a057d3c385179aa7645d63e11..69028fab08c593962e251b01196ed1bf8efc5416 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_45.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewResize.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp index 1b8d6fbc8a04528f6ea30d6c52bd17e55ff2a683..486b44a0c1b1b2fe0a8903aa7d0ac64ebf174839 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_6.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewResize.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp index f8efa195fc8e90eb9cbbde39a002b142192800a6..84c2a79ad68b993420e7a94207ca2cd95b573814 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_7.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewResize.hpp> diff --git a/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp b/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp index b0562f2fd12227f1e3270c332cd3f1a6c4298fad..25910fb5754b7e9835cebcacadf2186848c2045b 100644 --- a/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp +++ b/packages/kokkos/core/perf_test/PerfTest_ViewResize_8.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <PerfTest_ViewResize.hpp> diff --git a/packages/kokkos/core/perf_test/test_atomic.cpp b/packages/kokkos/core/perf_test/test_atomic.cpp index 54824e5b39b91456a81e541e39a441d20b2879a7..5f10afc45a18200caca69274bb968719929dd688 100644 --- a/packages/kokkos/core/perf_test/test_atomic.cpp +++ b/packages/kokkos/core/perf_test/test_atomic.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> #include <cstring> @@ -73,7 +45,7 @@ void textcolor(int attr, int fg, int bg) { char command[40]; /* Command is the control command to the terminal */ - sprintf(command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40); + snprintf(command, 40, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40); printf("%s", command); } void textcolor_standard() { textcolor(RESET, BLACK, WHITE); } diff --git a/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp b/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp index 4086ef58163ff4ec144d2c151241952752d3453d..4c2ae5c2d18144f91c420e2d8def00b2da710b2f 100644 --- a/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp +++ b/packages/kokkos/core/perf_test/test_atomic_minmax_simple.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + // export OMP_PROC_BIND=spread ; export OMP_PLACES=threads // c++ -O2 -g -DNDEBUG -fopenmp // ../core/perf_test/test_atomic_minmax_simple.cpp -I../core/src/ -I. -o diff --git a/packages/kokkos/core/perf_test/test_mempool.cpp b/packages/kokkos/core/perf_test/test_mempool.cpp index 7887d4ba55196ddbc283baa023884e2f43a48991..e4e1b4c9a3944bd43ea855ce6a69c85c3af76fd8 100644 --- a/packages/kokkos/core/perf_test/test_mempool.cpp +++ b/packages/kokkos/core/perf_test/test_mempool.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> #include <cstring> diff --git a/packages/kokkos/core/perf_test/test_sharedSpace.cpp b/packages/kokkos/core/perf_test/test_sharedSpace.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4f140c9409ad5e3b4db5d7b3522bbb2f931cceb8 --- /dev/null +++ b/packages/kokkos/core/perf_test/test_sharedSpace.cpp @@ -0,0 +1,311 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER +#include <Kokkos_Core.hpp> + +#if defined _WIN32 +#include <windows.h> +unsigned getBytesPerPage() { + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwPageSize; +} +#else // unix/posix system +#include <unistd.h> +unsigned getBytesPerPage() { return sysconf(_SC_PAGESIZE); } +#endif + +#include <algorithm> +#include <numeric> +#include <iostream> + +namespace { +void printTimings(std::ostream& out, std::vector<double> const& tr, + size_t numBytes, + double threshold = (std::numeric_limits<double>::max)()) { + out << "TimingResult contains " << tr.size() << " results:\n"; + for (auto it = tr.begin(); it != tr.end(); ++it) { + out << "Duration of loop " << it - tr.begin() << " is " << *it + << " seconds."; + if ((*it) > threshold) { + out << " Marked as page migation."; + } + out << " The transfer rate is " + << (double)numBytes / std::pow(1000.0, 3) / (*it) * + 2.0 // as we read and write + << " GB/s \n"; + } +} + +template <typename T> +T computeMean(std::vector<T> const& results) { + return std::accumulate(results.begin(), results.end(), T{}) / results.size(); +} + +template <typename ViewType> +class IncrementFunctor { + private: + using index_type = decltype(std::declval<ViewType>().size()); + ViewType view_; + + public: + IncrementFunctor() = delete; + + explicit IncrementFunctor(ViewType view) : view_(view) {} + + KOKKOS_INLINE_FUNCTION + void operator()(const index_type idx) const { ++view_(idx); } +}; + +// TIMING CAPTURED KERNEL +// PREMISE: This kernel should always be memory bound, as we are measuring +// memory access times. The compute load of an increment is small enough on +// current hardware but this could be different for new hardware. As we count +// the wall-clock time in the kernel, the core frequency of the device has to be +// at the maximum to guarantee accurate masurements. +template <typename ExecSpace, typename ViewType> +std::vector<double> incrementInLoop(ViewType& view, + unsigned int numRepetitions) { + using index_type = decltype(view.size()); + Kokkos::Timer timer; + std::vector<double> results; + + Kokkos::fence(); + for (unsigned i = 0; i < numRepetitions; ++i) { + IncrementFunctor<ViewType> func(view); + timer.reset(); + Kokkos::parallel_for( + "increment", + Kokkos::RangePolicy<ExecSpace, Kokkos::IndexType<index_type>>{ + 0, view.size()}, + func); + Kokkos::fence(); + results.push_back(timer.seconds()); + } + return results; +} + +size_t getDeviceMemorySize() { +#if defined KOKKOS_ENABLE_CUDA + return Kokkos::Cuda{}.cuda_device_prop().totalGlobalMem; +#elif defined KOKKOS_ENABLE_HIP + return Kokkos::HIP{}.hip_device_prop().totalGlobalMem; +#elif defined KOKKOS_ENABLE_SYCL + auto device = Kokkos::Experimental::SYCL{}.sycl_queue().get_device(); + return device.get_info<sycl::info::device::global_mem_size>(); +#else +#error \ + "The sharedMemory test is only defined for Kokkos::Cuda, Kokkos::HIP, and Kokkos::SYCL" + return 0; +#endif +} + +struct Arguments { + unsigned int numRepetitions = 10; + unsigned int numWarmupRepetitions = 100; + unsigned int numDeviceHostCycles = 3; + double fractionOfDeviceMemory = 0.4; + double threshold = 2.0; +}; + +void test_sharedSpace(Arguments args) { + const unsigned int numRepetitions = args.numRepetitions; + const unsigned int numWarmupRepetitions = args.numWarmupRepetitions; + const unsigned int numDeviceHostCycles = args.numDeviceHostCycles; + double fractionOfDeviceMemory = args.fractionOfDeviceMemory; + double threshold = args.threshold; + size_t numBytes = fractionOfDeviceMemory * getDeviceMemorySize(); + size_t numPages = numBytes / getBytesPerPage(); + + // ALLOCATION + Kokkos::View<int*, Kokkos::SharedSpace> migratableData( + "migratableData", numPages * getBytesPerPage() / sizeof(int)); + Kokkos::View<int*, Kokkos::DefaultExecutionSpace::memory_space> deviceData( + "deviceData", numPages * getBytesPerPage() / sizeof(int)); + Kokkos::View<int*, Kokkos::DefaultHostExecutionSpace::memory_space> hostData( + "hostData", numPages * getBytesPerPage() / sizeof(int)); + Kokkos::fence(); + + // WARMUP GPU + incrementInLoop<Kokkos::DefaultExecutionSpace>( + deviceData, + numWarmupRepetitions); // warming up gpu + + // GET DEVICE LOCAL TIMINGS + auto deviceLocalResults = incrementInLoop<Kokkos::DefaultExecutionSpace>( + deviceData, numRepetitions); + + // WARMUP HOST + incrementInLoop<Kokkos::DefaultHostExecutionSpace>( + hostData, + numWarmupRepetitions); // warming up host + // GET HOST LOCAL TIMINGS + auto hostLocalResults = incrementInLoop<Kokkos::DefaultHostExecutionSpace>( + hostData, numRepetitions); + + // GET PAGE MIGRATING TIMINGS DATA + std::vector<decltype(deviceLocalResults)> deviceResults{}; + std::vector<decltype(hostLocalResults)> hostResults{}; + for (unsigned i = 0; i < numDeviceHostCycles; ++i) { + // WARMUP GPU + incrementInLoop<Kokkos::DefaultExecutionSpace>( + deviceData, + numWarmupRepetitions); // warming up gpu without touching the + // migratableData to get measurements of initial + // position + // GET RESULTS DEVICE + deviceResults.push_back(incrementInLoop<Kokkos::DefaultExecutionSpace>( + migratableData, numRepetitions)); + + // WARMUP HOST + incrementInLoop<Kokkos::DefaultHostExecutionSpace>( + hostData, + numWarmupRepetitions); // warming up host without touching the + // migratableData to get measurements of initial + // position + // GET RESULTS HOST + hostResults.push_back(incrementInLoop<Kokkos::DefaultHostExecutionSpace>( + migratableData, numRepetitions)); + } + + // COMPUTE STATISTICS OF HOST AND DEVICE LOCAL KERNELS + auto hostLocalMean = computeMean(hostLocalResults); + auto deviceLocalMean = computeMean(deviceLocalResults); + + // ASSESS PAGE MIGRATIONS + bool initialPlacementOnDevice = false; + bool migratesOnEverySpaceAccess = true; + bool migratesOnlyOncePerAccess = true; + + for (unsigned cycle = 0; cycle < numDeviceHostCycles; ++cycle) { + unsigned int indicatedPageMigrationsDevice = std::count_if( + deviceResults[cycle].begin(), deviceResults[cycle].end(), + [&](auto const& val) { return val > (threshold * deviceLocalMean); }); + + if (cycle == 0 && indicatedPageMigrationsDevice == 0) + initialPlacementOnDevice = true; + else { + if (indicatedPageMigrationsDevice != 1) migratesOnlyOncePerAccess = false; + } + + unsigned int indicatedPageMigrationsHost = std::count_if( + hostResults[cycle].begin(), hostResults[cycle].end(), + [&](auto const& val) { return val > (threshold * hostLocalMean); }); + + if (indicatedPageMigrationsHost != 1) migratesOnlyOncePerAccess = false; + + if (cycle != 0 && indicatedPageMigrationsDevice != 1 && + indicatedPageMigrationsHost != 1) + migratesOnEverySpaceAccess = false; + } + + std::cout << "Page size as reported by os: " << getBytesPerPage() + << " bytes \n"; + std::cout << "Allocating " << numPages + << " pages of memory in pageMigratingMemorySpace.\n" + << "This corresponds to " << fractionOfDeviceMemory * 100 + << " % of the device memory.\n" + << "The view size is " << migratableData.size() << "\n"; + + std::cout << "Behavior found: \n"; + std::cout << "Initial placement on device is " << initialPlacementOnDevice + << "\n"; + std::cout << "Memory migrates on every space access is " + << migratesOnEverySpaceAccess << "\n"; + std::cout << "Memory migrates only once per access " + << migratesOnlyOncePerAccess << "\n\n"; + + std::cout << "Please look at the following timings. A migration was " + "marked detected if the time was larger than " + << threshold * hostLocalMean << " for the host and " + << threshold * deviceLocalMean << " for the device\n\n"; + + std::cout << "#############TIMINGS WITH SHAREDSPACE##################\n"; + + for (unsigned cycle = 0; cycle < numDeviceHostCycles; ++cycle) { + std::cout << "device timings of run " << cycle << ":\n"; + printTimings(std::cout, deviceResults[cycle], numBytes, + threshold * deviceLocalMean); + std::cout << "host timings of run " << cycle << ":\n"; + printTimings(std::cout, hostResults[cycle], numBytes, + threshold * hostLocalMean); + } + std::cout << "\n#############TIMINGS WITH LOCALSPACE##################\n"; + std::cout << "Device local memory timings for comparison:\n"; + printTimings(std::cout, deviceLocalResults, numBytes); + std::cout << "Host local memory timings for comparison:\n"; + printTimings(std::cout, hostLocalResults, numBytes); +} +} // namespace + +int main(int argc, char* argv[]) { + static const char help_flag[] = "--help"; + static const char numRepetitions_flag[] = "--numRepetitions="; + static const char numWarmupRepetitions_flag[] = "--numWarmupRepetitions="; + static const char numDeviceHostCycles_flag[] = "--numDeviceHostCycles="; + static const char fractionOfDeviceMemory_flag[] = "--fractionOfDeviceMemory="; + static const char threshold_flag[] = "--threshold="; + + int ask_help = 0; + Arguments args; + + for (int i = 1; i < argc; i++) { + const char* const a = argv[i]; + + if (!strncmp(a, help_flag, strlen(help_flag))) ask_help = 1; + + if (!strncmp(a, numRepetitions_flag, strlen(numRepetitions_flag))) + args.numRepetitions = std::stoi(a + strlen(numRepetitions_flag)); + + if (!strncmp(a, numWarmupRepetitions_flag, + strlen(numWarmupRepetitions_flag))) + args.numWarmupRepetitions = + std::stoi(a + strlen(numWarmupRepetitions_flag)); + + if (!strncmp(a, numDeviceHostCycles_flag, strlen(numDeviceHostCycles_flag))) + args.numDeviceHostCycles = + std::stoi(a + strlen(numDeviceHostCycles_flag)); + + if (!strncmp(a, fractionOfDeviceMemory_flag, + strlen(fractionOfDeviceMemory_flag))) + args.fractionOfDeviceMemory = + std::stod(a + strlen(fractionOfDeviceMemory_flag)); + + if (!strncmp(a, threshold_flag, strlen(threshold_flag))) + args.threshold = std::stod(a + strlen(threshold_flag)); + } + + if (ask_help) { + std::cout << "command line options:" + << " " << help_flag << " " << numRepetitions_flag << "##" + << " " << numWarmupRepetitions_flag << "##" + << " " << numDeviceHostCycles_flag << "##" + << " " << fractionOfDeviceMemory_flag << "##" + << " " << threshold_flag << "##" + << " any given Kokkos args are passed to Kokkos::initialize ##" + << std::endl; + return 0; + } + + Kokkos::initialize(argc, argv); + if constexpr (Kokkos::has_shared_space) + test_sharedSpace(args); + else + std::cout + << "The used Kokkos configuration does not support SharedSpace \n"; + Kokkos::finalize(); + + return 0; +} diff --git a/packages/kokkos/core/perf_test/test_taskdag.cpp b/packages/kokkos/core/perf_test/test_taskdag.cpp index 49957ae9323db825ebcfa6d3c19dddb38856862d..bbb48af6c43e8bd16b350aad9ca4f0633f5fb8dc 100644 --- a/packages/kokkos/core/perf_test/test_taskdag.cpp +++ b/packages/kokkos/core/perf_test/test_taskdag.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/src/CMakeLists.txt b/packages/kokkos/core/src/CMakeLists.txt index 684ea353ae35f024211eef1c1d4642fbbbe6a2ff..862c0c47dd2598815dd262fc2cb645addfa0245b 100644 --- a/packages/kokkos/core/src/CMakeLists.txt +++ b/packages/kokkos/core/src/CMakeLists.txt @@ -4,12 +4,27 @@ KOKKOS_INCLUDE_DIRECTORIES( ${KOKKOS_TOP_BUILD_DIR} ) IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND NOT desul_FOUND) + IF(KOKKOS_ENABLE_CUDA) + SET(DESUL_ATOMICS_ENABLE_CUDA ON) + ENDIF() + IF(KOKKOS_ENABLE_HIP) + SET(DESUL_ATOMICS_ENABLE_HIP ON) + ENDIF() + IF(KOKKOS_ENABLE_SYCL) + SET(DESUL_ATOMICS_ENABLE_SYCL ON) + ENDIF() + IF(KOKKOS_ENABLE_OPENMPTARGET) + SET(DESUL_ATOMICS_ENABLE_OPENMP ON) # not a typo Kokkos OpenMPTarget -> Desul OpenMP + ENDIF() + CONFIGURE_FILE( + ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/Config.hpp.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/desul/atomics/Config.hpp + ) KOKKOS_INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include ) ENDIF() - INSTALL (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/" DESTINATION ${KOKKOS_HEADER_DIR} @@ -79,15 +94,18 @@ IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND NOT desul_FOUND) APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include/desul/*/*.hpp) APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include/desul/*/*/*.hpp) APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include/*/*/*.inc*) + APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/desul/*.hpp) INSTALL (DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/desul/include/desul" + "${CMAKE_CURRENT_BINARY_DIR}/desul" DESTINATION ${KOKKOS_HEADER_DIR} FILES_MATCHING PATTERN "*.inc" PATTERN "*.inc_*" PATTERN "*.hpp" ) + MESSAGE(STATUS "Using internal desul_atomics copy") ELSE() MESSAGE(STATUS "Using external desul_atomics install found at:") @@ -113,6 +131,42 @@ IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND NOT desul_FOUND) ) ENDIF() +IF (Kokkos_ENABLE_IMPL_MDSPAN) + MESSAGE(STATUS "Experimental mdspan support is enabled") + + # Some compilers now include mdspan... we just flag on their version + # for now until we can get some compiler detection support + include(CheckIncludeFileCXX) + check_include_file_cxx(experimental/mdspan KOKKOS_COMPILER_SUPPORTS_EXPERIMENTAL_MDSPAN) + check_include_file_cxx(mdspan KOKKOS_COMPILER_SUPPORTS_MDSPAN) + + if (Kokkos_ENABLE_MDSPAN_EXTERNAL) + MESSAGE(STATUS "Using external mdspan") + target_link_libraries(kokkoscore PUBLIC std::mdspan) + elseif(KOKKOS_COMPILER_SUPPORTS_MDSPAN AND NOT Kokkos_ENABLE_IMPL_SKIP_COMPILER_MDSPAN) + message(STATUS "Using compiler-supplied mdspan") + elseif(KOKKOS_COMPILER_SUPPORTS_EXPERIMENTAL_MDSPAN AND NOT Kokkos_ENABLE_IMPL_SKIP_COMPILER_MDSPAN) + message(STATUS "Using compiler-supplied experimental/mdspan") + else() + KOKKOS_LIB_INCLUDE_DIRECTORIES( + kokkoscore + ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include + ) + + APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include/experimental/__p0009_bits/*.hpp) + APPEND_GLOB(KOKKOS_CORE_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include/experimental/mdspan) + + INSTALL (DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include/" + DESTINATION ${KOKKOS_HEADER_DIR} + FILES_MATCHING + PATTERN "mdspan" + PATTERN "*.hpp" + ) + MESSAGE(STATUS "Using internal mdspan directory ${CMAKE_CURRENT_SOURCE_DIR}/../../tpls/mdspan/include") + endif() +ENDIF() + KOKKOS_LINK_TPL(kokkoscore PUBLIC HWLOC) KOKKOS_LINK_TPL(kokkoscore PUBLIC MEMKIND) IF (NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) @@ -125,14 +179,15 @@ KOKKOS_LINK_TPL(kokkoscore PUBLIC LIBRT) IF (NOT WIN32) KOKKOS_LINK_TPL(kokkoscore PUBLIC THREADS) ENDIF() -KOKKOS_LINK_TPL(kokkoscore PUBLIC ROCM) +IF (NOT KOKKOS_ENABLE_COMPILE_AS_CMAKE_LANGUAGE) + KOKKOS_LINK_TPL(kokkoscore PUBLIC ROCM) +ENDIF() # FIXME: We need a proper solution to figure out whether to enable # libatomic -# XL requires libatomic even for 64 bit CAS, most others only for 128 +# Most compilers only require libatomic for 128-bit CAS # I (CT) had removed 128bit CAS from desul to not need libatomic. -IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND - (KOKKOS_ENABLE_OPENMPTARGET OR (CMAKE_CXX_COMPILER_ID STREQUAL XLClang))) +IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND KOKKOS_ENABLE_OPENMPTARGET) target_link_libraries(kokkoscore PUBLIC atomic) ENDIF() @@ -140,4 +195,11 @@ IF (Kokkos_ENABLE_IMPL_DESUL_ATOMICS AND desul_FOUND) target_link_libraries(kokkoscore PUBLIC desul_atomics) ENDIF() +# FIXME_TRILINOS Trilinos doesn't allow for Kokkos to use find_dependency so we +# just append the flags in cmake/kokkos_tpls.cmake instead of linking with the +# OpenMP target. +IF(Kokkos_ENABLE_OPENMP AND NOT KOKKOS_HAS_TRILINOS) + target_link_libraries(kokkoscore PUBLIC OpenMP::OpenMP_CXX) +ENDIF() + KOKKOS_LINK_TPL(kokkoscore PUBLIC LIBQUADMATH) diff --git a/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp b/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp index b2161bc1fa50000ca99d85fcab28bca0947963cb..87b4c8c00c999efc64e0edf9e0ffd1037c20d95d 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_CudaSpace.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -122,40 +94,12 @@ void DeepCopyAsyncCuda(void *dst, const void *src, size_t n) { namespace Kokkos { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -KOKKOS_DEPRECATED void CudaSpace::access_error() { - const std::string msg( - "Kokkos::CudaSpace::access_error attempt to execute Cuda function from " - "non-Cuda space"); - Kokkos::Impl::throw_runtime_exception(msg); -} - -KOKKOS_DEPRECATED void CudaSpace::access_error(const void *const) { - const std::string msg( - "Kokkos::CudaSpace::access_error attempt to execute Cuda function from " - "non-Cuda space"); - Kokkos::Impl::throw_runtime_exception(msg); -} +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 +bool CudaUVMSpace::available() { return true; } #endif /*--------------------------------------------------------------------------*/ -bool CudaUVMSpace::available() { -#if defined(CUDA_VERSION) && !defined(__APPLE__) - enum : bool { UVM_available = true }; -#else - enum : bool { UVM_available = false }; -#endif - return UVM_available; -} - -/*--------------------------------------------------------------------------*/ - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -int CudaUVMSpace::number_of_allocations() { - return Kokkos::Impl::num_uvm_allocations.load(); -} -#endif #ifdef KOKKOS_IMPL_DEBUG_CUDA_PIN_UVM_TO_HOST // The purpose of the following variable is to allow a state-based choice // for pinning UVM allocations to the CPU. For now this is considered @@ -674,11 +618,7 @@ void cuda_prefetch_pointer(const Cuda &space, const void *ptr, size_t bytes, // DualView syncs down. Probably because the latency is not too bad in the // first place for the pull down. If we want to change that provde // cudaCpuDeviceId as the device if to_device is false -#if CUDA_VERSION < 10000 - bool is_managed = attr.isManaged; -#else bool is_managed = attr.type == cudaMemoryTypeManaged; -#endif if (to_device && is_managed && space.cuda_device_prop().concurrentManagedAccess) { KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemPrefetchAsync( diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Alloc.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Alloc.hpp deleted file mode 100644 index e76133fae8702484874cc6afe5b7aa92934cba02..0000000000000000000000000000000000000000 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Alloc.hpp +++ /dev/null @@ -1,153 +0,0 @@ -/* -//@HEADER -// ************************************************************************ -// -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ -//@HEADER -*/ - -#ifndef KOKKOS_CUDA_ALLOCATION_TRACKING_HPP -#define KOKKOS_CUDA_ALLOCATION_TRACKING_HPP - -#include <Kokkos_Macros.hpp> -#ifdef KOKKOS_ENABLE_CUDA - -#include <impl/Kokkos_Traits.hpp> - -namespace Kokkos { -namespace Impl { - -template <class DestructFunctor> -SharedAllocationRecord* shared_allocation_record( - Kokkos::CudaSpace const& arg_space, void* const arg_alloc_ptr, - DestructFunctor const& arg_destruct) { - SharedAllocationRecord* const record = - SharedAllocationRecord::get_record(arg_alloc_ptr); - - // assert: record != 0 - - // assert: sizeof(DestructFunctor) <= record->m_destruct_size - - // assert: record->m_destruct_function == 0 - - DestructFunctor* const functor = reinterpret_cast<DestructFunctor*>( - reinterpret_cast<uintptr_t>(record) + sizeof(SharedAllocationRecord)); - - new (functor) DestructFunctor(arg_destruct); - - record->m_destruct_functor = &shared_allocation_destroy<DestructFunctor>; - - return record; -} - -/// class CudaUnmanagedAllocator -/// does nothing when deallocate(ptr,size) is called -struct CudaUnmanagedAllocator { - static const char* name() { return "Cuda Unmanaged Allocator"; } - - static void deallocate(void* /*ptr*/, size_t /*size*/) {} - - static bool support_texture_binding() { return true; } -}; - -/// class CudaUnmanagedAllocator -/// does nothing when deallocate(ptr,size) is called -struct CudaUnmanagedUVMAllocator { - static const char* name() { return "Cuda Unmanaged UVM Allocator"; } - - static void deallocate(void* /*ptr*/, size_t /*size*/) {} - - static bool support_texture_binding() { return true; } -}; - -/// class CudaUnmanagedHostAllocator -/// does nothing when deallocate(ptr,size) is called -class CudaUnmanagedHostAllocator { - public: - static const char* name() { return "Cuda Unmanaged Host Allocator"; } - // Unmanaged deallocate does nothing - static void deallocate(void* /*ptr*/, size_t /*size*/) {} -}; - -/// class CudaMallocAllocator -class CudaMallocAllocator { - public: - static const char* name() { return "Cuda Malloc Allocator"; } - - static void* allocate(size_t size); - - static void deallocate(void* ptr, size_t); - - static void* reallocate(void* old_ptr, size_t old_size, size_t new_size); - - static bool support_texture_binding() { return true; } -}; - -/// class CudaUVMAllocator -class CudaUVMAllocator { - public: - static const char* name() { return "Cuda UVM Allocator"; } - - static void* allocate(size_t size); - - static void deallocate(void* ptr, size_t); - - static void* reallocate(void* old_ptr, size_t old_size, size_t new_size); - - static bool support_texture_binding() { return true; } -}; - -/// class CudaHostAllocator -class CudaHostAllocator { - public: - static const char* name() { return "Cuda Host Allocator"; } - - static void* allocate(size_t size); - - static void deallocate(void* ptr, size_t); - - static void* reallocate(void* old_ptr, size_t old_size, size_t new_size); -}; - -} // namespace Impl -} // namespace Kokkos - -#endif // KOKKOS_ENABLE_CUDA - -#endif // #ifndef KOKKOS_CUDA_ALLOCATION_TRACKING_HPP diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp index 8e8dff67763f495771377a2cff5b412fd233a4dc..cb196f6e8ffa062716b583faf257b085d101a1b7 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp @@ -32,40 +32,16 @@ LICENSE ASSOCIATED WITH SUBSEQUENT MODIFICATIONS // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // ************************************************************************ @HEADER diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp index d7cd1bab1303a76e08723c07d6ff32cb613c0245..a7dfc15d7a74781cf1c36b6d5eb362714000d81e 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics_Restore_Builtins.hpp @@ -1,45 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifdef KOKKOS_SIMT_ATOMIC_BUILTIN_REPLACEMENTS_DEFINED diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp index 993c8d1bbadc4ebff2fcc9bdc905fca6bb37a9cf..75c1686dc2ccff2bf67e591f9a6ec07824f28eaf 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_BlockSize_Deduction.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_INTERNAL_HPP #define KOKKOS_CUDA_INTERNAL_HPP @@ -53,13 +25,67 @@ namespace Kokkos { namespace Impl { +inline int cuda_warp_per_sm_allocation_granularity( + cudaDeviceProp const& properties) { + // Allocation granularity of warps in each sm + switch (properties.major) { + case 3: + case 5: + case 7: + case 8: + case 9: return 4; + case 6: return (properties.minor == 0 ? 2 : 4); + default: + throw_runtime_exception( + "Unknown device in cuda warp per sm allocation granularity"); + return 0; + } +} + +inline int cuda_max_warps_per_sm_registers( + cudaDeviceProp const& properties, cudaFuncAttributes const& attributes) { + // Maximum number of warps per sm as a function of register counts, + // subject to the constraint that warps are allocated with a fixed granularity + int const max_regs_per_block = properties.regsPerBlock; + int const regs_per_warp = attributes.numRegs * properties.warpSize; + int const warp_granularity = + cuda_warp_per_sm_allocation_granularity(properties); + // The granularity of register allocation is chunks of 256 registers per warp, + // which implies a need to over-allocate, so we round up + int const allocated_regs_per_warp = 256 * ((regs_per_warp + 256 - 1) / 256); + + // The maximum number of warps per SM is constrained from above by register + // allocation. To satisfy the constraint that warps per SM is allocated at a + // finite granularity, we need to round down. + int const max_warps_per_sm = + warp_granularity * + (max_regs_per_block / (allocated_regs_per_warp * warp_granularity)); + + return max_warps_per_sm; +} + inline int cuda_max_active_blocks_per_sm(cudaDeviceProp const& properties, cudaFuncAttributes const& attributes, int block_size, size_t dynamic_shmem) { - // Limits due do registers/SM + // Limits due to registers/SM int const regs_per_sm = properties.regsPerMultiprocessor; int const regs_per_thread = attributes.numRegs; - int const max_blocks_regs = regs_per_sm / (regs_per_thread * block_size); + // The granularity of register allocation is chunks of 256 registers per warp + // -> 8 registers per thread + int const allocated_regs_per_thread = 8 * ((regs_per_thread + 8 - 1) / 8); + int max_blocks_regs = regs_per_sm / (allocated_regs_per_thread * block_size); + + // Compute the maximum number of warps as a function of the number of + // registers + int const max_warps_per_sm_registers = + cuda_max_warps_per_sm_registers(properties, attributes); + + // Correct the number of blocks to respect the maximum number of warps per + // SM, which is constrained to be a multiple of the warp allocation + // granularity defined in `cuda_warp_per_sm_allocation_granularity`. + while ((max_blocks_regs * block_size / properties.warpSize) > + max_warps_per_sm_registers) + max_blocks_regs--; // Limits due to shared memory/SM size_t const shmem_per_sm = properties.sharedMemPerMultiprocessor; @@ -203,40 +229,16 @@ int cuda_get_opt_block_size(const CudaInternal* cuda_instance, LaunchBounds{}); } -// Assuming cudaFuncSetCacheConfig(MyKernel, cudaFuncCachePreferL1) -// NOTE these number can be obtained several ways: -// * One option is to download the CUDA Occupancy Calculator spreadsheet, select -// "Compute Capability" first and check what is the smallest "Shared Memory -// Size Config" that is available. The "Shared Memory Per Multiprocessor" in -// bytes is then to be found below in the summary. -// * Another option would be to look for the information in the "Tuning -// Guide(s)" of the CUDA Toolkit Documentation for each GPU architecture, in -// the "Shared Memory" section (more tedious) -inline size_t get_shmem_per_sm_prefer_l1(cudaDeviceProp const& properties) { - int const compute_capability = properties.major * 10 + properties.minor; - return [compute_capability]() { - switch (compute_capability) { - case 30: - case 32: - case 35: return 16; - case 37: return 80; - case 50: - case 53: - case 60: - case 62: return 64; - case 52: - case 61: return 96; - case 70: - case 80: - case 86: return 8; - case 75: return 32; - default: - Kokkos::Impl::throw_runtime_exception( - "Unknown device in cuda block size deduction"); - } - return 0; - }() * 1024; +// Thin version of cuda_get_opt_block_size for cases where there is no shared +// memory +template <class LaunchBounds> +int cuda_get_opt_block_size_no_shmem(const cudaDeviceProp& prop, + const cudaFuncAttributes& attr, + LaunchBounds) { + return cuda_deduce_block_size( + false, prop, attr, [](int /*block_size*/) { return 0; }, LaunchBounds{}); } + } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp index e28e964d36aabfccf31e688050d286e2d25a0268..f68e05f7804028e4264224e543af87b4e3edb404 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Error.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_ERROR_HPP #define KOKKOS_CUDA_ERROR_HPP @@ -100,21 +72,6 @@ inline void cuda_internal_safe_call(cudaError e, const char* name, #define KOKKOS_IMPL_CUDA_SAFE_CALL(call) \ Kokkos::Impl::cuda_internal_safe_call(call, #call, __FILE__, __LINE__) -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - -KOKKOS_DEPRECATED -inline void cuda_internal_safe_call_deprecated(cudaError e, const char* name, - const char* file = nullptr, - const int line = 0) { - cuda_internal_safe_call(e, name, file, line); -} - -#define CUDA_SAFE_CALL(call) \ - Kokkos::Impl::cuda_internal_safe_call_deprecated(call, #call, __FILE__, \ - __LINE__) - -#endif - } // namespace Impl namespace Experimental { diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp index d6fadd82c0fbbb2d3927afe2b6b5b4566710dc1a..8e5d4a07068bfca839ac19de371796fb9c01ce5e 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNodeKernel.hpp @@ -1,53 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_CUDA_GRAPHNODEKERNEL_IMPL_HPP #define KOKKOS_KOKKOS_CUDA_GRAPHNODEKERNEL_IMPL_HPP #include <Kokkos_Macros.hpp> -#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_CUDA_ENABLE_GRAPHS) +#if defined(KOKKOS_ENABLE_CUDA) #include <Kokkos_Graph_fwd.hpp> @@ -154,14 +126,15 @@ template <class KernelType, class Tag = typename PatternTagFromImplSpecialization<KernelType>::type> struct get_graph_node_kernel_type - : identity<GraphNodeKernelImpl<Kokkos::Cuda, typename KernelType::Policy, - typename KernelType::functor_type, Tag>> {}; + : type_identity< + GraphNodeKernelImpl<Kokkos::Cuda, typename KernelType::Policy, + typename KernelType::functor_type, Tag>> {}; template <class KernelType> struct get_graph_node_kernel_type<KernelType, Kokkos::ParallelReduceTag> - : identity<GraphNodeKernelImpl<Kokkos::Cuda, typename KernelType::Policy, - typename KernelType::functor_type, - Kokkos::ParallelReduceTag, - typename KernelType::reducer_type>> {}; + : type_identity<GraphNodeKernelImpl< + Kokkos::Cuda, typename KernelType::Policy, + typename KernelType::functor_type, Kokkos::ParallelReduceTag, + typename KernelType::reducer_type>> {}; //============================================================================== // <editor-fold desc="get_cuda_graph_*() helper functions"> {{{1 diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp index f4539cd2ca378a95c845d4e189512cf9ba21a200..a586d30147a87f71fcd780f1e413ebd9b8bf9714 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_GraphNode_Impl.hpp @@ -1,53 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_CUDA_GRAPHNODE_IMPL_HPP #define KOKKOS_KOKKOS_CUDA_GRAPHNODE_IMPL_HPP #include <Kokkos_Macros.hpp> -#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_CUDA_ENABLE_GRAPHS) +#if defined(KOKKOS_ENABLE_CUDA) #include <Kokkos_Graph_fwd.hpp> diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp index bd514f5e88d915b46eccc6ccd5da7baa311088e3..26face64c91701638978ff5e39dcce6021f6be58 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Graph_Impl.hpp @@ -1,53 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_CUDA_GRAPH_IMPL_HPP #define KOKKOS_KOKKOS_CUDA_GRAPH_IMPL_HPP #include <Kokkos_Macros.hpp> -#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_CUDA_ENABLE_GRAPHS) +#if defined(KOKKOS_ENABLE_CUDA) #include <Kokkos_Graph_fwd.hpp> diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp index 40a263561f4cd1b1389d0f8ac4a9e5afa9d58fb8..eaa6263c406fc2e0d76de023a193e8a3f5dcec93 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Conversion.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_HALF_HPP_ #define KOKKOS_CUDA_HALF_HPP_ @@ -48,7 +20,7 @@ #ifdef KOKKOS_IMPL_CUDA_HALF_TYPE_DEFINED #include <Kokkos_Half.hpp> -#include <Kokkos_NumericTraits.hpp> // reduction_identity +#include <Kokkos_ReductionIdentity.hpp> #if CUDA_VERSION >= 11000 #include <cuda_bf16.h> @@ -290,7 +262,8 @@ KOKKOS_INLINE_FUNCTION // Go in this branch if CUDA version is >= 11.0.0 and less than 11.1.0 or if the // architecture is not Ampere #if CUDA_VERSION >= 11000 && \ - (CUDA_VERSION < 11010 || !defined(KOKKOS_ARCH_AMPERE)) + (CUDA_VERSION < 11010 || \ + !(defined(KOKKOS_ARCH_AMPERE) || defined(KOKKOS_ARCH_HOPPER))) KOKKOS_INLINE_FUNCTION bhalf_t cast_to_bhalf(bhalf_t val) { return val; } @@ -418,7 +391,7 @@ KOKKOS_INLINE_FUNCTION #endif // CUDA_VERSION >= 11000 && CUDA_VERSION < 11010 #if CUDA_VERSION >= 11010 && \ - ((defined(KOKKOS_ARCH_AMPERE80) || defined(KOKKOS_ARCH_AMPERE86))) + ((defined(KOKKOS_ARCH_AMPERE) || defined(KOKKOS_ARCH_HOPPER))) KOKKOS_INLINE_FUNCTION bhalf_t cast_to_bhalf(bhalf_t val) { return val; } KOKKOS_INLINE_FUNCTION diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp index e296a9239a6f0cc35604a84cda6cd7a919b7130a..79d3322da2823b00894de9d42f9a42d35932c393 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Half_Impl_Type.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_HALF_IMPL_TYPE_HPP_ #define KOKKOS_CUDA_HALF_IMPL_TYPE_HPP_ diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp index 5811498e010f4b34ededc6b763f3d6cbd7cf9490..3dbe179d66ed24a7f88d6af074db8f1e45344b77 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /*--------------------------------------------------------------------------*/ /* Kokkos interfaces */ @@ -202,7 +174,9 @@ void cuda_internal_error_abort(cudaError e, const char *name, const char *file, if (file) { out << " " << file << ":" << line; } - abort(out.str().c_str()); + // FIXME Call Kokkos::Impl::host_abort instead of Kokkos::abort to avoid a + // warning about Kokkos::abort returning in some cases. + host_abort(out.str().c_str()); } //---------------------------------------------------------------------------- @@ -291,12 +265,14 @@ const CudaInternalDevices &CudaInternalDevices::singleton() { } // namespace -unsigned long *CudaInternal::constantMemHostStaging = nullptr; -cudaEvent_t CudaInternal::constantMemReusable = nullptr; -std::mutex CudaInternal::constantMemMutex; - //---------------------------------------------------------------------------- +int Impl::CudaInternal::concurrency() { + static int const concurrency = m_deviceProp.maxThreadsPerMultiProcessor * + m_deviceProp.multiProcessorCount; + return concurrency; +} + void CudaInternal::print_configuration(std::ostream &s) const { const CudaInternalDevices &dev_info = CudaInternalDevices::singleton(); @@ -328,22 +304,13 @@ CudaInternal::~CudaInternal() { << std::endl; } - m_cudaDev = -1; - m_cudaArch = -1; - m_multiProcCount = 0; - m_maxWarpCount = 0; - m_maxBlock = {0, 0, 0}; - m_maxSharedWords = 0; - m_maxConcurrency = 0; - m_scratchSpaceCount = 0; - m_scratchFlagsCount = 0; - m_scratchUnifiedCount = 0; - m_scratchUnifiedSupported = 0; - m_streamCount = 0; - m_scratchSpace = nullptr; - m_scratchFlags = nullptr; - m_scratchUnified = nullptr; - m_stream = nullptr; + m_scratchSpaceCount = 0; + m_scratchFlagsCount = 0; + m_scratchUnifiedCount = 0; + m_scratchSpace = nullptr; + m_scratchFlags = nullptr; + m_scratchUnified = nullptr; + m_stream = nullptr; for (int i = 0; i < m_n_team_scratch; ++i) { m_team_scratch_current_size[i] = 0; m_team_scratch_ptr[i] = nullptr; @@ -370,15 +337,12 @@ void CudaInternal::fence() const { fence("Kokkos::CudaInternal::fence(): Unnamed Instance Fence"); } -void CudaInternal::initialize(int cuda_device_id, cudaStream_t stream, - bool manage_stream) { +void CudaInternal::initialize(cudaStream_t stream, bool manage_stream) { if (was_finalized) Kokkos::abort("Calling Cuda::initialize after Cuda::finalize is illegal\n"); was_initialized = true; if (is_initialized()) return; - enum { WordSize = sizeof(size_type) }; - #ifndef KOKKOS_IMPL_TURN_OFF_CUDA_HOST_INIT_CHECK if (!HostSpace::execution_space::impl_is_initialized()) { const std::string msg( @@ -388,107 +352,9 @@ void CudaInternal::initialize(int cuda_device_id, cudaStream_t stream, } #endif - const CudaInternalDevices &dev_info = CudaInternalDevices::singleton(); - const bool ok_init = nullptr == m_scratchSpace || nullptr == m_scratchFlags; - const bool ok_id = - 0 <= cuda_device_id && cuda_device_id < dev_info.m_cudaDevCount; - - // Need device capability 3.0 or better - - const bool ok_dev = - ok_id && (3 <= dev_info.m_cudaProp[cuda_device_id].major && - 0 <= dev_info.m_cudaProp[cuda_device_id].minor); - - if (ok_init && ok_dev) { - const struct cudaDeviceProp &cudaProp = dev_info.m_cudaProp[cuda_device_id]; - - m_cudaDev = cuda_device_id; - m_deviceProp = cudaProp; - - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaSetDevice(m_cudaDev)); - Kokkos::Impl::cuda_device_synchronize( - "Kokkos::CudaInternal::initialize: Fence on space initialization"); - - // Query what compute capability architecture a kernel executes: - m_cudaArch = cuda_kernel_arch(); - - if (m_cudaArch == 0) { - std::stringstream ss; - ss << "Kokkos::Cuda::initialize ERROR: likely mismatch of architecture\n"; - std::string msg = ss.str(); - Kokkos::abort(msg.c_str()); - } - - int compiled_major = m_cudaArch / 100; - int compiled_minor = (m_cudaArch % 100) / 10; - - if (compiled_major != cudaProp.major || compiled_minor > cudaProp.minor) { - std::stringstream ss; - ss << "Kokkos::Cuda::initialize ERROR: running kernels compiled for " - "compute capability " - << compiled_major << "." << compiled_minor - << " on device with compute capability " << cudaProp.major << "." - << cudaProp.minor << " is not supported by CUDA!\n"; - std::string msg = ss.str(); - Kokkos::abort(msg.c_str()); - } - if (Kokkos::show_warnings() && (compiled_major != cudaProp.major || - compiled_minor != cudaProp.minor)) { - std::cerr << "Kokkos::Cuda::initialize WARNING: running kernels compiled " - "for compute capability " - << compiled_major << "." << compiled_minor - << " on device with compute capability " << cudaProp.major - << "." << cudaProp.minor - << " , this will likely reduce potential performance." - << std::endl; - } - - // number of multiprocessors - - m_multiProcCount = cudaProp.multiProcessorCount; - - //---------------------------------- - // Maximum number of warps, - // at most one warp per thread in a warp for reduction. - - m_maxWarpCount = cudaProp.maxThreadsPerBlock / Impl::CudaTraits::WarpSize; - - if (Impl::CudaTraits::WarpSize < m_maxWarpCount) { - m_maxWarpCount = Impl::CudaTraits::WarpSize; - } - - m_maxSharedWords = cudaProp.sharedMemPerBlock / WordSize; - - //---------------------------------- - // Maximum number of blocks: - - m_maxBlock[0] = cudaProp.maxGridSize[0]; - m_maxBlock[1] = cudaProp.maxGridSize[1]; - m_maxBlock[2] = cudaProp.maxGridSize[2]; - - m_shmemPerSM = cudaProp.sharedMemPerMultiprocessor; - m_maxShmemPerBlock = cudaProp.sharedMemPerBlock; - m_regsPerSM = cudaProp.regsPerMultiprocessor; - m_maxBlocksPerSM = - m_cudaArch < 500 - ? 16 - : (m_cudaArch < 750 ? 32 : (m_cudaArch == 750 ? 16 : 32)); - m_maxThreadsPerSM = cudaProp.maxThreadsPerMultiProcessor; - m_maxThreadsPerBlock = cudaProp.maxThreadsPerBlock; - - //---------------------------------- - - m_scratchUnifiedSupported = cudaProp.unifiedAddressing; - - if (Kokkos::show_warnings() && !m_scratchUnifiedSupported) { - std::cerr << "Kokkos::Cuda device " << cudaProp.name << " capability " - << cudaProp.major << "." << cudaProp.minor - << " does not support unified virtual address space" - << std::endl; - } - + if (ok_init) { //---------------------------------- // Multiblock reduction uses scratch flags for counters // and scratch space for partial reduction values. @@ -502,45 +368,10 @@ void CudaInternal::initialize(int cuda_device_id, cudaStream_t stream, (void)scratch_flags(reduce_block_count * 2 * sizeof(size_type)); (void)scratch_space(reduce_block_count * 16 * sizeof(size_type)); } - //---------------------------------- - // Concurrent bitset for obtaining unique tokens from within - // an executing kernel. - { - m_maxConcurrency = m_maxThreadsPerSM * cudaProp.multiProcessorCount; - - const int32_t buffer_bound = - Kokkos::Impl::concurrent_bitset::buffer_bound(m_maxConcurrency); - - // Allocate and initialize uint32_t[ buffer_bound ] - - using Record = - Kokkos::Impl::SharedAllocationRecord<Kokkos::CudaSpace, void>; - - Record *const r = - Record::allocate(Kokkos::CudaSpace(), "Kokkos::InternalScratchBitset", - sizeof(uint32_t) * buffer_bound); - - Record::increment(r); - } - //---------------------------------- - } else { std::ostringstream msg; - msg << "Kokkos::Cuda::initialize(" << cuda_device_id << ") FAILED"; - - if (!ok_init) { - msg << " : Already initialized"; - } - if (!ok_id) { - msg << " : Device identifier out of range " - << "[0.." << dev_info.m_cudaDevCount << "]"; - } else if (!ok_dev) { - msg << " : Device "; - msg << dev_info.m_cudaProp[cuda_device_id].major; - msg << "."; - msg << dev_info.m_cudaProp[cuda_device_id].minor; - msg << " has insufficient capability, required 3.0 or better"; - } + msg << "Kokkos::Cuda::initialize(" << m_cudaDev + << ") FAILED : Already initialized"; Kokkos::Impl::throw_runtime_exception(msg.str()); } @@ -569,18 +400,12 @@ Kokkos::Cuda::initialize WARNING: Cuda is allocating into UVMSpace by default } #endif -#ifdef KOKKOS_ENABLE_PRE_CUDA_10_DEPRECATION_API - cudaThreadSetCacheConfig(cudaFuncCachePreferShared); -#else - cudaDeviceSetCacheConfig(cudaFuncCachePreferShared); -#endif - // Init the array for used for arbitrarily sized atomics - if (stream == nullptr) Impl::initialize_host_cuda_lock_arrays(); + if (this == &singleton()) Impl::initialize_host_cuda_lock_arrays(); // Allocate a staging buffer for constant mem in pinned host memory // and an event to avoid overwriting driver for previous kernel launches - if (stream == nullptr) { + if (this == &singleton()) { KOKKOS_IMPL_CUDA_SAFE_CALL( cudaMallocHost(reinterpret_cast<void **>(&constantMemHostStaging), CudaTraits::ConstantMemoryUsage)); @@ -596,9 +421,9 @@ Kokkos::Cuda::initialize WARNING: Cuda is allocating into UVMSpace by default } KOKKOS_IMPL_CUDA_SAFE_CALL( - cudaMalloc(&m_scratch_locks, sizeof(int32_t) * m_maxConcurrency)); + cudaMalloc(&m_scratch_locks, sizeof(int32_t) * concurrency())); KOKKOS_IMPL_CUDA_SAFE_CALL( - cudaMemset(m_scratch_locks, 0, sizeof(int32_t) * m_maxConcurrency)); + cudaMemset(m_scratch_locks, 0, sizeof(int32_t) * concurrency())); } //---------------------------------------------------------------------------- @@ -698,37 +523,44 @@ Cuda::size_type *CudaInternal::scratch_functor(const std::size_t size) const { return m_scratchFunctor; } -std::pair<void *, int> CudaInternal::resize_team_scratch_space( - std::int64_t bytes, bool force_shrink) { - // Multiple ParallelFor/Reduce Teams can call this function at the same time - // and invalidate the m_team_scratch_ptr. We use a pool to avoid any race - // condition. - +int CudaInternal::acquire_team_scratch_space() { int current_team_scratch = 0; int zero = 0; - int one = 1; while (!m_team_scratch_pool[current_team_scratch].compare_exchange_weak( - zero, one, std::memory_order_release, std::memory_order_relaxed)) { + zero, 1, std::memory_order_release, std::memory_order_relaxed)) { current_team_scratch = (current_team_scratch + 1) % m_n_team_scratch; } - if (m_team_scratch_current_size[current_team_scratch] == 0) { - m_team_scratch_current_size[current_team_scratch] = bytes; - m_team_scratch_ptr[current_team_scratch] = + + return current_team_scratch; +} + +void *CudaInternal::resize_team_scratch_space(int scratch_pool_id, + std::int64_t bytes, + bool force_shrink) { + // Multiple ParallelFor/Reduce Teams can call this function at the same time + // and invalidate the m_team_scratch_ptr. We use a pool to avoid any race + // condition. + if (m_team_scratch_current_size[scratch_pool_id] == 0) { + m_team_scratch_current_size[scratch_pool_id] = bytes; + m_team_scratch_ptr[scratch_pool_id] = Kokkos::kokkos_malloc<Kokkos::CudaSpace>( "Kokkos::CudaSpace::TeamScratchMemory", - m_team_scratch_current_size[current_team_scratch]); + m_team_scratch_current_size[scratch_pool_id]); } - if ((bytes > m_team_scratch_current_size[current_team_scratch]) || - ((bytes < m_team_scratch_current_size[current_team_scratch]) && + if ((bytes > m_team_scratch_current_size[scratch_pool_id]) || + ((bytes < m_team_scratch_current_size[scratch_pool_id]) && (force_shrink))) { - m_team_scratch_current_size[current_team_scratch] = bytes; - m_team_scratch_ptr[current_team_scratch] = + m_team_scratch_current_size[scratch_pool_id] = bytes; + m_team_scratch_ptr[scratch_pool_id] = Kokkos::kokkos_realloc<Kokkos::CudaSpace>( - m_team_scratch_ptr[current_team_scratch], - m_team_scratch_current_size[current_team_scratch]); + m_team_scratch_ptr[scratch_pool_id], + m_team_scratch_current_size[scratch_pool_id]); } - return std::make_pair(m_team_scratch_ptr[current_team_scratch], - current_team_scratch); + return m_team_scratch_ptr[scratch_pool_id]; +} + +void CudaInternal::release_team_scratch_space(int scratch_pool_id) { + m_team_scratch_pool[scratch_pool_id] = 0; } //---------------------------------------------------------------------------- @@ -773,15 +605,9 @@ void CudaInternal::finalize() { if (m_manage_stream && m_stream != nullptr) KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamDestroy(m_stream)); - m_cudaDev = -1; - m_multiProcCount = 0; - m_maxWarpCount = 0; - m_maxBlock = {0, 0, 0}; - m_maxSharedWords = 0; m_scratchSpaceCount = 0; m_scratchFlagsCount = 0; m_scratchUnifiedCount = 0; - m_streamCount = 0; m_scratchSpace = nullptr; m_scratchFlags = nullptr; m_scratchUnified = nullptr; @@ -851,8 +677,12 @@ Cuda::size_type Cuda::detect_device_count() { return Impl::CudaInternalDevices::singleton().m_cudaDevCount; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 int Cuda::concurrency() { - return Impl::CudaInternal::singleton().m_maxConcurrency; +#else +int Cuda::concurrency() const { +#endif + return Impl::CudaInternal::concurrency(); } int Cuda::impl_is_initialized() { @@ -860,15 +690,120 @@ int Cuda::impl_is_initialized() { } void Cuda::impl_initialize(InitializationSettings const &settings) { - Impl::CudaInternal::singleton().initialize(Impl::get_gpu(settings)); + const int cuda_device_id = Impl::get_gpu(settings); + const auto &dev_info = Impl::CudaInternalDevices::singleton(); + + // Need device capability 3.0 or better + const bool ok_dev = 3 <= dev_info.m_cudaProp[cuda_device_id].major && + 0 <= dev_info.m_cudaProp[cuda_device_id].minor; + if (ok_dev) { + const struct cudaDeviceProp &cudaProp = dev_info.m_cudaProp[cuda_device_id]; + + Impl::CudaInternal::m_cudaDev = cuda_device_id; + Impl::CudaInternal::m_deviceProp = cudaProp; + + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaSetDevice(cuda_device_id)); + Kokkos::Impl::cuda_device_synchronize( + "Kokkos::CudaInternal::initialize: Fence on space initialization"); + + // Query what compute capability architecture a kernel executes: + Impl::CudaInternal::m_cudaArch = Impl::cuda_kernel_arch(); + + if (Impl::CudaInternal::m_cudaArch == 0) { + std::stringstream ss; + ss << "Kokkos::Cuda::initialize ERROR: likely mismatch of architecture\n"; + std::string msg = ss.str(); + Kokkos::abort(msg.c_str()); + } + + int compiled_major = Impl::CudaInternal::m_cudaArch / 100; + int compiled_minor = (Impl::CudaInternal::m_cudaArch % 100) / 10; + + if ((compiled_major > cudaProp.major) || + ((compiled_major == cudaProp.major) && + (compiled_minor > cudaProp.minor))) { + std::stringstream ss; + ss << "Kokkos::Cuda::initialize ERROR: running kernels compiled for " + "compute capability " + << compiled_major << "." << compiled_minor + << " on device with compute capability " << cudaProp.major << "." + << cudaProp.minor << " is not supported by CUDA!\n"; + std::string msg = ss.str(); + Kokkos::abort(msg.c_str()); + } + if (Kokkos::show_warnings() && (compiled_major != cudaProp.major || + compiled_minor != cudaProp.minor)) { + std::cerr << "Kokkos::Cuda::initialize WARNING: running kernels compiled " + "for compute capability " + << compiled_major << "." << compiled_minor + << " on device with compute capability " << cudaProp.major + << "." << cudaProp.minor + << " , this will likely reduce potential performance." + << std::endl; + } + + // number of multiprocessors + Impl::CudaInternal::m_multiProcCount = cudaProp.multiProcessorCount; + + //---------------------------------- + // Maximum number of warps, + // at most one warp per thread in a warp for reduction. + Impl::CudaInternal::m_maxWarpCount = + cudaProp.maxThreadsPerBlock / Impl::CudaTraits::WarpSize; + + if (Impl::CudaTraits::WarpSize < Impl::CudaInternal::m_maxWarpCount) { + Impl::CudaInternal::m_maxWarpCount = Impl::CudaTraits::WarpSize; + } + + constexpr auto WordSize = sizeof(size_type); + Impl::CudaInternal::m_maxSharedWords = + cudaProp.sharedMemPerBlock / WordSize; + + //---------------------------------- + // Maximum number of blocks: + + Impl::CudaInternal::m_maxBlock[0] = cudaProp.maxGridSize[0]; + Impl::CudaInternal::m_maxBlock[1] = cudaProp.maxGridSize[1]; + Impl::CudaInternal::m_maxBlock[2] = cudaProp.maxGridSize[2]; + + Impl::CudaInternal::m_shmemPerSM = cudaProp.sharedMemPerMultiprocessor; + Impl::CudaInternal::m_maxShmemPerBlock = cudaProp.sharedMemPerBlock; + Impl::CudaInternal::m_maxBlocksPerSM = + Impl::CudaInternal::m_cudaArch < 500 + ? 16 + : (Impl::CudaInternal::m_cudaArch < 750 + ? 32 + : (Impl::CudaInternal::m_cudaArch == 750 ? 16 : 32)); + Impl::CudaInternal::m_maxThreadsPerSM = + cudaProp.maxThreadsPerMultiProcessor; + Impl::CudaInternal::m_maxThreadsPerBlock = cudaProp.maxThreadsPerBlock; + + //---------------------------------- - // In order to support setting an atexit hook for Kokkos::finalize - // We need to ensure that the Cuda deep_copy instance is not destroyed - // before that atexit hook is getting called. - // Thus we create the static instance here, so that it will be deallocated - // after the potential atexit call. - // This is neccessary since we will access that instance in Kokkos::finalize - (void)::Kokkos::Impl::cuda_get_deep_copy_space(true); + Impl::CudaInternal::m_scratchUnifiedSupported = cudaProp.unifiedAddressing; + + if (Kokkos::show_warnings() && + !Impl::CudaInternal::m_scratchUnifiedSupported) { + std::cerr << "Kokkos::Cuda device " << cudaProp.name << " capability " + << cudaProp.major << "." << cudaProp.minor + << " does not support unified virtual address space" + << std::endl; + } + } else { + std::ostringstream msg; + msg << "Kokkos::Cuda::initialize(" << cuda_device_id << ") FAILED: Device "; + msg << dev_info.m_cudaProp[cuda_device_id].major; + msg << "."; + msg << dev_info.m_cudaProp[cuda_device_id].minor; + msg << " has insufficient capability, required 3.0 or better"; + Kokkos::Impl::throw_runtime_exception(msg.str()); + } + + cudaStream_t singleton_stream; + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaStreamCreate(&singleton_stream)); + + auto &cuda_singleton = Impl::CudaInternal::singleton(); + cuda_singleton.initialize(singleton_stream, /*manage*/ true); } std::vector<unsigned> Cuda::detect_device_arch() { @@ -914,8 +849,7 @@ Cuda::Cuda(cudaStream_t stream, bool manage_stream) }) { Impl::CudaInternal::singleton().verify_is_initialized( "Cuda instance constructor"); - m_space_instance->initialize(Impl::CudaInternal::singleton().m_cudaDev, - stream, manage_stream); + m_space_instance->initialize(stream, manage_stream); } void Cuda::print_configuration(std::ostream &os, bool /*verbose*/) const { @@ -937,11 +871,9 @@ void Cuda::print_configuration(std::ostream &os, bool /*verbose*/) const { #else os << "no\n"; #endif +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 os << " KOKKOS_ENABLE_CUDA_LDG_INTRINSIC: "; -#ifdef KOKKOS_ENABLE_CUDA_LDG_INTRINSIC os << "yes\n"; -#else - os << "no\n"; #endif os << " KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE: "; #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE @@ -993,14 +925,6 @@ int g_cuda_space_factory_initialized = } // namespace Impl -#ifdef KOKKOS_ENABLE_CXX14 -namespace Tools { -namespace Experimental { -constexpr DeviceType DeviceTypeTraits<Cuda>::id; -} -} // namespace Tools -#endif - } // namespace Kokkos #else diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp index 62b1f09cd564fd233ea57a1c97f25097f15dc795..af34a5b9db345e7ef3225d7a019e5f92b3c816c6 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Instance.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #ifndef KOKKOS_CUDA_INSTANCE_HPP_ #define KOKKOS_CUDA_INSTANCE_HPP_ @@ -85,23 +101,22 @@ class CudaInternal { public: using size_type = Cuda::size_type; - int m_cudaDev; + inline static int m_cudaDev = -1; // Device Properties - int m_cudaArch; - unsigned m_multiProcCount; - unsigned m_maxWarpCount; - std::array<size_type, 3> m_maxBlock; - unsigned m_maxSharedWords; - uint32_t m_maxConcurrency; - int m_shmemPerSM; - int m_maxShmemPerBlock; - int m_regsPerSM; - int m_maxBlocksPerSM; - int m_maxThreadsPerSM; - int m_maxThreadsPerBlock; - - cudaDeviceProp m_deviceProp; + inline static int m_cudaArch = -1; + inline static unsigned m_multiProcCount = 0; + inline static unsigned m_maxWarpCount = 0; + inline static std::array<size_type, 3> m_maxBlock = {0, 0, 0}; + inline static unsigned m_maxSharedWords = 0; + inline static int m_shmemPerSM = 0; + inline static int m_maxShmemPerBlock = 0; + inline static int m_maxBlocksPerSM = 0; + inline static int m_maxThreadsPerSM = 0; + inline static int m_maxThreadsPerBlock = 0; + static int concurrency(); + + inline static cudaDeviceProp m_deviceProp; // Scratch Spaces for Reductions mutable std::size_t m_scratchSpaceCount; @@ -109,8 +124,7 @@ class CudaInternal { mutable std::size_t m_scratchUnifiedCount; mutable std::size_t m_scratchFunctorSize; - size_type m_scratchUnifiedSupported; - size_type m_streamCount; + inline static size_type m_scratchUnifiedSupported = 0; mutable size_type* m_scratchSpace; mutable size_type* m_scratchFlags; mutable size_type* m_scratchUnified; @@ -131,9 +145,9 @@ class CudaInternal { // FIXME_CUDA: these want to be per-device, not per-stream... use of 'static' // here will break once there are multiple devices though - static unsigned long* constantMemHostStaging; - static cudaEvent_t constantMemReusable; - static std::mutex constantMemMutex; + inline static unsigned long* constantMemHostStaging = nullptr; + inline static cudaEvent_t constantMemReusable = nullptr; + inline static std::mutex constantMemMutex; static CudaInternal& singleton(); @@ -143,8 +157,7 @@ class CudaInternal { return nullptr != m_scratchSpace && nullptr != m_scratchFlags; } - void initialize(int cuda_device_id, cudaStream_t stream = nullptr, - bool manage_stream = false); + void initialize(cudaStream_t stream, bool manage_stream); void finalize(); void print_configuration(std::ostream&) const; @@ -160,25 +173,10 @@ class CudaInternal { ~CudaInternal(); CudaInternal() - : m_cudaDev(-1), - m_cudaArch(-1), - m_multiProcCount(0), - m_maxWarpCount(0), - m_maxBlock({0, 0, 0}), - m_maxSharedWords(0), - m_maxConcurrency(0), - m_shmemPerSM(0), - m_maxShmemPerBlock(0), - m_regsPerSM(0), - m_maxBlocksPerSM(0), - m_maxThreadsPerSM(0), - m_maxThreadsPerBlock(0), - m_scratchSpaceCount(0), + : m_scratchSpaceCount(0), m_scratchFlagsCount(0), m_scratchUnifiedCount(0), m_scratchFunctorSize(0), - m_scratchUnifiedSupported(0), - m_streamCount(0), m_scratchSpace(nullptr), m_scratchFlags(nullptr), m_scratchUnified(nullptr), @@ -200,9 +198,11 @@ class CudaInternal { size_type* scratch_unified(const std::size_t size) const; size_type* scratch_functor(const std::size_t size) const; uint32_t impl_get_instance_id() const; + int acquire_team_scratch_space(); // Resizing of team level 1 scratch - std::pair<void*, int> resize_team_scratch_space(std::int64_t bytes, - bool force_shrink = false); + void* resize_team_scratch_space(int scratch_pool_id, std::int64_t bytes, + bool force_shrink = false); + void release_team_scratch_space(int scratch_pool_id); }; } // Namespace Impl @@ -225,11 +225,9 @@ inline void create_Cuda_instances(std::vector<Cuda>& instances) { template <class... Args> std::vector<Cuda> partition_space(const Cuda&, Args...) { -#ifdef __cpp_fold_expressions static_assert( (... && std::is_arithmetic_v<Args>), "Kokkos Error: partitioning arguments must be integers or floats"); -#endif std::vector<Cuda> instances(sizeof...(Args)); Impl::create_Cuda_instances(instances); return instances; diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp index b7a80ad84ff22b00d9666956cf5896b259d38b6a..5afad7a6a3d8c113cb3bdf6e14afadbd702bb857 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_KernelLaunch.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDAEXEC_HPP #define KOKKOS_CUDAEXEC_HPP @@ -93,10 +65,6 @@ namespace Impl { // __launch_bounds__(maxThreadsPerBlock,minBlocksPerMultiprocessor) // function qualifier which could be used to improve performance. //---------------------------------------------------------------------------- -// Maximize L1 cache and minimize shared memory: -// cudaFuncSetCacheConfig(MyKernel, cudaFuncCachePreferL1 ); -// For 2.0 capability: 48 KB L1 and 16 KB shared -//---------------------------------------------------------------------------- template <class DriverType> __global__ static void cuda_parallel_launch_constant_memory() { @@ -158,63 +126,117 @@ inline void check_shmem_request(CudaInternal const* cuda_instance, int shmem) { } } -// This function needs to be template on DriverType and LaunchBounds +// These functions need to be templated on DriverType and LaunchBounds // so that the static bool is unique for each type combo // KernelFuncPtr does not necessarily contain that type information. + template <class DriverType, class LaunchBounds, class KernelFuncPtr> -inline void configure_shmem_preference(KernelFuncPtr const& func, - bool prefer_shmem) { +const cudaFuncAttributes& get_cuda_kernel_func_attributes( + const KernelFuncPtr& func) { + // Only call cudaFuncGetAttributes once for each unique kernel + // by leveraging static variable initialization rules + auto wrap_get_attributes = [&]() -> cudaFuncAttributes { + cudaFuncAttributes attr; + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaFuncGetAttributes(&attr, func)); + return attr; + }; + static cudaFuncAttributes func_attr = wrap_get_attributes(); + return func_attr; +} + +template <class DriverType, class LaunchBounds, class KernelFuncPtr> +inline void configure_shmem_preference(const KernelFuncPtr& func, + const cudaDeviceProp& device_props, + const size_t block_size, int& shmem, + const size_t occupancy) { #ifndef KOKKOS_ARCH_KEPLER - // On Kepler the L1 has no benefit since it doesn't cache reads + + const auto& func_attr = + get_cuda_kernel_func_attributes<DriverType, LaunchBounds>(func); + + // Compute limits for number of blocks due to registers/SM + const size_t regs_per_sm = device_props.regsPerMultiprocessor; + const size_t regs_per_thread = func_attr.numRegs; + // The granularity of register allocation is chunks of 256 registers per warp + // -> 8 registers per thread + const size_t allocated_regs_per_thread = 8 * ((regs_per_thread + 8 - 1) / 8); + size_t max_blocks_regs = + regs_per_sm / (allocated_regs_per_thread * block_size); + + // Compute the maximum number of warps as a function of the number of + // registers + const size_t max_warps_per_sm_registers = + cuda_max_warps_per_sm_registers(device_props, func_attr); + + // Correct the number of blocks to respect the maximum number of warps per + // SM, which is constrained to be a multiple of the warp allocation + // granularity defined in `cuda_warp_per_sm_allocation_granularity`. + while ((max_blocks_regs * block_size / device_props.warpSize) > + max_warps_per_sm_registers) + max_blocks_regs--; + + // Compute how many threads per sm we actually want + const size_t max_threads_per_sm = device_props.maxThreadsPerMultiProcessor; + // only allocate multiples of warp size + const size_t num_threads_desired = + ((max_threads_per_sm * occupancy / 100 + 31) / 32) * 32; + // Get close to the desired occupancy, + // don't undershoot by much but also don't allocate a whole new block just + // because one is a few threads over otherwise. + size_t num_blocks_desired = + (num_threads_desired + block_size * 0.8) / block_size; + num_blocks_desired = ::std::min(max_blocks_regs, num_blocks_desired); + if (num_blocks_desired == 0) num_blocks_desired = 1; + + // Calculate how much shared memory we need per block + size_t shmem_per_block = shmem + func_attr.sharedSizeBytes; + + // The minimum shared memory allocation we can have in total per SM is 8kB. + // If we want to lower occupancy we have to make sure we request at least that + // much in aggregate over all blocks, so that shared memory actually becomes a + // limiting factor for occupancy + constexpr size_t min_shmem_size_per_sm = 8192; + if ((occupancy < 100) && + (shmem_per_block * num_blocks_desired < min_shmem_size_per_sm)) { + shmem_per_block = min_shmem_size_per_sm / num_blocks_desired; + // Need to set the caller's shmem variable so that the + // kernel launch uses the correct dynamic shared memory request + shmem = shmem_per_block - func_attr.sharedSizeBytes; + } + + // Compute the carveout fraction we need based on occupancy + // Use multiples of 8kB + const size_t max_shmem_per_sm = device_props.sharedMemPerMultiprocessor; + size_t carveout = shmem_per_block == 0 + ? 0 + : 100 * + (((num_blocks_desired * shmem_per_block + + min_shmem_size_per_sm - 1) / + min_shmem_size_per_sm) * + min_shmem_size_per_sm) / + max_shmem_per_sm; + if (carveout > 100) carveout = 100; + + // Set the carveout, but only call it once per kernel or when it changes auto set_cache_config = [&] { - KOKKOS_IMPL_CUDA_SAFE_CALL(cudaFuncSetCacheConfig( - func, - (prefer_shmem ? cudaFuncCachePreferShared : cudaFuncCachePreferL1))); - return prefer_shmem; + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaFuncSetAttribute( + func, cudaFuncAttributePreferredSharedMemoryCarveout, carveout)); + return carveout; }; - static bool cache_config_preference_cached = set_cache_config(); - if (cache_config_preference_cached != prefer_shmem) { + // Store the value in a static variable so we only reset if needed + static size_t cache_config_preference_cached = set_cache_config(); + if (cache_config_preference_cached != carveout) { cache_config_preference_cached = set_cache_config(); } #else // Use the parameters so we don't get a warning (void)func; - (void)prefer_shmem; + (void)device_props; + (void)block_size; + (void)occupancy; #endif } -template <class Policy> -std::enable_if_t<Policy::experimental_contains_desired_occupancy> -modify_launch_configuration_if_desired_occupancy_is_specified( - Policy const& policy, cudaDeviceProp const& properties, - cudaFuncAttributes const& attributes, dim3 const& block, int& shmem, - bool& prefer_shmem) { - int const block_size = block.x * block.y * block.z; - int const desired_occupancy = policy.impl_get_desired_occupancy().value(); - - size_t const shmem_per_sm_prefer_l1 = get_shmem_per_sm_prefer_l1(properties); - size_t const static_shmem = attributes.sharedSizeBytes; - - // round to nearest integer and avoid division by zero - int active_blocks = std::max( - 1, static_cast<int>(std::round( - static_cast<double>(properties.maxThreadsPerMultiProcessor) / - block_size * desired_occupancy / 100))); - int const dynamic_shmem = - shmem_per_sm_prefer_l1 / active_blocks - static_shmem; - - if (dynamic_shmem > shmem) { - shmem = dynamic_shmem; - prefer_shmem = false; - } -} - -template <class Policy> -std::enable_if_t<!Policy::experimental_contains_desired_occupancy> -modify_launch_configuration_if_desired_occupancy_is_specified( - Policy const&, cudaDeviceProp const&, cudaFuncAttributes const&, - dim3 const& /*block*/, int& /*shmem*/, bool& /*prefer_shmem*/) {} - // </editor-fold> end Some helper functions for launch code readability }}}1 //============================================================================== @@ -345,10 +367,9 @@ struct CudaParallelLaunchKernelInvoker< driver); } -#ifdef KOKKOS_CUDA_ENABLE_GRAPHS inline static void create_parallel_launch_graph_node( DriverType const& driver, dim3 const& grid, dim3 const& block, int shmem, - CudaInternal const* cuda_instance, bool prefer_shmem) { + CudaInternal const* cuda_instance) { //---------------------------------------- auto const& graph = Impl::get_cuda_graph_from_kernel(driver); KOKKOS_EXPECTS(bool(graph)); @@ -358,8 +379,15 @@ struct CudaParallelLaunchKernelInvoker< if (!Impl::is_empty_launch(grid, block)) { Impl::check_shmem_request(cuda_instance, shmem); - Impl::configure_shmem_preference<DriverType, LaunchBounds>( - base_t::get_kernel_func(), prefer_shmem); + if constexpr (DriverType::Policy:: + experimental_contains_desired_occupancy) { + int desired_occupancy = + driver.get_policy().impl_get_desired_occupancy().value(); + size_t block_size = block.x * block.y * block.z; + Impl::configure_shmem_preference<DriverType, LaunchBounds>( + base_t::get_kernel_func(), cuda_instance->m_deviceProp, block_size, + shmem, desired_occupancy); + } void const* args[] = {&driver}; @@ -384,7 +412,6 @@ struct CudaParallelLaunchKernelInvoker< } KOKKOS_ENSURES(bool(graph_node)) } -#endif }; // </editor-fold> end local memory }}}2 @@ -439,10 +466,9 @@ struct CudaParallelLaunchKernelInvoker< driver_ptr); } -#ifdef KOKKOS_CUDA_ENABLE_GRAPHS inline static void create_parallel_launch_graph_node( DriverType const& driver, dim3 const& grid, dim3 const& block, int shmem, - CudaInternal const* cuda_instance, bool prefer_shmem) { + CudaInternal const* cuda_instance) { //---------------------------------------- auto const& graph = Impl::get_cuda_graph_from_kernel(driver); KOKKOS_EXPECTS(bool(graph)); @@ -452,8 +478,15 @@ struct CudaParallelLaunchKernelInvoker< if (!Impl::is_empty_launch(grid, block)) { Impl::check_shmem_request(cuda_instance, shmem); - Impl::configure_shmem_preference<DriverType, LaunchBounds>( - base_t::get_kernel_func(), prefer_shmem); + if constexpr (DriverType::Policy:: + experimental_contains_desired_occupancy) { + int desired_occupancy = + driver.get_policy().impl_get_desired_occupancy().value(); + size_t block_size = block.x * block.y * block.z; + Impl::configure_shmem_preference<DriverType, LaunchBounds>( + base_t::get_kernel_func(), cuda_instance->m_deviceProp, block_size, + shmem, desired_occupancy); + } auto* driver_ptr = Impl::allocate_driver_storage_for_kernel(driver); @@ -488,7 +521,6 @@ struct CudaParallelLaunchKernelInvoker< } KOKKOS_ENSURES(bool(graph_node)) } -#endif }; // </editor-fold> end Global Memory }}}2 @@ -563,10 +595,9 @@ struct CudaParallelLaunchKernelInvoker< cudaStream_t(cuda_instance->m_stream))); } -#ifdef KOKKOS_CUDA_ENABLE_GRAPHS inline static void create_parallel_launch_graph_node( DriverType const& driver, dim3 const& grid, dim3 const& block, int shmem, - CudaInternal const* cuda_instance, bool prefer_shmem) { + CudaInternal const* cuda_instance) { // Just use global memory; coordinating through events to share constant // memory with the non-graph interface is not really reasonable since // events don't work with Graphs directly, and this would anyway require @@ -580,9 +611,8 @@ struct CudaParallelLaunchKernelInvoker< DriverType, LaunchBounds, Experimental::CudaLaunchMechanism::GlobalMemory>; global_launch_impl_t::create_parallel_launch_graph_node( - driver, grid, block, shmem, cuda_instance, prefer_shmem); + driver, grid, block, shmem, cuda_instance); } -#endif }; // </editor-fold> end Constant Memory }}}2 @@ -613,8 +643,7 @@ struct CudaParallelLaunchImpl< inline static void launch_kernel(const DriverType& driver, const dim3& grid, const dim3& block, int shmem, - const CudaInternal* cuda_instance, - bool prefer_shmem) { + const CudaInternal* cuda_instance) { if (!Impl::is_empty_launch(grid, block)) { // Prevent multiple threads to simultaneously set the cache configuration // preference and launch the same kernel @@ -623,20 +652,19 @@ struct CudaParallelLaunchImpl< Impl::check_shmem_request(cuda_instance, shmem); - // If a desired occupancy is specified, we compute how much shared memory - // to ask for to achieve that occupancy, assuming that the cache - // configuration is `cudaFuncCachePreferL1`. If the amount of dynamic - // shared memory computed is actually smaller than `shmem` we overwrite - // `shmem` and set `prefer_shmem` to `false`. - modify_launch_configuration_if_desired_occupancy_is_specified( - driver.get_policy(), cuda_instance->m_deviceProp, - get_cuda_func_attributes(), block, shmem, prefer_shmem); + if constexpr (DriverType::Policy:: + experimental_contains_desired_occupancy) { + int desired_occupancy = + driver.get_policy().impl_get_desired_occupancy().value(); + size_t block_size = block.x * block.y * block.z; + Impl::configure_shmem_preference< + DriverType, + Kokkos::LaunchBounds<MaxThreadsPerBlock, MinBlocksPerSM>>( + base_t::get_kernel_func(), cuda_instance->m_deviceProp, block_size, + shmem, desired_occupancy); + } - Impl::configure_shmem_preference< - DriverType, Kokkos::LaunchBounds<MaxThreadsPerBlock, MinBlocksPerSM>>( - base_t::get_kernel_func(), prefer_shmem); - - KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE(); + ensure_cuda_lock_arrays_on_device(); // Invoke the driver function on the device base_t::invoke_kernel(driver, grid, block, shmem, cuda_instance); @@ -650,18 +678,9 @@ struct CudaParallelLaunchImpl< } static cudaFuncAttributes get_cuda_func_attributes() { - // Race condition inside of cudaFuncGetAttributes if the same address is - // given requires using a local variable as input instead of a static Rely - // on static variable initialization to make sure only one thread executes - // the code and the result is visible. - auto wrap_get_attributes = []() -> cudaFuncAttributes { - cudaFuncAttributes attr_tmp; - KOKKOS_IMPL_CUDA_SAFE_CALL( - cudaFuncGetAttributes(&attr_tmp, base_t::get_kernel_func())); - return attr_tmp; - }; - static cudaFuncAttributes attr = wrap_get_attributes(); - return attr; + return get_cuda_kernel_func_attributes< + DriverType, Kokkos::LaunchBounds<MaxThreadsPerBlock, MinBlocksPerSM>>( + base_t::get_kernel_func()); } }; @@ -674,11 +693,7 @@ struct CudaParallelLaunchImpl< template <class DriverType, class LaunchBounds = Kokkos::LaunchBounds<>, Experimental::CudaLaunchMechanism LaunchMechanism = DeduceCudaLaunchMechanism<DriverType>::launch_mechanism, - bool DoGraph = DriverType::Policy::is_graph_kernel::value -#ifndef KOKKOS_CUDA_ENABLE_GRAPHS - && false -#endif - > + bool DoGraph = DriverType::Policy::is_graph_kernel::value> struct CudaParallelLaunch; // General launch mechanism @@ -695,7 +710,6 @@ struct CudaParallelLaunch<DriverType, LaunchBounds, LaunchMechanism, } }; -#ifdef KOKKOS_CUDA_ENABLE_GRAPHS // Launch mechanism for creating graph nodes template <class DriverType, class LaunchBounds, Experimental::CudaLaunchMechanism LaunchMechanism> @@ -709,7 +723,6 @@ struct CudaParallelLaunch<DriverType, LaunchBounds, LaunchMechanism, base_t::create_parallel_launch_graph_node((Args &&) args...); } }; -#endif // </editor-fold> end CudaParallelLaunch }}}1 //============================================================================== diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp index 84d4307cfd549f9567cb2bc5982a882543e19168..b18fda80f06193152b23004468b00a3b806acecb 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -79,8 +51,7 @@ CudaLockArrays g_host_cuda_lock_arrays = {nullptr, 0}; void initialize_host_cuda_lock_arrays() { #ifdef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS desul::Impl::init_lock_arrays(); - - DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE(); + desul::ensure_cuda_lock_arrays_on_device(); #endif if (g_host_cuda_lock_arrays.atomic != nullptr) return; KOKKOS_IMPL_CUDA_SAFE_CALL( @@ -88,8 +59,8 @@ void initialize_host_cuda_lock_arrays() { sizeof(int) * (CUDA_SPACE_ATOMIC_MASK + 1))); Impl::cuda_device_synchronize( "Kokkos::Impl::initialize_host_cuda_lock_arrays: Pre Init Lock Arrays"); - g_host_cuda_lock_arrays.n = Cuda::concurrency(); - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + g_host_cuda_lock_arrays.n = CudaInternal::concurrency(); + copy_cuda_lock_arrays_to_device(); init_lock_array_kernel_atomic<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>(); Impl::cuda_device_synchronize( @@ -106,7 +77,7 @@ void finalize_host_cuda_lock_arrays() { g_host_cuda_lock_arrays.atomic = nullptr; g_host_cuda_lock_arrays.n = 0; #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); #endif } diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp index bdb7723985e5a3c6c0451ada3d0b6b7303204089..3916ae2c539008bcadb5a3ffacdb16043a89b4e3 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Locks.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_LOCKS_HPP #define KOKKOS_CUDA_LOCKS_HPP @@ -54,7 +26,7 @@ #include <Cuda/Kokkos_Cuda_Error.hpp> #ifdef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS -#include <desul/atomics/Lock_Array_Cuda.hpp> +#include <desul/atomics/Lock_Array_CUDA.hpp> #endif namespace Kokkos { @@ -67,7 +39,7 @@ struct CudaLockArrays { /// \brief This global variable in Host space is the central definition /// of these arrays. -extern Kokkos::Impl::CudaLockArrays g_host_cuda_lock_arrays; +extern CudaLockArrays g_host_cuda_lock_arrays; /// \brief After this call, the g_host_cuda_lock_arrays variable has /// valid, initialized arrays. @@ -105,12 +77,12 @@ namespace Impl { /// instances in other translation units, we must update this CUDA global /// variable based on the Host global variable prior to running any kernels /// that will use it. -/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro. +/// That is the purpose of the ensure_cuda_lock_arrays_on_device function. __device__ #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE __constant__ extern #endif - Kokkos::Impl::CudaLockArrays g_device_cuda_lock_arrays; + CudaLockArrays g_device_cuda_lock_arrays; #define CUDA_SPACE_ATOMIC_MASK 0x1FFFF @@ -123,9 +95,7 @@ __device__ inline bool lock_address_cuda_space(void* ptr) { size_t offset = size_t(ptr); offset = offset >> 2; offset = offset & CUDA_SPACE_ATOMIC_MASK; - return ( - 0 == - atomicCAS(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0, 1)); + return (0 == atomicCAS(&g_device_cuda_lock_arrays.atomic[offset], 0, 1)); } /// \brief Release lock for the address @@ -138,7 +108,7 @@ __device__ inline void unlock_address_cuda_space(void* ptr) { size_t offset = size_t(ptr); offset = offset >> 2; offset = offset & CUDA_SPACE_ATOMIC_MASK; - atomicExch(&Kokkos::Impl::g_device_cuda_lock_arrays.atomic[offset], 0); + atomicExch(&g_device_cuda_lock_arrays.atomic[offset], 0); } } // namespace Impl @@ -151,45 +121,49 @@ namespace { static int lock_array_copied = 0; inline int eliminate_warning_for_lock_array() { return lock_array_copied; } } // namespace -} // namespace Impl -} // namespace Kokkos -/* Dan Ibanez: it is critical that this code be a macro, so that it will - capture the right address for Kokkos::Impl::g_device_cuda_lock_arrays! - putting this in an inline function will NOT do the right thing! */ -#define KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - { \ - if (::Kokkos::Impl::lock_array_copied == 0) { \ - KOKKOS_IMPL_CUDA_SAFE_CALL( \ - cudaMemcpyToSymbol(Kokkos::Impl::g_device_cuda_lock_arrays, \ - &Kokkos::Impl::g_host_cuda_lock_arrays, \ - sizeof(Kokkos::Impl::CudaLockArrays))); \ - } \ - lock_array_copied = 1; \ +#ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE +inline +#else +inline static +#endif + void + copy_cuda_lock_arrays_to_device() { + if (lock_array_copied == 0) { + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMemcpyToSymbol(g_device_cuda_lock_arrays, + &g_host_cuda_lock_arrays, + sizeof(CudaLockArrays))); } + lock_array_copied = 1; +} #ifndef KOKKOS_ENABLE_IMPL_DESUL_ATOMICS #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() +inline static void ensure_cuda_lock_arrays_on_device() { + copy_cuda_lock_arrays_to_device(); +} #endif #else #ifdef KOKKOS_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else // Still Need COPY_CUDA_LOCK_ARRAYS for team scratch etc. -#define KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - KOKKOS_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline static void ensure_cuda_lock_arrays_on_device() { + copy_cuda_lock_arrays_to_device(); + desul::ensure_cuda_lock_arrays_on_device(); +} #endif #endif /* defined( KOKKOS_ENABLE_IMPL_DESUL_ATOMICS ) */ +} // namespace Impl +} // namespace Kokkos + #endif /* defined( KOKKOS_ENABLE_CUDA ) */ #endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP */ diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp index 12b7f70a97495fca628580dda12b115cb5c25a12..7492ab49e56b903f5b326c8672c546a5877cdc85 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_MDRangePolicy.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #ifndef KOKKOS_CUDA_MDRANGEPOLICY_HPP_ #define KOKKOS_CUDA_MDRANGEPOLICY_HPP_ @@ -32,6 +48,11 @@ inline TileSizeProperties get_tile_size_properties<Kokkos::Cuda>( return properties; } +// Settings for TeamMDRangePolicy +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, Cuda, ThreadAndVector> + : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {}; + } // Namespace Impl } // Namespace Kokkos #endif diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp index e586bb4cc6c58e41ad3eff95ddf05f6e0a5cb8cf..0015d1ea14d7755cef5f7a93c3c762cfd1f50d90 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_MDRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_PARALLEL_MD_RANGE_HPP #define KOKKOS_CUDA_PARALLEL_MD_RANGE_HPP @@ -67,6 +39,34 @@ namespace Kokkos { namespace Impl { +template <typename ParallelType, typename Policy, typename LaunchBounds> +int max_tile_size_product_helper(const Policy& pol, const LaunchBounds&) { + cudaFuncAttributes attr = + CudaParallelLaunch<ParallelType, + LaunchBounds>::get_cuda_func_attributes(); + auto const& prop = pol.space().cuda_device_prop(); + + // Limits due to registers/SM, MDRange doesn't have + // shared memory constraints + int const optimal_block_size = + cuda_get_opt_block_size_no_shmem(prop, attr, LaunchBounds{}); + + // Compute how many blocks of this size we can launch, based on warp + // constraints + int const max_warps_per_sm_registers = + Kokkos::Impl::cuda_max_warps_per_sm_registers(prop, attr); + int const max_num_threads_from_warps = + max_warps_per_sm_registers * prop.warpSize; + int const max_num_blocks = max_num_threads_from_warps / optimal_block_size; + + // Compute the total number of threads + int const max_threads_per_sm = optimal_block_size * max_num_blocks; + + return std::min( + max_threads_per_sm, + static_cast<int>(Kokkos::Impl::CudaTraits::MaxHierarchicalParallelism)); +} + template <class FunctorType, class... Traits> class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> { public: @@ -85,18 +85,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> { public: template <typename Policy, typename Functor> static int max_tile_size_product(const Policy& pol, const Functor&) { - cudaFuncAttributes attr = - CudaParallelLaunch<ParallelFor, - LaunchBounds>::get_cuda_func_attributes(); - auto const& prop = pol.space().cuda_device_prop(); - // Limits due to registers/SM, MDRange doesn't have - // shared memory constraints - int const regs_per_sm = prop.regsPerMultiprocessor; - int const regs_per_thread = attr.numRegs; - int const max_threads_per_sm = regs_per_sm / regs_per_thread; - return std::min( - max_threads_per_sm, - static_cast<int>(Kokkos::Impl::CudaTraits::MaxHierarchicalParallelism)); + return max_tile_size_product_helper<ParallelFor>(pol, LaunchBounds{}); } Policy const& get_policy() const { return m_rp; } inline __device__ void operator()() const { @@ -121,8 +110,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> { maxblocks[1]), 1); CudaParallelLaunch<ParallelFor, LaunchBounds>( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance(), - false); + *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); } else if (RP::rank == 3) { const dim3 block(m_rp.m_tile[0], m_rp.m_tile[1], m_rp.m_tile[2]); KOKKOS_ASSERT(block.x > 0); @@ -139,8 +127,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> { (m_rp.m_upper[2] - m_rp.m_lower[2] + block.z - 1) / block.z, maxblocks[2])); CudaParallelLaunch<ParallelFor, LaunchBounds>( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance(), - false); + *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); } else if (RP::rank == 4) { // id0,id1 encoded within threadIdx.x; id2 to threadIdx.y; id3 to // threadIdx.z @@ -158,8 +145,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> { (m_rp.m_upper[3] - m_rp.m_lower[3] + block.z - 1) / block.z, maxblocks[2])); CudaParallelLaunch<ParallelFor, LaunchBounds>( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance(), - false); + *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); } else if (RP::rank == 5) { // id0,id1 encoded within threadIdx.x; id2,id3 to threadIdx.y; id4 to // threadIdx.z @@ -175,8 +161,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> { (m_rp.m_upper[4] - m_rp.m_lower[4] + block.z - 1) / block.z, maxblocks[2])); CudaParallelLaunch<ParallelFor, LaunchBounds>( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance(), - false); + *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); } else if (RP::rank == 6) { // id0,id1 encoded within threadIdx.x; id2,id3 to threadIdx.y; id4,id5 to // threadIdx.z @@ -191,8 +176,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, Kokkos::Cuda> { std::min<array_index_type>(m_rp.m_tile_end[4] * m_rp.m_tile_end[5], maxblocks[2])); CudaParallelLaunch<ParallelFor, LaunchBounds>( - *this, grid, block, 0, m_rp.space().impl_internal_space_instance(), - false); + *this, grid, block, 0, m_rp.space().impl_internal_space_instance()); } else { Kokkos::abort("Kokkos::MDRange Error: Exceeded rank bounds with Cuda\n"); } @@ -263,17 +247,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, public: template <typename Policy, typename Functor> static int max_tile_size_product(const Policy& pol, const Functor&) { - cudaFuncAttributes attr = - CudaParallelLaunch<ParallelReduce, - LaunchBounds>::get_cuda_func_attributes(); - auto const& prop = pol.space().cuda_device_prop(); - // Limits due do registers/SM - int const regs_per_sm = prop.regsPerMultiprocessor; - int const regs_per_thread = attr.numRegs; - int const max_threads_per_sm = regs_per_sm / regs_per_thread; - return std::min( - max_threads_per_sm, - static_cast<int>(Kokkos::Impl::CudaTraits::MaxHierarchicalParallelism)); + return max_tile_size_product_helper<ParallelReduce>(pol, LaunchBounds{}); } Policy const& get_policy() const { return m_policy; } inline __device__ void exec_range(reference_type update) const { @@ -405,8 +379,8 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, CudaParallelLaunch<ParallelReduce, LaunchBounds>( *this, grid, block, shmem, - m_policy.space().impl_internal_space_instance(), - false); // copy to device and execute + m_policy.space() + .impl_internal_space_instance()); // copy to device and execute if (!m_result_ptr_device_accessible) { if (m_result_ptr) { diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp index ac160f8fe268a42e04eebcee2639160e7edbd512..c5e89fc3da1df33cdd001db579d5eb1d3f4bedfd 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Range.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_PARALLEL_RANGE_HPP #define KOKKOS_CUDA_PARALLEL_RANGE_HPP @@ -135,8 +107,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::Cuda> { #endif CudaParallelLaunch<ParallelFor, LaunchBounds>( - *this, grid, block, 0, m_policy.space().impl_internal_space_instance(), - false); + *this, grid, block, 0, m_policy.space().impl_internal_space_instance()); } ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy) @@ -326,9 +297,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, const bool need_device_set = Analysis::has_init_member_function || Analysis::has_final_member_function || !m_result_ptr_host_accessible || -#ifdef KOKKOS_CUDA_ENABLE_GRAPHS Policy::is_graph_kernel::value || -#endif !std::is_same<ReducerType, InvalidType>::value; if ((nwork > 0) || need_device_set) { const int block_size = local_block_size(m_functor); @@ -375,8 +344,8 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, CudaParallelLaunch<ParallelReduce, LaunchBounds>( *this, grid, block, shmem, - m_policy.space().impl_internal_space_instance(), - false); // copy to device and execute + m_policy.space() + .impl_internal_space_instance()); // copy to device and execute if (!m_result_ptr_device_accessible) { if (m_result_ptr) { @@ -726,16 +695,16 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::Cuda> { m_final = false; CudaParallelLaunch<ParallelScan, LaunchBounds>( *this, grid, block, shmem, - m_policy.space().impl_internal_space_instance(), - false); // copy to device and execute + m_policy.space() + .impl_internal_space_instance()); // copy to device and execute #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION } #endif m_final = true; CudaParallelLaunch<ParallelScan, LaunchBounds>( *this, grid, block, shmem, - m_policy.space().impl_internal_space_instance(), - false); // copy to device and execute + m_policy.space() + .impl_internal_space_instance()); // copy to device and execute } } @@ -803,7 +772,9 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, word_size_type* m_scratch_space; size_type* m_scratch_flags; size_type m_final; - ReturnType& m_returnvalue; + const pointer_type m_result_ptr; + const bool m_result_ptr_device_accessible; + #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION bool m_run_serial; #endif @@ -944,6 +915,9 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, reinterpret_cast<pointer_type>(shared_prefix)), true); } + if (iwork + 1 == m_policy.end() && m_policy.end() == range.end() && + m_result_ptr_device_accessible) + *m_result_ptr = *reinterpret_cast<pointer_type>(shared_prefix); } } @@ -1032,22 +1006,20 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, if (m_run_serial) { block = dim3(1, 1, 1); grid = dim3(1, 1, 1); - } else { + } else #endif - + { m_final = false; CudaParallelLaunch<ParallelScanWithTotal, LaunchBounds>( *this, grid, block, shmem, - m_policy.space().impl_internal_space_instance(), - false); // copy to device and execute -#ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION + m_policy.space() + .impl_internal_space_instance()); // copy to device and execute } -#endif m_final = true; CudaParallelLaunch<ParallelScanWithTotal, LaunchBounds>( *this, grid, block, shmem, - m_policy.space().impl_internal_space_instance(), - false); // copy to device and execute + m_policy.space() + .impl_internal_space_instance()); // copy to device and execute const int size = Analysis::value_size(m_functor); #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION @@ -1056,21 +1028,29 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, m_scratch_space, size); else #endif - DeepCopy<HostSpace, CudaSpace, Cuda>( - m_policy.space(), &m_returnvalue, - m_scratch_space + (grid_x - 1) * size / sizeof(word_size_type), - size); + { + if (!m_result_ptr_device_accessible) + DeepCopy<HostSpace, CudaSpace, Cuda>( + m_policy.space(), m_result_ptr, + m_scratch_space + (grid_x - 1) * size / sizeof(word_size_type), + size); + } } } + template <class ViewType> ParallelScanWithTotal(const FunctorType& arg_functor, - const Policy& arg_policy, ReturnType& arg_returnvalue) + const Policy& arg_policy, + const ViewType& arg_result_view) : m_functor(arg_functor), m_policy(arg_policy), m_scratch_space(nullptr), m_scratch_flags(nullptr), m_final(false), - m_returnvalue(arg_returnvalue) + m_result_ptr(arg_result_view.data()), + m_result_ptr_device_accessible( + MemorySpaceAccess<Kokkos::CudaSpace, + typename ViewType::memory_space>::accessible) #ifdef KOKKOS_IMPL_DEBUG_CUDA_SERIAL_EXECUTION , m_run_serial(Kokkos::Impl::CudaInternal::cuda_use_serial_execution()) diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp index cdd16085b352fbbe8177e0d249d85007e58ca945..cdff86ccfc48d54dfc6a8c8c35256787959fed64 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Parallel_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_PARALLEL_TEAM_HPP #define KOKKOS_CUDA_PARALLEL_TEAM_HPP @@ -226,21 +198,25 @@ class TeamPolicyInternal<Kokkos::Cuda, Properties...> } inline static int scratch_size_max(int level) { - return ( - level == 0 ? 1024 * 40 : // 48kB is the max for CUDA, but we need some - // for team_member.reduce etc. - 20 * 1024 * - 1024); // arbitrarily setting this to 20MB, for a Volta V100 - // that would give us about 3.2GB for 2 teams per SM + // Cuda Teams use (team_size + 2)*sizeof(double) shared memory for team + // reductions. They also use one int64_t in static shared memory for a + // shared ID. Furthermore, they use additional scratch memory in some + // reduction scenarios, which depend on the size of the value_type and is + // NOT captured here. + constexpr size_t max_possible_team_size = 1024; + constexpr size_t max_reserved_shared_mem_per_team = + (max_possible_team_size + 2) * sizeof(double) + sizeof(int64_t); + // arbitrarily setting level 1 scratch limit to 20MB, for a + // Volta V100 that would give us about 3.2GB for 2 teams per SM + constexpr size_t max_l1_scratch_size = 20 * 1024 * 1024; + + size_t max_shmem = Cuda().cuda_device_prop().sharedMemPerBlock; + return (level == 0 ? max_shmem - max_reserved_shared_mem_per_team + : max_l1_scratch_size); } //---------------------------------------- -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - KOKKOS_DEPRECATED inline int vector_length() const { - return impl_vector_length(); - } -#endif inline int impl_vector_length() const { return m_vector_length; } inline int team_size() const { return m_team_size; } inline int league_size() const { return m_league_size; } @@ -552,8 +528,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, CudaParallelLaunch<ParallelFor, LaunchBounds>( *this, grid, block, shmem_size_total, - m_policy.space().impl_internal_space_instance(), - true); // copy to device and execute + m_policy.space() + .impl_internal_space_instance()); // copy to device and execute } ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy) @@ -562,6 +538,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, m_league_size(arg_policy.league_size()), m_team_size(arg_policy.team_size()), m_vector_size(arg_policy.impl_vector_length()) { + auto internal_space_instance = + m_policy.space().impl_internal_space_instance(); cudaFuncAttributes attr = CudaParallelLaunch<ParallelFor, LaunchBounds>::get_cuda_func_attributes(); @@ -569,8 +547,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, m_team_size >= 0 ? m_team_size : Kokkos::Impl::cuda_get_opt_block_size<FunctorType, LaunchBounds>( - m_policy.space().impl_internal_space_instance(), attr, - m_functor, m_vector_size, m_policy.team_scratch_size(0), + internal_space_instance, attr, m_functor, m_vector_size, + m_policy.team_scratch_size(0), m_policy.thread_scratch_size(0)) / m_vector_size; @@ -580,8 +558,7 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, FunctorTeamShmemSize<FunctorType>::value(m_functor, m_team_size)); m_scratch_size[0] = m_policy.scratch_size(0, m_team_size); m_scratch_size[1] = m_policy.scratch_size(1, m_team_size); - m_scratch_locks = - m_policy.space().impl_internal_space_instance()->m_scratch_locks; + m_scratch_locks = internal_space_instance->m_scratch_locks; // Functor's reduce memory, team scan memory, and team shared memory depend // upon team size. @@ -589,34 +566,28 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, if (m_team_size <= 0) { m_scratch_ptr[1] = nullptr; } else { - auto scratch_ptr_id = - m_policy.space() - .impl_internal_space_instance() - ->resize_team_scratch_space( - static_cast<std::int64_t>(m_scratch_size[1]) * - (std::min( - static_cast<std::int64_t>(Cuda::concurrency() / - (m_team_size * m_vector_size)), - static_cast<std::int64_t>(m_league_size)))); - m_scratch_ptr[1] = scratch_ptr_id.first; - m_scratch_pool_id = scratch_ptr_id.second; + m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space(); + m_scratch_ptr[1] = internal_space_instance->resize_team_scratch_space( + m_scratch_pool_id, + static_cast<std::int64_t>(m_scratch_size[1]) * + (std::min( + static_cast<std::int64_t>(Cuda().concurrency() / + (m_team_size * m_vector_size)), + static_cast<std::int64_t>(m_league_size)))); } const int shmem_size_total = m_shmem_begin + m_shmem_size; - if (m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock < - shmem_size_total) { - printf( - "%i %i\n", - m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock, - shmem_size_total); + if (internal_space_instance->m_maxShmemPerBlock < shmem_size_total) { + printf("%i %i\n", internal_space_instance->m_maxShmemPerBlock, + shmem_size_total); Kokkos::Impl::throw_runtime_exception(std::string( "Kokkos::Impl::ParallelFor< Cuda > insufficient shared memory")); } if (int(m_team_size) > int(Kokkos::Impl::cuda_get_max_block_size<FunctorType, LaunchBounds>( - m_policy.space().impl_internal_space_instance(), attr, - arg_functor, arg_policy.impl_vector_length(), + internal_space_instance, attr, arg_functor, + arg_policy.impl_vector_length(), arg_policy.team_scratch_size(0), arg_policy.thread_scratch_size(0)) / arg_policy.impl_vector_length())) { @@ -629,7 +600,7 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, if (m_scratch_pool_id >= 0) { m_policy.space() .impl_internal_space_instance() - ->m_team_scratch_pool[m_scratch_pool_id] = 0; + ->release_team_scratch_space(m_scratch_pool_id); } } }; @@ -844,9 +815,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, const bool need_device_set = Analysis::has_init_member_function || Analysis::has_final_member_function || !m_result_ptr_host_accessible || -#ifdef KOKKOS_CUDA_ENABLE_GRAPHS Policy::is_graph_kernel::value || -#endif !std::is_same<ReducerType, InvalidType>::value; if (!is_empty_range || need_device_set) { const int block_count = std::max( @@ -878,8 +847,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, CudaParallelLaunch<ParallelReduce, LaunchBounds>( *this, grid, block, shmem_size_total, - m_policy.space().impl_internal_space_instance(), - true); // copy to device and execute + m_policy.space() + .impl_internal_space_instance()); // copy to device and execute if (!m_result_ptr_device_accessible) { m_policy.space().fence( @@ -933,6 +902,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_league_size(arg_policy.league_size()), m_team_size(arg_policy.team_size()), m_vector_size(arg_policy.impl_vector_length()) { + auto internal_space_instance = + m_policy.space().impl_internal_space_instance(); cudaFuncAttributes attr = CudaParallelLaunch<ParallelReduce, LaunchBounds>::get_cuda_func_attributes(); @@ -940,8 +911,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_team_size >= 0 ? m_team_size : Kokkos::Impl::cuda_get_opt_block_size<FunctorType, LaunchBounds>( - m_policy.space().impl_internal_space_instance(), attr, - m_functor, m_vector_size, m_policy.team_scratch_size(0), + internal_space_instance, attr, m_functor, m_vector_size, + m_policy.team_scratch_size(0), m_policy.thread_scratch_size(0)) / m_vector_size; @@ -957,22 +928,18 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, FunctorTeamShmemSize<FunctorType>::value(arg_functor, m_team_size); m_scratch_size[0] = m_shmem_size; m_scratch_size[1] = m_policy.scratch_size(1, m_team_size); - m_scratch_locks = - m_policy.space().impl_internal_space_instance()->m_scratch_locks; + m_scratch_locks = internal_space_instance->m_scratch_locks; if (m_team_size <= 0) { m_scratch_ptr[1] = nullptr; } else { - auto scratch_ptr_id = - m_policy.space() - .impl_internal_space_instance() - ->resize_team_scratch_space( - static_cast<std::int64_t>(m_scratch_size[1]) * - (std::min( - static_cast<std::int64_t>(Cuda::concurrency() / - (m_team_size * m_vector_size)), - static_cast<std::int64_t>(m_league_size)))); - m_scratch_ptr[1] = scratch_ptr_id.first; - m_scratch_pool_id = scratch_ptr_id.second; + m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space(); + m_scratch_ptr[1] = internal_space_instance->resize_team_scratch_space( + m_scratch_pool_id, + static_cast<std::int64_t>(m_scratch_size[1]) * + (std::min( + static_cast<std::int64_t>(Cuda().concurrency() / + (m_team_size * m_vector_size)), + static_cast<std::int64_t>(m_league_size)))); } // The global parallel_reduce does not support vector_length other than 1 at @@ -1000,8 +967,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, std::string("Kokkos::Impl::ParallelReduce< Cuda > bad team size")); } - if (m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock < - shmem_size_total) { + if (internal_space_instance->m_maxShmemPerBlock < shmem_size_total) { Kokkos::Impl::throw_runtime_exception( std::string("Kokkos::Impl::ParallelReduce< Cuda > requested too much " "L0 scratch memory")); @@ -1039,6 +1005,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_league_size(arg_policy.league_size()), m_team_size(arg_policy.team_size()), m_vector_size(arg_policy.impl_vector_length()) { + auto internal_space_instance = + m_policy.space().impl_internal_space_instance(); cudaFuncAttributes attr = CudaParallelLaunch<ParallelReduce, LaunchBounds>::get_cuda_func_attributes(); @@ -1048,8 +1016,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_team_size >= 0 ? m_team_size : Kokkos::Impl::cuda_get_opt_block_size<FunctorType, LaunchBounds>( - m_policy.space().impl_internal_space_instance(), attr, - m_functor, m_vector_size, m_policy.team_scratch_size(0), + internal_space_instance, attr, m_functor, m_vector_size, + m_policy.team_scratch_size(0), m_policy.thread_scratch_size(0)) / m_vector_size; @@ -1065,22 +1033,18 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, FunctorTeamShmemSize<FunctorType>::value(arg_functor, m_team_size); m_scratch_size[0] = m_shmem_size; m_scratch_size[1] = m_policy.scratch_size(1, m_team_size); - m_scratch_locks = - m_policy.space().impl_internal_space_instance()->m_scratch_locks; + m_scratch_locks = internal_space_instance->m_scratch_locks; if (m_team_size <= 0) { m_scratch_ptr[1] = nullptr; } else { - auto scratch_ptr_id = - m_policy.space() - .impl_internal_space_instance() - ->resize_team_scratch_space( - static_cast<std::int64_t>(m_scratch_size[1]) * - (std::min( - static_cast<std::int64_t>(Cuda::concurrency() / - (m_team_size * m_vector_size)), - static_cast<std::int64_t>(m_league_size)))); - m_scratch_ptr[1] = scratch_ptr_id.first; - m_scratch_pool_id = scratch_ptr_id.second; + m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space(); + m_scratch_ptr[1] = internal_space_instance->resize_team_scratch_space( + m_scratch_pool_id, + static_cast<std::int64_t>(m_scratch_size[1]) * + (std::min( + static_cast<std::int64_t>(Cuda().concurrency() / + (m_team_size * m_vector_size)), + static_cast<std::int64_t>(m_league_size)))); } // The global parallel_reduce does not support vector_length other than 1 at @@ -1104,17 +1068,15 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, if ((!Kokkos::Impl::is_integral_power_of_two(m_team_size) && !UseShflReduction) || - m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock < - shmem_size_total) { + internal_space_instance->m_maxShmemPerBlock < shmem_size_total) { Kokkos::Impl::throw_runtime_exception( std::string("Kokkos::Impl::ParallelReduce< Cuda > bad team size")); } size_type team_size_max = Kokkos::Impl::cuda_get_max_block_size<FunctorType, LaunchBounds>( - m_policy.space().impl_internal_space_instance(), attr, m_functor, - m_vector_size, m_policy.team_scratch_size(0), - m_policy.thread_scratch_size(0)) / + internal_space_instance, attr, m_functor, m_vector_size, + m_policy.team_scratch_size(0), m_policy.thread_scratch_size(0)) / m_vector_size; if ((int)m_team_size > (int)team_size_max) { @@ -1128,7 +1090,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, if (m_scratch_pool_id >= 0) { m_policy.space() .impl_internal_space_instance() - ->m_team_scratch_pool[m_scratch_pool_id] = 0; + ->release_team_scratch_space(m_scratch_pool_id); } } }; diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp index 34d4bef9fdaaf038a2fcdab257d043438a348887..59fdd1351386c705861da0030eedd60a3c31fb0c 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_ReduceScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_REDUCESCAN_HPP #define KOKKOS_CUDA_REDUCESCAN_HPP @@ -90,31 +62,31 @@ template <class ValueType, class ReducerType> __device__ inline void cuda_inter_warp_reduction( ValueType& value, const ReducerType& reducer, const int max_active_thread = blockDim.y) { -#define STEP_WIDTH 4 - // Depending on the ValueType _shared__ memory must be aligned up to 8byte - // boundaries The reason not to use ValueType directly is that for types with + constexpr int step_width = 4; + // Depending on the ValueType, __shared__ memory must be aligned up to 8byte + // boundaries. The reason not to use ValueType directly is that for types with // constructors it could lead to race conditions alignas(alignof(ValueType) > alignof(double) ? alignof(ValueType) : alignof(double)) - __shared__ double sh_result[(sizeof(ValueType) + 7) / 8 * STEP_WIDTH]; + __shared__ double sh_result[(sizeof(ValueType) + 7) / 8 * step_width]; ValueType* result = (ValueType*)&sh_result; const int step = 32 / blockDim.x; - int shift = STEP_WIDTH; + int shift = step_width; const int id = threadIdx.y % step == 0 ? threadIdx.y / step : 65000; - if (id < STEP_WIDTH) { + if (id < step_width) { result[id] = value; } __syncthreads(); while (shift <= max_active_thread / step) { - if (shift <= id && shift + STEP_WIDTH > id && threadIdx.x == 0) { - reducer.join(&result[id % STEP_WIDTH], &value); + if (shift <= id && shift + step_width > id && threadIdx.x == 0) { + reducer.join(&result[id % step_width], &value); } __syncthreads(); - shift += STEP_WIDTH; + shift += step_width; } value = result[0]; - for (int i = 1; (i * step < max_active_thread) && i < STEP_WIDTH; i++) + for (int i = 1; (i * step < max_active_thread) && i < step_width; i++) reducer.join(&value, &result[i]); __syncthreads(); } @@ -428,11 +400,6 @@ struct CudaReductionsFunctor<FunctorType, false, false> { // __launch_bounds__(maxThreadsPerBlock,minBlocksPerMultiprocessor) // function qualifier which could be used to improve performance. //---------------------------------------------------------------------------- -// Maximize shared memory and minimize L1 cache: -// cudaFuncSetCacheConfig(MyKernel, cudaFuncCachePreferShared ); -// For 2.0 capability: 48 KB shared and 16 KB L1 -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- /* * Algorithmic constraints: * (a) blockDim.y <= 1024 diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp index 8f05448b17a6e584f16c4efbc8d3faa0debbcb4c..e401c9f74b1f304fec0fdadd1ccf5810511a7adc 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp index 1f2e394f1ebff0af1a89ca1650fef1fdea7fe40b..76e4122af2e0636ede640a96e20f01231dd39bad 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Task.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_CUDA_TASK_HPP #define KOKKOS_IMPL_CUDA_TASK_HPP diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp index ffafc47f010fdd667b8a9bad3a71ea0467226897..fc3f46bce6a62e32955b662850fc0b96481d93b2 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_TEAM_HPP #define KOKKOS_CUDA_TEAM_HPP @@ -101,6 +73,7 @@ class CudaTeamMember { public: using execution_space = Kokkos::Cuda; using scratch_memory_space = execution_space::scratch_memory_space; + using team_handle = CudaTeamMember; private: mutable void* m_team_reduce; diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp index 6da2cad011bd8681034cfdfc650b74a5c92febdf..1ade4c34b6e1bc11c1d775c299257adb22b315dd 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_UniqueToken.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_UNIQUE_TOKEN_HPP #define KOKKOS_CUDA_UNIQUE_TOKEN_HPP diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp index d3d881424c1359f77402519196f083eb7a8a75f4..a3f4f2f4cccf5dbdbb1abd951cd4f515394bc3dc 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_Vectorization.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_VECTORIZATION_HPP #define KOKKOS_CUDA_VECTORIZATION_HPP diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp index a1758208252c9c1e22aa8d1c1f636b5b2e12278c..a18661f2f28fafe46c5c41af83586412c2c71f95 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_View.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXPERIMENTAL_CUDA_VIEW_HPP #define KOKKOS_EXPERIMENTAL_CUDA_VIEW_HPP @@ -54,89 +26,12 @@ namespace Kokkos { namespace Impl { -// Cuda Texture fetches can be performed for 4, 8 and 16 byte objects -// (int,int2,int4) Via reinterpret_case this can be used to support all scalar -// types of those sizes. Any other scalar type falls back to either normal reads -// out of global memory, or using the __ldg intrinsic on Kepler GPUs or newer -// (Compute Capability >= 3.0) - -template <typename ValueType, typename AliasType> -struct CudaTextureFetch { - ::cudaTextureObject_t m_obj; - const ValueType* m_ptr; - int m_offset; - - // Deference operator pulls through texture object and returns by value - template <typename iType> - KOKKOS_INLINE_FUNCTION ValueType operator[](const iType& i) const { - KOKKOS_IF_ON_DEVICE( - (AliasType v = tex1Dfetch<AliasType>(m_obj, i + m_offset); - return *(reinterpret_cast<ValueType*>(&v));)) - KOKKOS_IF_ON_HOST((return m_ptr[i];)) - } - - // Pointer to referenced memory - KOKKOS_INLINE_FUNCTION - operator const ValueType*() const { return m_ptr; } - - KOKKOS_INLINE_FUNCTION - CudaTextureFetch() : m_obj(), m_ptr(), m_offset() {} - - KOKKOS_DEFAULTED_FUNCTION - ~CudaTextureFetch() = default; - - KOKKOS_INLINE_FUNCTION - CudaTextureFetch(const CudaTextureFetch& rhs) - : m_obj(rhs.m_obj), m_ptr(rhs.m_ptr), m_offset(rhs.m_offset) {} - - KOKKOS_INLINE_FUNCTION - CudaTextureFetch(CudaTextureFetch&& rhs) - : m_obj(rhs.m_obj), m_ptr(rhs.m_ptr), m_offset(rhs.m_offset) {} - - KOKKOS_INLINE_FUNCTION - CudaTextureFetch& operator=(const CudaTextureFetch& rhs) { - m_obj = rhs.m_obj; - m_ptr = rhs.m_ptr; - m_offset = rhs.m_offset; - return *this; - } - - KOKKOS_INLINE_FUNCTION - CudaTextureFetch& operator=(CudaTextureFetch&& rhs) { - m_obj = rhs.m_obj; - m_ptr = rhs.m_ptr; - m_offset = rhs.m_offset; - return *this; - } - - // Texture object spans the entire allocation. - // This handle may view a subset of the allocation, so an offset is required. - template <class CudaMemorySpace> - inline explicit CudaTextureFetch( - const ValueType* const arg_ptr, - Kokkos::Impl::SharedAllocationRecord<CudaMemorySpace, void>* record) - : m_obj(record->template attach_texture_object<AliasType>()), - m_ptr(arg_ptr), - m_offset(record->attach_texture_object_offset( - reinterpret_cast<const AliasType*>(arg_ptr))) {} - - // Texture object spans the entire allocation. - // This handle may view a subset of the allocation, so an offset is required. - KOKKOS_INLINE_FUNCTION - CudaTextureFetch(const CudaTextureFetch& rhs, size_t offset) - : m_obj(rhs.m_obj), - m_ptr(rhs.m_ptr + offset), - m_offset(offset + rhs.m_offset) {} -}; - -#if defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC) - template <typename ValueType, typename AliasType> struct CudaLDGFetch { const ValueType* m_ptr; template <typename iType> - KOKKOS_INLINE_FUNCTION ValueType operator[](const iType& i) const { + KOKKOS_FUNCTION ValueType operator[](const iType& i) const { #if defined(KOKKOS_ARCH_KEPLER30) || defined(KOKKOS_ARCH_KEPLER32) return m_ptr[i]; #else @@ -147,46 +42,20 @@ struct CudaLDGFetch { #endif } - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION operator const ValueType*() const { return m_ptr; } - KOKKOS_INLINE_FUNCTION - CudaLDGFetch() : m_ptr() {} - KOKKOS_DEFAULTED_FUNCTION - ~CudaLDGFetch() = default; - - KOKKOS_INLINE_FUNCTION - CudaLDGFetch(const CudaLDGFetch& rhs) : m_ptr(rhs.m_ptr) {} - - KOKKOS_INLINE_FUNCTION - CudaLDGFetch(CudaLDGFetch&& rhs) : m_ptr(rhs.m_ptr) {} - - KOKKOS_INLINE_FUNCTION - CudaLDGFetch& operator=(const CudaLDGFetch& rhs) { - m_ptr = rhs.m_ptr; - return *this; - } - - KOKKOS_INLINE_FUNCTION - CudaLDGFetch& operator=(CudaLDGFetch&& rhs) { - m_ptr = rhs.m_ptr; - return *this; - } + CudaLDGFetch() = default; - template <class CudaMemorySpace> - inline explicit CudaLDGFetch( - const ValueType* const arg_ptr, - Kokkos::Impl::SharedAllocationRecord<CudaMemorySpace, void>*) - : m_ptr(arg_ptr) {} + KOKKOS_FUNCTION + explicit CudaLDGFetch(const ValueType* const arg_ptr) : m_ptr(arg_ptr) {} - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION CudaLDGFetch(CudaLDGFetch const rhs, size_t offset) : m_ptr(rhs.m_ptr + offset) {} }; -#endif - } // namespace Impl } // namespace Kokkos @@ -196,7 +65,7 @@ struct CudaLDGFetch { namespace Kokkos { namespace Impl { -/** \brief Replace Default ViewDataHandle with Cuda texture fetch +/** \brief Replace Default ViewDataHandle with CudaLDGFetch * specialization if 'const' value type, CudaSpace and random access. */ template <class Traits> @@ -228,11 +97,7 @@ class ViewDataHandle< (sizeof(value_type) == 8), ::int2, std::conditional_t<(sizeof(value_type) == 16), ::int4, void>>>; -#if defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC) using handle_type = Kokkos::Impl::CudaLDGFetch<value_type, alias_type>; -#else - using handle_type = Kokkos::Impl::CudaTextureFetch<value_type, alias_type>; -#endif KOKKOS_INLINE_FUNCTION static handle_type const& assign(handle_type const& arg_handle, @@ -248,48 +113,9 @@ class ViewDataHandle< KOKKOS_INLINE_FUNCTION static handle_type assign(value_type* arg_data_ptr, - track_type const& arg_tracker) { + track_type const& /*arg_tracker*/) { if (arg_data_ptr == nullptr) return handle_type(); - -#if !defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC) - KOKKOS_IF_ON_HOST(( - // Assignment of texture = non-texture requires creation of a texture - // object which can only occur on the host. In addition, 'get_record' - // is only valid if called in a host execution space - - using memory_space = typename Traits::memory_space; - using record = - typename Impl::SharedAllocationRecord<memory_space, void>; - - record* const r = arg_tracker.template get_record<memory_space>(); - - if (0 == r) { - Kokkos::abort( - "Cuda const random access View using Cuda texture memory " - "requires " - "Kokkos to allocate the View's memory"); - } - - return handle_type(arg_data_ptr, r);)) -#else - KOKKOS_IF_ON_HOST(( - // Assignment of texture = non-texture requires creation of a texture - // object which can only occur on the host. In addition, 'get_record' - // is only valid if called in a host execution space - - using memory_space = typename Traits::memory_space; - using record = - typename Impl::SharedAllocationRecord<memory_space, void>; - - record* const r = arg_tracker.template get_record<memory_space>(); - - return handle_type(arg_data_ptr, r);)) -#endif - - KOKKOS_IF_ON_DEVICE( - ((void)arg_tracker; Kokkos::Impl::cuda_abort( - "Cannot create Cuda texture object from within a Cuda kernel"); - return handle_type();)) + return handle_type(arg_data_ptr); } }; diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp index fb3a6b138fea5bbf48654320b8c787b3f999cdad..d5d11f499a2bc857aa2e26e826eeb3f6b1e7ac01 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_WorkGraphPolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_WORKGRAPHPOLICY_HPP #define KOKKOS_CUDA_WORKGRAPHPOLICY_HPP @@ -79,7 +51,11 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>, Policy const& get_policy() const { return m_policy; } __device__ inline void operator()() const noexcept { - if (0 == (threadIdx.y % 16)) { + // The following makes most threads idle, + // which helps significantly with throughput due to reducing conflict rates + // on the work acquisition, updated based on perf experiments of the + // static Fibonacci experiment on Volta + if (0 == (threadIdx.y % 4)) { // Spin until COMPLETED_TOKEN. // END_TOKEN indicates no work is currently available. @@ -89,6 +65,12 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>, exec_one<typename Policy::work_tag>(w); m_policy.completed_work(w); } +// On pre-volta architectures we need a __syncwarp here to prevent +// infinite loops depending on the scheduling order above +#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \ + defined(KOKKOS_ARCH_PASCAL) + __syncwarp(__activemask()); +#endif } } } @@ -100,8 +82,7 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>, const int shared = 0; Kokkos::Impl::CudaParallelLaunch<Self>( - *this, grid, block, shared, Cuda().impl_internal_space_instance(), - false); + *this, grid, block, shared, Cuda().impl_internal_space_instance()); } inline ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy) diff --git a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp index c0daa274f82a62c17dd40515622b7d9c0092d6ef..c8d6641d1ee7ae66899d2a76caaad6d12cbaaeec 100644 --- a/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp +++ b/packages/kokkos/core/src/Cuda/Kokkos_Cuda_abort.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_ABORT_HPP #define KOKKOS_CUDA_ABORT_HPP @@ -64,7 +36,6 @@ extern __device__ void __assertfail(const void *message, const void *file, namespace Kokkos { namespace Impl { -#if !defined(__APPLE__) // required to workaround failures in random number generator unit tests with // pre-volta architectures #if defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK) @@ -87,11 +58,6 @@ __device__ inline void cuda_abort(const char *const message) { ; #endif } -#else -__device__ inline void cuda_abort(const char *const message) { - // __assertfail is not supported on MAC -} -#endif } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp new file mode 100644 index 0000000000000000000000000000000000000000..766f815c72c97da7ea5e12e069c3940b65669a8e --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP.cpp @@ -0,0 +1,165 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#endif + +#include <HIP/Kokkos_HIP.hpp> +#include <HIP/Kokkos_HIP_Instance.hpp> +#include <HIP/Kokkos_HIP_Locks.hpp> + +#include <impl/Kokkos_DeviceManagement.hpp> +#include <impl/Kokkos_ExecSpaceManager.hpp> + +#include <hip/hip_runtime_api.h> + +namespace Kokkos { + +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 +int HIP::concurrency() { +#else +int HIP::concurrency() const { +#endif + return Impl::HIPInternal::concurrency(); +} + +int HIP::impl_is_initialized() { + return Impl::HIPInternal::singleton().is_initialized(); +} + +void HIP::impl_initialize(InitializationSettings const& settings) { + const int hip_device_id = Impl::get_gpu(settings); + + Impl::HIPInternal::m_hipDev = hip_device_id; + KOKKOS_IMPL_HIP_SAFE_CALL( + hipGetDeviceProperties(&Impl::HIPInternal::m_deviceProp, hip_device_id)); + const auto& hipProp = Impl::HIPInternal::m_deviceProp; + KOKKOS_IMPL_HIP_SAFE_CALL(hipSetDevice(hip_device_id)); + + // number of multiprocessors + Impl::HIPInternal::m_multiProcCount = hipProp.multiProcessorCount; + + //---------------------------------- + // Maximum number of warps, + // at most one warp per thread in a warp for reduction. + Impl::HIPInternal::m_maxWarpCount = + hipProp.maxThreadsPerBlock / Impl::HIPTraits::WarpSize; + if (Impl::HIPTraits::WarpSize < Impl::HIPInternal::m_maxWarpCount) { + Impl::HIPInternal::m_maxWarpCount = Impl::HIPTraits::WarpSize; + } + int constexpr WordSize = sizeof(size_type); + Impl::HIPInternal::m_maxSharedWords = hipProp.sharedMemPerBlock / WordSize; + + //---------------------------------- + // Maximum number of blocks + Impl::HIPInternal::m_maxBlock[0] = hipProp.maxGridSize[0]; + Impl::HIPInternal::m_maxBlock[1] = hipProp.maxGridSize[1]; + Impl::HIPInternal::m_maxBlock[2] = hipProp.maxGridSize[2]; + + // theoretically, we can get 40 WF's / CU, but only can sustain 32 see + // https://github.com/ROCm-Developer-Tools/HIP/blob/a0b5dfd625d99af7e288629747b40dd057183173/vdi/hip_platform.cpp#L742 + Impl::HIPInternal::m_maxWavesPerCU = 32; + Impl::HIPInternal::m_shmemPerSM = hipProp.maxSharedMemoryPerMultiProcessor; + Impl::HIPInternal::m_maxShmemPerBlock = hipProp.sharedMemPerBlock; + Impl::HIPInternal::m_maxThreadsPerSM = + Impl::HIPInternal::m_maxWavesPerCU * Impl::HIPTraits::WarpSize; + + // Init the array for used for arbitrarily sized atomics + Impl::initialize_host_hip_lock_arrays(); + + // Allocate a staging buffer for constant mem in pinned host memory + // and an event to avoid overwriting driver for previous kernel launches + KOKKOS_IMPL_HIP_SAFE_CALL( + hipHostMalloc((void**)&Impl::HIPInternal::constantMemHostStaging, + Impl::HIPTraits::ConstantMemoryUsage)); + + KOKKOS_IMPL_HIP_SAFE_CALL( + hipEventCreate(&Impl::HIPInternal::constantMemReusable)); + + hipStream_t singleton_stream; + KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&singleton_stream)); + Impl::HIPInternal::singleton().initialize(singleton_stream, /*manage*/ true); +} + +void HIP::impl_finalize() { Impl::HIPInternal::singleton().finalize(); } + +HIP::HIP() + : m_space_instance(&Impl::HIPInternal::singleton(), + [](Impl::HIPInternal*) {}) { + Impl::HIPInternal::singleton().verify_is_initialized( + "HIP instance constructor"); +} + +HIP::HIP(hipStream_t const stream, bool manage_stream) + : m_space_instance(new Impl::HIPInternal, [](Impl::HIPInternal* ptr) { + ptr->finalize(); + delete ptr; + }) { + Impl::HIPInternal::singleton().verify_is_initialized( + "HIP instance constructor"); + m_space_instance->initialize(stream, manage_stream); +} + +void HIP::print_configuration(std::ostream& os, bool /*verbose*/) const { + os << "Device Execution Space:\n"; + os << " KOKKOS_ENABLE_HIP: yes\n"; + + os << "HIP Options:\n"; + os << " KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE: "; +#ifdef KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE + os << "yes\n"; +#else + os << "no\n"; +#endif + + os << "\nRuntime Configuration:\n"; + + m_space_instance->print_configuration(os); +} + +uint32_t HIP::impl_instance_id() const noexcept { + return m_space_instance->impl_get_instance_id(); +} +void HIP::impl_static_fence(const std::string& name) { + Kokkos::Tools::Experimental::Impl::profile_fence_event<HIP>( + name, + Kokkos::Tools::Experimental::SpecialSynchronizationCases:: + GlobalDeviceSynchronization, + [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipDeviceSynchronize()); }); +} + +void HIP::fence(const std::string& name) const { + m_space_instance->fence(name); +} + +hipStream_t HIP::hip_stream() const { return m_space_instance->m_stream; } + +int HIP::hip_device() const { return impl_internal_space_instance()->m_hipDev; } + +hipDeviceProp_t const& HIP::hip_device_prop() { + return Impl::HIPInternal::singleton().m_deviceProp; +} + +const char* HIP::name() { return "HIP"; } + +namespace Impl { + +int g_hip_space_factory_initialized = initialize_space_factory<HIP>("150_HIP"); + +} // namespace Impl + +} // namespace Kokkos diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d48be3228088f63f6c341a99f724d0af2fbcdfca --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP.hpp @@ -0,0 +1,162 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_HIP_HPP +#define KOKKOS_HIP_HPP + +#include <Kokkos_Core_fwd.hpp> + +#include <Kokkos_Layout.hpp> +#include <HIP/Kokkos_HIP_Space.hpp> + +#include <hip/hip_runtime_api.h> + +namespace Kokkos { +namespace Impl { +class HIPInternal; +} +/// \class HIP +/// \brief Kokkos device for multicore processors in the host memory space. +class HIP { + public: + //------------------------------------ + //! \name Type declarations that all Kokkos devices must provide. + //@{ + + //! Tag this class as a kokkos execution space + using execution_space = HIP; + using memory_space = HIPSpace; + using device_type = Kokkos::Device<execution_space, memory_space>; + + using array_layout = LayoutLeft; + using size_type = HIPSpace::size_type; + + using scratch_memory_space = ScratchMemorySpace<HIP>; + + HIP(); + HIP(hipStream_t stream, bool manage_stream = false); + + //@} + //------------------------------------ + //! \name Functions that all Kokkos devices must implement. + //@{ + + KOKKOS_INLINE_FUNCTION static int in_parallel() { +#if defined(__HIP_DEVICE_COMPILE__) + return true; +#else + return false; +#endif + } + + /** \brief Wait until all dispatched functors complete. + * + * The parallel_for or parallel_reduce dispatch of a functor may return + * asynchronously, before the functor completes. This method does not return + * until all dispatched functors on this device have completed. + */ + static void impl_static_fence(const std::string& name); + + void fence(const std::string& name = + "Kokkos::HIP::fence(): Unnamed Instance Fence") const; + + hipStream_t hip_stream() const; + + /// \brief Print configuration information to the given output stream. + void print_configuration(std::ostream& os, bool verbose = false) const; + + /// \brief Free any resources being consumed by the device. + static void impl_finalize(); + + /** \brief Initialize the device. + * + */ + int hip_device() const; + static hipDeviceProp_t const& hip_device_prop(); + + static void impl_initialize(InitializationSettings const&); + + static int impl_is_initialized(); + + // static size_type device_arch(); + + static size_type detect_device_count(); + +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + static int concurrency(); +#else + int concurrency() const; +#endif + static const char* name(); + + inline Impl::HIPInternal* impl_internal_space_instance() const { + return m_space_instance.get(); + } + + uint32_t impl_instance_id() const noexcept; + + private: + friend bool operator==(HIP const& lhs, HIP const& rhs) { + return lhs.impl_internal_space_instance() == + rhs.impl_internal_space_instance(); + } + friend bool operator!=(HIP const& lhs, HIP const& rhs) { + return !(lhs == rhs); + } + Kokkos::Impl::HostSharedPtr<Impl::HIPInternal> m_space_instance; +}; + +namespace Impl { +template <> +struct MemorySpaceAccess<HIPSpace, HIP::scratch_memory_space> { + enum : bool { assignable = false }; + enum : bool { accessible = true }; + enum : bool { deepcopy = false }; +}; +} // namespace Impl + +namespace Tools { +namespace Experimental { +template <> +struct DeviceTypeTraits<HIP> { + static constexpr DeviceType id = DeviceType::HIP; + static int device_id(const HIP& exec) { return exec.hip_device(); } +}; +} // namespace Experimental +} // namespace Tools + +namespace Impl { +template <class DT, class... DP> +struct ZeroMemset<HIP, DT, DP...> { + ZeroMemset(const HIP& exec_space, const View<DT, DP...>& dst, + typename View<DT, DP...>::const_value_type&) { + KOKKOS_IMPL_HIP_SAFE_CALL(hipMemsetAsync( + dst.data(), 0, + dst.size() * sizeof(typename View<DT, DP...>::value_type), + exec_space.hip_stream())); + } + + ZeroMemset(const View<DT, DP...>& dst, + typename View<DT, DP...>::const_value_type&) { + KOKKOS_IMPL_HIP_SAFE_CALL( + hipMemset(dst.data(), 0, + dst.size() * sizeof(typename View<DT, DP...>::value_type))); + } +}; +} // namespace Impl +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp index dcc5863721e9dc364969316f5aef59efd92de48e..fdf688fdad8f817239fb4c6e1f04c8ae9ea236d3 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Abort.hpp @@ -1,67 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_ABORT_HPP #define KOKKOS_HIP_ABORT_HPP #include <Kokkos_Macros.hpp> -#if defined(KOKKOS_ENABLE_HIP) #include <hip/hip_runtime.h> -// FIXME_HIP ROCm 4.5 version header include would be <rocm/rocm_version.h> -#if __has_include(<rocm_version.h>) -#include <rocm_version.h> -#define KOKKOS_IMPL_ROCM_VERSION \ - ROCM_VERSION_MAJOR * 10000 + ROCM_VERSION_MINOR * 100 + ROCM_VERSION_PATCH -#endif - -// FIXME_HIP workaround for ROCm version less than 5.0.2 -#if KOKKOS_IMPL_ROCM_VERSION < 50002 -#define KOKKOS_IMPL_HIP_ABORT_DOES_NOT_PRINT_MESSAGE -#endif - namespace Kokkos { namespace Impl { @@ -82,4 +41,3 @@ namespace Impl { } // namespace Kokkos #endif -#endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp index 88bcab62645e651f5dba4d76c832c2d9cb7013d2..49f89ed332e30a587fbd681a84d1f36354d2d0ec 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Atomic.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_ATOMIC_HPP #define KOKKOS_HIP_ATOMIC_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp index 87551ae50896d0f497ab561babc5890b4d04b3c6..1f084c41e50e64a516e14c4f31b5f75856ca2bbe 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_BlockSize_Deduction.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_BLOCKSIZE_DEDUCTION_HPP #define KOKKOS_HIP_BLOCKSIZE_DEDUCTION_HPP @@ -54,7 +26,6 @@ #include <HIP/Kokkos_HIP_KernelLaunch.hpp> namespace Kokkos { -namespace Experimental { namespace Impl { enum class BlockType { Max, Preferred }; @@ -63,9 +34,8 @@ template <typename DriverType, typename LaunchBounds = Kokkos::LaunchBounds<>, HIPLaunchMechanism LaunchMechanism = DeduceHIPLaunchMechanism<DriverType>::launch_mechanism> unsigned get_preferred_blocksize_impl() { - // FIXME_HIP - could be if constexpr for c++17 - if (!HIPParallelLaunch<DriverType, LaunchBounds, - LaunchMechanism>::default_launchbounds()) { + if constexpr (!HIPParallelLaunch<DriverType, LaunchBounds, + LaunchMechanism>::default_launchbounds()) { // use the user specified value return LaunchBounds::maxTperB; } else { @@ -77,14 +47,12 @@ unsigned get_preferred_blocksize_impl() { } } -// FIXME_HIP - entire function could be constexpr for c++17 template <typename DriverType, typename LaunchBounds = Kokkos::LaunchBounds<>, HIPLaunchMechanism LaunchMechanism = DeduceHIPLaunchMechanism<DriverType>::launch_mechanism> -unsigned get_max_blocksize_impl() { - // FIXME_HIP - could be if constexpr for c++17 - if (!HIPParallelLaunch<DriverType, LaunchBounds, - LaunchMechanism>::default_launchbounds()) { +constexpr unsigned get_max_blocksize_impl() { + if constexpr (!HIPParallelLaunch<DriverType, LaunchBounds, + LaunchMechanism>::default_launchbounds()) { // use the user specified value return LaunchBounds::maxTperB; } else { @@ -105,15 +73,13 @@ hipFuncAttributes get_hip_func_attributes_impl() { return HIPParallelLaunch<DriverType, LaunchBounds, LaunchMechanism>::get_hip_func_attributes(); #else - // FIXME_HIP - could be if constexpr for c++17 - if (!HIPParallelLaunch<DriverType, LaunchBounds, - LaunchMechanism>::default_launchbounds()) { + if constexpr (!HIPParallelLaunch<DriverType, LaunchBounds, + LaunchMechanism>::default_launchbounds()) { // for user defined, we *always* honor the request return HIPParallelLaunch<DriverType, LaunchBounds, LaunchMechanism>::get_hip_func_attributes(); } else { - // FIXME_HIP - could be if constexpr for c++17 - if (BlockSize == BlockType::Max) { + if constexpr (BlockSize == BlockType::Max) { return HIPParallelLaunch< DriverType, Kokkos::LaunchBounds<HIPTraits::MaxThreadsPerBlock, 1>, LaunchMechanism>::get_hip_func_attributes(); @@ -154,8 +120,7 @@ unsigned hip_internal_get_block_size(const HIPInternal *hip_instance, // find how many threads we can fit with this blocksize based on LDS usage unsigned tperb_shmem = total_shmem > shmem_per_sm ? 0 : block_size; - // FIXME_HIP - could be if constexpr for c++17 - if (BlockSize == BlockType::Max) { + if constexpr (BlockSize == BlockType::Max) { // we want the maximum blocksize possible // just wait until we get a case where we can fit the LDS per SM if (tperb_shmem) return block_size; @@ -296,7 +261,6 @@ unsigned hip_get_max_team_blocksize(HIPInternal const *hip_instance, } } // namespace Impl -} // namespace Experimental } // namespace Kokkos #endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d1f3d95adf22666d5e1395ce0d705cd069228f39 --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.cpp @@ -0,0 +1,58 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#endif + +#include <HIP/Kokkos_HIP_DeepCopy.hpp> +#include <HIP/Kokkos_HIP_Error.hpp> // HIP_SAFE_CALL +#include <HIP/Kokkos_HIP.hpp> + +namespace Kokkos { +namespace Impl { +namespace { +hipStream_t get_deep_copy_stream() { + static hipStream_t s = nullptr; + if (s == nullptr) { + KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&s)); + } + return s; +} +} // namespace + +void DeepCopyHIP(void* dst, void const* src, size_t n) { + KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(dst, src, n, hipMemcpyDefault)); +} + +void DeepCopyAsyncHIP(const HIP& instance, void* dst, void const* src, + size_t n) { + KOKKOS_IMPL_HIP_SAFE_CALL( + hipMemcpyAsync(dst, src, n, hipMemcpyDefault, instance.hip_stream())); +} + +void DeepCopyAsyncHIP(void* dst, void const* src, size_t n) { + hipStream_t s = get_deep_copy_stream(); + KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(dst, src, n, hipMemcpyDefault, s)); + Kokkos::Tools::Experimental::Impl::profile_fence_event<HIP>( + "Kokkos::Impl::DeepCopyAsyncHIP: Post Deep Copy Fence on Deep-Copy " + "stream", + Kokkos::Tools::Experimental::SpecialSynchronizationCases:: + DeepCopyResourceSynchronization, + [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(s)); }); +} +} // namespace Impl +} // namespace Kokkos diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..206ce4bb67a207050ba7a5670455b4b228fd862f --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_DeepCopy.hpp @@ -0,0 +1,134 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_HIP_DEEP_COPY_HPP +#define KOKKOS_HIP_DEEP_COPY_HPP + +#include <HIP/Kokkos_HIP_Space.hpp> +#include <HIP/Kokkos_HIP_Error.hpp> // HIP_SAFE_CALL + +#include <hip/hip_runtime_api.h> + +namespace Kokkos { +namespace Impl { + +void DeepCopyHIP(void* dst, const void* src, size_t n); +void DeepCopyAsyncHIP(const HIP& instance, void* dst, const void* src, + size_t n); +void DeepCopyAsyncHIP(void* dst, const void* src, size_t n); + +template <class MemSpace> +struct DeepCopy<MemSpace, HostSpace, HIP, + std::enable_if_t<is_hip_type_space<MemSpace>::value>> { + DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); } + DeepCopy(const HIP& instance, void* dst, const void* src, size_t n) { + DeepCopyAsyncHIP(instance, dst, src, n); + } +}; + +template <class MemSpace> +struct DeepCopy<HostSpace, MemSpace, HIP, + std::enable_if_t<is_hip_type_space<MemSpace>::value>> { + DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); } + DeepCopy(const HIP& instance, void* dst, const void* src, size_t n) { + DeepCopyAsyncHIP(instance, dst, src, n); + } +}; + +template <class MemSpace1, class MemSpace2> +struct DeepCopy<MemSpace1, MemSpace2, HIP, + std::enable_if_t<is_hip_type_space<MemSpace1>::value && + is_hip_type_space<MemSpace2>::value>> { + DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); } + DeepCopy(const HIP& instance, void* dst, const void* src, size_t n) { + DeepCopyAsyncHIP(instance, dst, src, n); + } +}; + +template <class MemSpace1, class MemSpace2, class ExecutionSpace> +struct DeepCopy<MemSpace1, MemSpace2, ExecutionSpace, + std::enable_if_t<is_hip_type_space<MemSpace1>::value && + is_hip_type_space<MemSpace2>::value && + !std::is_same<ExecutionSpace, HIP>::value>> { + inline DeepCopy(void* dst, const void* src, size_t n) { + DeepCopyHIP(dst, src, n); + } + + inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, + size_t n) { + exec.fence(fence_string()); + DeepCopyAsyncHIP(dst, src, n); + } + + private: + static const std::string& fence_string() { + static const std::string string = + std::string("Kokkos::Impl::DeepCopy<") + MemSpace1::name() + "Space, " + + MemSpace2::name() + + "Space, ExecutionSpace>::DeepCopy: fence before copy"; + return string; + } +}; + +template <class MemSpace, class ExecutionSpace> +struct DeepCopy<MemSpace, HostSpace, ExecutionSpace, + std::enable_if_t<is_hip_type_space<MemSpace>::value && + !std::is_same<ExecutionSpace, HIP>::value>> { + inline DeepCopy(void* dst, const void* src, size_t n) { + DeepCopyHIP(dst, src, n); + } + + inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, + size_t n) { + exec.fence(fence_string()); + DeepCopyAsyncHIP(dst, src, n); + } + + private: + static const std::string& fence_string() { + static const std::string string = + std::string("Kokkos::Impl::DeepCopy<") + MemSpace::name() + + "Space, HostSpace, ExecutionSpace>::DeepCopy: fence before copy"; + return string; + } +}; + +template <class MemSpace, class ExecutionSpace> +struct DeepCopy<HostSpace, MemSpace, ExecutionSpace, + std::enable_if_t<is_hip_type_space<MemSpace>::value && + !std::is_same<ExecutionSpace, HIP>::value>> { + inline DeepCopy(void* dst, const void* src, size_t n) { + DeepCopyHIP(dst, src, n); + } + + inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, + size_t n) { + exec.fence(fence_string()); + DeepCopyAsyncHIP(dst, src, n); + } + + private: + static const std::string& fence_string() { + static const std::string string = + std::string("Kokkos::Impl::DeepCopy<HostSpace, ") + MemSpace::name() + + "Space, ExecutionSpace>::DeepCopy: fence before copy"; + return string; + } +}; +} // namespace Impl +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp index a75e7a4a6c9351c0d39f7b2f7e8719a1a81c0adf..e09382c7056fb5ffdce8f40e553fd66910484005 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Error.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_ERROR_HPP #define KOKKOS_HIP_ERROR_HPP @@ -66,30 +38,12 @@ inline void hip_internal_safe_call(hipError_t e, const char* name, } } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - -KOKKOS_DEPRECATED -inline void hip_internal_safe_call_deprecated(hipError_t e, const char* name, - const char* file = nullptr, - const int line = 0) { - hip_internal_safe_call(e, name, file, line); -} - -#endif - } // namespace Impl } // namespace Kokkos #define KOKKOS_IMPL_HIP_SAFE_CALL(call) \ Kokkos::Impl::hip_internal_safe_call(call, #call, __FILE__, __LINE__) -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -#define HIP_SAFE_CALL(call) \ - Kokkos::Impl::hip_internal_safe_call_deprecated(call, #call, __FILE__, \ - __LINE__) - -#endif - namespace Kokkos { namespace Experimental { diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp index d04fe2051a435df04691d84392b0b460f5ce1747..fa0373a87ea87a1c17439909d419988bc156d6a3 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Conversion.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_HALF_HPP_ #define KOKKOS_HIP_HALF_HPP_ @@ -48,7 +20,7 @@ #ifdef KOKKOS_IMPL_HALF_TYPE_DEFINED #include <Kokkos_Half.hpp> -#include <Kokkos_NumericTraits.hpp> // reduction_identity +#include <Kokkos_ReductionIdentity.hpp> namespace Kokkos { namespace Experimental { diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp index 728a229c1a825a366b012de8f474644108587180..64c7706f94571ab66976f4a1aa79fb13f76ac3a9 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Half_Impl_Type.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_HALF_IMPL_TYPE_HPP_ #define KOKKOS_HIP_HALF_IMPL_TYPE_HPP_ diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp index 3785cfe80b4974a4a0f74d2e0376b116f7641e6a..28c9c1cb6ad19dad002ac1ddae807dba36e6b459 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /*--------------------------------------------------------------------------*/ /* Kokkos interfaces */ @@ -52,8 +24,8 @@ #include <Kokkos_Core.hpp> #include <HIP/Kokkos_HIP_Instance.hpp> -#include <Kokkos_HIP.hpp> -#include <Kokkos_HIP_Space.hpp> +#include <HIP/Kokkos_HIP.hpp> +#include <HIP/Kokkos_HIP_Space.hpp> #include <impl/Kokkos_Error.hpp> /*--------------------------------------------------------------------------*/ @@ -68,71 +40,37 @@ #ifdef KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE __device__ __constant__ unsigned long kokkos_impl_hip_constant_memory_buffer - [Kokkos::Experimental::Impl::HIPTraits::ConstantMemoryUsage / - sizeof(unsigned long)]; + [Kokkos::Impl::HIPTraits::ConstantMemoryUsage / sizeof(unsigned long)]; #endif namespace Kokkos { namespace Impl { -Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace> -hip_global_unique_token_locks(bool deallocate) { - static Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace> locks = - Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace>(); +Kokkos::View<uint32_t *, HIPSpace> hip_global_unique_token_locks( + bool deallocate) { + static Kokkos::View<uint32_t *, HIPSpace> locks = + Kokkos::View<uint32_t *, HIPSpace>(); if (!deallocate && locks.extent(0) == 0) - locks = Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace>( - "Kokkos::UniqueToken<HIP>::m_locks", - Kokkos::Experimental::HIP().concurrency()); - if (deallocate) - locks = Kokkos::View<uint32_t *, Kokkos::Experimental::HIPSpace>(); + locks = Kokkos::View<uint32_t *, HIPSpace>( + "Kokkos::UniqueToken<HIP>::m_locks", HIPInternal::concurrency()); + if (deallocate) locks = Kokkos::View<uint32_t *, HIPSpace>(); return locks; } } // namespace Impl } // namespace Kokkos namespace Kokkos { -namespace Experimental { -namespace { -class HIPInternalDevices { - public: - enum { MAXIMUM_DEVICE_COUNT = 64 }; - struct hipDeviceProp_t m_hipProp[MAXIMUM_DEVICE_COUNT]; - int m_hipDevCount; - - HIPInternalDevices(); - - static HIPInternalDevices const &singleton(); -}; - -HIPInternalDevices::HIPInternalDevices() { - KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceCount(&m_hipDevCount)); - - if (m_hipDevCount > MAXIMUM_DEVICE_COUNT) { - Kokkos::abort( - "Sorry, you have more GPUs per node than we thought anybody would ever " - "have. Please report this to github.com/kokkos/kokkos."); - } - for (int i = 0; i < m_hipDevCount; ++i) { - KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceProperties(m_hipProp + i, i)); - } -} - -const HIPInternalDevices &HIPInternalDevices::singleton() { - static HIPInternalDevices self; - return self; -} -} // namespace - -unsigned long *Impl::HIPInternal::constantMemHostStaging = nullptr; -hipEvent_t Impl::HIPInternal::constantMemReusable = nullptr; -std::mutex Impl::HIPInternal::constantMemMutex; namespace Impl { //---------------------------------------------------------------------------- -void HIPInternal::print_configuration(std::ostream &s) const { - const HIPInternalDevices &dev_info = HIPInternalDevices::singleton(); +int HIPInternal::concurrency() { + static int const concurrency = m_deviceProp.maxThreadsPerMultiProcessor * + m_deviceProp.multiProcessorCount; + return concurrency; +} +void HIPInternal::print_configuration(std::ostream &s) const { s << "macro KOKKOS_ENABLE_HIP : defined" << '\n'; #if defined(HIP_VERSION) s << "macro HIP_VERSION = " << HIP_VERSION << " = version " @@ -140,15 +78,18 @@ void HIPInternal::print_configuration(std::ostream &s) const { << '\n'; #endif - for (int i = 0; i < dev_info.m_hipDevCount; ++i) { - s << "Kokkos::Experimental::HIP[ " << i << " ] " - << dev_info.m_hipProp[i].name << " version " - << (dev_info.m_hipProp[i].major) << "." << dev_info.m_hipProp[i].minor - << ", Total Global Memory: " - << ::Kokkos::Impl::human_memory_size(dev_info.m_hipProp[i].totalGlobalMem) + int hipDevCount; + KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceCount(&hipDevCount)); + + for (int i = 0; i < hipDevCount; ++i) { + hipDeviceProp_t hipProp; + KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceProperties(&hipProp, i)); + + s << "Kokkos::HIP[ " << i << " ] " + << "gcnArch " << hipProp.gcnArch << ", Total Global Memory: " + << ::Kokkos::Impl::human_memory_size(hipProp.totalGlobalMem) << ", Shared Memory per Block: " - << ::Kokkos::Impl::human_memory_size( - dev_info.m_hipProp[i].sharedMemPerBlock); + << ::Kokkos::Impl::human_memory_size(hipProp.sharedMemPerBlock); if (m_hipDev == i) s << " : Selected"; s << '\n'; } @@ -158,18 +99,12 @@ void HIPInternal::print_configuration(std::ostream &s) const { HIPInternal::~HIPInternal() { if (m_scratchSpace || m_scratchFlags) { - std::cerr << "Kokkos::Experimental::HIP ERROR: Failed to call " - "Kokkos::Experimental::HIP::finalize()" + std::cerr << "Kokkos::HIP ERROR: Failed to call " + "Kokkos::HIP::finalize()" << std::endl; std::cerr.flush(); } - m_hipDev = -1; - m_hipArch = -1; - m_multiProcCount = 0; - m_maxWarpCount = 0; - m_maxSharedWords = 0; - m_maxShmemPerBlock = 0; m_scratchSpaceCount = 0; m_scratchFlagsCount = 0; m_scratchSpace = nullptr; @@ -179,7 +114,7 @@ HIPInternal::~HIPInternal() { int HIPInternal::verify_is_initialized(const char *const label) const { if (m_hipDev < 0) { - Kokkos::abort((std::string("Kokkos::Experimental::HIP::") + label + + Kokkos::abort((std::string("Kokkos::HIP::") + label + " : ERROR device not initialized\n") .c_str()); } @@ -201,27 +136,19 @@ void HIPInternal::fence() const { fence("Kokkos::HIPInternal::fence: Unnamed Internal Fence"); } void HIPInternal::fence(const std::string &name) const { - Kokkos::Tools::Experimental::Impl::profile_fence_event< - Kokkos::Experimental::HIP>( + Kokkos::Tools::Experimental::Impl::profile_fence_event<Kokkos::HIP>( name, Kokkos::Tools::Experimental::Impl::DirectFenceIDHandle{ impl_get_instance_id()}, - [&]() { - KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(m_stream)); - // can reset our cycle id now as well - m_cycleId = 0; - }); + [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(m_stream)); }); } -void HIPInternal::initialize(int hip_device_id, hipStream_t stream, - bool manage_stream) { +void HIPInternal::initialize(hipStream_t stream, bool manage_stream) { if (was_finalized) Kokkos::abort("Calling HIP::initialize after HIP::finalize is illegal\n"); if (is_initialized()) return; - int constexpr WordSize = sizeof(size_type); - if (!HostSpace::execution_space::impl_is_initialized()) { const std::string msg( "HIP::initialize ERROR : HostSpace::execution_space " @@ -229,59 +156,12 @@ void HIPInternal::initialize(int hip_device_id, hipStream_t stream, Kokkos::Impl::throw_runtime_exception(msg); } - const HIPInternalDevices &dev_info = HIPInternalDevices::singleton(); - const bool ok_init = nullptr == m_scratchSpace || nullptr == m_scratchFlags; - // Need at least a GPU device - const bool ok_id = - 0 <= hip_device_id && hip_device_id < dev_info.m_hipDevCount; - - if (ok_init && ok_id) { - const struct hipDeviceProp_t &hipProp = dev_info.m_hipProp[hip_device_id]; - - m_hipDev = hip_device_id; - m_deviceProp = hipProp; + if (ok_init) { + m_stream = stream; + m_manage_stream = manage_stream; - KOKKOS_IMPL_HIP_SAFE_CALL(hipSetDevice(m_hipDev)); - - m_stream = stream; - m_manage_stream = manage_stream; - m_team_scratch_current_size = 0; - m_team_scratch_ptr = nullptr; - - // number of multiprocessors - m_multiProcCount = hipProp.multiProcessorCount; - - //---------------------------------- - // Maximum number of warps, - // at most one warp per thread in a warp for reduction. - m_maxWarpCount = hipProp.maxThreadsPerBlock / Impl::HIPTraits::WarpSize; - if (HIPTraits::WarpSize < m_maxWarpCount) { - m_maxWarpCount = Impl::HIPTraits::WarpSize; - } - m_maxSharedWords = hipProp.sharedMemPerBlock / WordSize; - - //---------------------------------- - // Maximum number of blocks - m_maxBlock[0] = hipProp.maxGridSize[0]; - m_maxBlock[1] = hipProp.maxGridSize[1]; - m_maxBlock[2] = hipProp.maxGridSize[2]; - - // theoretically, we can get 40 WF's / CU, but only can sustain 32 - // see - // https://github.com/ROCm-Developer-Tools/HIP/blob/a0b5dfd625d99af7e288629747b40dd057183173/vdi/hip_platform.cpp#L742 - m_maxWavesPerCU = 32; - // FIXME_HIP - Nick to implement this upstream - // Register count comes from Sec. 2.2. "Data Sharing" of the - // Vega 7nm ISA document (see the diagram) - // https://developer.amd.com/wp-content/resources/Vega_7nm_Shader_ISA.pdf - // VGPRS = 4 (SIMD/CU) * 256 VGPR/SIMD * 64 registers / VGPR = - // 65536 VGPR/CU - m_regsPerSM = 65536; - m_shmemPerSM = hipProp.maxSharedMemoryPerMultiProcessor; - m_maxShmemPerBlock = hipProp.sharedMemPerBlock; - m_maxThreadsPerSM = m_maxWavesPerCU * HIPTraits::WarpSize; //---------------------------------- // Multiblock reduction uses scratch flags for counters // and scratch space for partial reduction values. @@ -293,81 +173,36 @@ void HIPInternal::initialize(int hip_device_id, hipStream_t stream, (void)scratch_flags(reduce_block_count * 2 * sizeof(size_type)); (void)scratch_space(reduce_block_count * 16 * sizeof(size_type)); } - //---------------------------------- - // Concurrent bitset for obtaining unique tokens from within - // an executing kernel. - { - const int32_t buffer_bound = - Kokkos::Impl::concurrent_bitset::buffer_bound(HIP::concurrency()); - - // Allocate and initialize uint32_t[ buffer_bound ] - - using Record = - Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::HIPSpace, - void>; - - Record *const r = Record::allocate(Kokkos::Experimental::HIPSpace(), - "Kokkos::InternalScratchBitset", - sizeof(uint32_t) * buffer_bound); - - Record::increment(r); - } - //---------------------------------- - } else { std::ostringstream msg; - msg << "Kokkos::Experimental::HIP::initialize(" << hip_device_id - << ") FAILED"; - - if (!ok_init) { - msg << " : Already initialized"; - } - if (!ok_id) { - msg << " : Device identifier out of range " - << "[0.." << dev_info.m_hipDevCount - 1 << "]"; - } + msg << "Kokkos::HIP::initialize(" << m_hipDev + << ") FAILED : Already initialized"; Kokkos::Impl::throw_runtime_exception(msg.str()); } - // Init the array for used for arbitrarily sized atomics - if (m_stream == nullptr) ::Kokkos::Impl::initialize_host_hip_lock_arrays(); - - // Allocate a staging buffer for constant mem in pinned host memory - // and an event to avoid overwriting driver for previous kernel launches - if (m_stream == nullptr) { - KOKKOS_IMPL_HIP_SAFE_CALL(hipHostMalloc((void **)&constantMemHostStaging, - HIPTraits::ConstantMemoryUsage)); - - KOKKOS_IMPL_HIP_SAFE_CALL(hipEventCreate(&constantMemReusable)); - } - KOKKOS_IMPL_HIP_SAFE_CALL( - hipMalloc(&m_scratch_locks, sizeof(int32_t) * HIP::concurrency())); + hipMalloc(&m_scratch_locks, sizeof(int32_t) * concurrency())); KOKKOS_IMPL_HIP_SAFE_CALL( - hipMemset(m_scratch_locks, 0, sizeof(int32_t) * HIP::concurrency())); + hipMemset(m_scratch_locks, 0, sizeof(int32_t) * concurrency())); } //---------------------------------------------------------------------------- -using ScratchGrain = - Kokkos::Experimental::HIP::size_type[Impl::HIPTraits::WarpSize]; +using ScratchGrain = Kokkos::HIP::size_type[Impl::HIPTraits::WarpSize]; enum { sizeScratchGrain = sizeof(ScratchGrain) }; -Kokkos::Experimental::HIP::size_type *HIPInternal::scratch_space( - const std::size_t size) { +Kokkos::HIP::size_type *HIPInternal::scratch_space(const std::size_t size) { if (verify_is_initialized("scratch_space") && m_scratchSpaceCount * sizeScratchGrain < size) { m_scratchSpaceCount = (size + sizeScratchGrain - 1) / sizeScratchGrain; - using Record = - Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::HIPSpace, - void>; + using Record = Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPSpace, void>; if (m_scratchSpace) Record::decrement(Record::get_record(m_scratchSpace)); - Record *const r = Record::allocate( - Kokkos::Experimental::HIPSpace(), "Kokkos::InternalScratchSpace", - (sizeScratchGrain * m_scratchSpaceCount)); + Record *const r = + Record::allocate(Kokkos::HIPSpace(), "Kokkos::InternalScratchSpace", + (sizeScratchGrain * m_scratchSpaceCount)); Record::increment(r); @@ -377,21 +212,18 @@ Kokkos::Experimental::HIP::size_type *HIPInternal::scratch_space( return m_scratchSpace; } -Kokkos::Experimental::HIP::size_type *HIPInternal::scratch_flags( - const std::size_t size) { +Kokkos::HIP::size_type *HIPInternal::scratch_flags(const std::size_t size) { if (verify_is_initialized("scratch_flags") && m_scratchFlagsCount * sizeScratchGrain < size) { m_scratchFlagsCount = (size + sizeScratchGrain - 1) / sizeScratchGrain; - using Record = - Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::HIPSpace, - void>; + using Record = Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPSpace, void>; if (m_scratchFlags) Record::decrement(Record::get_record(m_scratchFlags)); - Record *const r = Record::allocate( - Kokkos::Experimental::HIPSpace(), "Kokkos::InternalScratchFlags", - (sizeScratchGrain * m_scratchFlagsCount)); + Record *const r = + Record::allocate(Kokkos::HIPSpace(), "Kokkos::InternalScratchFlags", + (sizeScratchGrain * m_scratchFlagsCount)); Record::increment(r); @@ -404,20 +236,86 @@ Kokkos::Experimental::HIP::size_type *HIPInternal::scratch_flags( return m_scratchFlags; } -void *HIPInternal::resize_team_scratch_space(std::int64_t bytes, +Kokkos::HIP::size_type *HIPInternal::stage_functor_for_execution( + void const *driver, std::size_t const size) const { + if (verify_is_initialized("scratch_functor") && m_scratchFunctorSize < size) { + m_scratchFunctorSize = size; + + using Record = Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPSpace, void>; + using RecordHost = + Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPHostPinnedSpace, void>; + + if (m_scratchFunctor) { + Record::decrement(Record::get_record(m_scratchFunctor)); + RecordHost::decrement(RecordHost::get_record(m_scratchFunctorHost)); + } + + Record *const r = + Record::allocate(Kokkos::HIPSpace(), "Kokkos::InternalScratchFunctor", + m_scratchFunctorSize); + RecordHost *const r_host = RecordHost::allocate( + Kokkos::HIPHostPinnedSpace(), "Kokkos::InternalScratchFunctorHost", + m_scratchFunctorSize); + + Record::increment(r); + RecordHost::increment(r_host); + + m_scratchFunctor = reinterpret_cast<size_type *>(r->data()); + m_scratchFunctorHost = reinterpret_cast<size_type *>(r_host->data()); + } + + // When using HSA_XNACK=1, it is necessary to copy the driver to the host to + // ensure that the driver is not destroyed before the computation is done. + // Without this fix, all the atomic tests fail. It is not obvious that this + // problem is limited to HSA_XNACK=1 even if all the tests pass when + // HSA_XNACK=0. That's why we always copy the driver. + KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(m_stream)); + std::memcpy(m_scratchFunctorHost, driver, size); + KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(m_scratchFunctor, + m_scratchFunctorHost, size, + hipMemcpyDefault, m_stream)); + + return m_scratchFunctor; +} + +int HIPInternal::acquire_team_scratch_space() { + int current_team_scratch = 0; + int zero = 0; + while (!m_team_scratch_pool[current_team_scratch].compare_exchange_weak( + zero, 1, std::memory_order_release, std::memory_order_relaxed)) { + current_team_scratch = (current_team_scratch + 1) % m_n_team_scratch; + } + + return current_team_scratch; +} + +void *HIPInternal::resize_team_scratch_space(int scratch_pool_id, + std::int64_t bytes, bool force_shrink) { - if (m_team_scratch_current_size == 0) { - m_team_scratch_current_size = bytes; - m_team_scratch_ptr = Kokkos::kokkos_malloc<Kokkos::Experimental::HIPSpace>( - "Kokkos::HIPSpace::TeamScratchMemory", m_team_scratch_current_size); + // Multiple ParallelFor/Reduce Teams can call this function at the same time + // and invalidate the m_team_scratch_ptr. We use a pool to avoid any race + // condition. + if (m_team_scratch_current_size[scratch_pool_id] == 0) { + m_team_scratch_current_size[scratch_pool_id] = bytes; + m_team_scratch_ptr[scratch_pool_id] = + Kokkos::kokkos_malloc<Kokkos::HIPSpace>( + "Kokkos::HIPSpace::TeamScratchMemory", + m_team_scratch_current_size[scratch_pool_id]); } - if ((bytes > m_team_scratch_current_size) || - ((bytes < m_team_scratch_current_size) && (force_shrink))) { - m_team_scratch_current_size = bytes; - m_team_scratch_ptr = Kokkos::kokkos_realloc<Kokkos::Experimental::HIPSpace>( - m_team_scratch_ptr, m_team_scratch_current_size); + if ((bytes > m_team_scratch_current_size[scratch_pool_id]) || + ((bytes < m_team_scratch_current_size[scratch_pool_id]) && + (force_shrink))) { + m_team_scratch_current_size[scratch_pool_id] = bytes; + m_team_scratch_ptr[scratch_pool_id] = + Kokkos::kokkos_realloc<Kokkos::HIPSpace>( + m_team_scratch_ptr[scratch_pool_id], + m_team_scratch_current_size[scratch_pool_id]); } - return m_team_scratch_ptr; + return m_team_scratch_ptr[scratch_pool_id]; +} + +void HIPInternal::release_team_scratch_space(int scratch_pool_id) { + m_team_scratch_pool[scratch_pool_id] = 0; } //---------------------------------------------------------------------------- @@ -428,108 +326,71 @@ void HIPInternal::finalize() { if (this == &singleton()) { (void)Kokkos::Impl::hip_global_unique_token_locks(true); + Impl::finalize_host_hip_lock_arrays(); + KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(constantMemHostStaging)); KOKKOS_IMPL_HIP_SAFE_CALL(hipEventDestroy(constantMemReusable)); } if (nullptr != m_scratchSpace || nullptr != m_scratchFlags) { - using RecordHIP = - Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::HIPSpace>; + using RecordHIP = Kokkos::Impl::SharedAllocationRecord<Kokkos::HIPSpace>; RecordHIP::decrement(RecordHIP::get_record(m_scratchFlags)); RecordHIP::decrement(RecordHIP::get_record(m_scratchSpace)); - if (m_team_scratch_current_size > 0) - Kokkos::kokkos_free<Kokkos::Experimental::HIPSpace>(m_team_scratch_ptr); - - if (m_manage_stream && m_stream != nullptr) - KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamDestroy(m_stream)); + if (m_scratchFunctorSize > 0) { + RecordHIP::decrement(RecordHIP::get_record(m_scratchFunctor)); + RecordHIP::decrement(RecordHIP::get_record(m_scratchFunctorHost)); + } } - m_hipDev = -1; - m_hipArch = -1; - m_multiProcCount = 0; - m_maxWarpCount = 0; - m_maxBlock = {0, 0, 0}; - m_maxSharedWords = 0; - m_maxShmemPerBlock = 0; - m_scratchSpaceCount = 0; - m_scratchFlagsCount = 0; - m_scratchSpace = nullptr; - m_scratchFlags = nullptr; - m_stream = nullptr; - m_team_scratch_current_size = 0; - m_team_scratch_ptr = nullptr; + for (int i = 0; i < m_n_team_scratch; ++i) { + if (m_team_scratch_current_size[i] > 0) + Kokkos::kokkos_free<Kokkos::HIPSpace>(m_team_scratch_ptr[i]); + } - KOKKOS_IMPL_HIP_SAFE_CALL(hipFree(m_scratch_locks)); - m_scratch_locks = nullptr; + if (m_manage_stream && m_stream != nullptr) + KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamDestroy(m_stream)); - if (nullptr != d_driverWorkArray) { - KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(d_driverWorkArray)); - d_driverWorkArray = nullptr; + m_scratchSpaceCount = 0; + m_scratchFlagsCount = 0; + m_scratchSpace = nullptr; + m_scratchFlags = nullptr; + m_stream = nullptr; + for (int i = 0; i < m_n_team_scratch; ++i) { + m_team_scratch_current_size[i] = 0; + m_team_scratch_ptr[i] = nullptr; } -} -char *HIPInternal::get_next_driver(size_t driverTypeSize) const { - if (d_driverWorkArray == nullptr) { - KOKKOS_IMPL_HIP_SAFE_CALL( - hipHostMalloc(&d_driverWorkArray, - m_maxDriverCycles * m_maxDriverTypeSize * sizeof(char), - hipHostMallocNonCoherent)); - } - if (driverTypeSize > m_maxDriverTypeSize) { - // fence handles the cycle id reset for us - fence( - "Kokkos::HIPInternal::get_next_driver: fence before reallocating " - "resources"); - KOKKOS_IMPL_HIP_SAFE_CALL(hipHostFree(d_driverWorkArray)); - m_maxDriverTypeSize = driverTypeSize; - if (m_maxDriverTypeSize % 128 != 0) - m_maxDriverTypeSize = - m_maxDriverTypeSize + 128 - m_maxDriverTypeSize % 128; - KOKKOS_IMPL_HIP_SAFE_CALL( - hipHostMalloc(&d_driverWorkArray, - m_maxDriverCycles * m_maxDriverTypeSize * sizeof(char), - hipHostMallocNonCoherent)); - } else { - m_cycleId = (m_cycleId + 1) % m_maxDriverCycles; - if (m_cycleId == 0) { - // ensure any outstanding kernels are completed before we wrap around - fence( - "Kokkos::HIPInternal::get_next_driver: fence before reusing first " - "driver"); - } - } - return &d_driverWorkArray[m_maxDriverTypeSize * m_cycleId]; + KOKKOS_IMPL_HIP_SAFE_CALL(hipFree(m_scratch_locks)); + m_scratch_locks = nullptr; } //---------------------------------------------------------------------------- -Kokkos::Experimental::HIP::size_type hip_internal_multiprocessor_count() { +Kokkos::HIP::size_type hip_internal_multiprocessor_count() { return HIPInternal::singleton().m_multiProcCount; } -Kokkos::Experimental::HIP::size_type hip_internal_maximum_warp_count() { +Kokkos::HIP::size_type hip_internal_maximum_warp_count() { return HIPInternal::singleton().m_maxWarpCount; } -std::array<Kokkos::Experimental::HIP::size_type, 3> -hip_internal_maximum_grid_count() { +std::array<Kokkos::HIP::size_type, 3> hip_internal_maximum_grid_count() { return HIPInternal::singleton().m_maxBlock; } -Kokkos::Experimental::HIP::size_type *hip_internal_scratch_space( - const HIP &instance, const std::size_t size) { +Kokkos::HIP::size_type *hip_internal_scratch_space(const HIP &instance, + const std::size_t size) { return instance.impl_internal_space_instance()->scratch_space(size); } -Kokkos::Experimental::HIP::size_type *hip_internal_scratch_flags( - const HIP &instance, const std::size_t size) { +Kokkos::HIP::size_type *hip_internal_scratch_flags(const HIP &instance, + const std::size_t size) { return instance.impl_internal_space_instance()->scratch_flags(size); } } // namespace Impl -} // namespace Experimental } // namespace Kokkos //---------------------------------------------------------------------------- @@ -537,8 +398,7 @@ Kokkos::Experimental::HIP::size_type *hip_internal_scratch_flags( namespace Kokkos { namespace Impl { void hip_device_synchronize(const std::string &name) { - Kokkos::Tools::Experimental::Impl::profile_fence_event< - Kokkos::Experimental::HIP>( + Kokkos::Tools::Experimental::Impl::profile_fence_event<Kokkos::HIP>( name, Kokkos::Tools::Experimental::SpecialSynchronizationCases:: GlobalDeviceSynchronization, @@ -561,9 +421,9 @@ void hip_internal_error_throw(hipError_t e, const char *name, const char *file, //---------------------------------------------------------------------------- namespace Kokkos { -namespace Experimental { HIP::size_type HIP::detect_device_count() { - return HIPInternalDevices::singleton().m_hipDevCount; + int hipDevCount; + KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDeviceCount(&hipDevCount)); + return hipDevCount; } -} // namespace Experimental } // namespace Kokkos diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp index d8f265834a0e5103b322201a6a5ab8bb86568b7f..06fab84b56d9b3548945c78f7542f7fb6e31556f 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Instance.hpp @@ -1,65 +1,42 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /*--------------------------------------------------------------------------*/ #ifndef KOKKOS_HIP_INSTANCE_HPP #define KOKKOS_HIP_INSTANCE_HPP -#include <Kokkos_HIP_Space.hpp> +#include <HIP/Kokkos_HIP_Space.hpp> #include <HIP/Kokkos_HIP_Error.hpp> #include <mutex> namespace Kokkos { -namespace Experimental { namespace Impl { struct HIPTraits { +#if defined(KOKKOS_ARCH_VEGA) static int constexpr WarpSize = 64; static int constexpr WarpIndexMask = 0x003f; /* hexadecimal for 63 */ static int constexpr WarpIndexShift = 6; /* WarpSize == 1 << WarpShift*/ +#elif defined(KOKKOS_ARCH_NAVI) + static int constexpr WarpSize = 32; + static int constexpr WarpIndexMask = 0x001f; /* hexadecimal for 31 */ + static int constexpr WarpIndexShift = 5; /* WarpSize == 1 << WarpShift*/ +#endif static int constexpr ConservativeThreadsPerBlock = 256; // conservative fallback blocksize in case of spills static int constexpr MaxThreadsPerBlock = @@ -88,70 +65,64 @@ class HIPInternal { HIPInternal &operator=(const HIPInternal &); public: - using size_type = ::Kokkos::Experimental::HIP::size_type; - - int m_hipDev = -1; - int m_hipArch = -1; - unsigned m_multiProcCount = 0; - unsigned m_maxWarpCount = 0; - std::array<size_type, 3> m_maxBlock = {0, 0, 0}; - unsigned m_maxWavesPerCU = 0; - unsigned m_maxSharedWords = 0; - int m_regsPerSM; - int m_shmemPerSM = 0; - int m_maxShmemPerBlock = 0; - int m_maxThreadsPerSM = 0; - - // array of DriverTypes to be allocated in host-pinned memory for async - // kernel launches - mutable char *d_driverWorkArray = nullptr; - // number of kernel launches that can be in-flight w/o synchronization - const int m_maxDriverCycles = 100; - // max size of a DriverType [bytes] - mutable size_t m_maxDriverTypeSize = 1024 * 10; - // the current index in the driverWorkArray - mutable int m_cycleId = 0; - // mutex to access d_driverWorkArray - mutable std::mutex m_mutexWorkArray; - // mutex to access shared memory - mutable std::mutex m_mutexSharedMemory; + using size_type = ::Kokkos::HIP::size_type; - // Scratch Spaces for Reductions - std::size_t m_scratchSpaceCount = 0; - std::size_t m_scratchFlagsCount = 0; + inline static int m_hipDev = -1; + inline static int m_hipArch = -1; + inline static unsigned m_multiProcCount = 0; + inline static unsigned m_maxWarpCount = 0; + inline static std::array<size_type, 3> m_maxBlock = {0, 0, 0}; + inline static unsigned m_maxWavesPerCU = 0; + inline static unsigned m_maxSharedWords = 0; + inline static int m_shmemPerSM = 0; + inline static int m_maxShmemPerBlock = 0; + inline static int m_maxThreadsPerSM = 0; - size_type *m_scratchSpace = nullptr; - size_type *m_scratchFlags = nullptr; + inline static hipDeviceProp_t m_deviceProp; - hipDeviceProp_t m_deviceProp; + static int concurrency(); - hipStream_t m_stream = nullptr; - uint32_t m_instance_id = Kokkos::Tools::Experimental::Impl::idForInstance< - Kokkos::Experimental::HIP>(reinterpret_cast<uintptr_t>(this)); + // Scratch Spaces for Reductions + std::size_t m_scratchSpaceCount = 0; + std::size_t m_scratchFlagsCount = 0; + mutable std::size_t m_scratchFunctorSize = 0; + + size_type *m_scratchSpace = nullptr; + size_type *m_scratchFlags = nullptr; + mutable size_type *m_scratchFunctor = nullptr; + mutable size_type *m_scratchFunctorHost = nullptr; + inline static std::mutex scratchFunctorMutex; + + hipStream_t m_stream = nullptr; + uint32_t m_instance_id = + Kokkos::Tools::Experimental::Impl::idForInstance<HIP>( + reinterpret_cast<uintptr_t>(this)); bool m_manage_stream = false; // Team Scratch Level 1 Space - mutable int64_t m_team_scratch_current_size = 0; - mutable void *m_team_scratch_ptr = nullptr; - mutable std::mutex m_team_scratch_mutex; + int m_n_team_scratch = 10; + mutable int64_t m_team_scratch_current_size[10] = {}; + mutable void *m_team_scratch_ptr[10] = {}; + mutable std::atomic_int m_team_scratch_pool[10] = {}; std::int32_t *m_scratch_locks; bool was_finalized = false; // FIXME_HIP: these want to be per-device, not per-stream... use of 'static' // here will break once there are multiple devices though - static unsigned long *constantMemHostStaging; - static hipEvent_t constantMemReusable; - static std::mutex constantMemMutex; + inline static unsigned long *constantMemHostStaging = nullptr; + inline static hipEvent_t constantMemReusable = nullptr; + inline static std::mutex constantMemMutex; static HIPInternal &singleton(); int verify_is_initialized(const char *const label) const; - int is_initialized() const { return m_hipDev >= 0; } + int is_initialized() const { + return nullptr != m_scratchSpace && nullptr != m_scratchFlags; + } - void initialize(int hip_device_id, hipStream_t stream = nullptr, - bool manage_stream = false); + void initialize(hipStream_t stream, bool manage_stream); void finalize(); void print_configuration(std::ostream &) const; @@ -159,24 +130,26 @@ class HIPInternal { void fence() const; void fence(const std::string &) const; - // returns the next driver type pointer in our work array - char *get_next_driver(size_t driverTypeSize) const; - ~HIPInternal(); HIPInternal() = default; // Resizing of reduction related scratch spaces - size_type *scratch_space(const std::size_t size); - size_type *scratch_flags(const std::size_t size); + size_type *scratch_space(std::size_t const size); + size_type *scratch_flags(std::size_t const size); + size_type *stage_functor_for_execution(void const *driver, + std::size_t const size) const; uint32_t impl_get_instance_id() const noexcept; + int acquire_team_scratch_space(); // Resizing of team level 1 scratch - void *resize_team_scratch_space(std::int64_t bytes, + void *resize_team_scratch_space(int scratch_pool_id, std::int64_t bytes, bool force_shrink = false); + void release_team_scratch_space(int scratch_pool_id); }; } // namespace Impl +namespace Experimental { // Partitioning an Execution Space: expects space and integer arguments for // relative weight // Customization point for backends @@ -194,11 +167,9 @@ inline void create_HIP_instances(std::vector<HIP> &instances) { template <class... Args> std::vector<HIP> partition_space(const HIP &, Args...) { -#ifdef __cpp_fold_expressions static_assert( (... && std::is_arithmetic_v<Args>), "Kokkos Error: partitioning arguments must be integers or floats"); -#endif std::vector<HIP> instances(sizeof...(Args)); Impl::create_HIP_instances(instances); diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp index 70b979e00abd6775904b900899eb3200a8c00581..8e8895f65a960c000da6941f8d67ac57bd64817a 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_KernelLaunch.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_KERNEL_LAUNCH_HPP #define KOKKOS_HIP_KERNEL_LAUNCH_HPP @@ -51,7 +23,7 @@ #include <HIP/Kokkos_HIP_Error.hpp> #include <HIP/Kokkos_HIP_Instance.hpp> -#include <Kokkos_HIP_Space.hpp> +#include <HIP/Kokkos_HIP_Space.hpp> #include <HIP/Kokkos_HIP_Locks.hpp> // Must use global variable on the device with HIP-Clang @@ -61,23 +33,19 @@ __device__ __constant__ extern unsigned long kokkos_impl_hip_constant_memory_buffer[]; #else __device__ __constant__ unsigned long kokkos_impl_hip_constant_memory_buffer - [Kokkos::Experimental::Impl::HIPTraits::ConstantMemoryUsage / - sizeof(unsigned long)]; + [Kokkos::Impl::HIPTraits::ConstantMemoryUsage / sizeof(unsigned long)]; #endif #endif namespace Kokkos { -namespace Experimental { template <typename T> inline __device__ T *kokkos_impl_hip_shared_memory() { - extern __shared__ Kokkos::Experimental::HIPSpace::size_type sh[]; + extern __shared__ Kokkos::HIPSpace::size_type sh[]; return (T *)sh; } -} // namespace Experimental } // namespace Kokkos namespace Kokkos { -namespace Experimental { namespace Impl { // The hip_parallel_launch_*_memory code is identical to the cuda code @@ -100,18 +68,16 @@ __global__ __launch_bounds__( template <class DriverType> __global__ static void hip_parallel_launch_local_memory( - const DriverType *driver) { - // FIXME_HIP driver() pass by copy - driver->operator()(); + const DriverType driver) { + driver(); } template <class DriverType, unsigned int maxTperB, unsigned int minBperSM> __global__ __launch_bounds__( maxTperB, minBperSM) static void hip_parallel_launch_local_memory(const DriverType - *driver) { - // FIXME_HIP driver() pass by copy - driver->operator()(); + driver) { + driver(); } template <typename DriverType> @@ -161,6 +127,9 @@ struct DeduceHIPLaunchMechanism { light_weight = Kokkos::Experimental::WorkItemProperty::HintLightWeight; static constexpr Kokkos::Experimental::WorkItemProperty::HintHeavyWeight_t heavy_weight = Kokkos::Experimental::WorkItemProperty::HintHeavyWeight; + static constexpr Kokkos::Experimental::WorkItemProperty:: + ImplForceGlobalLaunch_t force_global_launch = + Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch; static constexpr typename DriverType::Policy::work_item_property property = typename DriverType::Policy::work_item_property(); @@ -194,15 +163,17 @@ struct DeduceHIPLaunchMechanism { // Kal<F<CMU CG LCG C C CG LG C G CG CG C C // CMU<F G LCG G G G LG G G G CG G G static constexpr HIPLaunchMechanism launch_mechanism = - ((property & light_weight) == light_weight) - ? (sizeof(DriverType) < HIPTraits::KernelArgumentLimit - ? HIPLaunchMechanism::LocalMemory - : HIPLaunchMechanism::GlobalMemory) - : (((property & heavy_weight) == heavy_weight) - ? (sizeof(DriverType) < HIPTraits::ConstantMemoryUsage - ? HIPLaunchMechanism::ConstantMemory - : HIPLaunchMechanism::GlobalMemory) - : (default_launch_mechanism)); + ((property & force_global_launch) == force_global_launch) + ? HIPLaunchMechanism::GlobalMemory + : ((property & light_weight) == light_weight) + ? (sizeof(DriverType) < HIPTraits::KernelArgumentLimit + ? HIPLaunchMechanism::LocalMemory + : HIPLaunchMechanism::GlobalMemory) + : (((property & heavy_weight) == heavy_weight) + ? (sizeof(DriverType) < HIPTraits::ConstantMemoryUsage + ? HIPLaunchMechanism::ConstantMemory + : HIPLaunchMechanism::GlobalMemory) + : (default_launch_mechanism)); }; template <typename DriverType, typename LaunchBounds, @@ -391,7 +362,7 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds, using base_t = HIPParallelLaunchKernelFunc<DriverType, LaunchBounds, HIPLaunchMechanism::LocalMemory>; - static void invoke_kernel(DriverType const *driver, dim3 const &grid, + static void invoke_kernel(DriverType const &driver, dim3 const &grid, dim3 const &block, int shmem, HIPInternal const *hip_instance) { (base_t::get_kernel_func())<<<grid, block, shmem, hip_instance->m_stream>>>( @@ -408,13 +379,16 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds, using base_t = HIPParallelLaunchKernelFunc<DriverType, LaunchBounds, HIPLaunchMechanism::GlobalMemory>; - // FIXME_HIP the code is different than cuda because driver cannot be passed - // by copy - static void invoke_kernel(DriverType const *driver, dim3 const &grid, + static void invoke_kernel(DriverType const &driver, dim3 const &grid, dim3 const &block, int shmem, HIPInternal const *hip_instance) { + // Wait until the previous kernel that uses m_scratchFuntor is done + std::lock_guard<std::mutex> lock(HIPInternal::scratchFunctorMutex); + DriverType *driver_ptr = reinterpret_cast<DriverType *>( + hip_instance->stage_functor_for_execution( + reinterpret_cast<void const *>(&driver), sizeof(DriverType))); (base_t::get_kernel_func())<<<grid, block, shmem, hip_instance->m_stream>>>( - driver); + driver_ptr); } }; @@ -431,7 +405,7 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds, "Kokkos Error: Requested HIPLaunchConstantMemory with a " "Functor larger than 32kB."); - static void invoke_kernel(DriverType const *driver, dim3 const &grid, + static void invoke_kernel(DriverType const &driver, dim3 const &grid, dim3 const &block, int shmem, HIPInternal const *hip_instance) { // Wait until the previous kernel that uses the constant buffer is done @@ -441,7 +415,8 @@ struct HIPParallelLaunchKernelInvoker<DriverType, LaunchBounds, // Copy functor (synchronously) to staging buffer in pinned host memory unsigned long *staging = hip_instance->constantMemHostStaging; - std::memcpy((void *)staging, (void *)driver, sizeof(DriverType)); + std::memcpy(static_cast<void *>(staging), + static_cast<const void *>(&driver), sizeof(DriverType)); // Copy functor asynchronously from there to constant memory on the device KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyToSymbolAsync( @@ -490,18 +465,13 @@ struct HIPParallelLaunch< KOKKOS_ENSURE_HIP_LOCK_ARRAYS_ON_DEVICE(); - std::lock_guard<std::mutex> const lock(hip_instance->m_mutexWorkArray); - // Invoke the driver function on the device - DriverType *d_driver = reinterpret_cast<DriverType *>( - hip_instance->get_next_driver(sizeof(DriverType))); - std::memcpy((void *)d_driver, (void *)&driver, sizeof(DriverType)); - base_t::invoke_kernel(d_driver, grid, block, shmem, hip_instance); + base_t::invoke_kernel(driver, grid, block, shmem, hip_instance); #if defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK) KOKKOS_IMPL_HIP_SAFE_CALL(hipGetLastError()); hip_instance->fence( - "Kokkos::Experimental::Impl::HIParallelLaunch: Debug Only Check for " + "Kokkos::Impl::HIParallelLaunch: Debug Only Check for " "Execution Error"); #endif } @@ -521,9 +491,8 @@ void hip_parallel_launch(const DriverType &driver, const dim3 &grid, HIPParallelLaunch<DriverType, LaunchBounds, LaunchMechanism>( driver, grid, block, shmem, hip_instance, prefer_shmem); #else - // FIXME_HIP - could be if constexpr for c++17 - if (!HIPParallelLaunch<DriverType, LaunchBounds, - LaunchMechanism>::default_launchbounds()) { + if constexpr (!HIPParallelLaunch<DriverType, LaunchBounds, + LaunchMechanism>::default_launchbounds()) { // for user defined, we *always* honor the request HIPParallelLaunch<DriverType, LaunchBounds, LaunchMechanism>( driver, grid, block, shmem, hip_instance, prefer_shmem); @@ -547,7 +516,6 @@ void hip_parallel_launch(const DriverType &driver, const dim3 &grid, #endif } } // namespace Impl -} // namespace Experimental } // namespace Kokkos #endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp index f1ffaf3753a3edef4431f1838d7cbd302f410277..76d3f6f5c8ef4079f2854ee7525f513159fb01a5 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -50,7 +22,8 @@ #include <HIP/Kokkos_HIP_Locks.hpp> #include <HIP/Kokkos_HIP_Error.hpp> -#include <Kokkos_HIP_Space.hpp> +#include <HIP/Kokkos_HIP.hpp> +#include <HIP/Kokkos_HIP_Instance.hpp> #include <hip/hip_runtime.h> @@ -91,7 +64,7 @@ void initialize_host_hip_lock_arrays() { &g_host_hip_lock_arrays.atomic, sizeof(std::int32_t) * (KOKKOS_IMPL_HIP_SPACE_ATOMIC_MASK + 1))); - g_host_hip_lock_arrays.n = ::Kokkos::Experimental::HIP::concurrency(); + g_host_hip_lock_arrays.n = HIPInternal::concurrency(); KOKKOS_COPY_HIP_LOCK_ARRAYS_TO_DEVICE(); init_lock_array_kernel_atomic<<< diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.hpp index c72616dab166ccd0e1f3744eebbc1e2c941bf367..fbed4afd3f434c8f1fdefdb34fb7be4f20a96024 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Locks.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_LOCKS_HPP #define KOKKOS_HIP_LOCKS_HPP diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp index acb538e1cb3970bab9bafc2f44d3568b34c6c31f..58e13cf3e824408984ae559ebc46fc81f2e91cf8 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_MDRangePolicy.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #ifndef KOKKOS_HIP_MDRANGEPOLICY_HPP_ #define KOKKOS_HIP_MDRANGEPOLICY_HPP_ @@ -6,13 +22,13 @@ namespace Kokkos { template <> -struct default_outer_direction<Kokkos::Experimental::HIP> { +struct default_outer_direction<HIP> { using type = Iterate; static constexpr Iterate value = Iterate::Left; }; template <> -struct default_inner_direction<Kokkos::Experimental::HIP> { +struct default_inner_direction<HIP> { using type = Iterate; static constexpr Iterate value = Iterate::Left; }; @@ -21,18 +37,21 @@ namespace Impl { // Settings for MDRangePolicy template <> -inline TileSizeProperties get_tile_size_properties<Kokkos::Experimental::HIP>( - const Kokkos::Experimental::HIP& space) { +inline TileSizeProperties get_tile_size_properties<HIP>(const HIP& space) { TileSizeProperties properties; properties.max_threads = space.impl_internal_space_instance()->m_maxThreadsPerSM; properties.default_largest_tile_size = 16; properties.default_tile_size = 4; - properties.max_total_tile_size = - Kokkos::Experimental::Impl::HIPTraits::MaxThreadsPerBlock; + properties.max_total_tile_size = HIPTraits::MaxThreadsPerBlock; return properties; } +// Settings for TeamMDRangePolicy +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, HIP, ThreadAndVector> + : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {}; + } // Namespace Impl } // Namespace Kokkos #endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp index 212bbb9ecd8a35f30f0d121d1b368af087d13c8a..10ec301d15d1fcfd735b809a43aad858362f3fad 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_MDRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_PARALLEL_MDRANGE_HPP #define KOKKOS_HIP_PARALLEL_MDRANGE_HPP @@ -56,8 +28,7 @@ namespace Kokkos { namespace Impl { // ParallelFor template <class FunctorType, class... Traits> -class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, - Kokkos::Experimental::HIP> { +class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, HIP> { public: using Policy = Kokkos::MDRangePolicy<Traits...>; @@ -81,11 +52,9 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, } inline void execute() const { - using ClosureType = - ParallelFor<FunctorType, Policy, Kokkos::Experimental::HIP>; + using ClosureType = ParallelFor<FunctorType, Policy, HIP>; if (m_policy.m_num_tiles == 0) return; - auto const maxblocks = - Kokkos::Experimental::Impl::hip_internal_maximum_grid_count(); + auto const maxblocks = hip_internal_maximum_grid_count(); if (Policy::rank == 2) { dim3 const block(m_policy.m_tile[0], m_policy.m_tile[1], 1); dim3 const grid( @@ -98,8 +67,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, block.y, maxblocks[1]), 1); - Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType, - LaunchBounds>( + hip_parallel_launch<ClosureType, LaunchBounds>( *this, grid, block, 0, m_policy.space().impl_internal_space_instance(), false); } else if (Policy::rank == 3) { @@ -118,8 +86,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, (m_policy.m_upper[2] - m_policy.m_lower[2] + block.z - 1) / block.z, maxblocks[2])); - Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType, - LaunchBounds>( + hip_parallel_launch<ClosureType, LaunchBounds>( *this, grid, block, 0, m_policy.space().impl_internal_space_instance(), false); } else if (Policy::rank == 4) { @@ -138,8 +105,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, (m_policy.m_upper[3] - m_policy.m_lower[3] + block.z - 1) / block.z, maxblocks[2])); - Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType, - LaunchBounds>( + hip_parallel_launch<ClosureType, LaunchBounds>( *this, grid, block, 0, m_policy.space().impl_internal_space_instance(), false); } else if (Policy::rank == 5) { @@ -157,8 +123,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, (m_policy.m_upper[4] - m_policy.m_lower[4] + block.z - 1) / block.z, maxblocks[2])); - Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType, - LaunchBounds>( + hip_parallel_launch<ClosureType, LaunchBounds>( *this, grid, block, 0, m_policy.space().impl_internal_space_instance(), false); } else if (Policy::rank == 6) { @@ -174,8 +139,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, m_policy.m_tile_end[2] * m_policy.m_tile_end[3], maxblocks[1]), std::min<array_index_type>( m_policy.m_tile_end[4] * m_policy.m_tile_end[5], maxblocks[2])); - Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType, - LaunchBounds>( + hip_parallel_launch<ClosureType, LaunchBounds>( *this, grid, block, 0, m_policy.space().impl_internal_space_instance(), false); } else { @@ -190,11 +154,8 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, template <typename Policy, typename Functor> static int max_tile_size_product(const Policy&, const Functor&) { using closure_type = - ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, - Kokkos::Experimental::HIP>; - unsigned block_size = - Kokkos::Experimental::Impl::hip_get_max_blocksize<closure_type, - LaunchBounds>(); + ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, HIP>; + unsigned block_size = hip_get_max_blocksize<closure_type, LaunchBounds>(); if (block_size == 0) Kokkos::Impl::throw_runtime_exception( std::string("Kokkos::Impl::ParallelFor< HIP > could not find a valid " @@ -206,7 +167,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, // ParallelReduce template <class FunctorType, class ReducerType, class... Traits> class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, - Kokkos::Experimental::HIP> { + HIP> { public: using Policy = Kokkos::MDRangePolicy<Traits...>; @@ -235,7 +196,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, using value_type = typename Analysis::value_type; using reference_type = typename Analysis::reference_type; using functor_type = FunctorType; - using size_type = Experimental::HIP::size_type; + using size_type = HIP::size_type; // Algorithmic constraints: blockSize is a power of two AND blockDim.y == // blockDim.z == 1 @@ -247,9 +208,6 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, const bool m_result_ptr_device_accessible; size_type* m_scratch_space; size_type* m_scratch_flags; - // Only let one Parallel/Scan modify the shared memory. The - // constructor acquires the mutex which is released in the destructor. - std::lock_guard<std::mutex> m_shared_memory_lock; using DeviceIteratePattern = typename Kokkos::Impl::Reduce::DeviceIterateTile< Policy::rank, Policy, FunctorType, WorkTag, reference_type>; @@ -271,7 +229,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, { reference_type value = final_reducer.init(reinterpret_cast<pointer_type>( - Experimental::kokkos_impl_hip_shared_memory<size_type>() + + kokkos_impl_hip_shared_memory<size_type>() + threadIdx.y * word_count.value)); // Number of blocks is bounded so that the reduction can be limited to two @@ -287,13 +245,12 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, // Problem: non power-of-two blockDim if (::Kokkos::Impl::hip_single_inter_block_reduce_scan<false>( final_reducer, blockIdx.x, gridDim.x, - Experimental::kokkos_impl_hip_shared_memory<size_type>(), - m_scratch_space, m_scratch_flags)) { + kokkos_impl_hip_shared_memory<size_type>(), m_scratch_space, + m_scratch_flags)) { // This is the final block with the final result at the final threads' // location - size_type* const shared = - Experimental::kokkos_impl_hip_shared_memory<size_type>() + - (blockDim.y - 1) * word_count.value; + size_type* const shared = kokkos_impl_hip_shared_memory<size_type>() + + (blockDim.y - 1) * word_count.value; size_type* const global = m_result_ptr_device_accessible ? reinterpret_cast<size_type*>(m_result_ptr) : m_scratch_space; @@ -302,7 +259,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, final_reducer.final(reinterpret_cast<value_type*>(shared)); } - if (Experimental::Impl::HIPTraits::WarpSize < word_count.value) { + if (Impl::HIPTraits::WarpSize < word_count.value) { __syncthreads(); } @@ -320,12 +277,10 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, return hip_single_inter_block_reduce_scan_shmem<false, FunctorType, WorkTag>(f, n); }; - using closure_type = ParallelReduce<FunctorType, Policy, ReducerType, - Kokkos::Experimental::HIP>; + using closure_type = ParallelReduce<FunctorType, Policy, ReducerType, HIP>; unsigned block_size = - Kokkos::Experimental::Impl::hip_get_preferred_blocksize<closure_type, - LaunchBounds>( + Kokkos::Impl::hip_get_preferred_blocksize<closure_type, LaunchBounds>( instance, shmem_functor); if (block_size == 0) { Kokkos::Impl::throw_runtime_exception( @@ -339,9 +294,9 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, typename Analysis::Reducer final_reducer( &ReducerConditional::select(m_functor, m_reducer)); - using ClosureType = ParallelReduce<FunctorType, Policy, ReducerType, - Kokkos::Experimental::HIP>; - const auto nwork = m_policy.m_num_tiles; + using ClosureType = + ParallelReduce<FunctorType, Policy, ReducerType, Kokkos::HIP>; + const auto nwork = m_policy.m_num_tiles; if (nwork) { int block_size = m_policy.m_prod_tile_dims; // CONSTRAINT: Algorithm requires block_size >= product of tile dimensions @@ -355,15 +310,12 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, : suggested_blocksize; // Note: block_size must be less // than or equal to 512 - m_scratch_space = - ::Kokkos::Experimental::Impl::hip_internal_scratch_space( - m_policy.space(), - Analysis::value_size( - ReducerConditional::select(m_functor, m_reducer)) * - block_size /* block_size == max block_count */); + m_scratch_space = hip_internal_scratch_space( + m_policy.space(), Analysis::value_size(ReducerConditional::select( + m_functor, m_reducer)) * + block_size /* block_size == max block_count */); m_scratch_flags = - ::Kokkos::Experimental::Impl::hip_internal_scratch_flags( - m_policy.space(), sizeof(size_type)); + hip_internal_scratch_flags(m_policy.space(), sizeof(size_type)); // REQUIRED ( 1 , N , 1 ) const dim3 block(1, block_size, 1); @@ -376,8 +328,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, ::Kokkos::Impl::hip_single_inter_block_reduce_scan_shmem< false, FunctorType, WorkTag>(m_functor, block.y); - Kokkos::Experimental::Impl::hip_parallel_launch<ClosureType, - LaunchBounds>( + hip_parallel_launch<ClosureType, LaunchBounds>( *this, grid, block, shmem, m_policy.space().impl_internal_space_instance(), false); // copy to device and execute @@ -385,8 +336,8 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, if (!m_result_ptr_device_accessible && m_result_ptr) { const int size = Analysis::value_size( ReducerConditional::select(m_functor, m_reducer)); - DeepCopy<HostSpace, Experimental::HIPSpace, Experimental::HIP>( - m_policy.space(), m_result_ptr, m_scratch_space, size); + DeepCopy<HostSpace, HIPSpace, HIP>(m_policy.space(), m_result_ptr, + m_scratch_space, size); } } else { if (m_result_ptr) { @@ -405,13 +356,10 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, m_reducer(InvalidType()), m_result_ptr(arg_result.data()), m_result_ptr_device_accessible( - MemorySpaceAccess<Kokkos::Experimental::HIPSpace, + MemorySpaceAccess<HIPSpace, typename ViewType::memory_space>::accessible), m_scratch_space(nullptr), - m_scratch_flags(nullptr), - m_shared_memory_lock(m_policy.space() - .impl_internal_space_instance() - ->m_mutexSharedMemory) {} + m_scratch_flags(nullptr) {} ParallelReduce(const FunctorType& arg_functor, const Policy& arg_policy, const ReducerType& reducer) @@ -420,23 +368,17 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, m_reducer(reducer), m_result_ptr(reducer.view().data()), m_result_ptr_device_accessible( - MemorySpaceAccess<Kokkos::Experimental::HIPSpace, - typename ReducerType::result_view_type:: - memory_space>::accessible), + MemorySpaceAccess<HIPSpace, typename ReducerType::result_view_type:: + memory_space>::accessible), m_scratch_space(nullptr), - m_scratch_flags(nullptr), - m_shared_memory_lock(m_policy.space() - .impl_internal_space_instance() - ->m_mutexSharedMemory) {} + m_scratch_flags(nullptr) {} template <typename Policy, typename Functor> static int max_tile_size_product(const Policy&, const Functor&) { using closure_type = ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, - ReducerType, Kokkos::Experimental::HIP>; - unsigned block_size = - Kokkos::Experimental::Impl::hip_get_max_blocksize<closure_type, - LaunchBounds>(); + ReducerType, HIP>; + unsigned block_size = hip_get_max_blocksize<closure_type, LaunchBounds>(); if (block_size == 0) { Kokkos::Impl::throw_runtime_exception( std::string("Kokkos::Impl::ParallelReduce< HIP > could not find a " diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp index dca1fb9073e6de4f5889e0ae61c0f5a5787254de..d8c52aa95f7e991e0c65c250c41d6cd743590604 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Range.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKO_HIP_PARALLEL_RANGE_HPP #define KOKKO_HIP_PARALLEL_RANGE_HPP @@ -59,8 +31,7 @@ namespace Kokkos { namespace Impl { template <class FunctorType, class... Traits> -class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, - Kokkos::Experimental::HIP> { +class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::HIP> { public: using Policy = Kokkos::RangePolicy<Traits...>; @@ -106,11 +77,9 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, inline void execute() const { const typename Policy::index_type nwork = m_policy.end() - m_policy.begin(); - using DriverType = - ParallelFor<FunctorType, Policy, Kokkos::Experimental::HIP>; + using DriverType = ParallelFor<FunctorType, Policy, Kokkos::HIP>; const int block_size = - Kokkos::Experimental::Impl::hip_get_preferred_blocksize<DriverType, - LaunchBounds>(); + Kokkos::Impl::hip_get_preferred_blocksize<DriverType, LaunchBounds>(); const dim3 block(1, block_size, 1); const dim3 grid( typename Policy::index_type((nwork + block.y - 1) / block.y), 1, 1); @@ -120,7 +89,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, std::string("Kokkos::Impl::ParallelFor< HIP > could not find a " "valid execution configuration.")); } - Kokkos::Experimental::Impl::hip_parallel_launch<DriverType, LaunchBounds>( + Kokkos::Impl::hip_parallel_launch<DriverType, LaunchBounds>( *this, grid, block, 0, m_policy.space().impl_internal_space_instance(), false); } @@ -134,7 +103,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, template <class FunctorType, class ReducerType, class... Traits> class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, - Kokkos::Experimental::HIP> { + Kokkos::HIP> { public: using Policy = Kokkos::RangePolicy<Traits...>; @@ -161,7 +130,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, using value_type = typename Analysis::value_type; using reference_type = typename Analysis::reference_type; using functor_type = FunctorType; - using size_type = Kokkos::Experimental::HIP::size_type; + using size_type = Kokkos::HIP::size_type; using index_type = typename Policy::index_type; // Algorithmic constraints: blockSize is a power of two AND blockDim.y == @@ -175,9 +144,6 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, const bool m_result_ptr_host_accessible; size_type* m_scratch_space = nullptr; size_type* m_scratch_flags = nullptr; - // Only let one ParallelReduce/Scan modify the shared memory. The - // constructor acquires the mutex which is released in the destructor. - std::lock_guard<std::mutex> m_shared_memory_lock; static bool constexpr UseShflReduction = static_cast<bool>(Analysis::StaticValueSize); @@ -217,7 +183,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, &ReducerConditional::select(m_functor, m_reducer)); { reference_type value = final_reducer.init(reinterpret_cast<pointer_type>( - ::Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>() + + ::Kokkos::kokkos_impl_hip_shared_memory<size_type>() + threadIdx.y * word_count.value)); // Number of blocks is bounded so that the reduction can be limited to two @@ -240,14 +206,14 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, if (!do_final_reduction) do_final_reduction = hip_single_inter_block_reduce_scan<false>( final_reducer, blockIdx.x, gridDim.x, - ::Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>(), - m_scratch_space, m_scratch_flags); + ::Kokkos::kokkos_impl_hip_shared_memory<size_type>(), m_scratch_space, + m_scratch_flags); if (do_final_reduction) { // This is the final block with the final result at the final threads' // location size_type* const shared = - ::Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>() + + ::Kokkos::kokkos_impl_hip_shared_memory<size_type>() + (blockDim.y - 1) * word_count.value; size_type* const global = m_result_ptr_device_accessible ? reinterpret_cast<size_type*>(m_result_ptr) @@ -257,8 +223,7 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, final_reducer.final(reinterpret_cast<value_type*>(shared)); } - if (::Kokkos::Experimental::Impl::HIPTraits::WarpSize < - word_count.value) { + if (::Kokkos::Impl::HIPTraits::WarpSize < word_count.value) { __syncthreads(); } @@ -323,10 +288,10 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, return hip_single_inter_block_reduce_scan_shmem<false, FunctorType, WorkTag>(f, n); }; - using DriverType = ParallelReduce<FunctorType, Policy, ReducerType, - Kokkos::Experimental::HIP>; - return Kokkos::Experimental::Impl::hip_get_preferred_blocksize< - DriverType, LaunchBounds>(instance, shmem_functor); + using DriverType = + ParallelReduce<FunctorType, Policy, ReducerType, Kokkos::HIP>; + return Kokkos::Impl::hip_get_preferred_blocksize<DriverType, LaunchBounds>( + instance, shmem_functor); } inline void execute() { @@ -346,15 +311,12 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, "valid execution configuration.")); } - m_scratch_space = - ::Kokkos::Experimental::Impl::hip_internal_scratch_space( - m_policy.space(), - Analysis::value_size( - ReducerConditional::select(m_functor, m_reducer)) * - block_size /* block_size == max block_count */); - m_scratch_flags = - ::Kokkos::Experimental::Impl::hip_internal_scratch_flags( - m_policy.space(), sizeof(size_type)); + m_scratch_space = ::Kokkos::Impl::hip_internal_scratch_space( + m_policy.space(), Analysis::value_size(ReducerConditional::select( + m_functor, m_reducer)) * + block_size /* block_size == max block_count */); + m_scratch_flags = ::Kokkos::Impl::hip_internal_scratch_flags( + m_policy.space(), sizeof(size_type)); // REQUIRED ( 1 , N , 1 ) dim3 block(1, block_size, 1); @@ -374,9 +336,9 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, WorkTag>(m_functor, block.y); - using DriverType = ParallelReduce<FunctorType, Policy, ReducerType, - Kokkos::Experimental::HIP>; - Kokkos::Experimental::Impl::hip_parallel_launch<DriverType, LaunchBounds>( + using DriverType = + ParallelReduce<FunctorType, Policy, ReducerType, Kokkos::HIP>; + Kokkos::Impl::hip_parallel_launch<DriverType, LaunchBounds>( *this, grid, block, shmem, m_policy.space().impl_internal_space_instance(), false); // copy to device and execute @@ -384,9 +346,8 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, if (!m_result_ptr_device_accessible && m_result_ptr) { const int size = Analysis::value_size( ReducerConditional::select(m_functor, m_reducer)); - DeepCopy<HostSpace, ::Kokkos::Experimental::HIPSpace, - ::Kokkos::Experimental::HIP>(m_policy.space(), m_result_ptr, - m_scratch_space, size); + DeepCopy<HostSpace, HIPSpace, HIP>(m_policy.space(), m_result_ptr, + m_scratch_space, size); } } else { if (m_result_ptr) { @@ -405,14 +366,11 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, m_reducer(InvalidType()), m_result_ptr(arg_result.data()), m_result_ptr_device_accessible( - MemorySpaceAccess<Kokkos::Experimental::HIPSpace, + MemorySpaceAccess<HIPSpace, typename ViewType::memory_space>::accessible), m_result_ptr_host_accessible( MemorySpaceAccess<Kokkos::HostSpace, - typename ViewType::memory_space>::accessible), - m_shared_memory_lock(m_policy.space() - .impl_internal_space_instance() - ->m_mutexSharedMemory) {} + typename ViewType::memory_space>::accessible) {} ParallelReduce(const FunctorType& arg_functor, const Policy& arg_policy, const ReducerType& reducer) @@ -421,16 +379,12 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, m_reducer(reducer), m_result_ptr(reducer.view().data()), m_result_ptr_device_accessible( - MemorySpaceAccess<Kokkos::Experimental::HIPSpace, - typename ReducerType::result_view_type:: - memory_space>::accessible), + MemorySpaceAccess<HIPSpace, typename ReducerType::result_view_type:: + memory_space>::accessible), m_result_ptr_host_accessible( MemorySpaceAccess<Kokkos::HostSpace, typename ReducerType::result_view_type:: - memory_space>::accessible), - m_shared_memory_lock(m_policy.space() - .impl_internal_space_instance() - ->m_mutexSharedMemory) {} + memory_space>::accessible) {} }; template <class FunctorType, class... Traits> @@ -452,7 +406,7 @@ class ParallelScanHIPBase { using pointer_type = typename Analysis::pointer_type; using reference_type = typename Analysis::reference_type; using functor_type = FunctorType; - using size_type = Kokkos::Experimental::HIP::size_type; + using size_type = HIP::size_type; using index_type = typename Policy::index_type; // Conditionally set word_size_type to int16_t or int8_t if value_type is // smaller than int32_t (Kokkos::HIP::size_type) @@ -479,13 +433,12 @@ class ParallelScanHIPBase { const FunctorType m_functor; const Policy m_policy; + const pointer_type m_result_ptr; + const bool m_result_ptr_device_accessible; word_size_type* m_scratch_space = nullptr; size_type* m_scratch_flags = nullptr; size_type m_final = false; int m_grid_x = 0; - // Only let one ParallelReduce/Scan modify the shared memory. The - // constructor acquires the mutex which is released in the destructor. - std::lock_guard<std::mutex> m_shared_memory_lock; private: template <class TagType> @@ -510,7 +463,7 @@ class ParallelScanHIPBase { word_count(Analysis::value_size(m_functor) / sizeof(word_size_type)); pointer_type const shared_value = reinterpret_cast<pointer_type>( - Kokkos::Experimental::kokkos_impl_hip_shared_memory<word_size_type>() + + kokkos_impl_hip_shared_memory<word_size_type>() + word_count.value * threadIdx.y); final_reducer.init(shared_value); @@ -534,8 +487,8 @@ class ParallelScanHIPBase { // gridDim.x hip_single_inter_block_reduce_scan<true>( final_reducer, blockIdx.x, gridDim.x, - Kokkos::Experimental::kokkos_impl_hip_shared_memory<word_size_type>(), - m_scratch_space, m_scratch_flags); + kokkos_impl_hip_shared_memory<word_size_type>(), m_scratch_space, + m_scratch_flags); } //---------------------------------------- @@ -550,7 +503,7 @@ class ParallelScanHIPBase { // Use shared memory as an exclusive scan: { 0 , value[0] , value[1] , // value[2] , ... } word_size_type* const shared_data = - Kokkos::Experimental::kokkos_impl_hip_shared_memory<word_size_type>(); + kokkos_impl_hip_shared_memory<word_size_type>(); word_size_type* const shared_prefix = shared_data + word_count.value * threadIdx.y; word_size_type* const shared_accum = @@ -619,6 +572,9 @@ class ParallelScanHIPBase { reinterpret_cast<pointer_type>(shared_prefix)), true); } + if (iwork + 1 == m_policy.end() && m_policy.end() == range.end() && + m_result_ptr_device_accessible) + *m_result_ptr = *reinterpret_cast<pointer_type>(shared_prefix); } } @@ -633,23 +589,13 @@ class ParallelScanHIPBase { } } - // Determine block size constrained by shared memory: - virtual inline unsigned local_block_size(const FunctorType& f) = 0; - - inline void impl_execute() { + inline void impl_execute(int block_size) { const index_type nwork = m_policy.end() - m_policy.begin(); if (nwork) { // FIXME_HIP we cannot choose it larger for large work sizes to work // correctly, the unit tests fail with wrong results const int gridMaxComputeCapability_2x = 0x01fff; - const int block_size = static_cast<int>(local_block_size(m_functor)); - if (block_size == 0) { - Kokkos::Impl::throw_runtime_exception( - std::string("Kokkos::Impl::ParallelScan< HIP > could not find a " - "valid execution configuration.")); - } - const int grid_max = std::min(block_size * block_size, gridMaxComputeCapability_2x); @@ -663,11 +609,11 @@ class ParallelScanHIPBase { // How many block are really needed for this much work: m_grid_x = (nwork + work_per_block - 1) / work_per_block; - m_scratch_space = reinterpret_cast<word_size_type*>( - Kokkos::Experimental::Impl::hip_internal_scratch_space( + m_scratch_space = + reinterpret_cast<word_size_type*>(Impl::hip_internal_scratch_space( m_policy.space(), Analysis::value_size(m_functor) * m_grid_x)); - m_scratch_flags = Kokkos::Experimental::Impl::hip_internal_scratch_flags( - m_policy.space(), sizeof(size_type) * 1); + m_scratch_flags = Impl::hip_internal_scratch_flags(m_policy.space(), + sizeof(size_type) * 1); dim3 grid(m_grid_x, 1, 1); dim3 block(1, block_size, 1); // REQUIRED DIMENSIONS ( 1 , N , 1 ) @@ -677,40 +623,49 @@ class ParallelScanHIPBase { // these ones are OK to be just the base because the specializations // do not modify the kernel at all using DriverType = ParallelScanHIPBase<FunctorType, Traits...>; - Kokkos::Experimental::Impl::hip_parallel_launch<DriverType, LaunchBounds>( + Impl::hip_parallel_launch<DriverType, LaunchBounds>( *this, grid, block, shmem, m_policy.space().impl_internal_space_instance(), false); // copy to device and execute m_final = true; - Kokkos::Experimental::Impl::hip_parallel_launch<DriverType, LaunchBounds>( + Impl::hip_parallel_launch<DriverType, LaunchBounds>( *this, grid, block, shmem, m_policy.space().impl_internal_space_instance(), false); // copy to device and execute } } - ParallelScanHIPBase(const FunctorType& arg_functor, const Policy& arg_policy) + ParallelScanHIPBase(const FunctorType& arg_functor, const Policy& arg_policy, + pointer_type arg_result_ptr, + bool arg_result_ptr_device_accessible) : m_functor(arg_functor), m_policy(arg_policy), - m_shared_memory_lock(m_policy.space() - .impl_internal_space_instance() - ->m_mutexSharedMemory) {} + m_result_ptr(arg_result_ptr), + m_result_ptr_device_accessible(arg_result_ptr_device_accessible) {} }; template <class FunctorType, class... Traits> -class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, - Kokkos::Experimental::HIP> +class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, HIP> : public ParallelScanHIPBase<FunctorType, Traits...> { public: using Base = ParallelScanHIPBase<FunctorType, Traits...>; using Base::operator(); - inline void execute() { Base::impl_execute(); } + inline void execute() { + const int block_size = static_cast<int>(local_block_size(Base::m_functor)); + if (block_size == 0) { + Kokkos::Impl::throw_runtime_exception( + std::string("Kokkos::Impl::ParallelScan< HIP > could not find a " + "valid execution configuration.")); + } + + Base::impl_execute(block_size); + } ParallelScan(const FunctorType& arg_functor, const typename Base::Policy& arg_policy) - : Base(arg_functor, arg_policy) {} + : Base(arg_functor, arg_policy, nullptr, false) {} inline unsigned local_block_size(const FunctorType& f) { // blockDim.y must be power of two = 128 (2 warps) or 256 (4 warps) or @@ -723,10 +678,10 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, typename Base::WorkTag>( f, n); }; - using DriverType = ParallelScan<FunctorType, typename Base::Policy, - Kokkos::Experimental::HIP>; - return Kokkos::Experimental::Impl::hip_get_preferred_blocksize< - DriverType, typename Base::LaunchBounds>(instance, shmem_functor); + using DriverType = ParallelScan<FunctorType, typename Base::Policy, HIP>; + return Impl::hip_get_preferred_blocksize<DriverType, + typename Base::LaunchBounds>( + instance, shmem_functor); } }; @@ -734,33 +689,40 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, template <class FunctorType, class ReturnType, class... Traits> class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, - ReturnType, Kokkos::Experimental::HIP> + ReturnType, HIP> : public ParallelScanHIPBase<FunctorType, Traits...> { public: using Base = ParallelScanHIPBase<FunctorType, Traits...>; using Base::operator(); - ReturnType& m_returnvalue; - inline void execute() { - Base::impl_execute(); + const int block_size = static_cast<int>(local_block_size(Base::m_functor)); + if (block_size == 0) { + Kokkos::Impl::throw_runtime_exception( + std::string("Kokkos::Impl::ParallelScan< HIP > could not find a " + "valid execution configuration.")); + } + + Base::impl_execute(block_size); const auto nwork = Base::m_policy.end() - Base::m_policy.begin(); - if (nwork) { + if (nwork && !Base::m_result_ptr_device_accessible) { const int size = Base::Analysis::value_size(Base::m_functor); - DeepCopy<HostSpace, Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIP>( - Base::m_policy.space(), &m_returnvalue, + DeepCopy<HostSpace, HIPSpace, HIP>( + Base::m_policy.space(), Base::m_result_ptr, Base::m_scratch_space + (Base::m_grid_x - 1) * size / sizeof(typename Base::word_size_type), size); } } + template <class ViewType> ParallelScanWithTotal(const FunctorType& arg_functor, const typename Base::Policy& arg_policy, - ReturnType& arg_returnvalue) - : Base(arg_functor, arg_policy), m_returnvalue(arg_returnvalue) {} + const ViewType& arg_result_view) + : Base(arg_functor, arg_policy, arg_result_view.data(), + MemorySpaceAccess<HIPSpace, + typename ViewType::memory_space>::accessible) {} inline unsigned local_block_size(const FunctorType& f) { // blockDim.y must be power of two = 128 (2 warps) or 256 (4 warps) or @@ -773,11 +735,10 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, typename Base::WorkTag>( f, n); }; - using DriverType = - ParallelScanWithTotal<FunctorType, typename Base::Policy, ReturnType, - Kokkos::Experimental::HIP>; - return Kokkos::Experimental::Impl::hip_get_preferred_blocksize< - DriverType, typename Base::LaunchBounds>(instance, shmem_functor); + using DriverType = ParallelScanWithTotal<FunctorType, typename Base::Policy, + ReturnType, HIP>; + return hip_get_preferred_blocksize<DriverType, typename Base::LaunchBounds>( + instance, shmem_functor); } }; diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp index 69ced48a9b33f438f382862171cad0e738270f28..442ca8aef290a309a5caa27961b311fdebfb2dfd 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Parallel_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKO_HIP_PARALLEL_TEAM_HPP #define KOKKO_HIP_PARALLEL_TEAM_HPP @@ -59,13 +31,12 @@ namespace Kokkos { namespace Impl { template <typename... Properties> -class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> +class TeamPolicyInternal<HIP, Properties...> : public PolicyTraits<Properties...> { public: using execution_policy = TeamPolicyInternal; - using traits = PolicyTraits<Properties...>; - using BlockType = Kokkos::Experimental::Impl::BlockType; + using traits = PolicyTraits<Properties...>; template <typename ExecSpace, typename... OtherProperties> friend class TeamPolicyInternal; @@ -82,7 +53,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> bool m_tune_vector_length; public: - using execution_space = Kokkos::Experimental::HIP; + using execution_space = HIP; template <class... OtherProperties> TeamPolicyInternal(TeamPolicyInternal<OtherProperties...> const& p) { @@ -119,7 +90,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> using closure_type = Impl::ParallelReduce<FunctorType, TeamPolicy<Properties...>, reducer_type>; - return internal_team_size_max<closure_type>(f); + return internal_team_size_common<BlockType::Max, closure_type>(f); } template <typename FunctorType, typename ReducerType> @@ -128,7 +99,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> using closure_type = Impl::ParallelReduce<FunctorType, TeamPolicy<Properties...>, ReducerType>; - return internal_team_size_max<closure_type>(f); + return internal_team_size_common<BlockType::Max, closure_type>(f); } template <typename FunctorType> @@ -151,7 +122,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> using closure_type = Impl::ParallelReduce<FunctorType, TeamPolicy<Properties...>, reducer_type>; - return internal_team_size_recommended<closure_type>(f); + return internal_team_size_common<BlockType::Preferred, closure_type>(f); } template <typename FunctorType, typename ReducerType> @@ -160,14 +131,12 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> using closure_type = Impl::ParallelReduce<FunctorType, TeamPolicy<Properties...>, ReducerType>; - return internal_team_size_recommended<closure_type>(f); + return internal_team_size_common<BlockType::Preferred, closure_type>(f); } inline bool impl_auto_vector_length() const { return m_tune_vector_length; } inline bool impl_auto_team_size() const { return m_tune_team_size; } - static int vector_length_max() { - return ::Kokkos::Experimental::Impl::HIPTraits::WarpSize; - } + static int vector_length_max() { return HIPTraits::WarpSize; } static int verify_requested_vector_length(int requested_vector_length) { int test_vector_length = @@ -176,7 +145,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> // Allow only power-of-two vector_length if (!(is_integral_power_of_two(test_vector_length))) { int test_pow2 = 1; - int constexpr warp_size = Experimental::Impl::HIPTraits::WarpSize; + int constexpr warp_size = HIPTraits::WarpSize; while (test_pow2 < warp_size) { test_pow2 <<= 1; if (test_pow2 > test_vector_length) { @@ -189,19 +158,28 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> return test_vector_length; } - static int scratch_size_max(int level) { - return ( - level == 0 ? 1024 * 40 : // FIXME_HIP arbitrarily setting this to 48kB - 20 * 1024 * 1024); // FIXME_HIP arbitrarily setting this to 20MB + inline static int scratch_size_max(int level) { + // HIP Teams use (team_size + 2)*sizeof(double) shared memory for team + // reductions. They also use one int64_t in static shared memory for a + // shared ID. Furthermore, they use additional scratch memory in some + // reduction scenarios, which depend on the size of the value_type and is + // NOT captured here + constexpr size_t max_possible_team_size = 1024; + constexpr size_t max_reserved_shared_mem_per_team = + (max_possible_team_size + 2) * sizeof(double) + sizeof(int64_t); + // arbitrarily setting level 1 scratch limit to 20MB, for a + // MI250 that would give us about 4.4GB for 2 teams per CU + constexpr size_t max_l1_scratch_size = 20 * 1024 * 1024; + + size_t max_shmem = HIP().hip_device_prop().sharedMemPerBlock; + return (level == 0 ? max_shmem - max_reserved_shared_mem_per_team + : max_l1_scratch_size); } + inline void impl_set_vector_length(size_t size) { m_vector_length = size; } inline void impl_set_team_size(size_t size) { m_team_size = size; } int impl_vector_length() const { return m_vector_length; } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - KOKKOS_DEPRECATED int vector_length() const { return impl_vector_length(); } -#endif - int team_size() const { return m_team_size; } int league_size() const { return m_league_size; } @@ -229,7 +207,7 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> m_vector_length(0), m_team_scratch_size{0, 0}, m_thread_scratch_size{0, 0}, - m_chunk_size(::Kokkos::Experimental::Impl::HIPTraits::WarpSize), + m_chunk_size(HIPTraits::WarpSize), m_tune_team_size(false), m_tune_vector_length(false) {} @@ -245,20 +223,17 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> : (verify_requested_vector_length(1))), m_team_scratch_size{0, 0}, m_thread_scratch_size{0, 0}, - m_chunk_size(::Kokkos::Experimental::Impl::HIPTraits::WarpSize), + m_chunk_size(HIPTraits::WarpSize), m_tune_team_size(bool(team_size_request <= 0)), m_tune_vector_length(bool(vector_length_request <= 0)) { // Make sure league size is permissible - if (league_size_ >= - static_cast<int>( - ::Kokkos::Experimental::Impl::hip_internal_maximum_grid_count()[0])) + if (league_size_ >= static_cast<int>(hip_internal_maximum_grid_count()[0])) Impl::throw_runtime_exception( "Requested too large league_size for TeamPolicy on HIP execution " "space."); // Make sure total block size is permissible - if (m_team_size * m_vector_length > - ::Kokkos::Experimental::Impl::HIPTraits::MaxThreadsPerBlock) { + if (m_team_size * m_vector_length > HIPTraits::MaxThreadsPerBlock) { Impl::throw_runtime_exception( std::string("Kokkos::TeamPolicy< HIP > the team size is too large. " "Team size x vector length must be smaller than 1024.")); @@ -356,57 +331,19 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> protected: template <BlockType BlockSize, class ClosureType, class FunctorType> - int internal_team_size_common(const FunctorType& f) const { - // FIXME_HIP: this could be unified with the - // internal_team_size_common_reduce - // once we can turn c++17 constexpr on by default. - // The problem right now is that we can't turn off the evaluation - // of the Analysis' valuesize / StaticValueSize - - const unsigned shmem_block = team_scratch_size(0) + 2 * sizeof(double); - const unsigned shmem_thread = thread_scratch_size(0) + sizeof(double); - const int vector_length = impl_vector_length(); - - const auto functor = [&f, shmem_block, shmem_thread, vector_length]( - const hipFuncAttributes& attr, int block_size) { - int functor_shmem = - ::Kokkos::Impl::FunctorTeamShmemSize<FunctorType>::value( - f, block_size / vector_length); - return shmem_block + shmem_thread * (block_size / vector_length) + - functor_shmem + attr.sharedSizeBytes; - }; - int block_size; - // FIXME_HIP - could be if constexpr for c++17 - if (BlockSize == BlockType::Max) { - block_size = ::Kokkos::Experimental::Impl::hip_get_max_team_blocksize< - ClosureType, typename traits::launch_bounds>( - space().impl_internal_space_instance(), functor); - } else { - block_size = - ::Kokkos::Experimental::Impl::hip_get_preferred_team_blocksize< - ClosureType, typename traits::launch_bounds>( - space().impl_internal_space_instance(), functor); - } - if (block_size == 0) { - Kokkos::Impl::throw_runtime_exception( - std::string("Kokkos::Impl::ParallelFor< HIP > could not find a valid " - "team size.")); - } - return block_size / impl_vector_length(); - } - - template <BlockType BlockSize, class ClosureType, class FunctorType> - int internal_team_size_common_reduce(const FunctorType& f) const { - using Interface = - typename Impl::DeduceFunctorPatternInterface<ClosureType>::type; - using Analysis = - Impl::FunctorAnalysis<Interface, typename ClosureType::Policy, - FunctorType>; - + int internal_team_size_common(FunctorType const& f) const { const unsigned shmem_block = team_scratch_size(0) + 2 * sizeof(double); - const unsigned shmem_thread = - thread_scratch_size(0) + sizeof(double) + - ((Analysis::StaticValueSize != 0) ? 0 : Analysis::value_size(f)); + unsigned shmem_thread = thread_scratch_size(0) + sizeof(double); + using Tag = typename PatternTagFromImplSpecialization<ClosureType>::type; + if constexpr (std::is_same_v<Tag, ParallelReduceTag>) { + using Interface = + typename Impl::DeduceFunctorPatternInterface<ClosureType>::type; + using Analysis = + Impl::FunctorAnalysis<Interface, typename ClosureType::Policy, + FunctorType>; + shmem_thread += + ((Analysis::StaticValueSize != 0) ? 0 : Analysis::value_size(f)); + } const int vector_length = impl_vector_length(); const auto functor = [&f, shmem_block, shmem_thread, vector_length]( @@ -418,44 +355,36 @@ class TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...> functor_shmem + attr.sharedSizeBytes; }; int block_size; - // FIXME_HIP - could be if constexpr for c++17 - if (BlockSize == BlockType::Max) { - block_size = ::Kokkos::Experimental::Impl::hip_get_max_team_blocksize< - ClosureType, typename traits::launch_bounds>( + if constexpr (BlockSize == BlockType::Max) { + block_size = hip_get_max_team_blocksize<ClosureType, + typename traits::launch_bounds>( space().impl_internal_space_instance(), functor); } else { block_size = - ::Kokkos::Experimental::Impl::hip_get_preferred_team_blocksize< - ClosureType, typename traits::launch_bounds>( + hip_get_preferred_team_blocksize<ClosureType, + typename traits::launch_bounds>( space().impl_internal_space_instance(), functor); } if (block_size == 0) { - Kokkos::Impl::throw_runtime_exception( - std::string("Kokkos::Impl::ParallelReduce< HIP > could not find a " - "valid team size.")); + Kokkos::Impl::throw_runtime_exception(std::string( + "Kokkos::Impl::ParallelFor/Reduce< HIP > could not find a valid " + "team size.")); + } + if constexpr (std::is_same_v<Tag, ParallelForTag>) { + return block_size / impl_vector_length(); + } else { + // Currently we require Power-of-2 team size for reductions. + int p2 = 1; + while (p2 <= block_size) p2 *= 2; + p2 /= 2; + return p2 / impl_vector_length(); } - // Currently we require Power-of-2 team size for reductions. - int p2 = 1; - while (p2 <= block_size) p2 *= 2; - p2 /= 2; - return p2 / impl_vector_length(); - } - - template <class ClosureType, class FunctorType> - int internal_team_size_max(const FunctorType& f) const { - return internal_team_size_common_reduce<BlockType::Max, ClosureType>(f); - } - - template <class ClosureType, class FunctorType> - int internal_team_size_recommended(const FunctorType& f) const { - return internal_team_size_common_reduce<BlockType::Preferred, ClosureType>( - f); } }; -__device__ inline int64_t hip_get_scratch_index( - Experimental::HIP::size_type league_size, int32_t* scratch_locks) { +__device__ inline int64_t hip_get_scratch_index(HIP::size_type league_size, + int32_t* scratch_locks) { int64_t threadid = 0; __shared__ int64_t base_thread_id; if (threadIdx.x == 0 && threadIdx.y == 0) { @@ -491,12 +420,11 @@ __device__ inline void hip_release_scratch_index(int32_t* scratch_locks, } template <typename FunctorType, typename... Properties> -class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, - Kokkos::Experimental::HIP> { +class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, HIP> { public: - using Policy = TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>; + using Policy = TeamPolicyInternal<HIP, Properties...>; using functor_type = FunctorType; - using size_type = ::Kokkos::Experimental::HIP::size_type; + using size_type = HIP::size_type; private: using member_type = typename Policy::member_type; @@ -518,10 +446,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, int m_shmem_size; void* m_scratch_ptr[2]; size_t m_scratch_size[2]; + int m_scratch_pool_id = -1; int32_t* m_scratch_locks; - // Only let one ParallelFor/Reduce modify the team scratch memory. The - // constructor acquires the mutex which is released in the destructor. - std::lock_guard<std::mutex> m_scratch_lock_guard; template <typename TagType> __device__ inline std::enable_if_t<std::is_void<TagType>::value> exec_team( @@ -547,8 +473,7 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, for (int league_rank = blockIdx.x; league_rank < int_league_size; league_rank += gridDim.x) { this->template exec_team<work_tag>(typename Policy::member_type( - ::Kokkos::Experimental::kokkos_impl_hip_shared_memory<void>(), - m_shmem_begin, m_shmem_size, + kokkos_impl_hip_shared_memory<void>(), m_shmem_begin, m_shmem_size, static_cast<void*>(static_cast<char*>(m_scratch_ptr[1]) + ptrdiff_t(threadid / (blockDim.x * blockDim.y)) * m_scratch_size[1]), @@ -566,10 +491,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, static_cast<int>(m_team_size), 1); using closure_type = - ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, - Kokkos::Experimental::HIP>; - ::Kokkos::Experimental::Impl::hip_parallel_launch<closure_type, - launch_bounds>( + ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, HIP>; + Impl::hip_parallel_launch<closure_type, launch_bounds>( *this, grid, block, shmem_size_total, m_policy.space().impl_internal_space_instance(), true); // copy to device and execute @@ -580,10 +503,9 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, m_policy(arg_policy), m_league_size(arg_policy.league_size()), m_team_size(arg_policy.team_size()), - m_vector_size(arg_policy.impl_vector_length()), - m_scratch_lock_guard(m_policy.space() - .impl_internal_space_instance() - ->m_team_scratch_mutex) { + m_vector_size(arg_policy.impl_vector_length()) { + auto internal_space_instance = + m_policy.space().impl_internal_space_instance(); m_team_size = m_team_size >= 0 ? m_team_size : arg_policy.team_size_recommended( arg_functor, ParallelForTag()); @@ -594,27 +516,26 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, FunctorTeamShmemSize<FunctorType>::value(m_functor, m_team_size)); m_scratch_size[0] = m_policy.scratch_size(0, m_team_size); m_scratch_size[1] = m_policy.scratch_size(1, m_team_size); - m_scratch_locks = - m_policy.space().impl_internal_space_instance()->m_scratch_locks; + m_scratch_locks = internal_space_instance->m_scratch_locks; // Functor's reduce memory, team scan memory, and team shared memory depend // upon team size. m_scratch_ptr[0] = nullptr; - m_scratch_ptr[1] = - m_team_size <= 0 - ? nullptr - : m_policy.space() - .impl_internal_space_instance() - ->resize_team_scratch_space( - static_cast<std::int64_t>(m_scratch_size[1]) * - (std::min(static_cast<std::int64_t>( - Kokkos::Experimental::HIP::concurrency() / - (m_team_size * m_vector_size)), - static_cast<std::int64_t>(m_league_size)))); + if (m_team_size <= 0) { + m_scratch_ptr[1] = nullptr; + } else { + m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space(); + m_scratch_ptr[1] = internal_space_instance->resize_team_scratch_space( + m_scratch_pool_id, + static_cast<std::int64_t>(m_scratch_size[1]) * + (std::min( + static_cast<std::int64_t>(HIP().concurrency() / + (m_team_size * m_vector_size)), + static_cast<std::int64_t>(m_league_size)))); + } int const shmem_size_total = m_shmem_begin + m_shmem_size; - if (m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock < - shmem_size_total) { + if (internal_space_instance->m_maxShmemPerBlock < shmem_size_total) { Kokkos::Impl::throw_runtime_exception(std::string( "Kokkos::Impl::ParallelFor< HIP > insufficient shared memory")); } @@ -625,6 +546,14 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, "Kokkos::Impl::ParallelFor< HIP > requested too large team size.")); } } + + ~ParallelFor() { + if (m_scratch_pool_id >= 0) { + m_policy.space() + .impl_internal_space_instance() + ->release_team_scratch_space(m_scratch_pool_id); + } + } }; //---------------------------------------------------------------------------- @@ -632,9 +561,9 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, template <class FunctorType, class ReducerType, class... Properties> class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, - ReducerType, Kokkos::Experimental::HIP> { + ReducerType, HIP> { public: - using Policy = TeamPolicyInternal<Kokkos::Experimental::HIP, Properties...>; + using Policy = TeamPolicyInternal<HIP, Properties...>; private: using member_type = typename Policy::member_type; @@ -658,7 +587,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, public: using functor_type = FunctorType; - using size_type = Kokkos::Experimental::HIP::size_type; + using size_type = HIP::size_type; static int constexpr UseShflReduction = (analysis::StaticValueSize != 0); @@ -687,13 +616,11 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, size_type m_shmem_size; void* m_scratch_ptr[2]; size_t m_scratch_size[2]; + int m_scratch_pool_id = -1; int32_t* m_scratch_locks; const size_type m_league_size; int m_team_size; const size_type m_vector_size; - // Only let one ParallelFor/Reduce modify the team scratch memory. The - // constructor acquires the mutex which is released in the destructor. - std::lock_guard<std::mutex> m_scratch_lock_guard; template <class TagType> __device__ inline std::enable_if_t<std::is_void<TagType>::value> exec_team( @@ -714,8 +641,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, league_rank += gridDim.x) { this->template exec_team<work_tag>( member_type( - Kokkos::Experimental::kokkos_impl_hip_shared_memory<char>() + - m_team_begin, + kokkos_impl_hip_shared_memory<char>() + m_team_begin, m_shmem_begin, m_shmem_size, reinterpret_cast<void*>( reinterpret_cast<char*>(m_scratch_ptr[1]) + @@ -752,9 +678,9 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, reducer_conditional::select(m_functor, m_reducer)) / sizeof(size_type)); - reference_type value = final_reducer.init( - Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>() + - threadIdx.y * word_count.value); + reference_type value = + final_reducer.init(kokkos_impl_hip_shared_memory<size_type>() + + threadIdx.y * word_count.value); // Iterate this block through the league iterate_through_league(threadid, value); @@ -765,16 +691,14 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, do_final_reduce = hip_single_inter_block_reduce_scan<false, FunctorType, work_tag>( reducer_conditional::select(m_functor, m_reducer), blockIdx.x, - gridDim.x, - Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>(), + gridDim.x, kokkos_impl_hip_shared_memory<size_type>(), m_scratch_space, m_scratch_flags); if (do_final_reduce) { // This is the final block with the final result at the final threads' // location - size_type* const shared = - Kokkos::Experimental::kokkos_impl_hip_shared_memory<size_type>() + - (blockDim.y - 1) * word_count.value; + size_type* const shared = kokkos_impl_hip_shared_memory<size_type>() + + (blockDim.y - 1) * word_count.value; size_type* const global = m_result_ptr_device_accessible ? reinterpret_cast<size_type*>(m_result_ptr) : m_scratch_space; @@ -783,7 +707,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, final_reducer.final(reinterpret_cast<value_type*>(shared)); } - if (Kokkos::Experimental::Impl::HIPTraits::WarpSize < word_count.value) { + if (HIPTraits::WarpSize < word_count.value) { __syncthreads(); } @@ -836,18 +760,15 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, if (!is_empty_range || need_device_set) { const int block_count = UseShflReduction - ? std::min( - m_league_size, - size_type(1024 * - Kokkos::Experimental::Impl::HIPTraits::WarpSize)) + ? std::min(m_league_size, size_type(1024 * HIPTraits::WarpSize)) : std::min(static_cast<int>(m_league_size), m_team_size); - m_scratch_space = Kokkos::Experimental::Impl::hip_internal_scratch_space( + m_scratch_space = hip_internal_scratch_space( m_policy.space(), analysis::value_size(reducer_conditional::select( m_functor, m_reducer)) * block_count); - m_scratch_flags = Kokkos::Experimental::Impl::hip_internal_scratch_flags( - m_policy.space(), sizeof(size_type)); + m_scratch_flags = + hip_internal_scratch_flags(m_policy.space(), sizeof(size_type)); dim3 block(m_vector_size, m_team_size, 1); dim3 grid(block_count, 1, 1); @@ -859,9 +780,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, using closure_type = ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, - ReducerType, Kokkos::Experimental::HIP>; - Kokkos::Experimental::Impl::hip_parallel_launch<closure_type, - launch_bounds>( + ReducerType, HIP>; + Impl::hip_parallel_launch<closure_type, launch_bounds>( *this, grid, block, shmem_size_total, m_policy.space().impl_internal_space_instance(), true); // copy to device and execute @@ -872,8 +792,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, if (m_result_ptr) { const int size = analysis::value_size( reducer_conditional::select(m_functor, m_reducer)); - DeepCopy<HostSpace, Kokkos::Experimental::HIPSpace>( - m_result_ptr, m_scratch_space, size); + DeepCopy<HostSpace, HIPSpace>(m_result_ptr, m_scratch_space, size); } } } else { @@ -893,7 +812,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_reducer(InvalidType()), m_result_ptr(arg_result.data()), m_result_ptr_device_accessible( - MemorySpaceAccess<Kokkos::Experimental::HIPSpace, + MemorySpaceAccess<HIPSpace, typename ViewType::memory_space>::accessible), m_result_ptr_host_accessible( MemorySpaceAccess<Kokkos::HostSpace, @@ -906,10 +825,9 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_scratch_ptr{nullptr, nullptr}, m_league_size(arg_policy.league_size()), m_team_size(arg_policy.team_size()), - m_vector_size(arg_policy.impl_vector_length()), - m_scratch_lock_guard(m_policy.space() - .impl_internal_space_instance() - ->m_team_scratch_mutex) { + m_vector_size(arg_policy.impl_vector_length()) { + auto internal_space_instance = + m_policy.space().impl_internal_space_instance(); m_team_size = m_team_size >= 0 ? m_team_size : arg_policy.team_size_recommended( arg_functor, ParallelReduceTag()); @@ -926,19 +844,19 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, FunctorTeamShmemSize<FunctorType>::value(arg_functor, m_team_size); m_scratch_size[0] = m_shmem_size; m_scratch_size[1] = m_policy.scratch_size(1, m_team_size); - m_scratch_locks = - m_policy.space().impl_internal_space_instance()->m_scratch_locks; - m_scratch_ptr[1] = - m_team_size <= 0 - ? nullptr - : m_policy.space() - .impl_internal_space_instance() - ->resize_team_scratch_space( - static_cast<std::int64_t>(m_scratch_size[1]) * - (std::min(static_cast<std::int64_t>( - Kokkos::Experimental::HIP::concurrency() / - (m_team_size * m_vector_size)), - static_cast<std::int64_t>(m_league_size)))); + m_scratch_locks = internal_space_instance->m_scratch_locks; + if (m_team_size <= 0) { + m_scratch_ptr[1] = nullptr; + } else { + m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space(); + m_scratch_ptr[1] = internal_space_instance->resize_team_scratch_space( + m_scratch_pool_id, + static_cast<std::int64_t>(m_scratch_size[1]) * + (std::min( + static_cast<std::int64_t>(HIP().concurrency() / + (m_team_size * m_vector_size)), + static_cast<std::int64_t>(m_league_size)))); + } // The global parallel_reduce does not support vector_length other than 1 at // the moment @@ -948,8 +866,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, "greater than 1 is not currently supported for HIP for dynamic " "sized reduction types."); - if ((m_team_size < Kokkos::Experimental::Impl::HIPTraits::WarpSize) && - !UseShflReduction) + if ((m_team_size < HIPTraits::WarpSize) && !UseShflReduction) Impl::throw_runtime_exception( "Kokkos::parallel_reduce with a TeamPolicy using a team_size smaller " "than 64 is not currently supported with HIP for dynamic sized " @@ -966,8 +883,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, std::string("Kokkos::Impl::ParallelReduce< HIP > bad team size")); } - if (m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock < - shmem_size_total) { + if (internal_space_instance->m_maxShmemPerBlock < shmem_size_total) { Kokkos::Impl::throw_runtime_exception( std::string("Kokkos::Impl::ParallelReduce< HIP > requested too much " "L0 scratch memory")); @@ -989,9 +905,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_reducer(reducer), m_result_ptr(reducer.view().data()), m_result_ptr_device_accessible( - MemorySpaceAccess<Kokkos::Experimental::HIPSpace, - typename ReducerType::result_view_type:: - memory_space>::accessible), + MemorySpaceAccess<HIPSpace, typename ReducerType::result_view_type:: + memory_space>::accessible), m_result_ptr_host_accessible( MemorySpaceAccess<Kokkos::HostSpace, typename ReducerType::result_view_type:: @@ -1004,10 +919,9 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_scratch_ptr{nullptr, nullptr}, m_league_size(arg_policy.league_size()), m_team_size(arg_policy.team_size()), - m_vector_size(arg_policy.impl_vector_length()), - m_scratch_lock_guard(m_policy.space() - .impl_internal_space_instance() - ->m_team_scratch_mutex) { + m_vector_size(arg_policy.impl_vector_length()) { + auto internal_space_instance = + m_policy.space().impl_internal_space_instance(); m_team_size = m_team_size >= 0 ? m_team_size : arg_policy.team_size_recommended(arg_functor, reducer, @@ -1024,19 +938,19 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, FunctorTeamShmemSize<FunctorType>::value(arg_functor, m_team_size); m_scratch_size[0] = m_shmem_size; m_scratch_size[1] = m_policy.scratch_size(1, m_team_size); - m_scratch_locks = - m_policy.space().impl_internal_space_instance()->m_scratch_locks; - m_scratch_ptr[1] = - m_team_size <= 0 - ? nullptr - : m_policy.space() - .impl_internal_space_instance() - ->resize_team_scratch_space( - static_cast<std::int64_t>(m_scratch_size[1]) * - (std::min(static_cast<std::int64_t>( - Kokkos::Experimental::HIP::concurrency() / - (m_team_size * m_vector_size)), - static_cast<std::int64_t>(m_league_size)))); + m_scratch_locks = internal_space_instance->m_scratch_locks; + if (m_team_size <= 0) { + m_scratch_ptr[1] = nullptr; + } else { + m_scratch_pool_id = internal_space_instance->acquire_team_scratch_space(); + m_scratch_ptr[1] = internal_space_instance->resize_team_scratch_space( + m_scratch_pool_id, + static_cast<std::int64_t>(m_scratch_size[1]) * + (std::min( + static_cast<std::int64_t>(HIP().concurrency() / + (m_team_size * m_vector_size)), + static_cast<std::int64_t>(m_league_size)))); + } // The global parallel_reduce does not support vector_length other than 1 at // the moment @@ -1046,8 +960,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, "greater than 1 is not currently supported for HIP for dynamic " "sized reduction types."); - if ((m_team_size < Kokkos::Experimental::Impl::HIPTraits::WarpSize) && - !UseShflReduction) + if ((m_team_size < HIPTraits::WarpSize) && !UseShflReduction) Impl::throw_runtime_exception( "Kokkos::parallel_reduce with a TeamPolicy using a team_size smaller " "than 64 is not currently supported with HIP for dynamic sized " @@ -1059,8 +972,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, const int shmem_size_total = m_team_begin + m_shmem_begin + m_shmem_size; if ((!Kokkos::Impl::is_integral_power_of_two(m_team_size) && !UseShflReduction) || - m_policy.space().impl_internal_space_instance()->m_maxShmemPerBlock < - shmem_size_total) { + internal_space_instance->m_maxShmemPerBlock < shmem_size_total) { Kokkos::Impl::throw_runtime_exception( std::string("Kokkos::Impl::ParallelReduce< HIP > bad team size")); } @@ -1073,6 +985,14 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, "large team size.")); } } + + ~ParallelReduce() { + if (m_scratch_pool_id >= 0) { + m_policy.space() + .impl_internal_space_instance() + ->release_team_scratch_space(m_scratch_pool_id); + } + } }; } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp index 9002f695894e987d34fd1437bbcc1f3da7e2a04c..9de26b63a7efd89437eadc87b5195e741fccfae3 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_ReduceScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_REDUCESCAN_HPP #define KOKKOS_HIP_REDUCESCAN_HPP @@ -49,6 +21,7 @@ #if defined(__HIPCC__) +#include <HIP/Kokkos_HIP.hpp> #include <HIP/Kokkos_HIP_Vectorization.hpp> namespace Kokkos { @@ -74,20 +47,19 @@ struct HIPReductionsFunctor<FunctorType, true> { int const width, // How much of the warp participates Scalar& result) { for (int delta = skip_vector ? blockDim.x : 1; delta < width; delta *= 2) { - Scalar tmp = Kokkos::Experimental::shfl_down(value, delta, width); + Scalar tmp = shfl_down(value, delta, width); functor.join(&value, &tmp); } - Experimental::Impl::in_place_shfl(result, value, 0, width); + in_place_shfl(result, value, 0, width); } __device__ static inline void scalar_intra_block_reduction( FunctorType const& functor, Scalar value, bool const skip, Scalar* my_global_team_buffer_element, int const shared_elements, Scalar* shared_team_buffer_element) { - unsigned int constexpr warp_size = - Kokkos::Experimental::Impl::HIPTraits::WarpSize; - int const warp_id = (threadIdx.y * blockDim.x) / warp_size; + unsigned int constexpr warp_size = HIPTraits::WarpSize; + int const warp_id = (threadIdx.y * blockDim.x) / warp_size; Scalar* const my_shared_team_buffer_element = shared_team_buffer_element + warp_id % shared_elements; @@ -122,22 +94,19 @@ struct HIPReductionsFunctor<FunctorType, true> { } __device__ static inline bool scalar_inter_block_reduction( - FunctorType const& functor, - ::Kokkos::Experimental::HIP::size_type const block_count, - ::Kokkos::Experimental::HIP::size_type* const shared_data, - ::Kokkos::Experimental::HIP::size_type* const global_data, - ::Kokkos::Experimental::HIP::size_type* const global_flags) { + FunctorType const& functor, HIP::size_type const block_count, + HIP::size_type* const shared_data, HIP::size_type* const global_data, + HIP::size_type* const global_flags) { Scalar* const global_team_buffer_element = reinterpret_cast<Scalar*>(global_data); Scalar* const my_global_team_buffer_element = global_team_buffer_element + blockIdx.x; Scalar* shared_team_buffer_elements = reinterpret_cast<Scalar*>(shared_data); - Scalar value = shared_team_buffer_elements[threadIdx.y]; - unsigned int constexpr warp_size = - Kokkos::Experimental::Impl::HIPTraits::WarpSize; - int shared_elements = blockDim.x * blockDim.y / warp_size; - int global_elements = block_count; + Scalar value = shared_team_buffer_elements[threadIdx.y]; + unsigned int constexpr warp_size = Impl::HIPTraits::WarpSize; + int shared_elements = blockDim.x * blockDim.y / warp_size; + int global_elements = block_count; __syncthreads(); scalar_intra_block_reduction(functor, value, true, @@ -185,10 +154,10 @@ struct HIPReductionsFunctor<FunctorType, false> { // part of the reduction int const width) // How much of the warp participates { - int const lane_id = (threadIdx.y * blockDim.x + threadIdx.x) % - ::Kokkos::Experimental::Impl::HIPTraits::WarpSize; + int const lane_id = + (threadIdx.y * blockDim.x + threadIdx.x) % HIPTraits::WarpSize; for (int delta = skip_vector ? blockDim.x : 1; delta < width; delta *= 2) { - if (lane_id + delta < ::Kokkos::Experimental::Impl::HIPTraits::WarpSize) { + if (lane_id + delta < HIPTraits::WarpSize) { functor.join(value, value + delta); } } @@ -198,39 +167,34 @@ struct HIPReductionsFunctor<FunctorType, false> { __device__ static inline void scalar_intra_block_reduction( FunctorType const& functor, Scalar value, bool const skip, Scalar* result, int const /*shared_elements*/, Scalar* shared_team_buffer_element) { - int const warp_id = (threadIdx.y * blockDim.x) / - ::Kokkos::Experimental::Impl::HIPTraits::WarpSize; + int const warp_id = (threadIdx.y * blockDim.x) / HIPTraits::WarpSize; Scalar* const my_shared_team_buffer_element = shared_team_buffer_element + threadIdx.y * blockDim.x + threadIdx.x; *my_shared_team_buffer_element = value; // Warp Level Reduction, ignoring Kokkos vector entries - scalar_intra_warp_reduction( - functor, my_shared_team_buffer_element, skip, - ::Kokkos::Experimental::Impl::HIPTraits::WarpSize); + scalar_intra_warp_reduction(functor, my_shared_team_buffer_element, skip, + HIPTraits::WarpSize); // Wait for every warp to be done before using one warp to do final cross // warp reduction __syncthreads(); if (warp_id == 0) { const unsigned int delta = - (threadIdx.y * blockDim.x + threadIdx.x) * - ::Kokkos::Experimental::Impl::HIPTraits::WarpSize; + (threadIdx.y * blockDim.x + threadIdx.x) * HIPTraits::WarpSize; if (delta < blockDim.x * blockDim.y) *my_shared_team_buffer_element = shared_team_buffer_element[delta]; scalar_intra_warp_reduction( functor, my_shared_team_buffer_element, false, - blockDim.x * blockDim.y / - ::Kokkos::Experimental::Impl::HIPTraits::WarpSize); + blockDim.x * blockDim.y / HIPTraits::WarpSize); if (threadIdx.x + threadIdx.y == 0) *result = *shared_team_buffer_element; } } template <typename SizeType> __device__ static inline bool scalar_inter_block_reduction( - FunctorType const& functor, - ::Kokkos::Experimental::HIP::size_type const block_count, + FunctorType const& functor, HIP::size_type const block_count, SizeType* const shared_data, SizeType* const global_data, - ::Kokkos::Experimental::HIP::size_type* const global_flags) { + HIP::size_type* const global_flags) { Scalar* const global_team_buffer_element = reinterpret_cast<Scalar*>(global_data); Scalar* const my_global_team_buffer_element = @@ -238,8 +202,7 @@ struct HIPReductionsFunctor<FunctorType, false> { Scalar* shared_team_buffer_elements = reinterpret_cast<Scalar*>(shared_data); Scalar value = shared_team_buffer_elements[threadIdx.y]; - int shared_elements = (blockDim.x * blockDim.y) / - ::Kokkos::Experimental::Impl::HIPTraits::WarpSize; + int shared_elements = (blockDim.x * blockDim.y) / HIPTraits::WarpSize; int global_elements = block_count; __syncthreads(); @@ -300,9 +263,8 @@ __device__ void hip_intra_block_reduce_scan( // For that warp, we shift all indices logically to the end and ignore join // operations with unassigned indices in the warp when performing the intra // warp reduction/scan. - const bool is_full_warp = - (((threadIdx.y >> Experimental::Impl::HIPTraits::WarpIndexShift) + 1) - << Experimental::Impl::HIPTraits::WarpIndexShift) <= blockDim.y; + const bool is_full_warp = (((threadIdx.y >> HIPTraits::WarpIndexShift) + 1) + << HIPTraits::WarpIndexShift) <= blockDim.y; auto block_reduce_step = [&functor, value_count]( int const R, pointer_type const TD, int const S, @@ -314,24 +276,19 @@ __device__ void hip_intra_block_reduce_scan( }; // Intra-warp reduction: + int bit_shift = 0; { const unsigned mapped_idx = - threadIdx.y + (is_full_warp - ? 0 - : (not_less_power_of_two - blockDim.y) & - (Experimental::Impl::HIPTraits::WarpSize - 1)); + threadIdx.y + (is_full_warp ? 0 + : (not_less_power_of_two - blockDim.y) & + (HIPTraits::WarpSize - 1)); const pointer_type tdata_intra = base_data + value_count * threadIdx.y; const pointer_type warp_start = - base_data + - value_count * - ((threadIdx.y >> Experimental::Impl::HIPTraits::WarpIndexShift) - << Experimental::Impl::HIPTraits::WarpIndexShift); - block_reduce_step(mapped_idx, tdata_intra, 0, warp_start, 0); - block_reduce_step(mapped_idx, tdata_intra, 1, warp_start, 0); - block_reduce_step(mapped_idx, tdata_intra, 2, warp_start, 0); - block_reduce_step(mapped_idx, tdata_intra, 3, warp_start, 0); - block_reduce_step(mapped_idx, tdata_intra, 4, warp_start, 0); - block_reduce_step(mapped_idx, tdata_intra, 5, warp_start, 0); + base_data + value_count * ((threadIdx.y >> HIPTraits::WarpIndexShift) + << HIPTraits::WarpIndexShift); + for (; (1 << bit_shift) < HIPTraits::WarpSize; ++bit_shift) { + block_reduce_step(mapped_idx, tdata_intra, bit_shift, warp_start, 0); + } } __syncthreads(); // Wait for all warps to reduce @@ -343,42 +300,26 @@ __device__ void hip_intra_block_reduce_scan( // following reduction, we shift all indices logically to the end of the // next power-of-two to the number of warps. const unsigned n_active_warps = - ((blockDim.y - 1) >> Experimental::Impl::HIPTraits::WarpIndexShift) + 1; + ((blockDim.y - 1) >> HIPTraits::WarpIndexShift) + 1; if (threadIdx.y < n_active_warps) { const bool is_full_warp_inter = - threadIdx.y < - (blockDim.y >> Experimental::Impl::HIPTraits::WarpIndexShift); + threadIdx.y < (blockDim.y >> HIPTraits::WarpIndexShift); pointer_type const tdata_inter = base_data + - value_count * - (is_full_warp_inter - ? (threadIdx.y - << Experimental::Impl::HIPTraits::WarpIndexShift) + - (Experimental::Impl::HIPTraits::WarpSize - 1) - : blockDim.y - 1); + value_count * (is_full_warp_inter + ? (threadIdx.y << HIPTraits::WarpIndexShift) + + (HIPTraits::WarpSize - 1) + : blockDim.y - 1); const unsigned index_shift = is_full_warp_inter ? 0 - : blockDim.y - (threadIdx.y - << Experimental::Impl::HIPTraits::WarpIndexShift); - const int rtid_inter = - (threadIdx.y << Experimental::Impl::HIPTraits::WarpIndexShift) + - (Experimental::Impl::HIPTraits::WarpSize - 1) - index_shift; - - if ((1 << 6) < BlockSizeMask) { - block_reduce_step(rtid_inter, tdata_inter, 6, base_data, index_shift); - } - if ((1 << 7) < BlockSizeMask) { - block_reduce_step(rtid_inter, tdata_inter, 7, base_data, index_shift); - } - if ((1 << 8) < BlockSizeMask) { - block_reduce_step(rtid_inter, tdata_inter, 8, base_data, index_shift); - } - if ((1 << 9) < BlockSizeMask) { - block_reduce_step(rtid_inter, tdata_inter, 9, base_data, index_shift); - } - if ((1 << 10) < BlockSizeMask) { - block_reduce_step(rtid_inter, tdata_inter, 10, base_data, index_shift); + : blockDim.y - (threadIdx.y << HIPTraits::WarpIndexShift); + const int rtid_inter = (threadIdx.y << HIPTraits::WarpIndexShift) + + (HIPTraits::WarpSize - 1) - index_shift; + + for (; (1 << bit_shift) < BlockSizeMask; ++bit_shift) { + block_reduce_step(rtid_inter, tdata_inter, bit_shift, base_data, + index_shift); } } } @@ -388,13 +329,11 @@ __device__ void hip_intra_block_reduce_scan( if (DoScan) { // Update all the values for the respective warps (except for the last one) // by adding from the last value of the previous warp. - const unsigned int WarpMask = Experimental::Impl::HIPTraits::WarpSize - 1; + const unsigned int WarpMask = HIPTraits::WarpSize - 1; const int is_last_thread_in_warp = - is_full_warp ? ((threadIdx.y & WarpMask) == - Experimental::Impl::HIPTraits::WarpSize - 1) + is_full_warp ? ((threadIdx.y & WarpMask) == HIPTraits::WarpSize - 1) : (threadIdx.y == blockDim.y - 1); - if (threadIdx.y >= Experimental::Impl::HIPTraits::WarpSize && - !is_last_thread_in_warp) { + if (threadIdx.y >= HIPTraits::WarpSize && !is_last_thread_in_warp) { const int offset_to_previous_warp_total = (threadIdx.y & (~WarpMask)) - 1; functor.join(base_data + value_count * threadIdx.y, base_data + value_count * offset_to_previous_warp_total); @@ -413,11 +352,9 @@ __device__ void hip_intra_block_reduce_scan( template <bool DoScan, typename FunctorType, typename SizeType> __device__ bool hip_single_inter_block_reduce_scan_impl( - FunctorType const& functor, - ::Kokkos::Experimental::HIP::size_type const block_id, - ::Kokkos::Experimental::HIP::size_type const block_count, - SizeType* const shared_data, SizeType* const global_data, - ::Kokkos::Experimental::HIP::size_type* const global_flags) { + FunctorType const& functor, HIP::size_type const block_id, + HIP::size_type const block_count, SizeType* const shared_data, + SizeType* const global_data, HIP::size_type* const global_flags) { using size_type = SizeType; using value_type = typename FunctorType::value_type; using pointer_type = typename FunctorType::pointer_type; @@ -518,11 +455,9 @@ __device__ bool hip_single_inter_block_reduce_scan_impl( template <bool DoScan, typename FunctorType, typename SizeType> __device__ bool hip_single_inter_block_reduce_scan( - FunctorType const& functor, - ::Kokkos::Experimental::HIP::size_type const block_id, - ::Kokkos::Experimental::HIP::size_type const block_count, - SizeType* const shared_data, SizeType* const global_data, - ::Kokkos::Experimental::HIP::size_type* const global_flags) { + FunctorType const& functor, HIP::size_type const block_id, + HIP::size_type const block_count, SizeType* const shared_data, + SizeType* const global_data, HIP::size_type* const global_flags) { // If we are doing a reduction and we don't do an array reduction, we use the // reduction-only path. Otherwise, we use the common path between reduction // and scan. @@ -547,8 +482,7 @@ inline std::enable_if_t<DoScan, unsigned> hip_single_inter_block_reduce_scan_shmem(const FunctorType& functor, const unsigned BlockSize) { using Analysis = Impl::FunctorAnalysis<Impl::FunctorPatternInterface::SCAN, - RangePolicy<Experimental::HIP, ArgTag>, - FunctorType>; + RangePolicy<HIP, ArgTag>, FunctorType>; return (BlockSize + 2) * Analysis::value_size(functor); } @@ -558,8 +492,7 @@ inline std::enable_if_t<!DoScan, unsigned> hip_single_inter_block_reduce_scan_shmem(const FunctorType& functor, const unsigned BlockSize) { using Analysis = Impl::FunctorAnalysis<Impl::FunctorPatternInterface::REDUCE, - RangePolicy<Experimental::HIP, ArgTag>, - FunctorType>; + RangePolicy<HIP, ArgTag>, FunctorType>; return (BlockSize + 2) * Analysis::value_size(functor); } diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ea599989e7ad9617e30678c0712dee1f95727752 --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.cpp @@ -0,0 +1,155 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#endif + +#include <HIP/Kokkos_HIP_SharedAllocationRecord.hpp> +#include <HIP/Kokkos_HIP_DeepCopy.hpp> +#include <HIP/Kokkos_HIP.hpp> + +namespace Kokkos { +namespace Impl { + +#ifdef KOKKOS_ENABLE_DEBUG +SharedAllocationRecord<void, void> + SharedAllocationRecord<HIPSpace, void>::s_root_record; + +SharedAllocationRecord<void, void> + SharedAllocationRecord<HIPHostPinnedSpace, void>::s_root_record; + +SharedAllocationRecord<void, void> + SharedAllocationRecord<HIPManagedSpace, void>::s_root_record; +#endif + +SharedAllocationRecord<HIPSpace, void>::~SharedAllocationRecord() { + auto alloc_size = SharedAllocationRecord<void, void>::m_alloc_size; + m_space.deallocate(m_label.c_str(), + SharedAllocationRecord<void, void>::m_alloc_ptr, + alloc_size, (alloc_size - sizeof(SharedAllocationHeader))); +} + +SharedAllocationRecord<HIPHostPinnedSpace, void>::~SharedAllocationRecord() { + m_space.deallocate(m_label.c_str(), + SharedAllocationRecord<void, void>::m_alloc_ptr, + SharedAllocationRecord<void, void>::m_alloc_size); +} + +SharedAllocationRecord<HIPManagedSpace, void>::~SharedAllocationRecord() { + m_space.deallocate(m_label.c_str(), + SharedAllocationRecord<void, void>::m_alloc_ptr, + SharedAllocationRecord<void, void>::m_alloc_size); +} + +SharedAllocationRecord<HIPSpace, void>::SharedAllocationRecord( + const HIPSpace& arg_space, const std::string& arg_label, + const size_t arg_alloc_size, + const SharedAllocationRecord<void, void>::function_type arg_dealloc) + // Pass through allocated [ SharedAllocationHeader , user_memory ] + // Pass through deallocation function + : base_t( +#ifdef KOKKOS_ENABLE_DEBUG + &SharedAllocationRecord<HIPSpace, void>::s_root_record, +#endif + Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label, + arg_alloc_size), + sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, + arg_label), + m_space(arg_space) { + + SharedAllocationHeader header; + + this->base_t::_fill_host_accessible_header_info(header, arg_label); + + // Copy to device memory + HIP exec; + Kokkos::Impl::DeepCopy<HIPSpace, HostSpace>( + exec, RecordBase::m_alloc_ptr, &header, sizeof(SharedAllocationHeader)); + exec.fence( + "SharedAllocationRecord<Kokkos::HIPSpace, " + "void>::SharedAllocationRecord(): fence after copying header from " + "HostSpace"); +} + +SharedAllocationRecord<HIPSpace, void>::SharedAllocationRecord( + const HIP& arg_exec_space, const HIPSpace& arg_space, + const std::string& arg_label, const size_t arg_alloc_size, + const SharedAllocationRecord<void, void>::function_type arg_dealloc) + // Pass through allocated [ SharedAllocationHeader , user_memory ] + // Pass through deallocation function + : base_t( +#ifdef KOKKOS_ENABLE_DEBUG + &SharedAllocationRecord<HIPSpace, void>::s_root_record, +#endif + Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label, + arg_alloc_size), + sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, + arg_label), + m_space(arg_space) { + + SharedAllocationHeader header; + + this->base_t::_fill_host_accessible_header_info(header, arg_label); + + // Copy to device memory + Kokkos::Impl::DeepCopy<HIPSpace, HostSpace>(arg_exec_space, + RecordBase::m_alloc_ptr, &header, + sizeof(SharedAllocationHeader)); +} + +SharedAllocationRecord<HIPHostPinnedSpace, void>::SharedAllocationRecord( + const HIPHostPinnedSpace& arg_space, const std::string& arg_label, + const size_t arg_alloc_size, + const SharedAllocationRecord<void, void>::function_type arg_dealloc) + // Pass through allocated [ SharedAllocationHeader , user_memory ] + // Pass through deallocation function + : base_t( +#ifdef KOKKOS_ENABLE_DEBUG + &SharedAllocationRecord<HIPHostPinnedSpace, void>::s_root_record, +#endif + Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label, + arg_alloc_size), + sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, + arg_label), + m_space(arg_space) { + // Fill in the Header information, directly accessible via host pinned memory + this->base_t::_fill_host_accessible_header_info(*RecordBase::m_alloc_ptr, + arg_label); +} + +SharedAllocationRecord<HIPManagedSpace, void>::SharedAllocationRecord( + const HIPManagedSpace& arg_space, const std::string& arg_label, + const size_t arg_alloc_size, + const SharedAllocationRecord<void, void>::function_type arg_dealloc) + // Pass through allocated [ SharedAllocationHeader , user_memory ] + // Pass through deallocation function + : base_t( +#ifdef KOKKOS_ENABLE_DEBUG + &SharedAllocationRecord<HIPManagedSpace, void>::s_root_record, +#endif + Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label, + arg_alloc_size), + sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, + arg_label), + m_space(arg_space) { + // Fill in the Header information, directly accessible via managed memory + this->base_t::_fill_host_accessible_header_info(*RecordBase::m_alloc_ptr, + arg_label); +} + +} // namespace Impl +} // namespace Kokkos diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e68bad9723079fcbf0666fa2945391db446f64c8 --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_SharedAllocationRecord.hpp @@ -0,0 +1,137 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_HIP_SHARED_ALLOCATION_RECORD_HPP +#define KOKKOS_HIP_SHARED_ALLOCATION_RECORD_HPP + +#include <HIP/Kokkos_HIP_Space.hpp> + +namespace Kokkos { +namespace Impl { + +template <> +class SharedAllocationRecord<HIPSpace, void> + : public HostInaccessibleSharedAllocationRecordCommon<HIPSpace> { + private: + friend class SharedAllocationRecordCommon<HIPSpace>; + friend class HostInaccessibleSharedAllocationRecordCommon<HIPSpace>; + using base_t = HostInaccessibleSharedAllocationRecordCommon<HIPSpace>; + using RecordBase = SharedAllocationRecord<void, void>; + + SharedAllocationRecord(const SharedAllocationRecord&) = delete; + SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete; + +#ifdef KOKKOS_ENABLE_DEBUG + static RecordBase s_root_record; +#endif + + const HIPSpace m_space; + + protected: + ~SharedAllocationRecord(); + + template <typename ExecutionSpace> + SharedAllocationRecord( + const ExecutionSpace& /*exec*/, const HIPSpace& arg_space, + const std::string& arg_label, const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &base_t::deallocate) + : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size, + arg_dealloc) {} + + SharedAllocationRecord( + const HIP& exec_space, const HIPSpace& arg_space, + const std::string& arg_label, const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &base_t::deallocate); + + SharedAllocationRecord( + const HIPSpace& arg_space, const std::string& arg_label, + const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &base_t::deallocate); +}; + +template <> +class SharedAllocationRecord<HIPHostPinnedSpace, void> + : public SharedAllocationRecordCommon<HIPHostPinnedSpace> { + private: + friend class SharedAllocationRecordCommon<HIPHostPinnedSpace>; + using base_t = SharedAllocationRecordCommon<HIPHostPinnedSpace>; + using RecordBase = SharedAllocationRecord<void, void>; + + SharedAllocationRecord(const SharedAllocationRecord&) = delete; + SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete; + +#ifdef KOKKOS_ENABLE_DEBUG + static RecordBase s_root_record; +#endif + + const HIPHostPinnedSpace m_space; + + protected: + ~SharedAllocationRecord(); + SharedAllocationRecord() = default; + + template <typename ExecutionSpace> + SharedAllocationRecord( + const ExecutionSpace& /*exec_space*/, const HIPHostPinnedSpace& arg_space, + const std::string& arg_label, const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &base_t::deallocate) + : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size, + arg_dealloc) {} + + SharedAllocationRecord( + const HIPHostPinnedSpace& arg_space, const std::string& arg_label, + const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &base_t::deallocate); +}; + +template <> +class SharedAllocationRecord<HIPManagedSpace, void> + : public SharedAllocationRecordCommon<HIPManagedSpace> { + private: + friend class SharedAllocationRecordCommon<HIPManagedSpace>; + using base_t = SharedAllocationRecordCommon<HIPManagedSpace>; + using RecordBase = SharedAllocationRecord<void, void>; + + SharedAllocationRecord(const SharedAllocationRecord&) = delete; + SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete; + +#ifdef KOKKOS_ENABLE_DEBUG + static RecordBase s_root_record; +#endif + + const HIPManagedSpace m_space; + + protected: + ~SharedAllocationRecord(); + SharedAllocationRecord() = default; + + template <typename ExecutionSpace> + SharedAllocationRecord( + const ExecutionSpace& /*exec_space*/, const HIPManagedSpace& arg_space, + const std::string& arg_label, const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &base_t::deallocate) + : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size, + arg_dealloc) {} + + SharedAllocationRecord( + const HIPManagedSpace& arg_space, const std::string& arg_label, + const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &base_t::deallocate); +}; +} // namespace Impl +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp index d0bbc18da8a1c64839444f5abb8c4d507a01a30b..cca5e9ff26e4f6b05686d764affefdd0343dd932 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Shuffle_Reduce.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_SHUFFLE_REDUCE_HPP #define KOKKOS_HIP_SHUFFLE_REDUCE_HPP @@ -68,11 +40,9 @@ __device__ inline void hip_intra_warp_shuffle_reduction( unsigned int shift = 1; // Reduce over values from threads with different threadIdx.y - unsigned int constexpr warp_size = - Kokkos::Experimental::Impl::HIPTraits::WarpSize; + unsigned int constexpr warp_size = HIPTraits::WarpSize; while (blockDim.x * shift < warp_size) { - ValueType const tmp = - Kokkos::Experimental::shfl_down(result, blockDim.x * shift, warp_size); + ValueType const tmp = shfl_down(result, blockDim.x * shift, warp_size); // Only join if upper thread is active (this allows non power of two for // blockDim.y) if (threadIdx.y + shift < max_active_thread) { @@ -82,16 +52,15 @@ __device__ inline void hip_intra_warp_shuffle_reduction( } // Broadcast the result to all the threads in the warp - result = Kokkos::Experimental::shfl(result, 0, warp_size); + result = shfl(result, 0, warp_size); } template <typename ValueType, typename ReducerType> __device__ inline void hip_inter_warp_shuffle_reduction( ValueType& value, const ReducerType& reducer, const int max_active_thread = blockDim.y) { - unsigned int constexpr warp_size = - Kokkos::Experimental::Impl::HIPTraits::WarpSize; - int constexpr step_width = 8; + unsigned int constexpr warp_size = HIPTraits::WarpSize; + int constexpr step_width = 8; // Depending on the ValueType __shared__ memory must be aligned up to 8 byte // boundaries. The reason not to use ValueType directly is that for types with // constructors it could lead to race conditions. @@ -131,9 +100,9 @@ template <class FunctorType> __device__ inline bool hip_inter_block_shuffle_reduction( typename FunctorType::reference_type value, typename FunctorType::reference_type neutral, FunctorType const& reducer, - Kokkos::Experimental::HIP::size_type* const m_scratch_space, + HIP::size_type* const m_scratch_space, typename FunctorType::pointer_type const /*result*/, - Kokkos::Experimental::HIP::size_type* const m_scratch_flags, + HIP::size_type* const m_scratch_flags, int const max_active_thread = blockDim.y) { using pointer_type = typename FunctorType::pointer_type; using value_type = typename FunctorType::value_type; @@ -155,13 +124,13 @@ __device__ inline bool hip_inter_block_shuffle_reduction( // block values from global scratch_memory bool last_block = false; __syncthreads(); - int constexpr warp_size = Kokkos::Experimental::Impl::HIPTraits::WarpSize; + int constexpr warp_size = HIPTraits::WarpSize; if (id < warp_size) { - Kokkos::Experimental::HIP::size_type count; + HIP::size_type count; // Figure out whether this is the last block if (id == 0) count = Kokkos::atomic_fetch_add(m_scratch_flags, 1); - count = Kokkos::Experimental::shfl(count, 0, warp_size); + count = shfl(count, 0, warp_size); // Last block does the inter block reduction if (count == gridDim.x - 1) { @@ -186,7 +155,7 @@ __device__ inline bool hip_inter_block_shuffle_reduction( // valid (allows gridDim.x non power of two and <warp_size) for (unsigned int i = 1; i < warp_size; i *= 2) { if ((blockDim.x * blockDim.y) > i) { - value_type tmp = Kokkos::Experimental::shfl_down(value, i, warp_size); + value_type tmp = shfl_down(value, i, warp_size); if (id + i < gridDim.x) reducer.join(&value, &tmp); } } diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp index aee9756af0d166c113ee7f8c986b53cba4872981..07b9382ab7658d87ea1dcb226181164cf379c533 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -49,14 +21,18 @@ #include <Kokkos_Macros.hpp> #include <Kokkos_Core.hpp> -#include <Kokkos_HIP.hpp> -#include <Kokkos_HIP_Space.hpp> +#include <HIP/Kokkos_HIP_Space.hpp> + +#include <HIP/Kokkos_HIP_DeepCopy.hpp> +#include <HIP/Kokkos_HIP_SharedAllocationRecord.hpp> #include <impl/Kokkos_Error.hpp> #include <impl/Kokkos_MemorySpace.hpp> #include <impl/Kokkos_DeviceManagement.hpp> #include <impl/Kokkos_ExecSpaceManager.hpp> +#include <hip/hip_runtime_api.h> + #include <stdlib.h> #include <iostream> #include <sstream> @@ -78,73 +54,12 @@ bool hip_driver_check_page_migration(int deviceId) { return static_cast<bool>(hasManagedMemory); } } // namespace -namespace Kokkos { -namespace Impl { - -namespace { -hipStream_t get_deep_copy_stream() { - static hipStream_t s = nullptr; - if (s == nullptr) { - KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&s)); - } - return s; -} -} // namespace - -void DeepCopyHIP(void* dst, void const* src, size_t n) { - KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(dst, src, n, hipMemcpyDefault)); -} - -void DeepCopyAsyncHIP(const Kokkos::Experimental::HIP& instance, void* dst, - void const* src, size_t n) { - KOKKOS_IMPL_HIP_SAFE_CALL( - hipMemcpyAsync(dst, src, n, hipMemcpyDefault, instance.hip_stream())); -} - -void DeepCopyAsyncHIP(void* dst, void const* src, size_t n) { - hipStream_t s = get_deep_copy_stream(); - KOKKOS_IMPL_HIP_SAFE_CALL(hipMemcpyAsync(dst, src, n, hipMemcpyDefault, s)); - Kokkos::Tools::Experimental::Impl::profile_fence_event< - Kokkos::Experimental::HIP>( - "Kokkos::Impl::DeepCopyAsyncHIP: Post Deep Copy Fence on Deep-Copy " - "stream", - Kokkos::Tools::Experimental::SpecialSynchronizationCases:: - DeepCopyResourceSynchronization, - [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamSynchronize(s)); }); -} - -} // namespace Impl -} // namespace Kokkos /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 namespace Kokkos { -KOKKOS_DEPRECATED void Experimental::HIPSpace::access_error() { - const std::string msg( - "Kokkos::Experimental::HIPSpace::access_error attempt to execute " - "Experimental::HIP function from non-HIP space"); - Kokkos::Impl::throw_runtime_exception(msg); -} - -KOKKOS_DEPRECATED void Experimental::HIPSpace::access_error(const void* const) { - const std::string msg( - "Kokkos::Experimental::HIPSpace::access_error attempt to execute " - "Experimental::HIP function from non-HIP space"); - Kokkos::Impl::throw_runtime_exception(msg); -} - -} // namespace Kokkos -#endif - -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Experimental { - HIPSpace::HIPSpace() : m_device(HIP().hip_device()) {} HIPHostPinnedSpace::HIPHostPinnedSpace() {} @@ -172,9 +87,10 @@ void* HIPSpace::impl_allocate( // This is the only way to clear the last error, which we should do here // since we're turning it into an exception here (void)hipGetLastError(); - throw HIPRawMemoryAllocationFailure( + throw Experimental::HIPRawMemoryAllocationFailure( arg_alloc_size, error_code, - RawMemoryAllocationFailure::AllocationMechanism::HIPMalloc); + Experimental::RawMemoryAllocationFailure::AllocationMechanism:: + HIPMalloc); } if (Kokkos::Profiling::profileLibraryLoaded()) { const size_t reported_size = @@ -205,9 +121,10 @@ void* HIPHostPinnedSpace::impl_allocate( // This is the only way to clear the last error, which we should do here // since we're turning it into an exception here (void)hipGetLastError(); - throw HIPRawMemoryAllocationFailure( + throw Experimental::HIPRawMemoryAllocationFailure( arg_alloc_size, error_code, - RawMemoryAllocationFailure::AllocationMechanism::HIPHostMalloc); + Experimental::RawMemoryAllocationFailure::AllocationMechanism:: + HIPHostMalloc); } if (Kokkos::Profiling::profileLibraryLoaded()) { const size_t reported_size = @@ -235,41 +152,46 @@ void* HIPManagedSpace::impl_allocate( if (arg_alloc_size > 0) { if (is_first_hip_managed_allocation.exchange(false) && Kokkos::show_warnings()) { - if (!hip_driver_check_page_migration(m_device)) { - std::cerr << R"warning( + do { // hack to avoid spamming users with too many warnings + if (!hip_driver_check_page_migration(m_device)) { + std::cerr << R"warning( Kokkos::HIP::allocation WARNING: The combination of device and system configuration does not support page migration between device and host. HIPManagedSpace might not work as expected. Please refer to the ROCm documentation on unified/managed memory.)warning" - << std::endl; - } - - // check for correct runtime environment - const char* hsa_xnack = std::getenv("HSA_XNACK"); - if (!hsa_xnack) - std::cerr << R"warning( + << std::endl; + break; // do not warn about HSA_XNACK environement variable + } + + // check for correct runtime environment + const char* hsa_xnack = std::getenv("HSA_XNACK"); + if (!hsa_xnack) + std::cerr << R"warning( Kokkos::HIP::runtime WARNING: Kokkos did not find an environment variable 'HSA_XNACK' for the current process. Nevertheless, xnack is enabled for all processes if amdgpu.noretry=0 was set in the Linux kernel boot line. Without xnack enabled, Kokkos::HIPManaged might not behave as expected.)warning" - << std::endl; - else if (Kokkos::Impl::strcmp(hsa_xnack, "1") != 0) - std::cerr << "Kokkos::HIP::runtime WARNING: Kokkos detected the " - "environement variable " - << "'HSA_XNACK=" << hsa_xnack << "\n" - << "Kokkos advises to set it to '1' to enable it per process." - << std::endl; + << std::endl; + else if (Kokkos::Impl::strcmp(hsa_xnack, "1") != 0) + std::cerr + << "Kokkos::HIP::runtime WARNING: Kokkos detected the " + "environement variable " + << "'HSA_XNACK'=" << hsa_xnack << "\n" + << "Kokkos advises to set it to '1' to enable it per process." + << std::endl; + } while (false); } auto const error_code = hipMallocManaged(&ptr, arg_alloc_size); if (error_code != hipSuccess) { // This is the only way to clear the last error, which we should do here // since we're turning it into an exception here (void)hipGetLastError(); - throw HIPRawMemoryAllocationFailure( + throw Experimental::HIPRawMemoryAllocationFailure( arg_alloc_size, error_code, - RawMemoryAllocationFailure::AllocationMechanism::HIPMallocManaged); + Experimental::RawMemoryAllocationFailure::AllocationMechanism:: + HIPMallocManaged); } KOKKOS_IMPL_HIP_SAFE_CALL(hipMemAdvise( ptr, arg_alloc_size, hipMemAdviseSetCoarseGrain, m_device)); @@ -359,257 +281,10 @@ void HIPManagedSpace::impl_deallocate( KOKKOS_IMPL_HIP_SAFE_CALL(hipFree(arg_alloc_ptr)); } -} // namespace Experimental -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Impl { - -#ifdef KOKKOS_ENABLE_DEBUG -SharedAllocationRecord<void, void> - SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>::s_root_record; - -SharedAllocationRecord<void, void> SharedAllocationRecord< - Kokkos::Experimental::HIPHostPinnedSpace, void>::s_root_record; - -SharedAllocationRecord<void, void> SharedAllocationRecord< - Kokkos::Experimental::HIPManagedSpace, void>::s_root_record; -#endif - -SharedAllocationRecord<Kokkos::Experimental::HIPSpace, - void>::~SharedAllocationRecord() { - auto alloc_size = SharedAllocationRecord<void, void>::m_alloc_size; - m_space.deallocate(m_label.c_str(), - SharedAllocationRecord<void, void>::m_alloc_ptr, - alloc_size, (alloc_size - sizeof(SharedAllocationHeader))); -} - -SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace, - void>::~SharedAllocationRecord() { - m_space.deallocate(m_label.c_str(), - SharedAllocationRecord<void, void>::m_alloc_ptr, - SharedAllocationRecord<void, void>::m_alloc_size); -} - -SharedAllocationRecord<Kokkos::Experimental::HIPManagedSpace, - void>::~SharedAllocationRecord() { - m_space.deallocate(m_label.c_str(), - SharedAllocationRecord<void, void>::m_alloc_ptr, - SharedAllocationRecord<void, void>::m_alloc_size); -} - -SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>:: - SharedAllocationRecord( - const Kokkos::Experimental::HIPSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const SharedAllocationRecord<void, void>::function_type arg_dealloc) - // Pass through allocated [ SharedAllocationHeader , user_memory ] - // Pass through deallocation function - : base_t( -#ifdef KOKKOS_ENABLE_DEBUG - &SharedAllocationRecord<Kokkos::Experimental::HIPSpace, - void>::s_root_record, -#endif - Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label, - arg_alloc_size), - sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, - arg_label), - m_space(arg_space) { - - SharedAllocationHeader header; - - this->base_t::_fill_host_accessible_header_info(header, arg_label); - - // Copy to device memory - Kokkos::Experimental::HIP exec; - Kokkos::Impl::DeepCopy<Kokkos::Experimental::HIPSpace, HostSpace>( - exec, RecordBase::m_alloc_ptr, &header, sizeof(SharedAllocationHeader)); - exec.fence( - "SharedAllocationRecord<Kokkos::Experimental::HIPSpace, " - "void>::SharedAllocationRecord(): fence after copying header from " - "HostSpace"); -} - -SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>:: - SharedAllocationRecord( - const Kokkos::Experimental::HIP& arg_exec_space, - const Kokkos::Experimental::HIPSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const SharedAllocationRecord<void, void>::function_type arg_dealloc) - // Pass through allocated [ SharedAllocationHeader , user_memory ] - // Pass through deallocation function - : base_t( -#ifdef KOKKOS_ENABLE_DEBUG - &SharedAllocationRecord<Kokkos::Experimental::HIPSpace, - void>::s_root_record, -#endif - Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label, - arg_alloc_size), - sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, - arg_label), - m_space(arg_space) { - - SharedAllocationHeader header; - - this->base_t::_fill_host_accessible_header_info(header, arg_label); - - // Copy to device memory - Kokkos::Impl::DeepCopy<Kokkos::Experimental::HIPSpace, HostSpace>( - arg_exec_space, RecordBase::m_alloc_ptr, &header, - sizeof(SharedAllocationHeader)); -} - -SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace, void>:: - SharedAllocationRecord( - const Kokkos::Experimental::HIPHostPinnedSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const SharedAllocationRecord<void, void>::function_type arg_dealloc) - // Pass through allocated [ SharedAllocationHeader , user_memory ] - // Pass through deallocation function - : base_t( -#ifdef KOKKOS_ENABLE_DEBUG - &SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace, - void>::s_root_record, -#endif - Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label, - arg_alloc_size), - sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, - arg_label), - m_space(arg_space) { - // Fill in the Header information, directly accessible via host pinned memory - this->base_t::_fill_host_accessible_header_info(*RecordBase::m_alloc_ptr, - arg_label); -} - -SharedAllocationRecord<Kokkos::Experimental::HIPManagedSpace, void>:: - SharedAllocationRecord( - const Kokkos::Experimental::HIPManagedSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const SharedAllocationRecord<void, void>::function_type arg_dealloc) - // Pass through allocated [ SharedAllocationHeader , user_memory ] - // Pass through deallocation function - : base_t( -#ifdef KOKKOS_ENABLE_DEBUG - &SharedAllocationRecord<Kokkos::Experimental::HIPManagedSpace, - void>::s_root_record, -#endif - Kokkos::Impl::checked_allocation_with_header(arg_space, arg_label, - arg_alloc_size), - sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, - arg_label), - m_space(arg_space) { - // Fill in the Header information, directly accessible via managed memory - this->base_t::_fill_host_accessible_header_info(*RecordBase::m_alloc_ptr, - arg_label); -} - -} // namespace Impl } // namespace Kokkos /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ -namespace Kokkos { -namespace Experimental { - -int HIP::concurrency() { - auto const& prop = hip_device_prop(); - return prop.maxThreadsPerMultiProcessor * prop.multiProcessorCount; -} -int HIP::impl_is_initialized() { - return Impl::HIPInternal::singleton().is_initialized(); -} - -void HIP::impl_initialize(InitializationSettings const& settings) { - Impl::HIPInternal::singleton().initialize(::Kokkos::Impl::get_gpu(settings)); -} - -void HIP::impl_finalize() { Impl::HIPInternal::singleton().finalize(); } - -HIP::HIP() - : m_space_instance(&Impl::HIPInternal::singleton(), - [](Impl::HIPInternal*) {}) { - Impl::HIPInternal::singleton().verify_is_initialized( - "HIP instance constructor"); -} - -HIP::HIP(hipStream_t const stream, bool manage_stream) - : m_space_instance(new Impl::HIPInternal, [](Impl::HIPInternal* ptr) { - ptr->finalize(); - delete ptr; - }) { - Impl::HIPInternal::singleton().verify_is_initialized( - "HIP instance constructor"); - m_space_instance->initialize(Impl::HIPInternal::singleton().m_hipDev, stream, - manage_stream); -} - -void HIP::print_configuration(std::ostream& os, bool /*verbose*/) const { - os << "Device Execution Space:\n"; - os << " KOKKOS_ENABLE_HIP: yes\n"; - - os << "HIP Options:\n"; - os << " KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE: "; -#ifdef KOKKOS_ENABLE_HIP_RELOCATABLE_DEVICE_CODE - os << "yes\n"; -#else - os << "no\n"; -#endif - - os << "\nRuntime Configuration:\n"; - - m_space_instance->print_configuration(os); -} - -uint32_t HIP::impl_instance_id() const noexcept { - return m_space_instance->impl_get_instance_id(); -} -void HIP::impl_static_fence(const std::string& name) { - Kokkos::Tools::Experimental::Impl::profile_fence_event< - Kokkos::Experimental::HIP>( - name, - Kokkos::Tools::Experimental::SpecialSynchronizationCases:: - GlobalDeviceSynchronization, - [&]() { KOKKOS_IMPL_HIP_SAFE_CALL(hipDeviceSynchronize()); }); -} - -void HIP::fence(const std::string& name) const { - m_space_instance->fence(name); -} - -hipStream_t HIP::hip_stream() const { return m_space_instance->m_stream; } - -int HIP::hip_device() const { return impl_internal_space_instance()->m_hipDev; } - -hipDeviceProp_t const& HIP::hip_device_prop() { - return Impl::HIPInternal::singleton().m_deviceProp; -} - -const char* HIP::name() { return "HIP"; } - -} // namespace Experimental - -namespace Impl { - -int g_hip_space_factory_initialized = - initialize_space_factory<::Kokkos::Experimental::HIP>("150_HIP"); - -} // namespace Impl - -#ifdef KOKKOS_ENABLE_CXX14 -namespace Tools { -namespace Experimental { -constexpr DeviceType DeviceTypeTraits<Kokkos::Experimental::HIP>::id; -} -} // namespace Tools -#endif - -} // namespace Kokkos - -//============================================================================== -// <editor-fold desc="Explicit instantiations of CRTP Base classes"> {{{1 #include <impl/Kokkos_SharedAlloc_timpl.hpp> @@ -619,16 +294,10 @@ namespace Impl { // To avoid additional compilation cost for something that's (mostly?) not // performance sensitive, we explicity instantiate these CRTP base classes here, // where we have access to the associated *_timpl.hpp header files. -template class HostInaccessibleSharedAllocationRecordCommon< - Kokkos::Experimental::HIPSpace>; -template class SharedAllocationRecordCommon<Kokkos::Experimental::HIPSpace>; -template class SharedAllocationRecordCommon< - Kokkos::Experimental::HIPHostPinnedSpace>; -template class SharedAllocationRecordCommon< - Kokkos::Experimental::HIPManagedSpace>; +template class HostInaccessibleSharedAllocationRecordCommon<HIPSpace>; +template class SharedAllocationRecordCommon<HIPSpace>; +template class SharedAllocationRecordCommon<HIPHostPinnedSpace>; +template class SharedAllocationRecordCommon<HIPManagedSpace>; } // end namespace Impl } // end namespace Kokkos - -// </editor-fold> end Explicit instantiations of CRTP Base classes }}}1 -//============================================================================== diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp new file mode 100644 index 0000000000000000000000000000000000000000..902b6f05527b1a10ae30da1a82ac1c2de41eb421 --- /dev/null +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Space.hpp @@ -0,0 +1,345 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_HIPSPACE_HPP +#define KOKKOS_HIPSPACE_HPP + +#include <Kokkos_Core_fwd.hpp> + +#include <iosfwd> +#include <typeinfo> +#include <string> +#include <cstddef> +#include <iosfwd> + +#include <Kokkos_HostSpace.hpp> +#include <Kokkos_ScratchSpace.hpp> +#include <HIP/Kokkos_HIP_Error.hpp> // HIP_SAFE_CALL + +#include <impl/Kokkos_Profiling_Interface.hpp> +#include <impl/Kokkos_HostSharedPtr.hpp> + +#include <hip/hip_runtime_api.h> + +/*--------------------------------------------------------------------------*/ + +namespace Kokkos { +namespace Impl { + +template <typename T> +struct is_hip_type_space : public std::false_type {}; + +} // namespace Impl + +/** \brief HIP on-device memory management */ + +class HIPSpace { + public: + //! Tag this class as a kokkos memory space + using memory_space = HIPSpace; + using execution_space = HIP; + using device_type = Kokkos::Device<execution_space, memory_space>; + + using size_type = unsigned int; + + /*--------------------------------*/ + + HIPSpace(); + HIPSpace(HIPSpace&& rhs) = default; + HIPSpace(const HIPSpace& rhs) = default; + HIPSpace& operator=(HIPSpace&& rhs) = default; + HIPSpace& operator=(const HIPSpace& rhs) = default; + ~HIPSpace() = default; + + /**\brief Allocate untracked memory in the hip space */ + void* allocate(const size_t arg_alloc_size) const; + void* allocate(const char* arg_label, const size_t arg_alloc_size, + const size_t arg_logical_size = 0) const; + + /**\brief Deallocate untracked memory in the hip space */ + void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const; + void deallocate(const char* arg_label, void* const arg_alloc_ptr, + const size_t arg_alloc_size, + const size_t arg_logical_size = 0) const; + + private: + template <class, class, class, class> + friend class LogicalMemorySpace; + void* impl_allocate(const char* arg_label, const size_t arg_alloc_size, + const size_t arg_logical_size = 0, + const Kokkos::Tools::SpaceHandle = + Kokkos::Tools::make_space_handle(name())) const; + void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr, + const size_t arg_alloc_size, + const size_t arg_logical_size = 0, + const Kokkos::Tools::SpaceHandle = + Kokkos::Tools::make_space_handle(name())) const; + + public: + /**\brief Return Name of the MemorySpace */ + static constexpr const char* name() { return "HIP"; } + + private: + int m_device; ///< Which HIP device + + friend class Kokkos::Impl::SharedAllocationRecord<HIPSpace, void>; +}; + +template <> +struct Impl::is_hip_type_space<HIPSpace> : public std::true_type {}; + +} // namespace Kokkos + +/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ + +namespace Kokkos { +/** \brief Host memory that is accessible to HIP execution space + * through HIP's host-pinned memory allocation. + */ +class HIPHostPinnedSpace { + public: + //! Tag this class as a kokkos memory space + /** \brief Memory is in HostSpace so use the HostSpace::execution_space */ + using execution_space = HostSpace::execution_space; + using memory_space = HIPHostPinnedSpace; + using device_type = Kokkos::Device<execution_space, memory_space>; + using size_type = unsigned int; + + /*--------------------------------*/ + + HIPHostPinnedSpace(); + HIPHostPinnedSpace(HIPHostPinnedSpace&& rhs) = default; + HIPHostPinnedSpace(const HIPHostPinnedSpace& rhs) = default; + HIPHostPinnedSpace& operator=(HIPHostPinnedSpace&& rhs) = default; + HIPHostPinnedSpace& operator=(const HIPHostPinnedSpace& rhs) = default; + ~HIPHostPinnedSpace() = default; + + /**\brief Allocate untracked memory in the space */ + void* allocate(const size_t arg_alloc_size) const; + void* allocate(const char* arg_label, const size_t arg_alloc_size, + const size_t arg_logical_size = 0) const; + + /**\brief Deallocate untracked memory in the space */ + void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const; + void deallocate(const char* arg_label, void* const arg_alloc_ptr, + const size_t arg_alloc_size, + const size_t arg_logical_size = 0) const; + + private: + template <class, class, class, class> + friend class LogicalMemorySpace; + void* impl_allocate(const char* arg_label, const size_t arg_alloc_size, + const size_t arg_logical_size = 0, + const Kokkos::Tools::SpaceHandle = + Kokkos::Tools::make_space_handle(name())) const; + void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr, + const size_t arg_alloc_size, + const size_t arg_logical_size = 0, + const Kokkos::Tools::SpaceHandle = + Kokkos::Tools::make_space_handle(name())) const; + + public: + /**\brief Return Name of the MemorySpace */ + static constexpr const char* name() { return "HIPHostPinned"; } + + /*--------------------------------*/ +}; + +template <> +struct Impl::is_hip_type_space<HIPHostPinnedSpace> : public std::true_type {}; + +} // namespace Kokkos + +/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ + +namespace Kokkos { +/** \brief Memory that is accessible to HIP execution space + * and host through HIP's memory page migration. + */ +class HIPManagedSpace { + public: + //! Tag this class as a kokkos memory space + /** \brief Memory is unified to both device and host via page migration + * and therefore able to be used by HostSpace::execution_space and + * DeviceSpace::execution_space. + */ + //! tag this class as a kokkos memory space + using memory_space = HIPManagedSpace; + using execution_space = HIP; + using device_type = Kokkos::Device<execution_space, memory_space>; + using size_type = unsigned int; + + /*--------------------------------*/ + + HIPManagedSpace(); + HIPManagedSpace(HIPManagedSpace&& rhs) = default; + HIPManagedSpace(const HIPManagedSpace& rhs) = default; + HIPManagedSpace& operator=(HIPManagedSpace&& rhs) = default; + HIPManagedSpace& operator=(const HIPManagedSpace& rhs) = default; + ~HIPManagedSpace() = default; + + /**\brief Allocate untracked memory in the space */ + void* allocate(const size_t arg_alloc_size) const; + void* allocate(const char* arg_label, const size_t arg_alloc_size, + const size_t arg_logical_size = 0) const; + + /**\brief Deallocate untracked memory in the space */ + void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const; + void deallocate(const char* arg_label, void* const arg_alloc_ptr, + const size_t arg_alloc_size, + const size_t arg_logical_size = 0) const; + + private: + int m_device; ///< Which HIP device + template <class, class, class, class> + friend class LogicalMemorySpace; + void* impl_allocate(const char* arg_label, const size_t arg_alloc_size, + const size_t arg_logical_size = 0, + const Kokkos::Tools::SpaceHandle = + Kokkos::Tools::make_space_handle(name())) const; + void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr, + const size_t arg_alloc_size, + const size_t arg_logical_size = 0, + const Kokkos::Tools::SpaceHandle = + Kokkos::Tools::make_space_handle(name())) const; + + public: + /**\brief Return Name of the MemorySpace */ + static constexpr const char* name() { return "HIPManaged"; } + + /*--------------------------------*/ +}; + +template <> +struct Impl::is_hip_type_space<HIPManagedSpace> : public std::true_type {}; + +} // namespace Kokkos + +/*--------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ + +namespace Kokkos { +namespace Impl { + +static_assert(Kokkos::Impl::MemorySpaceAccess<HIPSpace, HIPSpace>::assignable, + ""); + +//---------------------------------------- + +template <> +struct MemorySpaceAccess<HostSpace, HIPSpace> { + enum : bool { assignable = false }; + enum : bool { accessible = false }; + enum : bool { deepcopy = true }; +}; + +template <> +struct MemorySpaceAccess<HostSpace, HIPHostPinnedSpace> { + // HostSpace::execution_space == HIPHostPinnedSpace::execution_space + enum : bool { assignable = true }; + enum : bool { accessible = true }; + enum : bool { deepcopy = true }; +}; + +template <> +struct MemorySpaceAccess<HostSpace, HIPManagedSpace> { + // HostSpace::execution_space != HIPManagedSpace::execution_space + enum : bool { assignable = false }; + enum : bool { accessible = true }; + enum : bool { deepcopy = true }; +}; + +//---------------------------------------- + +template <> +struct MemorySpaceAccess<HIPSpace, HostSpace> { + enum : bool { assignable = false }; + enum : bool { accessible = false }; + enum : bool { deepcopy = true }; +}; + +template <> +struct MemorySpaceAccess<HIPSpace, HIPHostPinnedSpace> { + // HIPSpace::execution_space != HIPHostPinnedSpace::execution_space + enum : bool { assignable = false }; + enum : bool { accessible = true }; // HIPSpace::execution_space + enum : bool { deepcopy = true }; +}; + +template <> +struct MemorySpaceAccess<HIPSpace, HIPManagedSpace> { + // HIPSpace::execution_space == HIPManagedSpace::execution_space + enum : bool { assignable = true }; + enum : bool { accessible = true }; + enum : bool { deepcopy = true }; +}; + +//---------------------------------------- +// HIPHostPinnedSpace::execution_space == HostSpace::execution_space +// HIPHostPinnedSpace accessible to both HIP and Host + +template <> +struct MemorySpaceAccess<HIPHostPinnedSpace, HostSpace> { + enum : bool { assignable = false }; // Cannot access from HIP + enum : bool { accessible = true }; // HIPHostPinnedSpace::execution_space + enum : bool { deepcopy = true }; +}; + +template <> +struct MemorySpaceAccess<HIPHostPinnedSpace, HIPSpace> { + enum : bool { assignable = false }; // Cannot access from Host + enum : bool { accessible = false }; + enum : bool { deepcopy = true }; +}; + +template <> +struct MemorySpaceAccess<HIPHostPinnedSpace, HIPManagedSpace> { + enum : bool { assignable = false }; // different exec_space + enum : bool { accessible = true }; + enum : bool { deepcopy = true }; +}; + +//---------------------------------------- +// HIPManagedSpace::execution_space != HostSpace::execution_space +// HIPManagedSpace accessible to both HIP and Host + +template <> +struct MemorySpaceAccess<HIPManagedSpace, HostSpace> { + enum : bool { assignable = false }; + enum : bool { accessible = false }; // HIPHostPinnedSpace::execution_space + enum : bool { deepcopy = true }; +}; + +template <> +struct MemorySpaceAccess<HIPManagedSpace, HIPSpace> { + enum : bool { assignable = false }; + enum : bool { accessible = true }; + enum : bool { deepcopy = true }; +}; + +template <> +struct MemorySpaceAccess<HIPManagedSpace, HIPHostPinnedSpace> { + enum : bool { assignable = false }; // different exec_space + enum : bool { accessible = true }; + enum : bool { deepcopy = true }; +}; + +} // namespace Impl +} // namespace Kokkos + +#endif /* #define KOKKOS_HIPSPACE_HPP */ diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp index 9ddfa5f65106dd6409d4502c27d0599bb4ba5c61..5b9faba786f77e7fda2c92aa122d8bb3cc19884d 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_TEAM_HPP #define KOKKOS_HIP_TEAM_HPP @@ -94,8 +66,9 @@ struct HIPJoinFunctor { */ class HIPTeamMember { public: - using execution_space = Kokkos::Experimental::HIP; + using execution_space = HIP; using scratch_memory_space = execution_space::scratch_memory_space; + using team_handle = HIPTeamMember; private: mutable void* m_team_reduce; @@ -166,8 +139,7 @@ class HIPTeamMember { val = *(reinterpret_cast<ValueType*>(m_team_reduce)); } else { // team <= warp ValueType tmp(val); // input might not be a register variable - ::Kokkos::Experimental::Impl::in_place_shfl( - val, tmp, blockDim.x * thread_id, blockDim.x * blockDim.y); + in_place_shfl(val, tmp, blockDim.x * thread_id, blockDim.x * blockDim.y); } #else (void)val; @@ -209,8 +181,8 @@ class HIPTeamMember { typename ReducerType::value_type& value) const noexcept { #ifdef __HIP_DEVICE_COMPILE__ typename Kokkos::Impl::FunctorAnalysis< - FunctorPatternInterface::REDUCE, TeamPolicy<Experimental::HIP>, - ReducerType>::Reducer wrapped_reducer(&reducer); + FunctorPatternInterface::REDUCE, TeamPolicy<HIP>, ReducerType>::Reducer + wrapped_reducer(&reducer); hip_intra_block_shuffle_reduction(value, wrapped_reducer, blockDim.y); reducer.reference() = value; #else @@ -246,7 +218,7 @@ class HIPTeamMember { Impl::HIPJoinFunctor<Type> hip_join_functor; typename Kokkos::Impl::FunctorAnalysis< - FunctorPatternInterface::REDUCE, TeamPolicy<Experimental::HIP>, + FunctorPatternInterface::REDUCE, TeamPolicy<HIP>, Impl::HIPJoinFunctor<Type>>::Reducer reducer(&hip_join_functor); Impl::hip_intra_block_reduce_scan<true>(reducer, base_data + 1); @@ -297,8 +269,7 @@ class HIPTeamMember { typename ReducerType::value_type tmp2 = tmp; for (int i = blockDim.x; (i >>= 1);) { - ::Kokkos::Experimental::Impl::in_place_shfl_down(tmp2, tmp, i, - blockDim.x); + in_place_shfl_down(tmp2, tmp, i, blockDim.x); if (static_cast<int>(threadIdx.x) < i) { reducer.join(tmp, tmp2); } @@ -309,7 +280,7 @@ class HIPTeamMember { // because floating point summation is not associative // and thus different threads could have different results. - ::Kokkos::Experimental::Impl::in_place_shfl(tmp2, tmp, 0, blockDim.x); + in_place_shfl(tmp2, tmp, 0, blockDim.x); value = tmp2; reducer.reference() = tmp2; #else @@ -824,7 +795,7 @@ parallel_scan(const Impl::ThreadVectorRangeBoundariesStruct< // inversion. for (int j = 1; j < static_cast<int>(blockDim.x); j <<= 1) { value_type tmp = identity; - ::Kokkos::Experimental::Impl::in_place_shfl_up(tmp, val, j, blockDim.x); + Impl::in_place_shfl_up(tmp, val, j, blockDim.x); if (j <= static_cast<int>(threadIdx.x)) { reducer.join(val, tmp); } @@ -836,8 +807,7 @@ parallel_scan(const Impl::ThreadVectorRangeBoundariesStruct< // Update i's contribution into the val // and add it to accum for next round if (i < loop_boundaries.end) closure(i, val, true); - ::Kokkos::Experimental::Impl::in_place_shfl(accum, val, blockDim.x - 1, - blockDim.x); + Impl::in_place_shfl(accum, val, blockDim.x - 1, blockDim.x); } #else (void)loop_boundaries; @@ -899,7 +869,7 @@ KOKKOS_INLINE_FUNCTION void single( const FunctorType& lambda, ValueType& val) { #ifdef __HIP_DEVICE_COMPILE__ if (threadIdx.x == 0) lambda(val); - ::Kokkos::Experimental::Impl::in_place_shfl(val, val, 0, blockDim.x); + Impl::in_place_shfl(val, val, 0, blockDim.x); #else (void)lambda; (void)val; diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp index a0722f618b4559b759e538b9676ea0d4661a6f6f..13fc6216d6b06482026810fa2fd43507617bf602 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_UniqueToken.hpp @@ -1,59 +1,31 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_UNIQUE_TOKEN_HPP #define KOKKOS_HIP_UNIQUE_TOKEN_HPP -#include <Kokkos_HIP_Space.hpp> +#include <HIP/Kokkos_HIP_Space.hpp> #include <Kokkos_UniqueToken.hpp> #include <impl/Kokkos_SharedAlloc.hpp> namespace Kokkos { namespace Impl { -Kokkos::View<uint32_t*, Kokkos::Experimental::HIPSpace> -hip_global_unique_token_locks(bool deallocate = false); +Kokkos::View<uint32_t*, HIPSpace> hip_global_unique_token_locks( + bool deallocate = false); } namespace Experimental { @@ -164,11 +136,9 @@ class UniqueToken<HIP, UniqueTokenScope::Instance> // The instance version will forward to protected constructor which creates // a lock array per instance UniqueToken() - : UniqueToken<HIP, UniqueTokenScope::Global>( - Kokkos::Experimental::HIP().concurrency()) {} + : UniqueToken<HIP, UniqueTokenScope::Global>(HIP().concurrency()) {} explicit UniqueToken(execution_space const& arg) - : UniqueToken<HIP, UniqueTokenScope::Global>( - Kokkos::Experimental::HIP().concurrency(), arg) {} + : UniqueToken<HIP, UniqueTokenScope::Global>(HIP().concurrency(), arg) {} explicit UniqueToken(size_type max_size) : UniqueToken<HIP, UniqueTokenScope::Global>(max_size) {} UniqueToken(size_type max_size, execution_space const& arg) diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp index 18b5f57c2254e3791b9100fdb9640e5713b61cbd..e14b722f37378668b92fd04939770def45f0a4d8 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_Vectorization.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_VECTORIZATION_HPP #define KOKKOS_HIP_VECTORIZATION_HPP @@ -48,7 +20,6 @@ #include <Kokkos_Macros.hpp> namespace Kokkos { -namespace Experimental { namespace Impl { //---------------------------------------------------------------------------- @@ -196,7 +167,6 @@ __device__ inline T shfl_up(const T& val, int delta, int width) { return rv; } -} // namespace Experimental } // namespace Kokkos #endif diff --git a/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp b/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp index 081f6f4047ea3a4ae34f4f027133f100f2752783..136dca120887a63964a4fc0dc3caf389dbb151fb 100644 --- a/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/HIP/Kokkos_HIP_WorkGraphPolicy.hpp @@ -1,61 +1,34 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_WORKGRAPHPOLICY_HPP #define KOKKOS_HIP_WORKGRAPHPOLICY_HPP -#include <Kokkos_HIP.hpp> +#include <HIP/Kokkos_HIP.hpp> +#include <HIP/Kokkos_HIP_Instance.hpp> +#include <HIP/Kokkos_HIP_KernelLaunch.hpp> namespace Kokkos { namespace Impl { template <class FunctorType, class... Traits> -class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>, - Kokkos::Experimental::HIP> { +class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>, HIP> { public: using Policy = Kokkos::WorkGraphPolicy<Traits...>; - using Self = ParallelFor<FunctorType, Policy, Kokkos::Experimental::HIP>; + using Self = ParallelFor<FunctorType, Policy, HIP>; private: Policy m_policy; @@ -89,15 +62,12 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>, inline void execute() { const int warps_per_block = 4; - const dim3 grid( - Kokkos::Experimental::Impl::hip_internal_multiprocessor_count(), 1, 1); - const dim3 block(1, Kokkos::Experimental::Impl::HIPTraits::WarpSize, - warps_per_block); + const dim3 grid(hip_internal_multiprocessor_count(), 1, 1); + const dim3 block(1, HIPTraits::WarpSize, warps_per_block); const int shared = 0; - Kokkos::Experimental::Impl::HIPParallelLaunch<Self>( - *this, grid, block, shared, - Experimental::HIP().impl_internal_space_instance(), false); + HIPParallelLaunch<Self>(*this, grid, block, shared, + HIP().impl_internal_space_instance(), false); } inline ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy) diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp b/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp index 6027ead01bda8194d8d0ea95b9f6e82d4ce0d0dd..2074123a15fd4acbea86f4b8f753aa2628991d7d 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -143,14 +115,6 @@ int g_hpx_space_factory_initialized = } // namespace Impl -#ifdef KOKKOS_ENABLE_CXX14 -namespace Tools { -namespace Experimental { -constexpr DeviceType DeviceTypeTraits<Kokkos::Experimental::HPX>::id; -} -} // namespace Tools -#endif - } // namespace Kokkos #else diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cf0d1add1268eea58e6a635bc6892626e7d77d11 --- /dev/null +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_MDRangePolicy.hpp @@ -0,0 +1,33 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_HPX_MDRANGEPOLICY_HPP_ +#define KOKKOS_HPX_MDRANGEPOLICY_HPP_ + +#include <KokkosExp_MDRangePolicy.hpp> + +namespace Kokkos { +namespace Impl { + +// Settings for TeamMDRangePolicy +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, Kokkos::Experimental::HPX, + ThreadAndVector> + : HostBasedNestLevel<Rank, ThreadAndVector> {}; + +} // namespace Impl +} // namespace Kokkos +#endif diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp index e61ac728a90dd86eee5b7fb4965349b2307a680f..ad540a203d5b4f2825b51dafdee6d182b27d536e 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp index 67765a6ae0f6c3482e6410cad15e2c7571dde658..e75b7be49dc28f64f3fa818b6c51a2a41e3a5154 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_Task.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HPX_TASK_HPP #define KOKKOS_HPX_TASK_HPP diff --git a/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp b/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp index 5f2eff5774c0a5a73b323c2eb6a936aea1796db3..72a80199355b09d742168882939d344831bd6fb8 100644 --- a/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/HPX/Kokkos_HPX_WorkGraphPolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HPX_WORKGRAPHPOLICY_HPP #define KOKKOS_HPX_WORKGRAPHPOLICY_HPP diff --git a/packages/kokkos/core/src/KokkosExp_InterOp.hpp b/packages/kokkos/core/src/KokkosExp_InterOp.hpp index 0522ad7e8da8990c4378dc0830a5f4be3d0e5e1f..c46ba0de13975f90a3f3e194df7aadd72bf8a9bd 100644 --- a/packages/kokkos/core/src/KokkosExp_InterOp.hpp +++ b/packages/kokkos/core/src/KokkosExp_InterOp.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CORE_EXP_INTEROP_HPP #define KOKKOS_CORE_EXP_INTEROP_HPP diff --git a/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp b/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp index 64b31c7fea5d5cdefd5a91369c9144b3973be050..c9080db01cafc799d9da5c36516fddb7f52e861f 100644 --- a/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp +++ b/packages/kokkos/core/src/KokkosExp_MDRangePolicy.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_CORE_EXP_MD_RANGE_POLICY_HPP #define KOKKOS_CORE_EXP_MD_RANGE_POLICY_HPP @@ -208,6 +176,7 @@ struct MDRangePolicy : public Kokkos::Impl::PolicyTraits<Properties...> { using member_type = typename range_policy::member_type; static constexpr int rank = iteration_pattern::rank; + static_assert(rank < 7, "Kokkos MDRangePolicy Error: Unsupported rank..."); using index_type = typename traits::index_type; using array_index_type = std::int64_t; @@ -391,18 +360,4 @@ struct MDRangePolicy : public Kokkos::Impl::PolicyTraits<Properties...> { } // namespace Kokkos -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -// For backward compatibility -namespace Kokkos { -namespace Experimental { -using Iterate KOKKOS_DEPRECATED = Kokkos::Iterate; -template <typename... Properties> -using MDRangePolicy KOKKOS_DEPRECATED = Kokkos::MDRangePolicy<Properties...>; -template <unsigned N, Kokkos::Iterate OuterDir = Kokkos::Iterate::Default, - Kokkos::Iterate InnerDir = Kokkos::Iterate::Default> -using Rank KOKKOS_DEPRECATED = Kokkos::Rank<N, OuterDir, InnerDir>; -} // namespace Experimental -} // namespace Kokkos -#endif - #endif // KOKKOS_CORE_EXP_MD_RANGE_POLICY_HPP diff --git a/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp b/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp index 4a22aedd8c1c6a7dad41eb9810bc5ef3f9f8afef..660ee30b7d5e3d6d935be759c0ac3ea7ed6232c5 100644 --- a/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp +++ b/packages/kokkos/core/src/Kokkos_AcquireUniqueTokenImpl.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_ACQUIRE_UNIQUE_TOKEN_IMPL_HPP #define KOKKOS_ACQUIRE_UNIQUE_TOKEN_IMPL_HPP diff --git a/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp b/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp index 6eed92be0480d0974d5433ab8383bbcb347d774f..9f5deed5d66f974fefee183748f36289331c06e7 100644 --- a/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp +++ b/packages/kokkos/core/src/Kokkos_AnonymousSpace.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_ANONYMOUSSPACE_HPP #define KOKKOS_ANONYMOUSSPACE_HPP diff --git a/packages/kokkos/core/src/Kokkos_Array.hpp b/packages/kokkos/core/src/Kokkos_Array.hpp index e7fec4c449787b0018061120ee37387637e5eee1..1e3ab4741cd45601c5730cad45519ddb84fb6105 100644 --- a/packages/kokkos/core/src/Kokkos_Array.hpp +++ b/packages/kokkos/core/src/Kokkos_Array.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_ARRAY_HPP #define KOKKOS_ARRAY_HPP @@ -351,13 +323,6 @@ struct Array<T, KOKKOS_INVALID_INDEX, Array<>::strided> { } // namespace Kokkos //<editor-fold desc="Support for structured binding"> -// guarding against bogus error 'specialization in different namespace' with -// older GCC that do not support C++17 anyway -#if !defined(KOKKOS_COMPILER_GNU) || (KOKKOS_COMPILER_GNU >= 710) -#if defined(KOKKOS_COMPILER_CLANG) && KOKKOS_COMPILER_CLANG < 800 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wmismatched-tags" -#endif template <class T, std::size_t N> struct std::tuple_size<Kokkos::Array<T, N>> : std::integral_constant<std::size_t, N> {}; @@ -366,10 +331,6 @@ template <std::size_t I, class T, std::size_t N> struct std::tuple_element<I, Kokkos::Array<T, N>> { using type = T; }; -#if defined(KOKKOS_COMPILER_CLANG) && KOKKOS_COMPILER_CLANG < 800 -#pragma clang diagnostic pop -#endif -#endif namespace Kokkos { diff --git a/packages/kokkos/core/src/Kokkos_Atomic.hpp b/packages/kokkos/core/src/Kokkos_Atomic.hpp index 7a2d1c662c62a25a6c50853e6c2212e7f7b8211a..1347e09ebd6a488278ac59c364aeff6309f0517e 100644 --- a/packages/kokkos/core/src/Kokkos_Atomic.hpp +++ b/packages/kokkos/core/src/Kokkos_Atomic.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_Atomic.hpp /// \brief Atomic functions @@ -103,7 +75,7 @@ KOKKOS_INLINE_FUNCTION void desul_atomic_inc(T* dest, MemoryOrderSeqCst, template <class T> KOKKOS_INLINE_FUNCTION T -desul_atomic_exchange(T* dest, const Kokkos::Impl::identity_t<T> val, +desul_atomic_exchange(T* dest, const Kokkos::Impl::type_identity_t<T> val, MemoryOrderSeqCst, MemoryScopeDevice) { return desul::atomic_exchange(const_cast<T*>(dest), val, desul::MemoryOrderSeqCst(), @@ -112,8 +84,8 @@ desul_atomic_exchange(T* dest, const Kokkos::Impl::identity_t<T> val, template <class T> KOKKOS_INLINE_FUNCTION T desul_atomic_compare_exchange( - T* dest, Kokkos::Impl::identity_t<const T> compare, - Kokkos::Impl::identity_t<const T> val, MemoryOrderSeqCst, + T* dest, Kokkos::Impl::type_identity_t<const T> compare, + Kokkos::Impl::type_identity_t<const T> val, MemoryOrderSeqCst, MemoryScopeDevice) { return desul::atomic_compare_exchange(dest, compare, val, desul::MemoryOrderSeqCst(), @@ -168,7 +140,7 @@ KOKKOS_INLINE_FUNCTION T desul_atomic_compare_exchange( #define KOKKOS_ENABLE_SERIAL_ATOMICS #elif defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG) || \ - (defined(KOKKOS_COMPILER_NVCC) || defined(KOKKOS_COMPILER_IBM)) + defined(KOKKOS_COMPILER_NVCC) #define KOKKOS_ENABLE_GNU_ATOMICS @@ -401,15 +373,15 @@ KOKKOS_INLINE_FUNCTION void desul_atomic_inc(T* dest, MemoryOrderSeqCst, template <class T> KOKKOS_INLINE_FUNCTION T -desul_atomic_exchange(T* dest, Kokkos::Impl::identity_t<const T> val, +desul_atomic_exchange(T* dest, Kokkos::Impl::type_identity_t<const T> val, MemoryOrderSeqCst, MemoryScopeDevice) { return Kokkos::atomic_exchange(dest, val); } template <class T> KOKKOS_INLINE_FUNCTION T desul_atomic_compare_exchange( - T* dest, Kokkos::Impl::identity_t<const T> compare, - Kokkos::Impl::identity_t<const T> val, MemoryOrderSeqCst, + T* dest, Kokkos::Impl::type_identity_t<const T> compare, + Kokkos::Impl::type_identity_t<const T> val, MemoryOrderSeqCst, MemoryScopeDevice) { return Kokkos::atomic_compare_exchange(dest, compare, val); } diff --git a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Config.hpp b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Config.hpp index ef576d74c3cdfa8d75c564454ff6697a59cdf049..4cf170f5f1317e380a91196a9aaa36ec519c45df 100644 --- a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Config.hpp +++ b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Config.hpp @@ -1,62 +1,30 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_ATOMICS_DESUL_CONFIG_HPP #define KOKKOS_ATOMICS_DESUL_CONFIG_HPP #include <Kokkos_Macros.hpp> -#ifdef KOKKOS_ENABLE_OPENMPTARGET -#define DESUL_HAVE_OPENMP_ATOMICS +#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) +#define DESUL_CUDA_ARCH_IS_PRE_PASCAL #endif #if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \ diff --git a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp index b202ab8f83d49447e82d5bc673e80da6ca88080a..9da4b061102132f8613352975d3cebf7e190161f 100644 --- a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp +++ b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Volatile_Wrapper.hpp @@ -1,12 +1,23 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_DESUL_ATOMICS_VOLATILE_WRAPPER_HPP_ #define KOKKOS_DESUL_ATOMICS_VOLATILE_WRAPPER_HPP_ @@ -34,26 +45,6 @@ void atomic_store(volatile T* const dest, desul::Impl::dont_deduce_this_paramete template<class T> KOKKOS_INLINE_FUNCTION T atomic_fetch_add (volatile T* const dest, desul::Impl::dont_deduce_this_parameter_t<const T> val) { return desul::atomic_fetch_add (const_cast<T*>(dest), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -#ifdef DESUL_IMPL_ATOMIC_CUDA_USE_DOUBLE_ATOMICADD -KOKKOS_INLINE_FUNCTION -double atomic_fetch_add(volatile double* const dest, double val) { - #ifdef __CUDA_ARCH__ - return atomicAdd(const_cast<double*>(dest),val); - #else - return desul::atomic_fetch_add (const_cast<double*>(dest), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); - #endif -}; - -KOKKOS_INLINE_FUNCTION -double atomic_fetch_sub(volatile double* const dest, double val) { - #ifdef __CUDA_ARCH__ - return atomicAdd(const_cast<double*>(dest),-val); - #else - return desul::atomic_fetch_sub (const_cast<double*>(dest), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); - #endif -}; -#endif - template<class T> KOKKOS_INLINE_FUNCTION T atomic_fetch_sub (volatile T* const dest, desul::Impl::dont_deduce_this_parameter_t<const T> val) { return desul::atomic_fetch_sub (const_cast<T*>(dest), val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } diff --git a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp index ed7e8d9ede8508f3ed19682e5843945c85770e48..fdc5e123f687f1a8444c6196a5ba8260c1689212 100644 --- a/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp +++ b/packages/kokkos/core/src/Kokkos_Atomics_Desul_Wrapper.hpp @@ -1,12 +1,23 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_DESUL_ATOMICS_WRAPPER_HPP_ #define KOKKOS_DESUL_ATOMICS_WRAPPER_HPP_ @@ -70,26 +81,6 @@ void store_fence() { return desul::atomic_thread_fence(desul::MemoryOrderRelease template<class T> KOKKOS_INLINE_FUNCTION T atomic_fetch_add (T* const dest, desul::Impl::dont_deduce_this_parameter_t<const T> val) { return desul::atomic_fetch_add (dest, val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } -#ifdef DESUL_IMPL_ATOMIC_CUDA_USE_DOUBLE_ATOMICADD -KOKKOS_INLINE_FUNCTION -double atomic_fetch_add(double* const dest, double val) { - #ifdef __CUDA_ARCH__ - return atomicAdd(dest,val); - #else - return desul::atomic_fetch_add (dest, val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); - #endif -}; - -KOKKOS_INLINE_FUNCTION -double atomic_fetch_sub(double* const dest, double val) { - #ifdef __CUDA_ARCH__ - return atomicAdd(dest,-val); - #else - return desul::atomic_fetch_sub (dest, val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); - #endif -}; -#endif - template<class T> KOKKOS_INLINE_FUNCTION T atomic_fetch_sub (T* const dest, desul::Impl::dont_deduce_this_parameter_t<const T> val) { return desul::atomic_fetch_sub (dest, val, desul::MemoryOrderRelaxed(), KOKKOS_DESUL_MEM_SCOPE); } diff --git a/packages/kokkos/core/src/Kokkos_Complex.hpp b/packages/kokkos/core/src/Kokkos_Complex.hpp index 009c73c900c41ccf506a0d0988e49fd9e303cbb2..4cecbe4cfe59655c7b90205c279d689e2833043e 100644 --- a/packages/kokkos/core/src/Kokkos_Complex.hpp +++ b/packages/kokkos/core/src/Kokkos_Complex.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_COMPLEX_HPP #define KOKKOS_COMPLEX_HPP #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE @@ -51,6 +23,7 @@ #include <Kokkos_Atomic.hpp> #include <Kokkos_MathematicalFunctions.hpp> #include <Kokkos_NumericTraits.hpp> +#include <Kokkos_ReductionIdentity.hpp> #include <impl/Kokkos_Error.hpp> #include <complex> #include <type_traits> @@ -278,16 +251,13 @@ class return *this; } - //--------------------------------------------------------------------------- - // TODO: refactor Kokkos reductions to remove dependency on - // volatile member overloads since they are being deprecated in c++20 - //--------------------------------------------------------------------------- - +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 //! Copy constructor from volatile. template < class RType, std::enable_if_t<std::is_convertible<RType, RealType>::value, int> = 0> - KOKKOS_INLINE_FUNCTION complex(const volatile complex<RType>& src) noexcept + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION + complex(const volatile complex<RType>& src) noexcept // Intentionally do the conversions implicitly here so that users don't // get any warnings about narrowing, etc., that they would expect to get // otherwise. @@ -315,7 +285,8 @@ class // vl = cr; template <class Complex, std::enable_if_t<std::is_same<Complex, complex>::value, int> = 0> - KOKKOS_INLINE_FUNCTION void operator=(const Complex& src) volatile noexcept { + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator=( + const Complex& src) volatile noexcept { re_ = src.re_; im_ = src.im_; // We deliberately do not return anything here. See explanation @@ -337,7 +308,7 @@ class // vl = cvr; template <class Complex, std::enable_if_t<std::is_same<Complex, complex>::value, int> = 0> - KOKKOS_INLINE_FUNCTION volatile complex& operator=( + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION volatile complex& operator=( const volatile Complex& src) volatile noexcept { re_ = src.re_; im_ = src.im_; @@ -359,7 +330,7 @@ class // template <class Complex, std::enable_if_t<std::is_same<Complex, complex>::value, int> = 0> - KOKKOS_INLINE_FUNCTION complex& operator=( + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION complex& operator=( const volatile Complex& src) noexcept { re_ = src.re_; im_ = src.im_; @@ -370,7 +341,8 @@ class // RealType RHS versions. //! Assignment operator (from a volatile real number). - KOKKOS_INLINE_FUNCTION void operator=(const volatile RealType& val) noexcept { + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator=( + const volatile RealType& val) noexcept { re_ = val; im_ = RealType(0); // We deliberately do not return anything here. See explanation @@ -378,7 +350,7 @@ class } //! Assignment operator volatile LHS and non-volatile RHS - KOKKOS_INLINE_FUNCTION complex& operator=( + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION complex& operator=( const RealType& val) volatile noexcept { re_ = val; im_ = RealType(0); @@ -387,7 +359,7 @@ class //! Assignment operator volatile LHS and volatile RHS // TODO Should this return void like the other volatile assignment operators? - KOKKOS_INLINE_FUNCTION complex& operator=( + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION complex& operator=( const volatile RealType& val) volatile noexcept { re_ = val; im_ = RealType(0); @@ -395,33 +367,41 @@ class } //! The imaginary part of this complex number (volatile overload). - KOKKOS_INLINE_FUNCTION - volatile RealType& imag() volatile noexcept { return im_; } + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION volatile RealType& + imag() volatile noexcept { + return im_; + } //! The real part of this complex number (volatile overload). - KOKKOS_INLINE_FUNCTION - volatile RealType& real() volatile noexcept { return re_; } + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION volatile RealType& + real() volatile noexcept { + return re_; + } //! The imaginary part of this complex number (volatile overload). - KOKKOS_INLINE_FUNCTION - RealType imag() const volatile noexcept { return im_; } + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION RealType imag() const + volatile noexcept { + return im_; + } //! The real part of this complex number (volatile overload). - KOKKOS_INLINE_FUNCTION - RealType real() const volatile noexcept { return re_; } + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION RealType real() const + volatile noexcept { + return re_; + } - KOKKOS_INLINE_FUNCTION void operator+=( + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator+=( const volatile complex<RealType>& src) volatile noexcept { re_ += src.re_; im_ += src.im_; } - KOKKOS_INLINE_FUNCTION void operator+=( + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator+=( const volatile RealType& src) volatile noexcept { re_ += src; } - KOKKOS_INLINE_FUNCTION void operator*=( + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator*=( const volatile complex<RealType>& src) volatile noexcept { const RealType realPart = re_ * src.re_ - im_ * src.im_; const RealType imagPart = re_ * src.im_ + im_ * src.re_; @@ -430,13 +410,12 @@ class im_ = imagPart; } - KOKKOS_INLINE_FUNCTION void operator*=( + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION void operator*=( const volatile RealType& src) volatile noexcept { re_ *= src; im_ *= src; } - - // TODO DSH 2019-10-7 why are there no volatile /= and friends? +#endif // KOKKOS_ENABLE_DEPRECATED_CODE_4 }; //============================================================================== diff --git a/packages/kokkos/core/src/Kokkos_Concepts.hpp b/packages/kokkos/core/src/Kokkos_Concepts.hpp index 63f2b896b5d123cb50d1019a4a8ed871d57b11f4..2448efab046457e4ce9784418aeefaa62a2958b4 100644 --- a/packages/kokkos/core/src/Kokkos_Concepts.hpp +++ b/packages/kokkos/core/src/Kokkos_Concepts.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_CORE_CONCEPTS_HPP #define KOKKOS_CORE_CONCEPTS_HPP @@ -106,11 +74,14 @@ struct WorkItemProperty { ImplWorkItemProperty<4>(); constexpr static const ImplWorkItemProperty<8> HintIrregular = ImplWorkItemProperty<8>(); - using None_t = ImplWorkItemProperty<0>; - using HintLightWeight_t = ImplWorkItemProperty<1>; - using HintHeavyWeight_t = ImplWorkItemProperty<2>; - using HintRegular_t = ImplWorkItemProperty<4>; - using HintIrregular_t = ImplWorkItemProperty<8>; + constexpr static const ImplWorkItemProperty<16> ImplForceGlobalLaunch = + ImplWorkItemProperty<16>(); + using None_t = ImplWorkItemProperty<0>; + using HintLightWeight_t = ImplWorkItemProperty<1>; + using HintHeavyWeight_t = ImplWorkItemProperty<2>; + using HintRegular_t = ImplWorkItemProperty<4>; + using HintIrregular_t = ImplWorkItemProperty<8>; + using ImplForceGlobalLaunch_t = ImplWorkItemProperty<16>; }; template <unsigned long pv1, unsigned long pv2> @@ -171,7 +142,9 @@ namespace Kokkos { std::is_base_of<detected_t<have_t, T>, T>::value || \ std::is_base_of<detected_t<have_type_t, T>, T>::value; \ constexpr operator bool() const noexcept { return value; } \ - }; + }; \ + template <typename T> \ + inline constexpr bool is_##CONCEPT##_v = is_##CONCEPT<T>::value; // Public concept: @@ -181,6 +154,7 @@ KOKKOS_IMPL_IS_CONCEPT(execution_space) KOKKOS_IMPL_IS_CONCEPT(execution_policy) KOKKOS_IMPL_IS_CONCEPT(array_layout) KOKKOS_IMPL_IS_CONCEPT(reducer) +KOKKOS_IMPL_IS_CONCEPT(team_handle) namespace Experimental { KOKKOS_IMPL_IS_CONCEPT(work_item_property) KOKKOS_IMPL_IS_CONCEPT(hooks_policy) @@ -188,21 +162,6 @@ KOKKOS_IMPL_IS_CONCEPT(hooks_policy) namespace Impl { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -// For backward compatibility: - -template <typename T> -using is_array_layout KOKKOS_DEPRECATED = Kokkos::is_array_layout<T>; -template <typename T> -using is_execution_policy KOKKOS_DEPRECATED = Kokkos::is_execution_policy<T>; -template <typename T> -using is_execution_space KOKKOS_DEPRECATED = Kokkos::is_execution_space<T>; -template <typename T> -using is_memory_space KOKKOS_DEPRECATED = Kokkos::is_memory_space<T>; -template <typename T> -using is_memory_traits KOKKOS_DEPRECATED = Kokkos::is_memory_traits<T>; -#endif - // Implementation concept: KOKKOS_IMPL_IS_CONCEPT(thread_team_member) @@ -281,6 +240,9 @@ struct is_device_helper<Device<ExecutionSpace, MemorySpace>> : std::true_type { template <typename T> using is_device = typename Impl::is_device_helper<std::remove_cv_t<T>>::type; +template <typename T> +inline constexpr bool is_device_v = is_device<T>::value; + //---------------------------------------------------------------------------- template <typename T> @@ -344,10 +306,8 @@ struct is_space { || std::is_same<memory_space, Kokkos::CudaUVMSpace>::value || std::is_same<memory_space, Kokkos::CudaHostPinnedSpace>::value #elif defined(KOKKOS_ENABLE_HIP) - || std::is_same<memory_space, - Kokkos::Experimental::HIPHostPinnedSpace>::value || - std::is_same<memory_space, - Kokkos::Experimental::HIPManagedSpace>::value + || std::is_same<memory_space, Kokkos::HIPHostPinnedSpace>::value || + std::is_same<memory_space, Kokkos::HIPManagedSpace>::value #elif defined(KOKKOS_ENABLE_SYCL) || std::is_same<memory_space, Kokkos::Experimental::SYCLSharedUSMSpace>::value || @@ -361,7 +321,7 @@ struct is_space { #if defined(KOKKOS_ENABLE_CUDA) std::is_same<execution_space, Kokkos::Cuda>::value || #elif defined(KOKKOS_ENABLE_HIP) - std::is_same<execution_space, Kokkos::Experimental::HIP>::value || + std::is_same<execution_space, Kokkos::HIP>::value || #elif defined(KOKKOS_ENABLE_SYCL) std::is_same<execution_space, Kokkos::Experimental::SYCL>::value || #elif defined(KOKKOS_ENABLE_OPENMPTARGET) @@ -370,32 +330,8 @@ struct is_space { #endif false, Kokkos::DefaultHostExecutionSpace, execution_space>; - - public: -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - using host_memory_space KOKKOS_DEPRECATED = do_not_use_host_memory_space; - using host_execution_space KOKKOS_DEPRECATED = - do_not_use_host_execution_space; - using host_mirror_space KOKKOS_DEPRECATED = std::conditional_t< - std::is_same<execution_space, do_not_use_host_execution_space>::value && - std::is_same<memory_space, do_not_use_host_memory_space>::value, - T, - Kokkos::Device<do_not_use_host_execution_space, - do_not_use_host_memory_space>>; -#endif }; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -// For backward compatibility - -namespace Impl { - -template <typename T> -using is_space KOKKOS_DEPRECATED = Kokkos::is_space<T>; - -} -#endif - } // namespace Kokkos //---------------------------------------------------------------------------- @@ -514,19 +450,6 @@ struct SpaceAccessibility { } // namespace Kokkos -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -namespace Kokkos { -namespace Impl { - -// For backward compatibility -template <typename AccessSpace, typename MemorySpace> -using SpaceAccessibility KOKKOS_DEPRECATED = - Kokkos::SpaceAccessibility<AccessSpace, MemorySpace>; - -} // namespace Impl -} // namespace Kokkos -#endif - //---------------------------------------------------------------------------- #endif // KOKKOS_CORE_CONCEPTS_HPP diff --git a/packages/kokkos/core/src/Kokkos_CopyViews.hpp b/packages/kokkos/core/src/Kokkos_CopyViews.hpp index d859a5d8ae0f1908b35c4dc31aa9229cfd578bf6..6d5d9548c7998a51969f09d9c2d2f17d523017f3 100644 --- a/packages/kokkos/core/src/Kokkos_CopyViews.hpp +++ b/packages/kokkos/core/src/Kokkos_CopyViews.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_COPYVIEWS_HPP_ #define KOKKOS_COPYVIEWS_HPP_ @@ -3032,24 +3000,14 @@ impl_resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop, const bool sizeMismatch = Impl::size_mismatch(v, v.rank_dynamic, new_extents); if (sizeMismatch) { - // Add execution space here to avoid the need for if constexpr below - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., std::string, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 10>, - typename view_type::execution_space>>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - v.label(); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, typename view_type::execution_space{}, v.label()); view_type v_resized(prop_copy, n0, n1, n2, n3, n4, n5, n6, n7); - if (alloc_prop_input::has_execution_space) + if constexpr (alloc_prop_input::has_execution_space) Kokkos::Impl::ViewRemap<view_type, view_type>( - v_resized, v, - static_cast<const Impl::ViewCtorProp< - void, typename alloc_prop::execution_space>&>(prop_copy) - .value); + v_resized, v, Impl::get_property<Impl::ExecutionSpaceTag>(prop_copy)); else { Kokkos::Impl::ViewRemap<view_type, view_type>(v_resized, v); Kokkos::fence("Kokkos::resize(View)"); @@ -3142,24 +3100,13 @@ impl_resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop, "not include a memory space instance!"); if (v.layout() != layout) { - // Add execution space here to avoid the need for if constexpr below - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., std::string, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 10>, - typename view_type::execution_space>>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - v.label(); + auto prop_copy = Impl::with_properties_if_unset(arg_prop, v.label()); view_type v_resized(prop_copy, layout); - if (alloc_prop::has_execution_space) + if constexpr (alloc_prop_input::has_execution_space) Kokkos::Impl::ViewRemap<view_type, view_type>( - v_resized, v, - static_cast<const Impl::ViewCtorProp< - void, typename alloc_prop::execution_space>&>(prop_copy) - .value); + v_resized, v, Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop)); else { Kokkos::Impl::ViewRemap<view_type, view_type>(v_resized, v); Kokkos::fence("Kokkos::resize(View)"); @@ -3199,24 +3146,13 @@ impl_resize(const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop, "The view constructor arguments passed to Kokkos::resize must " "not include a memory space instance!"); - // Add execution space here to avoid the need for if constexpr below - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., std::string, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 10>, - typename view_type::execution_space>>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - v.label(); + auto prop_copy = Impl::with_properties_if_unset(arg_prop, v.label()); view_type v_resized(prop_copy, layout); - if (alloc_prop::has_execution_space) + if constexpr (alloc_prop_input::has_execution_space) Kokkos::Impl::ViewRemap<view_type, view_type>( - v_resized, v, - static_cast<const Impl::ViewCtorProp< - void, typename alloc_prop::execution_space>&>(prop_copy) - .value); + v_resized, v, Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop)); else { Kokkos::Impl::ViewRemap<view_type, view_type>(v_resized, v); Kokkos::fence("Kokkos::resize(View)"); @@ -3282,24 +3218,14 @@ impl_realloc(Kokkos::View<T, P...>& v, const size_t n0, const size_t n1, const bool sizeMismatch = Impl::size_mismatch(v, v.rank_dynamic, new_extents); if (sizeMismatch) { - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop arg_prop_copy(arg_prop); - static_cast<Kokkos::Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy) - .value = v.label(); + auto arg_prop_copy = Impl::with_properties_if_unset(arg_prop, v.label()); v = view_type(); // Best effort to deallocate in case no other view refers // to the shared allocation v = view_type(arg_prop_copy, n0, n1, n2, n3, n4, n5, n6, n7); } else if (alloc_prop_input::initialize) { - if (alloc_prop_input::has_execution_space) { - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 2>, - typename view_type::execution_space>>; - alloc_prop arg_prop_copy(arg_prop); - auto const& exec_space = static_cast<Kokkos::Impl::ViewCtorProp< - void, typename alloc_prop::execution_space> const&>(arg_prop_copy) - .value; + if constexpr (alloc_prop_input::has_execution_space) { + const auto& exec_space = + Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop); Kokkos::deep_copy(exec_space, v, typename view_type::value_type{}); } else Kokkos::deep_copy(v, typename view_type::value_type{}); @@ -3393,23 +3319,9 @@ impl_realloc(Kokkos::View<T, P...>& v, v = view_type(); // Deallocate first, if the only view to allocation v = view_type(arg_prop, layout); } else if (alloc_prop_input::initialize) { - if (alloc_prop_input::has_execution_space) { - // Add execution_space if not provided to avoid need for if constexpr - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 2>, - typename view_type::execution_space>, - std::string>; - alloc_prop arg_prop_copy(arg_prop); - static_cast<Kokkos::Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy) - .value = v.label(); - using execution_space_type = typename alloc_prop::execution_space; - const execution_space_type& exec_space = - static_cast< - Kokkos::Impl::ViewCtorProp<void, execution_space_type> const&>( - arg_prop_copy) - .value; + if constexpr (alloc_prop_input::has_execution_space) { + const auto& exec_space = + Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop); Kokkos::deep_copy(exec_space, v, typename view_type::value_type{}); } else Kokkos::deep_copy(v, typename view_type::value_type{}); @@ -3446,13 +3358,10 @@ impl_realloc(Kokkos::View<T, P...>& v, "The view constructor arguments passed to Kokkos::realloc must " "not include a memory space instance!"); - v = view_type(); // Deallocate first, if the only view to allocation + auto arg_prop_copy = Impl::with_properties_if_unset(arg_prop, v.label()); - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop arg_prop_copy(arg_prop); - static_cast<Kokkos::Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy) - .value = v.label(); - v = view_type(arg_prop_copy, layout); + v = view_type(); // Deallocate first, if the only view to allocation + v = view_type(arg_prop_copy, layout); } template <class T, class... P, class... ViewCtorArgs> @@ -3531,11 +3440,8 @@ struct MirrorType { }; template <class T, class... P, class... ViewCtorArgs> -inline std::enable_if_t< - !std::is_same<typename Kokkos::ViewTraits<T, P...>::array_layout, - Kokkos::LayoutStride>::value && - !Impl::ViewCtorProp<ViewCtorArgs...>::has_memory_space, - typename Kokkos::View<T, P...>::HostMirror> +inline std::enable_if_t<!Impl::ViewCtorProp<ViewCtorArgs...>::has_memory_space, + typename Kokkos::View<T, P...>::HostMirror> create_mirror(const Kokkos::View<T, P...>& src, const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop) { using src_type = View<T, P...>; @@ -3555,74 +3461,10 @@ create_mirror(const Kokkos::View<T, P...>& src, "The view constructor arguments passed to Kokkos::create_mirror must " "not explicitly allow padding!"); - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - std::string(src.label()).append("_mirror"); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string(src.label()).append("_mirror")); - return dst_type( - prop_copy, - src.rank_dynamic > 0 ? src.extent(0) : KOKKOS_IMPL_CTOR_DEFAULT_ARG, - src.rank_dynamic > 1 ? src.extent(1) : KOKKOS_IMPL_CTOR_DEFAULT_ARG, - src.rank_dynamic > 2 ? src.extent(2) : KOKKOS_IMPL_CTOR_DEFAULT_ARG, - src.rank_dynamic > 3 ? src.extent(3) : KOKKOS_IMPL_CTOR_DEFAULT_ARG, - src.rank_dynamic > 4 ? src.extent(4) : KOKKOS_IMPL_CTOR_DEFAULT_ARG, - src.rank_dynamic > 5 ? src.extent(5) : KOKKOS_IMPL_CTOR_DEFAULT_ARG, - src.rank_dynamic > 6 ? src.extent(6) : KOKKOS_IMPL_CTOR_DEFAULT_ARG, - src.rank_dynamic > 7 ? src.extent(7) : KOKKOS_IMPL_CTOR_DEFAULT_ARG); -} - -template <class T, class... P, class... ViewCtorArgs> -inline std::enable_if_t< - std::is_same<typename Kokkos::ViewTraits<T, P...>::array_layout, - Kokkos::LayoutStride>::value && - !Impl::ViewCtorProp<ViewCtorArgs...>::has_memory_space, - typename Kokkos::View<T, P...>::HostMirror> -create_mirror(const Kokkos::View<T, P...>& src, - const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop) { - using src_type = View<T, P...>; - using dst_type = typename src_type::HostMirror; - using alloc_prop_input = Impl::ViewCtorProp<ViewCtorArgs...>; - - static_assert( - !alloc_prop_input::has_label, - "The view constructor arguments passed to Kokkos::create_mirror " - "must not include a label!"); - static_assert( - !alloc_prop_input::has_pointer, - "The view constructor arguments passed to Kokkos::create_mirror must " - "not include a pointer!"); - static_assert( - !alloc_prop_input::allow_padding, - "The view constructor arguments passed to Kokkos::create_mirror must " - "not explicitly allow padding!"); - - Kokkos::LayoutStride layout; - - layout.dimension[0] = src.extent(0); - layout.dimension[1] = src.extent(1); - layout.dimension[2] = src.extent(2); - layout.dimension[3] = src.extent(3); - layout.dimension[4] = src.extent(4); - layout.dimension[5] = src.extent(5); - layout.dimension[6] = src.extent(6); - layout.dimension[7] = src.extent(7); - - layout.stride[0] = src.stride_0(); - layout.stride[1] = src.stride_1(); - layout.stride[2] = src.stride_2(); - layout.stride[3] = src.stride_3(); - layout.stride[4] = src.stride_4(); - layout.stride[5] = src.stride_5(); - layout.stride[6] = src.stride_6(); - layout.stride[7] = src.stride_7(); - - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - std::string(src.label()).append("_mirror"); - - return dst_type(prop_copy, layout); + return dst_type(prop_copy, src.layout()); } // Create a mirror in a new space (specialization for different space) @@ -3646,10 +3488,9 @@ auto create_mirror(const Kokkos::View<T, P...>& src, "The view constructor arguments passed to Kokkos::create_mirror must " "not explicitly allow padding!"); - using alloc_prop = Impl::ViewCtorProp<ViewCtorArgs..., std::string>; - alloc_prop prop_copy(arg_prop); - static_cast<Impl::ViewCtorProp<void, std::string>&>(prop_copy).value = - std::string(src.label()).append("_mirror"); + auto prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string(src.label()).append("_mirror")); + using alloc_prop = decltype(prop_copy); return typename Impl::MirrorType<typename alloc_prop::memory_space, T, P...>::view_type(prop_copy, src.layout()); @@ -3892,29 +3733,16 @@ auto create_mirror_view_and_copy( using Space = typename alloc_prop_input::memory_space; using Mirror = typename Impl::MirrorViewType<Space, T, P...>::view_type; - // Add some properties if not provided to avoid need for if constexpr - using alloc_prop = Impl::ViewCtorProp< - ViewCtorArgs..., - std::conditional_t<alloc_prop_input::has_label, - std::integral_constant<unsigned int, 12>, std::string>, - std::conditional_t<!alloc_prop_input::initialize, - std::integral_constant<unsigned int, 13>, - Impl::WithoutInitializing_t>, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 14>, - typename Space::execution_space>>; - alloc_prop arg_prop_copy(arg_prop); - - std::string& label = - static_cast<Impl::ViewCtorProp<void, std::string>&>(arg_prop_copy).value; + auto arg_prop_copy = Impl::with_properties_if_unset( + arg_prop, std::string{}, WithoutInitializing, + typename Space::execution_space{}); + + std::string& label = Impl::get_property<Impl::LabelTag>(arg_prop_copy); if (label.empty()) label = src.label(); auto mirror = typename Mirror::non_const_type{arg_prop_copy, src.layout()}; - if (alloc_prop_input::has_execution_space) { - using ExecutionSpace = typename alloc_prop::execution_space; - deep_copy( - static_cast<Impl::ViewCtorProp<void, ExecutionSpace>&>(arg_prop_copy) - .value, - mirror, src); + if constexpr (alloc_prop_input::has_execution_space) { + deep_copy(Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop_copy), + mirror, src); } else deep_copy(mirror, src); return mirror; @@ -3936,35 +3764,6 @@ create_mirror_view_and_copy( Kokkos::view_alloc(typename Space::memory_space{}, name), src); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -// Create a mirror view in a new space without initializing (specialization for -// same space) -template <class Space, class T, class... P> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the version taking WithoutInitializing as first argument") -typename Impl::MirrorViewType<Space, T, P...>::view_type create_mirror_view( - const Space&, const Kokkos::View<T, P...>& src, - Kokkos::Impl::WithoutInitializing_t, - std::enable_if_t<Impl::MirrorViewType<Space, T, P...>::is_same_memspace>* = - nullptr) { - return src; -} - -// Create a mirror view in a new space without initializing (specialization for -// different space) -template <class Space, class T, class... P> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the version taking WithoutInitializing as first argument") -typename Impl::MirrorViewType<Space, T, P...>::view_type create_mirror_view( - const Space&, const Kokkos::View<T, P...>& src, - Kokkos::Impl::WithoutInitializing_t, - std::enable_if_t<!Impl::MirrorViewType<Space, T, P...>::is_same_memspace>* = - nullptr) { - using Mirror = typename Impl::MirrorViewType<Space, T, P...>::view_type; - return Mirror(view_alloc(WithoutInitializing, src.label()), src.layout()); -} -#endif - } /* namespace Kokkos */ //---------------------------------------------------------------------------- diff --git a/packages/kokkos/core/src/Kokkos_Core.hpp b/packages/kokkos/core/src/Kokkos_Core.hpp index 3a9aaafbc300242efe20e7edb7b5cb51b0e5db45..cf898a71e7ad2ebf2154f08d11d3d31d1a494968 100644 --- a/packages/kokkos/core/src/Kokkos_Core.hpp +++ b/packages/kokkos/core/src/Kokkos_Core.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CORE_HPP #define KOKKOS_CORE_HPP @@ -49,6 +21,22 @@ #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE #endif +//---------------------------------------------------------------------------- +// In the case windows.h is included before Kokkos_Core.hpp there might be +// errors due to the potentially defined macros with name "min" and "max" in +// windows.h. These collide with the use of "min" and "max" in names inside +// Kokkos. The macros will be redefined at the end of Kokkos_Core.hpp +#if defined(min) +#pragma push_macro("min") +#undef min +#define KOKKOS_IMPL_PUSH_MACRO_MIN +#endif +#if defined(max) +#pragma push_macro("max") +#undef max +#define KOKKOS_IMPL_PUSH_MACRO_MAX +#endif + //---------------------------------------------------------------------------- // Include the execution space header files for the enabled execution spaces. @@ -64,6 +52,7 @@ #include <Kokkos_MathematicalConstants.hpp> #include <Kokkos_MathematicalFunctions.hpp> #include <Kokkos_MathematicalSpecialFunctions.hpp> +#include <Kokkos_NumericTraits.hpp> #include <Kokkos_MemoryPool.hpp> #include <Kokkos_Array.hpp> #include <Kokkos_View.hpp> @@ -75,6 +64,7 @@ #include <Kokkos_TaskScheduler.hpp> #include <Kokkos_Complex.hpp> #include <Kokkos_CopyViews.hpp> +#include <impl/Kokkos_TeamMDPolicy.hpp> #include <impl/Kokkos_InitializationSettings.hpp> #include <functional> #include <iosfwd> @@ -96,14 +86,18 @@ void pre_initialize(const InitializationSettings& settings); void post_initialize(const InitializationSettings& settings); +void pre_finalize(); + +void post_finalize(); + void declare_configuration_metadata(const std::string& category, const std::string& key, const std::string& value); } // namespace Impl -KOKKOS_ATTRIBUTE_NODISCARD bool is_initialized() noexcept; -KOKKOS_ATTRIBUTE_NODISCARD bool is_finalized() noexcept; +[[nodiscard]] bool is_initialized() noexcept; +[[nodiscard]] bool is_finalized() noexcept; bool show_warnings() noexcept; bool tune_internals() noexcept; @@ -133,10 +127,7 @@ void finalize(); */ void push_finalize_hook(std::function<void()> f); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -/** \brief Finalize all known execution spaces */ -KOKKOS_DEPRECATED void finalize_all(); -#endif +void fence(const std::string& name /*= "Kokkos::fence: Unnamed Global Fence"*/); /** \brief Print "Bill of Materials" */ void print_configuration(std::ostream& os, bool verbose = false); @@ -226,82 +217,13 @@ inline std::string scopeguard_destruct_after_finalize_warning() { } // namespace Impl -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -class KOKKOS_ATTRIBUTE_NODISCARD ScopeGuard { - public: -#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907 - KOKKOS_ATTRIBUTE_NODISCARD -#endif - ScopeGuard(int& argc, char* argv[]) { - sg_init = false; -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS - if (is_initialized()) { - std::cerr << Impl::scopeguard_create_while_initialized_warning() - << std::endl; - } - if (is_finalized()) { - std::cerr << Impl::scopeguard_create_after_finalize_warning() - << std::endl; - } -#endif - if (!is_initialized()) { - initialize(argc, argv); - sg_init = true; - } - } - -#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907 - KOKKOS_ATTRIBUTE_NODISCARD -#endif - explicit ScopeGuard( - const InitializationSettings& settings = InitializationSettings()) { - sg_init = false; -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS - if (is_initialized()) { - std::cerr << Impl::scopeguard_create_while_initialized_warning() - << std::endl; - } - if (is_finalized()) { - std::cerr << Impl::scopeguard_create_after_finalize_warning() - << std::endl; - } -#endif - if (!is_initialized()) { - initialize(settings); - sg_init = true; - } - } - - ~ScopeGuard() { -#ifdef KOKKOS_ENABLE_DEPRECATION_WARNINGS - if (is_finalized()) { - std::cerr << Impl::scopeguard_destruct_after_finalize_warning() - << std::endl; - } -#endif - if (is_initialized() && sg_init) { - finalize(); - } - } - - private: - bool sg_init; - - public: - ScopeGuard& operator=(const ScopeGuard&) = delete; - ScopeGuard& operator=(ScopeGuard&&) = delete; - ScopeGuard(const ScopeGuard&) = delete; - ScopeGuard(ScopeGuard&&) = delete; -}; - -#else // ifndef KOKKOS_ENABLE_DEPRECATED_CODE3 - class KOKKOS_ATTRIBUTE_NODISCARD ScopeGuard { public: + template <class... Args> #if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907 - KOKKOS_ATTRIBUTE_NODISCARD + [[nodiscard]] #endif - ScopeGuard(int& argc, char* argv[]) { + ScopeGuard(Args&&... args) { if (is_initialized()) { Kokkos::abort( Impl::scopeguard_create_while_initialized_warning().c_str()); @@ -309,22 +231,7 @@ class KOKKOS_ATTRIBUTE_NODISCARD ScopeGuard { if (is_finalized()) { Kokkos::abort(Impl::scopeguard_create_after_finalize_warning().c_str()); } - initialize(argc, argv); - } - -#if defined(__has_cpp_attribute) && __has_cpp_attribute(nodiscard) >= 201907 - KOKKOS_ATTRIBUTE_NODISCARD -#endif - ScopeGuard( - const InitializationSettings& settings = InitializationSettings()) { - if (is_initialized()) { - Kokkos::abort( - Impl::scopeguard_create_while_initialized_warning().c_str()); - } - if (is_finalized()) { - Kokkos::abort(Impl::scopeguard_create_after_finalize_warning().c_str()); - } - initialize(settings); + initialize(static_cast<Args&&>(args)...); } ~ScopeGuard() { @@ -339,7 +246,6 @@ class KOKKOS_ATTRIBUTE_NODISCARD ScopeGuard { ScopeGuard(const ScopeGuard&) = delete; ScopeGuard(ScopeGuard&&) = delete; }; -#endif } // namespace Kokkos @@ -350,22 +256,20 @@ namespace Experimental { // Customization point for backends // Default behavior is to return the passed in instance template <class ExecSpace, class... Args> -std::vector<ExecSpace> partition_space(ExecSpace space, Args...) { +std::vector<ExecSpace> partition_space(ExecSpace const& space, Args...) { static_assert(is_execution_space<ExecSpace>::value, "Kokkos Error: partition_space expects an Execution Space as " "first argument"); -#ifdef __cpp_fold_expressions static_assert( (... && std::is_arithmetic_v<Args>), "Kokkos Error: partitioning arguments must be integers or floats"); -#endif std::vector<ExecSpace> instances(sizeof...(Args)); for (int s = 0; s < int(sizeof...(Args)); s++) instances[s] = space; return instances; } template <class ExecSpace, class T> -std::vector<ExecSpace> partition_space(ExecSpace space, +std::vector<ExecSpace> partition_space(ExecSpace const& space, std::vector<T>& weights) { static_assert(is_execution_space<ExecSpace>::value, "Kokkos Error: partition_space expects an Execution Space as " @@ -395,6 +299,18 @@ std::vector<ExecSpace> partition_space(ExecSpace space, // Specializations required after core definitions #include <KokkosCore_Config_PostInclude.hpp> +//---------------------------------------------------------------------------- +// Redefinition of the macros min and max if we pushed them at entry of +// Kokkos_Core.hpp +#if defined(KOKKOS_IMPL_PUSH_MACRO_MIN) +#pragma pop_macro("min") +#undef KOKKOS_IMPL_PUSH_MACRO_MIN +#endif +#if defined(KOKKOS_IMPL_PUSH_MACRO_MAX) +#pragma pop_macro("max") +#undef KOKKOS_IMPL_PUSH_MACRO_MAX +#endif + //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- diff --git a/packages/kokkos/core/src/Kokkos_Core_fwd.hpp b/packages/kokkos/core/src/Kokkos_Core_fwd.hpp index 2bb323b4a6a9f10511ebc47f271d0bee6cbc9c55..a0b4df0c4bd09cf6726f5badf087f061573eb31a 100644 --- a/packages/kokkos/core/src/Kokkos_Core_fwd.hpp +++ b/packages/kokkos/core/src/Kokkos_Core_fwd.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CORE_FWD_HPP #define KOKKOS_CORE_FWD_HPP @@ -134,8 +106,7 @@ using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Cuda; using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Experimental::OpenMPTarget; #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP) -using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = - Experimental::HIP; +using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = HIP; #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL) using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Experimental::SYCL; @@ -153,7 +124,7 @@ using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = using DefaultExecutionSpace KOKKOS_IMPL_DEFAULT_EXEC_SPACE_ANNOTATION = Serial; #else #error \ - "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::Experimental::HIP, Kokkos::Experimental::SYCL, Kokkos::Experimental::OpenMPTarget, Kokkos::Experimental::OpenACC, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial." + "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::Cuda, Kokkos::HIP, Kokkos::Experimental::SYCL, Kokkos::Experimental::OpenMPTarget, Kokkos::Experimental::OpenACC, Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial." #endif #if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP) @@ -185,6 +156,50 @@ using DefaultHostExecutionSpace KOKKOS_IMPL_DEFAULT_HOST_EXEC_SPACE_ANNOTATION = "At least one of the following execution spaces must be defined in order to use Kokkos: Kokkos::OpenMP, Kokkos::Threads, Kokkos::Experimental::HPX, or Kokkos::Serial." #endif +// check for devices that support sharedSpace +#if defined(KOKKOS_ENABLE_CUDA) +using SharedSpace = CudaUVMSpace; +#define KOKKOS_HAS_SHARED_SPACE +#elif defined(KOKKOS_ENABLE_HIP) +using SharedSpace = HIPManagedSpace; +#define KOKKOS_HAS_SHARED_SPACE +#elif defined(KOKKOS_ENABLE_SYCL) +using SharedSpace = Experimental::SYCLSharedUSMSpace; +#define KOKKOS_HAS_SHARED_SPACE +// if only host compile point to HostSpace +#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET) +using SharedSpace = HostSpace; +#define KOKKOS_HAS_SHARED_SPACE +#endif + +inline constexpr bool has_shared_space = +#if defined KOKKOS_HAS_SHARED_SPACE + true; +#else + false; +#endif + +#if defined(KOKKOS_ENABLE_CUDA) +using SharedHostPinnedSpace = CudaHostPinnedSpace; +#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE +#elif defined(KOKKOS_ENABLE_HIP) +using SharedHostPinnedSpace = HIPHostPinnedSpace; +#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE +#elif defined(KOKKOS_ENABLE_SYCL) + using SharedHostPinnedSpace = Experimental::SYCLHostUSMSpace; +#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE +#elif !defined(KOKKOS_ENABLE_OPENACC) && !defined(KOKKOS_ENABLE_OPENMPTARGET) + using SharedHostPinnedSpace = HostSpace; +#define KOKKOS_HAS_SHARED_HOST_PINNED_SPACE +#endif + +inline constexpr bool has_shared_host_pinned_space = +#if defined KOKKOS_HAS_SHARED_HOST_PINNED_SPACE + true; +#else + false; +#endif + } // namespace Kokkos //---------------------------------------------------------------------------- @@ -241,42 +256,6 @@ KOKKOS_FUNCTION void runtime_check_memory_access_violation( msg);)) } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - -#if defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA) && \ - defined(KOKKOS_ENABLE_CUDA) -using ActiveExecutionMemorySpace KOKKOS_DEPRECATED = Kokkos::CudaSpace; -#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_SYCL) -using ActiveExecutionMemorySpace KOKKOS_DEPRECATED = - Kokkos::Experimental::SYCLDeviceUSMSpace; -#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HIP_GPU) -using ActiveExecutionMemorySpace KOKKOS_DEPRECATED = - Kokkos::Experimental::HIPSpace; -#elif defined(KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST) -using ActiveExecutionMemorySpace KOKKOS_DEPRECATED = Kokkos::HostSpace; -#else -using ActiveExecutionMemorySpace KOKKOS_DEPRECATED = void; -#endif - -template <typename DstMemorySpace, typename SrcMemorySpace> -struct MemorySpaceAccess; - -template <typename DstMemorySpace, typename SrcMemorySpace, - bool = Kokkos::Impl::MemorySpaceAccess<DstMemorySpace, - SrcMemorySpace>::accessible> -struct verify_space { - KOKKOS_DEPRECATED KOKKOS_FUNCTION static void check() {} -}; - -template <typename DstMemorySpace, typename SrcMemorySpace> -struct verify_space<DstMemorySpace, SrcMemorySpace, false> { - KOKKOS_DEPRECATED KOKKOS_FUNCTION static void check() { - Kokkos::abort( - "Kokkos::View ERROR: attempt to access inaccessible memory space"); - }; -}; -#endif - } // namespace Impl namespace Experimental { @@ -286,16 +265,6 @@ class LogicalMemorySpace; } // namespace Kokkos -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -#define KOKKOS_RESTRICT_EXECUTION_TO_DATA(DATA_SPACE, DATA_PTR) \ - Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \ - DATA_SPACE>::check(); - -#define KOKKOS_RESTRICT_EXECUTION_TO_(DATA_SPACE) \ - Kokkos::Impl::verify_space<Kokkos::Impl::ActiveExecutionMemorySpace, \ - DATA_SPACE>::check(); -#endif - //---------------------------------------------------------------------------- namespace Kokkos { diff --git a/packages/kokkos/core/src/Kokkos_Crs.hpp b/packages/kokkos/core/src/Kokkos_Crs.hpp index 9c0d1f68212ecea38797f832b65dae8b9175ba69..92931b584952b24eb2a5904dc2fcb97bf1ac770a 100644 --- a/packages/kokkos/core/src/Kokkos_Crs.hpp +++ b/packages/kokkos/core/src/Kokkos_Crs.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_CRS_HPP #define KOKKOS_CRS_HPP @@ -336,11 +304,11 @@ struct CountAndFillBase { Functor m_functor; counts_type m_counts; struct Count {}; - inline void operator()(Count, size_type i) const { + KOKKOS_FUNCTION void operator()(Count, size_type i) const { m_counts(i) = m_functor(i, nullptr); } struct Fill {}; - inline void operator()(Fill, size_type i) const { + KOKKOS_FUNCTION void operator()(Fill, size_type i) const { auto j = m_crs.row_map(i); /* we don't want to access entries(entries.size()), even if its just to get its address and never use it. this can happen when row (i) is empty and @@ -355,42 +323,6 @@ struct CountAndFillBase { CountAndFillBase(CrsType& crs, Functor const& f) : m_crs(crs), m_functor(f) {} }; -#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) -#if defined(KOKKOS_ENABLE_CUDA) -#define EXEC_SPACE Kokkos::Cuda -#elif defined(KOKKOS_ENABLE_HIP) -#define EXEC_SPACE Kokkos::Experimental::HIP -#endif -template <class CrsType, class Functor> -struct CountAndFillBase<CrsType, Functor, EXEC_SPACE> { - using data_type = typename CrsType::data_type; - using size_type = typename CrsType::size_type; - using row_map_type = typename CrsType::row_map_type; - using counts_type = row_map_type; - CrsType m_crs; - Functor m_functor; - counts_type m_counts; - struct Count {}; - __device__ inline void operator()(Count, size_type i) const { - m_counts(i) = m_functor(i, nullptr); - } - struct Fill {}; - __device__ inline void operator()(Fill, size_type i) const { - auto j = m_crs.row_map(i); - /* we don't want to access entries(entries.size()), even if its just to get - its address and never use it. this can happen when row (i) is empty and - all rows after it are also empty. we could compare to row_map(i + 1), but - that is a read from global memory, whereas dimension_0() should be part - of the View in registers (or constant memory) */ - data_type* fill = (j == static_cast<decltype(j)>(m_crs.entries.extent(0))) - ? nullptr - : (&(m_crs.entries(j))); - m_functor(i, fill); - } - CountAndFillBase(CrsType& crs, Functor const& f) : m_crs(crs), m_functor(f) {} -}; -#endif - template <class CrsType, class Functor> struct CountAndFill : public CountAndFillBase<CrsType, Functor> { using base_type = CountAndFillBase<CrsType, Functor>; diff --git a/packages/kokkos/core/src/Kokkos_Cuda.hpp b/packages/kokkos/core/src/Kokkos_Cuda.hpp index 72a00f41b7a239dd4af09f736815978284a13c5e..fce7351b3286ab74ab96635a94e5bc5ef84bbb9a 100644 --- a/packages/kokkos/core/src/Kokkos_Cuda.hpp +++ b/packages/kokkos/core/src/Kokkos_Cuda.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_CUDA_HPP #define KOKKOS_CUDA_HPP @@ -198,7 +166,11 @@ class Cuda { "Kokkos::Cuda::fence(): Unnamed Instance Fence") const; /** \brief Return the maximum amount of concurrency. */ +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 static int concurrency(); +#else + int concurrency() const; +#endif //! Print configuration information to the given output stream. void print_configuration(std::ostream& os, bool verbose = false) const; @@ -249,6 +221,13 @@ class Cuda { uint32_t impl_instance_id() const noexcept; private: + friend bool operator==(Cuda const& lhs, Cuda const& rhs) { + return lhs.impl_internal_space_instance() == + rhs.impl_internal_space_instance(); + } + friend bool operator!=(Cuda const& lhs, Cuda const& rhs) { + return !(lhs == rhs); + } Kokkos::Impl::HostSharedPtr<Impl::CudaInternal> m_space_instance; }; diff --git a/packages/kokkos/core/src/Kokkos_CudaSpace.hpp b/packages/kokkos/core/src/Kokkos_CudaSpace.hpp index 7ec78c0211c3af1dd32615901af643d066c8cde2..eec9999f616c9c32171c60f169c5e2042547b9a0 100644 --- a/packages/kokkos/core/src/Kokkos_CudaSpace.hpp +++ b/packages/kokkos/core/src/Kokkos_CudaSpace.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_CUDASPACE_HPP #define KOKKOS_CUDASPACE_HPP @@ -143,13 +111,6 @@ class CudaSpace { /**\brief Return Name of the MemorySpace */ static constexpr const char* name() { return m_name; } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - /*--------------------------------*/ - /** \brief Error reporting for HostSpace attempt to access CudaSpace */ - KOKKOS_DEPRECATED static void access_error(); - KOKKOS_DEPRECATED static void access_error(const void* const); -#endif - private: int m_device; ///< Which Cuda device @@ -178,13 +139,9 @@ class CudaUVMSpace { using device_type = Kokkos::Device<execution_space, memory_space>; using size_type = unsigned int; +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 /** \brief If UVM capability is available */ - static bool available(); - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - /*--------------------------------*/ - /** \brief CudaUVMSpace specific routine */ - KOKKOS_DEPRECATED static int number_of_allocations(); + KOKKOS_DEPRECATED static bool available(); #endif /*--------------------------------*/ diff --git a/packages/kokkos/core/src/Kokkos_DetectionIdiom.hpp b/packages/kokkos/core/src/Kokkos_DetectionIdiom.hpp index d45693819147e2eafdb04e80cd90aec08b4d9cc2..ae28805a42ee1acaad768f2cc634c48107465c2d 100644 --- a/packages/kokkos/core/src/Kokkos_DetectionIdiom.hpp +++ b/packages/kokkos/core/src/Kokkos_DetectionIdiom.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DETECTION_IDIOM_HPP #define KOKKOS_DETECTION_IDIOM_HPP #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE @@ -48,7 +20,9 @@ #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_DETECTIONIDIOM #endif -#include <impl/Kokkos_Utilities.hpp> // void_t +#include <Kokkos_Macros.hpp> // FIXME doesn't actually need it if it wasn't + // for the header self-containment test + #include <type_traits> // NOTE This header implements the detection idiom from Version 2 of the C++ @@ -73,7 +47,7 @@ struct detector { // specialization recognizes and handles only types supporting Op template <class Default, template <class...> class Op, class... Args> -struct detector<Default, void_t<Op<Args...>>, Op, Args...> { +struct detector<Default, std::void_t<Op<Args...>>, Op, Args...> { using value_t = std::true_type; using type = Op<Args...>; }; @@ -102,7 +76,6 @@ template <class To, template <class...> class Op, class... Args> using is_detected_convertible = std::is_convertible<detected_t<Op, Args...>, To>; -#ifdef KOKKOS_ENABLE_CXX17 template <template <class...> class Op, class... Args> inline constexpr bool is_detected_v = is_detected<Op, Args...>::value; @@ -113,7 +86,6 @@ inline constexpr bool is_detected_exact_v = template <class Expected, template <class...> class Op, class... Args> inline constexpr bool is_detected_convertible_v = is_detected_convertible<Expected, Op, Args...>::value; -#endif } // namespace Kokkos diff --git a/packages/kokkos/core/src/Kokkos_ExecPolicy.hpp b/packages/kokkos/core/src/Kokkos_ExecPolicy.hpp index 4cd57bae10a1f588bb1a84b1f7256d62704bcd67..357c2572a5c66880e068cdc72bae3a61fa45dcf9 100644 --- a/packages/kokkos/core/src/Kokkos_ExecPolicy.hpp +++ b/packages/kokkos/core/src/Kokkos_ExecPolicy.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_EXECPOLICY_HPP #define KOKKOS_EXECPOLICY_HPP @@ -217,8 +185,17 @@ class RangePolicy : public Impl::PolicyTraits<Properties...> { private: /** \brief finalize chunk_size if it was set to AUTO*/ inline void set_auto_chunk_size() { - int64_t concurrency = - static_cast<int64_t>(traits::execution_space::concurrency()); +#ifdef KOKKOS_ENABLE_SYCL + if (std::is_same_v<typename traits::execution_space, + Kokkos::Experimental::SYCL>) { + // chunk_size <=1 lets the compiler choose the workgroup size when + // launching kernels + m_granularity = 1; + m_granularity_mask = 0; + return; + } +#endif + auto concurrency = static_cast<int64_t>(m_space.concurrency()); if (concurrency == 0) concurrency = 1; if (m_granularity > 0) { @@ -868,6 +845,192 @@ ThreadVectorRange(const TeamMemberType&, const iType1& arg_begin, namespace Impl { +enum class TeamMDRangeLastNestLevel : bool { NotLastNestLevel, LastNestLevel }; +enum class TeamMDRangeParThread : bool { NotParThread, ParThread }; +enum class TeamMDRangeParVector : bool { NotParVector, ParVector }; +enum class TeamMDRangeThreadAndVector : bool { NotBoth, Both }; + +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct HostBasedNestLevel; + +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct AcceleratorBasedNestLevel; + +// ThreadAndVectorNestLevel determines on which nested level parallelization +// happens. +// - Rank is Kokkos::Rank<TotalNestLevel, Iter> +// - TotalNestLevel is the total number of loop nests +// - Iter is whether to go forward or backward through ranks (i.e. the +// iteration order for MDRangePolicy) +// - ThreadAndVector determines whether both vector and thread parallelism is +// in use +template <typename Rank, typename ExecSpace, + TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel; + +struct NoReductionTag {}; + +template <typename Rank, typename TeamMDPolicy, typename Lambda, + typename ReductionValueType> +KOKKOS_INLINE_FUNCTION void md_parallel_impl(TeamMDPolicy const& policy, + Lambda const& lambda, + ReductionValueType&& val); +} // namespace Impl + +template <typename Rank, typename TeamHandle> +struct TeamThreadMDRange; + +template <unsigned N, Iterate OuterDir, Iterate InnerDir, typename TeamHandle> +struct TeamThreadMDRange<Rank<N, OuterDir, InnerDir>, TeamHandle> { + using NestLevelType = int; + using BoundaryType = int; + using TeamHandleType = TeamHandle; + using ExecutionSpace = typename TeamHandleType::execution_space; + using ArrayLayout = typename ExecutionSpace::array_layout; + + static constexpr NestLevelType total_nest_level = + Rank<N, OuterDir, InnerDir>::rank; + static constexpr Iterate iter = OuterDir; + static constexpr auto par_thread = Impl::TeamMDRangeParThread::ParThread; + static constexpr auto par_vector = Impl::TeamMDRangeParVector::NotParVector; + + static constexpr Iterate direction = + OuterDir == Iterate::Default + ? layout_iterate_type_selector<ArrayLayout>::outer_iteration_pattern + : iter; + + template <class... Args> + KOKKOS_FUNCTION TeamThreadMDRange(TeamHandleType const& team_, Args&&... args) + : team(team_), boundaries{static_cast<BoundaryType>(args)...} { + static_assert(sizeof...(Args) == total_nest_level); + } + + TeamHandleType const& team; + BoundaryType boundaries[total_nest_level]; +}; + +template <typename TeamHandle, typename... Args> +TeamThreadMDRange(TeamHandle const&, Args&&...) + ->TeamThreadMDRange<Rank<sizeof...(Args), Iterate::Default>, TeamHandle>; + +template <typename Rank, typename TeamHandle> +struct ThreadVectorMDRange; + +template <unsigned N, Iterate OuterDir, Iterate InnerDir, typename TeamHandle> +struct ThreadVectorMDRange<Rank<N, OuterDir, InnerDir>, TeamHandle> { + using NestLevelType = int; + using BoundaryType = int; + using TeamHandleType = TeamHandle; + using ExecutionSpace = typename TeamHandleType::execution_space; + using ArrayLayout = typename ExecutionSpace::array_layout; + + static constexpr NestLevelType total_nest_level = + Rank<N, OuterDir, InnerDir>::rank; + static constexpr Iterate iter = OuterDir; + static constexpr auto par_thread = Impl::TeamMDRangeParThread::NotParThread; + static constexpr auto par_vector = Impl::TeamMDRangeParVector::ParVector; + + static constexpr Iterate direction = + OuterDir == Iterate::Default + ? layout_iterate_type_selector<ArrayLayout>::outer_iteration_pattern + : iter; + + template <class... Args> + KOKKOS_INLINE_FUNCTION ThreadVectorMDRange(TeamHandleType const& team_, + Args&&... args) + : team(team_), boundaries{static_cast<BoundaryType>(args)...} { + static_assert(sizeof...(Args) == total_nest_level); + } + + TeamHandleType const& team; + BoundaryType boundaries[total_nest_level]; +}; + +template <typename TeamHandle, typename... Args> +ThreadVectorMDRange(TeamHandle const&, Args&&...) + ->ThreadVectorMDRange<Rank<sizeof...(Args), Iterate::Default>, TeamHandle>; + +template <typename Rank, typename TeamHandle> +struct TeamVectorMDRange; + +template <unsigned N, Iterate OuterDir, Iterate InnerDir, typename TeamHandle> +struct TeamVectorMDRange<Rank<N, OuterDir, InnerDir>, TeamHandle> { + using NestLevelType = int; + using BoundaryType = int; + using TeamHandleType = TeamHandle; + using ExecutionSpace = typename TeamHandleType::execution_space; + using ArrayLayout = typename ExecutionSpace::array_layout; + + static constexpr NestLevelType total_nest_level = + Rank<N, OuterDir, InnerDir>::rank; + static constexpr Iterate iter = OuterDir; + static constexpr auto par_thread = Impl::TeamMDRangeParThread::ParThread; + static constexpr auto par_vector = Impl::TeamMDRangeParVector::ParVector; + + static constexpr Iterate direction = + iter == Iterate::Default + ? layout_iterate_type_selector<ArrayLayout>::outer_iteration_pattern + : iter; + + template <class... Args> + KOKKOS_INLINE_FUNCTION TeamVectorMDRange(TeamHandleType const& team_, + Args&&... args) + : team(team_), boundaries{static_cast<BoundaryType>(args)...} { + static_assert(sizeof...(Args) == total_nest_level); + } + + TeamHandleType const& team; + BoundaryType boundaries[total_nest_level]; +}; + +template <typename TeamHandle, typename... Args> +TeamVectorMDRange(TeamHandle const&, Args&&...) + ->TeamVectorMDRange<Rank<sizeof...(Args), Iterate::Default>, TeamHandle>; + +template <typename Rank, typename TeamHandle, typename Lambda, + typename ReducerValueType> +KOKKOS_INLINE_FUNCTION void parallel_reduce( + TeamThreadMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda, + ReducerValueType& val) { + Impl::md_parallel_impl<Rank>(policy, lambda, val); +} + +template <typename Rank, typename TeamHandle, typename Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + TeamThreadMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda) { + Impl::md_parallel_impl<Rank>(policy, lambda, Impl::NoReductionTag()); +} + +template <typename Rank, typename TeamHandle, typename Lambda, + typename ReducerValueType> +KOKKOS_INLINE_FUNCTION void parallel_reduce( + ThreadVectorMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda, + ReducerValueType& val) { + Impl::md_parallel_impl<Rank>(policy, lambda, val); +} + +template <typename Rank, typename TeamHandle, typename Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + ThreadVectorMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda) { + Impl::md_parallel_impl<Rank>(policy, lambda, Impl::NoReductionTag()); +} + +template <typename Rank, typename TeamHandle, typename Lambda, + typename ReducerValueType> +KOKKOS_INLINE_FUNCTION void parallel_reduce( + TeamVectorMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda, + ReducerValueType& val) { + Impl::md_parallel_impl<Rank>(policy, lambda, val); +} + +template <typename Rank, typename TeamHandle, typename Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + TeamVectorMDRange<Rank, TeamHandle> const& policy, Lambda const& lambda) { + Impl::md_parallel_impl<Rank>(policy, lambda, Impl::NoReductionTag()); +} + +namespace Impl { + template <typename FunctorType, typename TagType, bool HasTag = !std::is_void<TagType>::value> struct ParallelConstructName; @@ -914,30 +1077,30 @@ struct PatternImplSpecializationFromTag; template <class... Args> struct PatternImplSpecializationFromTag<Kokkos::ParallelForTag, Args...> - : identity<ParallelFor<Args...>> {}; + : type_identity<ParallelFor<Args...>> {}; template <class... Args> struct PatternImplSpecializationFromTag<Kokkos::ParallelReduceTag, Args...> - : identity<ParallelReduce<Args...>> {}; + : type_identity<ParallelReduce<Args...>> {}; template <class... Args> struct PatternImplSpecializationFromTag<Kokkos::ParallelScanTag, Args...> - : identity<ParallelScan<Args...>> {}; + : type_identity<ParallelScan<Args...>> {}; template <class PatternImpl> struct PatternTagFromImplSpecialization; template <class... Args> struct PatternTagFromImplSpecialization<ParallelFor<Args...>> - : identity<ParallelForTag> {}; + : type_identity<ParallelForTag> {}; template <class... Args> struct PatternTagFromImplSpecialization<ParallelReduce<Args...>> - : identity<ParallelReduceTag> {}; + : type_identity<ParallelReduceTag> {}; template <class... Args> struct PatternTagFromImplSpecialization<ParallelScan<Args...>> - : identity<ParallelScanTag> {}; + : type_identity<ParallelScanTag> {}; } // end namespace Impl diff --git a/packages/kokkos/core/src/Kokkos_Extents.hpp b/packages/kokkos/core/src/Kokkos_Extents.hpp index c51d663ce9bb10b074cb3378d4d8ef30f95e95da..7968fab3aaa829b7f5618fe59ff8b2062b3d8710 100644 --- a/packages/kokkos/core/src/Kokkos_Extents.hpp +++ b/packages/kokkos/core/src/Kokkos_Extents.hpp @@ -1,54 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_KOKKOS_EXTENTS_HPP #define KOKKOS_KOKKOS_EXTENTS_HPP diff --git a/packages/kokkos/core/src/Kokkos_Future.hpp b/packages/kokkos/core/src/Kokkos_Future.hpp index 4da6c2b5d94a1b26497316c2c14ce1355d088578..0b3a153de8c4a450377415c05f221064b0feb55b 100644 --- a/packages/kokkos/core/src/Kokkos_Future.hpp +++ b/packages/kokkos/core/src/Kokkos_Future.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_FUTURE_HPP #define KOKKOS_FUTURE_HPP @@ -449,10 +417,9 @@ struct is_future : public std::false_type {}; template <typename ValueType, typename Scheduler, typename ExecSpace> struct is_future<BasicFuture<ValueType, Scheduler>, ExecSpace> - : std::integral_constant< - bool, + : std::bool_constant< std::is_same<ExecSpace, typename Scheduler::execution_space>::value || - std::is_void<ExecSpace>::value> {}; + std::is_void<ExecSpace>::value> {}; //////////////////////////////////////////////////////////////////////////////// // END OLD CODE diff --git a/packages/kokkos/core/src/Kokkos_Graph.hpp b/packages/kokkos/core/src/Kokkos_Graph.hpp index 1f71665fbbe5668bfbf1bdae1f757a06886e2ac0..7f77c00b2d7b8f03c5d3abfa26628b51e314f884 100644 --- a/packages/kokkos/core/src/Kokkos_Graph.hpp +++ b/packages/kokkos/core/src/Kokkos_Graph.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_GRAPH_HPP #define KOKKOS_GRAPH_HPP @@ -58,8 +30,6 @@ // GraphAccess needs to be defined, not just declared #include <impl/Kokkos_GraphImpl.hpp> -#include <impl/Kokkos_Utilities.hpp> // fold emulation - #include <functional> #include <memory> @@ -70,7 +40,7 @@ namespace Experimental { // <editor-fold desc="Graph"> {{{1 template <class ExecutionSpace> -struct KOKKOS_ATTRIBUTE_NODISCARD Graph { +struct [[nodiscard]] Graph { public: //---------------------------------------------------------------------------- // <editor-fold desc="public member types"> {{{2 @@ -145,8 +115,7 @@ auto when_all(PredecessorRefs&&... arg_pred_refs) { .lock(); auto node_ptr_impl = graph_ptr_impl->create_aggregate_ptr(arg_pred_refs...); graph_ptr_impl->add_node(node_ptr_impl); - KOKKOS_IMPL_FOLD_COMMA_OPERATOR( - graph_ptr_impl->add_predecessor(node_ptr_impl, arg_pred_refs) /* ... */); + (graph_ptr_impl->add_predecessor(node_ptr_impl, arg_pred_refs), ...); return Kokkos::Impl::GraphAccess::make_graph_node_ref( std::move(graph_ptr_impl), std::move(node_ptr_impl)); } diff --git a/packages/kokkos/core/src/Kokkos_GraphNode.hpp b/packages/kokkos/core/src/Kokkos_GraphNode.hpp index 6eab5ec8c7b285018619b0350bbb76d7623ea257..1cfd2b382b2e7b409e39ce3b921f66c99d9be106 100644 --- a/packages/kokkos/core/src/Kokkos_GraphNode.hpp +++ b/packages/kokkos/core/src/Kokkos_GraphNode.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_KOKKOS_GRAPHNODE_HPP #define KOKKOS_KOKKOS_GRAPHNODE_HPP @@ -79,13 +47,10 @@ class GraphNodeRef { // Note: because of these assertions, instantiating this class template is not // intended to be SFINAE-safe, so do validation before you instantiate. -// WORKAROUND Could not get it to compile with IBM XL V16.1.1 -#ifndef KOKKOS_COMPILER_IBM static_assert( std::is_same<Predecessor, TypeErasedTag>::value || Kokkos::Impl::is_specialization_of<Predecessor, GraphNodeRef>::value, "Invalid predecessor template parameter given to GraphNodeRef"); -#endif static_assert( Kokkos::is_execution_space<ExecutionSpace>::value, diff --git a/packages/kokkos/core/src/Kokkos_Graph_fwd.hpp b/packages/kokkos/core/src/Kokkos_Graph_fwd.hpp index 6f639658e1d72cd4d1166a3189428b05f6b082d7..fd0caba907382d2c0674fc365fac1f5dcab3b3c4 100644 --- a/packages/kokkos/core/src/Kokkos_Graph_fwd.hpp +++ b/packages/kokkos/core/src/Kokkos_Graph_fwd.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_GRAPH_FWD_HPP #define KOKKOS_KOKKOS_GRAPH_FWD_HPP diff --git a/packages/kokkos/core/src/Kokkos_HBWSpace.hpp b/packages/kokkos/core/src/Kokkos_HBWSpace.hpp index 0c5dbbdc22b60fccbb159837a37b4e5a7229a290..d9064a298339e6e611c90dd5c9b60336cc7e2527 100644 --- a/packages/kokkos/core/src/Kokkos_HBWSpace.hpp +++ b/packages/kokkos/core/src/Kokkos_HBWSpace.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_HBWSPACE_HPP #define KOKKOS_HBWSPACE_HPP @@ -204,12 +172,7 @@ class SharedAllocationRecord<Kokkos::Experimental::HBWSpace, void> const Kokkos::Experimental::HBWSpace m_space; protected: - ~SharedAllocationRecord() -#if defined( \ - KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION) - noexcept -#endif - ; + ~SharedAllocationRecord(); SharedAllocationRecord() = default; SharedAllocationRecord( diff --git a/packages/kokkos/core/src/Kokkos_HIP_Space.hpp b/packages/kokkos/core/src/Kokkos_HIP_Space.hpp deleted file mode 100644 index 8c195a0f398f13107ffded35b14677e25db6e23d..0000000000000000000000000000000000000000 --- a/packages/kokkos/core/src/Kokkos_HIP_Space.hpp +++ /dev/null @@ -1,806 +0,0 @@ -/* -//@HEADER -// ************************************************************************ -// -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ -//@HEADER -*/ - -#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE -#include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 -static_assert(false, - "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif -#endif -#ifndef KOKKOS_HIPSPACE_HPP -#define KOKKOS_HIPSPACE_HPP - -#include <Kokkos_Core_fwd.hpp> - -#if defined(KOKKOS_ENABLE_HIP) - -#include <iosfwd> -#include <typeinfo> -#include <string> -#include <cstddef> -#include <iosfwd> - -#include <Kokkos_HostSpace.hpp> -#include <Kokkos_Layout.hpp> -#include <Kokkos_ScratchSpace.hpp> -#include <HIP/Kokkos_HIP_Error.hpp> // HIP_SAFE_CALL - -#include <impl/Kokkos_Profiling_Interface.hpp> -#include <impl/Kokkos_HostSharedPtr.hpp> -#include <impl/Kokkos_InitializationSettings.hpp> - -#include <hip/hip_runtime_api.h> -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Impl { - -template <typename T> -struct is_hip_type_space : public std::false_type {}; - -} // namespace Impl - -namespace Experimental { -/** \brief HIP on-device memory management */ - -class HIPSpace { - public: - //! Tag this class as a kokkos memory space - using memory_space = HIPSpace; - using execution_space = Kokkos::Experimental::HIP; - using device_type = Kokkos::Device<execution_space, memory_space>; - - using size_type = unsigned int; - - /*--------------------------------*/ - - HIPSpace(); - HIPSpace(HIPSpace&& rhs) = default; - HIPSpace(const HIPSpace& rhs) = default; - HIPSpace& operator=(HIPSpace&& rhs) = default; - HIPSpace& operator=(const HIPSpace& rhs) = default; - ~HIPSpace() = default; - - /**\brief Allocate untracked memory in the hip space */ - void* allocate(const size_t arg_alloc_size) const; - void* allocate(const char* arg_label, const size_t arg_alloc_size, - const size_t arg_logical_size = 0) const; - - /**\brief Deallocate untracked memory in the hip space */ - void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const; - void deallocate(const char* arg_label, void* const arg_alloc_ptr, - const size_t arg_alloc_size, - const size_t arg_logical_size = 0) const; - - private: - template <class, class, class, class> - friend class LogicalMemorySpace; - void* impl_allocate(const char* arg_label, const size_t arg_alloc_size, - const size_t arg_logical_size = 0, - const Kokkos::Tools::SpaceHandle = - Kokkos::Tools::make_space_handle(name())) const; - void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr, - const size_t arg_alloc_size, - const size_t arg_logical_size = 0, - const Kokkos::Tools::SpaceHandle = - Kokkos::Tools::make_space_handle(name())) const; - - public: - /**\brief Return Name of the MemorySpace */ - static constexpr const char* name() { return "HIP"; } - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - /*--------------------------------*/ - /** \brief Error reporting for HostSpace attempt to access HIPSpace */ - KOKKOS_DEPRECATED static void access_error(); - KOKKOS_DEPRECATED static void access_error(const void* const); -#endif - - private: - int m_device; ///< Which HIP device - - friend class Kokkos::Impl::SharedAllocationRecord< - Kokkos::Experimental::HIPSpace, void>; -}; - -} // namespace Experimental - -template <> -struct Impl::is_hip_type_space<Experimental::HIPSpace> : public std::true_type { -}; - -} // namespace Kokkos - -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Experimental { -/** \brief Host memory that is accessible to HIP execution space - * through HIP's host-pinned memory allocation. - */ -class HIPHostPinnedSpace { - public: - //! Tag this class as a kokkos memory space - /** \brief Memory is in HostSpace so use the HostSpace::execution_space */ - using execution_space = HostSpace::execution_space; - using memory_space = HIPHostPinnedSpace; - using device_type = Kokkos::Device<execution_space, memory_space>; - using size_type = unsigned int; - - /*--------------------------------*/ - - HIPHostPinnedSpace(); - HIPHostPinnedSpace(HIPHostPinnedSpace&& rhs) = default; - HIPHostPinnedSpace(const HIPHostPinnedSpace& rhs) = default; - HIPHostPinnedSpace& operator=(HIPHostPinnedSpace&& rhs) = default; - HIPHostPinnedSpace& operator=(const HIPHostPinnedSpace& rhs) = default; - ~HIPHostPinnedSpace() = default; - - /**\brief Allocate untracked memory in the space */ - void* allocate(const size_t arg_alloc_size) const; - void* allocate(const char* arg_label, const size_t arg_alloc_size, - const size_t arg_logical_size = 0) const; - - /**\brief Deallocate untracked memory in the space */ - void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const; - void deallocate(const char* arg_label, void* const arg_alloc_ptr, - const size_t arg_alloc_size, - const size_t arg_logical_size = 0) const; - - private: - template <class, class, class, class> - friend class LogicalMemorySpace; - void* impl_allocate(const char* arg_label, const size_t arg_alloc_size, - const size_t arg_logical_size = 0, - const Kokkos::Tools::SpaceHandle = - Kokkos::Tools::make_space_handle(name())) const; - void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr, - const size_t arg_alloc_size, - const size_t arg_logical_size = 0, - const Kokkos::Tools::SpaceHandle = - Kokkos::Tools::make_space_handle(name())) const; - - public: - /**\brief Return Name of the MemorySpace */ - static constexpr const char* name() { return "HIPHostPinned"; } - - /*--------------------------------*/ -}; -} // namespace Experimental - -template <> -struct Impl::is_hip_type_space<Experimental::HIPHostPinnedSpace> - : public std::true_type {}; - -} // namespace Kokkos - -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Experimental { -/** \brief Memory that is accessible to HIP execution space - * and host through HIP's memory page migration. - */ -class HIPManagedSpace { - public: - //! Tag this class as a kokkos memory space - /** \brief Memory is unified to both device and host via page migration - * and therefore able to be used by HostSpace::execution_space and - * DeviceSpace::execution_space. - */ - //! tag this class as a kokkos memory space - using memory_space = HIPManagedSpace; - using execution_space = Kokkos::Experimental::HIP; - using device_type = Kokkos::Device<execution_space, memory_space>; - using size_type = unsigned int; - - /*--------------------------------*/ - - HIPManagedSpace(); - HIPManagedSpace(HIPManagedSpace&& rhs) = default; - HIPManagedSpace(const HIPManagedSpace& rhs) = default; - HIPManagedSpace& operator=(HIPManagedSpace&& rhs) = default; - HIPManagedSpace& operator=(const HIPManagedSpace& rhs) = default; - ~HIPManagedSpace() = default; - - /**\brief Allocate untracked memory in the space */ - void* allocate(const size_t arg_alloc_size) const; - void* allocate(const char* arg_label, const size_t arg_alloc_size, - const size_t arg_logical_size = 0) const; - - /**\brief Deallocate untracked memory in the space */ - void deallocate(void* const arg_alloc_ptr, const size_t arg_alloc_size) const; - void deallocate(const char* arg_label, void* const arg_alloc_ptr, - const size_t arg_alloc_size, - const size_t arg_logical_size = 0) const; - - private: - int m_device; ///< Which HIP device - template <class, class, class, class> - friend class LogicalMemorySpace; - void* impl_allocate(const char* arg_label, const size_t arg_alloc_size, - const size_t arg_logical_size = 0, - const Kokkos::Tools::SpaceHandle = - Kokkos::Tools::make_space_handle(name())) const; - void impl_deallocate(const char* arg_label, void* const arg_alloc_ptr, - const size_t arg_alloc_size, - const size_t arg_logical_size = 0, - const Kokkos::Tools::SpaceHandle = - Kokkos::Tools::make_space_handle(name())) const; - - public: - /**\brief Return Name of the MemorySpace */ - static constexpr const char* name() { return "HIPManaged"; } - - /*--------------------------------*/ -}; -} // namespace Experimental - -template <> -struct Impl::is_hip_type_space<Experimental::HIPManagedSpace> - : public std::true_type {}; - -} // namespace Kokkos - -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Impl { - -static_assert( - Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIPSpace>::assignable, - ""); - -//---------------------------------------- - -template <> -struct MemorySpaceAccess<Kokkos::HostSpace, Kokkos::Experimental::HIPSpace> { - enum : bool { assignable = false }; - enum : bool { accessible = false }; - enum : bool { deepcopy = true }; -}; - -template <> -struct MemorySpaceAccess<Kokkos::HostSpace, - Kokkos::Experimental::HIPHostPinnedSpace> { - // HostSpace::execution_space == HIPHostPinnedSpace::execution_space - enum : bool { assignable = true }; - enum : bool { accessible = true }; - enum : bool { deepcopy = true }; -}; - -template <> -struct MemorySpaceAccess<Kokkos::HostSpace, - Kokkos::Experimental::HIPManagedSpace> { - // HostSpace::execution_space != HIPManagedSpace::execution_space - enum : bool { assignable = false }; - enum : bool { accessible = true }; - enum : bool { deepcopy = true }; -}; - -//---------------------------------------- - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace, Kokkos::HostSpace> { - enum : bool { assignable = false }; - enum : bool { accessible = false }; - enum : bool { deepcopy = true }; -}; - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIPHostPinnedSpace> { - // HIPSpace::execution_space != HIPHostPinnedSpace::execution_space - enum : bool { assignable = false }; - enum : bool { accessible = true }; // HIPSpace::execution_space - enum : bool { deepcopy = true }; -}; - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIPManagedSpace> { - // HIPSpace::execution_space == HIPManagedSpace::execution_space - enum : bool { assignable = true }; - enum : bool { accessible = true }; - enum : bool { deepcopy = true }; -}; - -//---------------------------------------- -// HIPHostPinnedSpace::execution_space == HostSpace::execution_space -// HIPHostPinnedSpace accessible to both HIP and Host - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::HostSpace> { - enum : bool { assignable = false }; // Cannot access from HIP - enum : bool { accessible = true }; // HIPHostPinnedSpace::execution_space - enum : bool { deepcopy = true }; -}; - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIPSpace> { - enum : bool { assignable = false }; // Cannot access from Host - enum : bool { accessible = false }; - enum : bool { deepcopy = true }; -}; - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIPManagedSpace> { - enum : bool { assignable = false }; // different exec_space - enum : bool { accessible = true }; - enum : bool { deepcopy = true }; -}; - -//---------------------------------------- -// HIPManagedSpace::execution_space != HostSpace::execution_space -// HIPManagedSpace accessible to both HIP and Host - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace, - Kokkos::HostSpace> { - enum : bool { assignable = false }; - enum : bool { accessible = false }; // HIPHostPinnedSpace::execution_space - enum : bool { deepcopy = true }; -}; - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIPSpace> { - enum : bool { assignable = false }; - enum : bool { accessible = true }; - enum : bool { deepcopy = true }; -}; - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIPHostPinnedSpace> { - enum : bool { assignable = false }; // different exec_space - enum : bool { accessible = true }; - enum : bool { deepcopy = true }; -}; - -}; // namespace Impl -//---------------------------------------- - -} // namespace Kokkos - -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Impl { - -void DeepCopyHIP(void* dst, const void* src, size_t n); -void DeepCopyAsyncHIP(const Kokkos::Experimental::HIP& instance, void* dst, - const void* src, size_t n); -void DeepCopyAsyncHIP(void* dst, const void* src, size_t n); - -template <class MemSpace> -struct DeepCopy<MemSpace, HostSpace, Kokkos::Experimental::HIP, - std::enable_if_t<is_hip_type_space<MemSpace>::value>> { - DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); } - DeepCopy(const Kokkos::Experimental::HIP& instance, void* dst, - const void* src, size_t n) { - DeepCopyAsyncHIP(instance, dst, src, n); - } -}; - -template <class MemSpace> -struct DeepCopy<HostSpace, MemSpace, Kokkos::Experimental::HIP, - std::enable_if_t<is_hip_type_space<MemSpace>::value>> { - DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); } - DeepCopy(const Kokkos::Experimental::HIP& instance, void* dst, - const void* src, size_t n) { - DeepCopyAsyncHIP(instance, dst, src, n); - } -}; - -template <class MemSpace1, class MemSpace2> -struct DeepCopy<MemSpace1, MemSpace2, Kokkos::Experimental::HIP, - std::enable_if_t<is_hip_type_space<MemSpace1>::value && - is_hip_type_space<MemSpace2>::value>> { - DeepCopy(void* dst, const void* src, size_t n) { DeepCopyHIP(dst, src, n); } - DeepCopy(const Kokkos::Experimental::HIP& instance, void* dst, - const void* src, size_t n) { - DeepCopyAsyncHIP(instance, dst, src, n); - } -}; - -template <class MemSpace1, class MemSpace2, class ExecutionSpace> -struct DeepCopy< - MemSpace1, MemSpace2, ExecutionSpace, - std::enable_if_t< - is_hip_type_space<MemSpace1>::value && - is_hip_type_space<MemSpace2>::value && - !std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value>> { - inline DeepCopy(void* dst, const void* src, size_t n) { - DeepCopyHIP(dst, src, n); - } - - inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, - size_t n) { - exec.fence(fence_string()); - DeepCopyAsyncHIP(dst, src, n); - } - - private: - static const std::string& fence_string() { - static const std::string string = - std::string("Kokkos::Impl::DeepCopy<") + MemSpace1::name() + "Space, " + - MemSpace2::name() + - "Space, ExecutionSpace>::DeepCopy: fence before copy"; - return string; - } -}; - -template <class MemSpace, class ExecutionSpace> -struct DeepCopy< - MemSpace, HostSpace, ExecutionSpace, - std::enable_if_t< - is_hip_type_space<MemSpace>::value && - !std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value>> { - inline DeepCopy(void* dst, const void* src, size_t n) { - DeepCopyHIP(dst, src, n); - } - - inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, - size_t n) { - exec.fence(fence_string()); - DeepCopyAsyncHIP(dst, src, n); - } - - private: - static const std::string& fence_string() { - static const std::string string = - std::string("Kokkos::Impl::DeepCopy<") + MemSpace::name() + - "Space, HostSpace, ExecutionSpace>::DeepCopy: fence before copy"; - return string; - } -}; - -template <class MemSpace, class ExecutionSpace> -struct DeepCopy< - HostSpace, MemSpace, ExecutionSpace, - std::enable_if_t< - is_hip_type_space<MemSpace>::value && - !std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value>> { - inline DeepCopy(void* dst, const void* src, size_t n) { - DeepCopyHIP(dst, src, n); - } - - inline DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, - size_t n) { - exec.fence(fence_string()); - DeepCopyAsyncHIP(dst, src, n); - } - - private: - static const std::string& fence_string() { - static const std::string string = - std::string("Kokkos::Impl::DeepCopy<HostSpace, ") + MemSpace::name() + - "Space, ExecutionSpace>::DeepCopy: fence before copy"; - return string; - } -}; -} // namespace Impl -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Impl { - -template <> -class SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void> - : public HostInaccessibleSharedAllocationRecordCommon< - Kokkos::Experimental::HIPSpace> { - private: - friend class SharedAllocationRecordCommon<Kokkos::Experimental::HIPSpace>; - friend class HostInaccessibleSharedAllocationRecordCommon< - Kokkos::Experimental::HIPSpace>; - using base_t = HostInaccessibleSharedAllocationRecordCommon< - Kokkos::Experimental::HIPSpace>; - using RecordBase = SharedAllocationRecord<void, void>; - - SharedAllocationRecord(const SharedAllocationRecord&) = delete; - SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete; - -#ifdef KOKKOS_ENABLE_DEBUG - static RecordBase s_root_record; -#endif - - const Kokkos::Experimental::HIPSpace m_space; - - protected: - ~SharedAllocationRecord(); - - template <typename ExecutionSpace> - SharedAllocationRecord( - const ExecutionSpace& /*exec*/, - const Kokkos::Experimental::HIPSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &base_t::deallocate) - : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size, - arg_dealloc) {} - - SharedAllocationRecord( - const Kokkos::Experimental::HIP& exec_space, - const Kokkos::Experimental::HIPSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &base_t::deallocate); - - SharedAllocationRecord( - const Kokkos::Experimental::HIPSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &base_t::deallocate); -}; - -template <> -class SharedAllocationRecord<Kokkos::Experimental::HIPHostPinnedSpace, void> - : public SharedAllocationRecordCommon< - Kokkos::Experimental::HIPHostPinnedSpace> { - private: - friend class SharedAllocationRecordCommon< - Kokkos::Experimental::HIPHostPinnedSpace>; - using base_t = - SharedAllocationRecordCommon<Kokkos::Experimental::HIPHostPinnedSpace>; - using RecordBase = SharedAllocationRecord<void, void>; - - SharedAllocationRecord(const SharedAllocationRecord&) = delete; - SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete; - -#ifdef KOKKOS_ENABLE_DEBUG - static RecordBase s_root_record; -#endif - - const Kokkos::Experimental::HIPHostPinnedSpace m_space; - - protected: - ~SharedAllocationRecord(); - SharedAllocationRecord() = default; - - template <typename ExecutionSpace> - SharedAllocationRecord( - const ExecutionSpace& /*exec_space*/, - const Kokkos::Experimental::HIPHostPinnedSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &base_t::deallocate) - : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size, - arg_dealloc) {} - - SharedAllocationRecord( - const Kokkos::Experimental::HIPHostPinnedSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &base_t::deallocate); -}; - -template <> -class SharedAllocationRecord<Kokkos::Experimental::HIPManagedSpace, void> - : public SharedAllocationRecordCommon< - Kokkos::Experimental::HIPManagedSpace> { - private: - friend class SharedAllocationRecordCommon< - Kokkos::Experimental::HIPManagedSpace>; - using base_t = - SharedAllocationRecordCommon<Kokkos::Experimental::HIPManagedSpace>; - using RecordBase = SharedAllocationRecord<void, void>; - - SharedAllocationRecord(const SharedAllocationRecord&) = delete; - SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete; - -#ifdef KOKKOS_ENABLE_DEBUG - static RecordBase s_root_record; -#endif - - const Kokkos::Experimental::HIPManagedSpace m_space; - - protected: - ~SharedAllocationRecord(); - SharedAllocationRecord() = default; - - template <typename ExecutionSpace> - SharedAllocationRecord( - const ExecutionSpace& /*exec_space*/, - const Kokkos::Experimental::HIPManagedSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &base_t::deallocate) - : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size, - arg_dealloc) {} - - SharedAllocationRecord( - const Kokkos::Experimental::HIPManagedSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &base_t::deallocate); -}; -} // namespace Impl -} // namespace Kokkos - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -namespace Kokkos { -namespace Experimental { -namespace Impl { -class HIPInternal; -} -/// \class HIP -/// \brief Kokkos device for multicore processors in the host memory space. -class HIP { - public: - //------------------------------------ - //! \name Type declarations that all Kokkos devices must provide. - //@{ - - //! Tag this class as a kokkos execution space - using execution_space = HIP; - using memory_space = HIPSpace; - using device_type = Kokkos::Device<execution_space, memory_space>; - - using array_layout = LayoutLeft; - using size_type = HIPSpace::size_type; - - using scratch_memory_space = ScratchMemorySpace<HIP>; - - HIP(); - HIP(hipStream_t stream, bool manage_stream = false); - - //@} - //------------------------------------ - //! \name Functions that all Kokkos devices must implement. - //@{ - - KOKKOS_INLINE_FUNCTION static int in_parallel() { -#if defined(__HIP_DEVICE_COMPILE__) - return true; -#else - return false; -#endif - } - - /** \brief Wait until all dispatched functors complete. - * - * The parallel_for or parallel_reduce dispatch of a functor may return - * asynchronously, before the functor completes. This method does not return - * until all dispatched functors on this device have completed. - */ - static void impl_static_fence(const std::string& name); - - void fence(const std::string& name = - "Kokkos::HIP::fence(): Unnamed Instance Fence") const; - - hipStream_t hip_stream() const; - - /// \brief Print configuration information to the given output stream. - void print_configuration(std::ostream& os, bool verbose = false) const; - - /// \brief Free any resources being consumed by the device. - static void impl_finalize(); - - /** \brief Initialize the device. - * - */ - int hip_device() const; - static hipDeviceProp_t const& hip_device_prop(); - - static void impl_initialize(InitializationSettings const&); - - static int impl_is_initialized(); - - // static size_type device_arch(); - - static size_type detect_device_count(); - - static int concurrency(); - static const char* name(); - - inline Impl::HIPInternal* impl_internal_space_instance() const { - return m_space_instance.get(); - } - - uint32_t impl_instance_id() const noexcept; - - private: - Kokkos::Impl::HostSharedPtr<Impl::HIPInternal> m_space_instance; -}; -} // namespace Experimental -namespace Tools { -namespace Experimental { -template <> -struct DeviceTypeTraits<Kokkos::Experimental::HIP> { - static constexpr DeviceType id = DeviceType::HIP; - static int device_id(const Kokkos::Experimental::HIP& exec) { - return exec.hip_device(); - } -}; -} // namespace Experimental -} // namespace Tools - -namespace Impl { -template <class DT, class... DP> -struct ZeroMemset<Kokkos::Experimental::HIP, DT, DP...> { - ZeroMemset(const Kokkos::Experimental::HIP& exec_space, - const View<DT, DP...>& dst, - typename View<DT, DP...>::const_value_type&) { - KOKKOS_IMPL_HIP_SAFE_CALL(hipMemsetAsync( - dst.data(), 0, - dst.size() * sizeof(typename View<DT, DP...>::value_type), - exec_space.hip_stream())); - } - - ZeroMemset(const View<DT, DP...>& dst, - typename View<DT, DP...>::const_value_type&) { - KOKKOS_IMPL_HIP_SAFE_CALL( - hipMemset(dst.data(), 0, - dst.size() * sizeof(typename View<DT, DP...>::value_type))); - } -}; -} // namespace Impl -} // namespace Kokkos - -namespace Kokkos { -namespace Impl { - -template <> -struct MemorySpaceAccess<Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIP::scratch_memory_space> { - enum : bool { assignable = false }; - enum : bool { accessible = true }; - enum : bool { deepcopy = false }; -}; - -} // namespace Impl -} // namespace Kokkos - -#endif /* #if defined( KOKKOS_ENABLE_HIP ) */ -#endif /* #define KOKKOS_HIPSPACE_HPP */ diff --git a/packages/kokkos/core/src/Kokkos_HPX.hpp b/packages/kokkos/core/src/Kokkos_HPX.hpp index 044e54fb29f6b1c9d96c84b55d1bfaaf79ea6f56..06693852622df02fb747228f7e1a4aa1ad0625a3 100644 --- a/packages/kokkos/core/src/Kokkos_HPX.hpp +++ b/packages/kokkos/core/src/Kokkos_HPX.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_HPX_HPP #define KOKKOS_HPX_HPP @@ -371,13 +339,6 @@ class HPX { } #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - static std::vector<HPX> partition(...) { - Kokkos::abort( - "Kokkos::Experimental::HPX::partition_master: can't partition an HPX " - "instance\n"); - return std::vector<HPX>(); - } - template <typename F> KOKKOS_DEPRECATED static void partition_master( F const &, int requested_num_partitions = 0, int = 0) { @@ -455,7 +416,7 @@ class HPX { #endif #if defined(KOKKOS_ENABLE_HPX_ASYNC_DISPATCH) - struct KOKKOS_ATTRIBUTE_NODISCARD reset_on_exit_parallel { + struct [[nodiscard]] reset_on_exit_parallel { HPX const &m_space; reset_on_exit_parallel(HPX const &space) : m_space(space) {} ~reset_on_exit_parallel() { @@ -471,25 +432,33 @@ class HPX { // data. It does, however, still decrement the parallel region count. It is // meant for use in parallel regions which do not capture the execution space // instance. - struct KOKKOS_ATTRIBUTE_NODISCARD reset_count_on_exit_parallel { - reset_count_on_exit_parallel() {} + struct [[nodiscard]] reset_count_on_exit_parallel { + reset_count_on_exit_parallel() = default; ~reset_count_on_exit_parallel() { HPX::impl_decrement_active_parallel_region_count(); } }; #else - struct KOKKOS_ATTRIBUTE_NODISCARD reset_on_exit_parallel { - reset_on_exit_parallel(HPX const &) {} - ~reset_on_exit_parallel() {} + struct [[nodiscard]] reset_on_exit_parallel { + reset_on_exit_parallel(HPX const &) = default; + ~reset_on_exit_parallel() = default; }; - struct KOKKOS_ATTRIBUTE_NODISCARD reset_count_on_exit_parallel { - reset_count_on_exit_parallel() {} - ~reset_count_on_exit_parallel() {} + struct [[nodiscard]] reset_count_on_exit_parallel { + reset_count_on_exit_parallel() = default; + ~reset_count_on_exit_parallel() = default; }; #endif static constexpr const char *name() noexcept { return "HPX"; } + + private: + friend bool operator==(HPX const &lhs, HPX const &rhs) { + return lhs.m_instance_id == rhs.m_instance_id; + } + friend bool operator!=(HPX const &lhs, HPX const &rhs) { + return !(lhs == rhs); + } }; } // namespace Experimental @@ -652,6 +621,7 @@ struct HPXTeamMember { using execution_space = Kokkos::Experimental::HPX; using scratch_memory_space = Kokkos::ScratchMemorySpace<Kokkos::Experimental::HPX>; + using team_handle = HPXTeamMember; private: scratch_memory_space m_team_shared; @@ -1095,17 +1065,16 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, typename Kokkos::Impl::HostIterateTile<MDRangePolicy, FunctorType, WorkTag, void>; - const FunctorType m_functor; - const MDRangePolicy m_mdr_policy; + const iterate_type m_iter; const Policy m_policy; public: - void execute() const { dispatch_execute_task(this, m_mdr_policy.space()); } + void execute() const { dispatch_execute_task(this, m_iter.m_rp.space()); } inline void execute_task() const { // See [note 1] for an explanation. Kokkos::Experimental::HPX::reset_on_exit_parallel reset_on_exit( - m_mdr_policy.space()); + m_iter.m_rp.space()); auto exec = Kokkos::Experimental::HPX::impl_get_executor(); @@ -1117,9 +1086,8 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, for_loop(par.on(exec).with( static_chunk_size(get_hpx_adjusted_chunk_size(m_policy))), - m_policy.begin(), m_policy.end(), [this](const Member i) { - iterate_type(m_mdr_policy, m_functor)(i); - }); + m_policy.begin(), m_policy.end(), + [this](const Member i) { iterate_type(i); }); #elif KOKKOS_HPX_IMPLEMENTATION == 1 using hpx::for_loop_strided; @@ -1131,15 +1099,14 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, const Member i_end = (std::min)(i_begin + chunk_size, m_policy.end()); for (Member i = i_begin; i < i_end; ++i) { - iterate_type(m_mdr_policy, m_functor)(i); + m_iter(i); } }); #endif } inline ParallelFor(const FunctorType &arg_functor, MDRangePolicy arg_policy) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), + : m_iter(arg_policy, arg_functor), m_policy(Policy(0, arg_policy.m_num_tiles).set_chunk_size(1)) {} template <typename Policy, typename Functor> static int max_tile_size_product(const Policy &, const Functor &) { @@ -1436,8 +1403,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, typename Kokkos::Impl::HostIterateTile<MDRangePolicy, FunctorType, WorkTag, reference_type>; - const FunctorType m_functor; - const MDRangePolicy m_mdr_policy; + const iterate_type m_iter; const Policy m_policy; const ReducerType m_reducer; const pointer_type m_result_ptr; @@ -1446,19 +1412,19 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, public: void execute() const { - dispatch_execute_task(this, m_mdr_policy.space(), m_force_synchronous); + dispatch_execute_task(this, m_iter.m_rp.space(), m_force_synchronous); } inline void execute_task() const { // See [note 1] for an explanation. Kokkos::Experimental::HPX::reset_on_exit_parallel reset_on_exit( - m_mdr_policy.space()); + m_iter.m_rp.space()); const int num_worker_threads = Kokkos::Experimental::HPX::concurrency(); - const std::size_t value_size = - Analysis::value_size(ReducerConditional::select(m_functor, m_reducer)); + const std::size_t value_size = Analysis::value_size( + ReducerConditional::select(m_iter.m_func, m_reducer)); - thread_buffer &buffer = m_mdr_policy.space().impl_get_buffer(); + thread_buffer &buffer = m_iter.m_rp.space().impl_get_buffer(); buffer.resize(num_worker_threads, value_size); using hpx::for_loop; @@ -1468,7 +1434,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, auto exec = Kokkos::Experimental::HPX::impl_get_executor(); typename Analysis::Reducer final_reducer( - &ReducerConditional::select(m_functor, m_reducer)); + &ReducerConditional::select(m_iter.m_func, m_reducer)); #if KOKKOS_HPX_IMPLEMENTATION == 0 @@ -1484,7 +1450,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, reference_type update = Analysis::Reducer::reference( reinterpret_cast<pointer_type>(buffer.get( Kokkos::Experimental::HPX::impl_hardware_thread_id()))); - iterate_type(m_mdr_policy, m_functor, update)(i); + m_iter(i, update); }); #elif KOKKOS_HPX_IMPLEMENTATION == 1 @@ -1507,7 +1473,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, const Member i_end = (std::min)(i_begin + chunk_size, m_policy.end()); for (Member i = i_begin; i < i_end; ++i) { - iterate_type(m_mdr_policy, m_functor, update)(i); + m_iter(i, update); } }); #endif @@ -1521,7 +1487,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, if (m_result_ptr != nullptr) { const int n = Analysis::value_count( - ReducerConditional::select(m_functor, m_reducer)); + ReducerConditional::select(m_iter.m_func, m_reducer)); for (int j = 0; j < n; ++j) { m_result_ptr[j] = reinterpret_cast<pointer_type>(buffer.get(0))[j]; @@ -1536,8 +1502,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, std::enable_if_t<Kokkos::is_view<ViewType>::value && !Kokkos::is_reducer<ReducerType>::value, void *> = nullptr) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), + : m_iter(arg_policy, arg_functor), m_policy(Policy(0, arg_policy.m_num_tiles).set_chunk_size(1)), m_reducer(InvalidType()), m_result_ptr(arg_view.data()), @@ -1545,9 +1510,8 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, inline ParallelReduce(const FunctorType &arg_functor, MDRangePolicy arg_policy, const ReducerType &reducer) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), + : m_iter(arg_policy, arg_functor), + m_policy(Policy(0, arg_policy.m_num_tiles).set_chunk_size(1)), m_reducer(reducer), m_result_ptr(reducer.view().data()), m_force_synchronous(!reducer.view().impl_track().has_record()) {} @@ -1693,7 +1657,7 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, const FunctorType m_functor; const Policy m_policy; - ReturnType &m_returnvalue; + pointer_type m_result_ptr; template <class TagType> inline static std::enable_if_t<std::is_void<TagType>::value> @@ -1783,17 +1747,23 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, update_base, true); if (t == num_worker_threads - 1) { - m_returnvalue = update_base; + *m_result_ptr = update_base; } }); } - inline ParallelScanWithTotal(const FunctorType &arg_functor, - const Policy &arg_policy, - ReturnType &arg_returnvalue) + template <class ViewType> + ParallelScanWithTotal(const FunctorType &arg_functor, + const Policy &arg_policy, + const ViewType &arg_result_view) : m_functor(arg_functor), m_policy(arg_policy), - m_returnvalue(arg_returnvalue) {} + m_result_ptr(arg_result_view.data()) { + static_assert( + Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space, + Kokkos::HostSpace>::accessible, + "Kokkos::HPX parallel_scan result must be host-accessible!"); + } }; } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/Kokkos_Half.hpp b/packages/kokkos/core/src/Kokkos_Half.hpp index c1085876c51f2ed5ee54da1caa81a88bce27195a..9231fac5ff72f740f7a8362d8938b3d7c3d0efa5 100644 --- a/packages/kokkos/core/src/Kokkos_Half.hpp +++ b/packages/kokkos/core/src/Kokkos_Half.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HALF_HPP_ #define KOKKOS_HALF_HPP_ diff --git a/packages/kokkos/core/src/Kokkos_HostSpace.hpp b/packages/kokkos/core/src/Kokkos_HostSpace.hpp index 1d67e2f9cd2081e701ef44a893739cc739cf0823..4b839aca0568931f8d1fafc705ea7fad8de67c4b 100644 --- a/packages/kokkos/core/src/Kokkos_HostSpace.hpp +++ b/packages/kokkos/core/src/Kokkos_HostSpace.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_HOSTSPACE_HPP #define KOKKOS_HOSTSPACE_HPP @@ -253,12 +221,7 @@ class SharedAllocationRecord<Kokkos::HostSpace, void> const Kokkos::HostSpace m_space; protected: - ~SharedAllocationRecord() -#if defined( \ - KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION) - noexcept -#endif - ; + ~SharedAllocationRecord(); SharedAllocationRecord() = default; // This constructor does not forward to the one without exec_space arg diff --git a/packages/kokkos/core/src/Kokkos_Layout.hpp b/packages/kokkos/core/src/Kokkos_Layout.hpp index 78173c083e6300e3b3aa533038bef54f2ca8947f..ca4d956784c914ac049d64576996e7f69fbd0e6b 100644 --- a/packages/kokkos/core/src/Kokkos_Layout.hpp +++ b/packages/kokkos/core/src/Kokkos_Layout.hpp @@ -1,58 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_Layout.hpp /// \brief Declaration of various \c MemoryLayout options. #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_LAYOUT_HPP #define KOKKOS_LAYOUT_HPP diff --git a/packages/kokkos/core/src/Kokkos_LogicalSpaces.hpp b/packages/kokkos/core/src/Kokkos_LogicalSpaces.hpp index d3ce354c2a61a20fd511ab0d569533feb2ea5565..1ee1d2c81fe58a04308fb488afe3f8f19fd7da89 100644 --- a/packages/kokkos/core/src/Kokkos_LogicalSpaces.hpp +++ b/packages/kokkos/core/src/Kokkos_LogicalSpaces.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_LOGICALSPACES_HPP #define KOKKOS_LOGICALSPACES_HPP diff --git a/packages/kokkos/core/src/Kokkos_Macros.hpp b/packages/kokkos/core/src/Kokkos_Macros.hpp index 9dbd2de0c80b56eb67ac4c23eda2796d60a1d954..289bfd7ddaebe9aa246d49f1db15e55b3a0e0a69 100644 --- a/packages/kokkos/core/src/Kokkos_Macros.hpp +++ b/packages/kokkos/core/src/Kokkos_Macros.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_MACROS_HPP #define KOKKOS_MACROS_HPP @@ -54,13 +26,33 @@ * KOKKOS_ENABLE_OPENMP Kokkos::OpenMP execution space * KOKKOS_ENABLE_OPENMPTARGET Kokkos::Experimental::OpenMPTarget * execution space - * KOKKOS_ENABLE_HIP Kokkos::Experimental::HIP execution space + * KOKKOS_ENABLE_HIP Kokkos::HIP execution space * KOKKOS_ENABLE_SYCL Kokkos::Experimental::SYCL execution space * KOKKOS_ENABLE_HWLOC HWLOC library is available. * KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK Insert array bounds checks, is expensive! * KOKKOS_ENABLE_CUDA_UVM Use CUDA UVM for Cuda memory space. */ +#define KOKKOS_VERSION_LESS(MAJOR, MINOR, PATCH) \ + (KOKKOS_VERSION < ((MAJOR)*10000 + (MINOR)*100 + (PATCH))) + +#define KOKKOS_VERSION_LESS_EQUAL(MAJOR, MINOR, PATCH) \ + (KOKKOS_VERSION <= ((MAJOR)*10000 + (MINOR)*100 + (PATCH))) + +#define KOKKOS_VERSION_GREATER(MAJOR, MINOR, PATCH) \ + (KOKKOS_VERSION > ((MAJOR)*10000 + (MINOR)*100 + (PATCH))) + +#define KOKKOS_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH) \ + (KOKKOS_VERSION >= ((MAJOR)*10000 + (MINOR)*100 + (PATCH))) + +#define KOKKOS_VERSION_EQUAL(MAJOR, MINOR, PATCH) \ + (KOKKOS_VERSION == ((MAJOR)*10000 + (MINOR)*100 + (PATCH))) + +#if !KOKKOS_VERSION_EQUAL(KOKKOS_VERSION_MAJOR, KOKKOS_VERSION_MINOR, \ + KOKKOS_VERSION_PATCH) +#error implementation bug +#endif + #ifndef KOKKOS_DONT_INCLUDE_CORE_CONFIG_H #include <KokkosCore_config.h> #endif @@ -73,11 +65,10 @@ * KOKKOS_COMPILER_NVCC * KOKKOS_COMPILER_GNU * KOKKOS_COMPILER_INTEL - * KOKKOS_COMPILER_IBM * KOKKOS_COMPILER_CRAYC * KOKKOS_COMPILER_APPLECC * KOKKOS_COMPILER_CLANG - * KOKKOS_COMPILER_PGI + * KOKKOS_COMPILER_NVHPC * KOKKOS_COMPILER_MSVC * * Macros for which compiler extension to use for atomics on intrinsic types @@ -117,15 +108,18 @@ // Code is parsed and separated into host and device code. // Host code is compiled again with another compiler. // Device code is compile to 'ptx'. -#define KOKKOS_COMPILER_NVCC __NVCC__ +// NOTE: There is no __CUDACC_VER_PATCH__ officially, its __CUDACC_VER_BUILD__ +// which does have more than one digit (potentially undefined number of them). +// This macro definition is in line with our other compiler defs +#define KOKKOS_COMPILER_NVCC \ + __CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__ * 10 #endif // #if defined( __NVCC__ ) #if !defined(KOKKOS_LAMBDA) #define KOKKOS_LAMBDA [=] #endif -#if (defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20)) && \ - !defined(KOKKOS_CLASS_LAMBDA) +#if !defined(KOKKOS_CLASS_LAMBDA) #define KOKKOS_CLASS_LAMBDA [ =, *this ] #endif @@ -150,21 +144,11 @@ #define KOKKOS_COMPILER_CRAYC _CRAYC #endif -#if defined(__IBMCPP__) -// IBM C++ -#define KOKKOS_COMPILER_IBM __IBMCPP__ -#elif defined(__IBMC__) -#define KOKKOS_COMPILER_IBM __IBMC__ -#elif defined(__ibmxl_vrm__) // xlclang++ -#define KOKKOS_COMPILER_IBM __ibmxl_vrm__ -#endif - #if defined(__APPLE_CC__) #define KOKKOS_COMPILER_APPLECC __APPLE_CC__ #endif -#if defined(__clang__) && !defined(KOKKOS_COMPILER_INTEL) && \ - !defined(KOKKOS_COMPILER_IBM) +#if defined(__clang__) && !defined(KOKKOS_COMPILER_INTEL) #define KOKKOS_COMPILER_CLANG \ __clang_major__ * 100 + __clang_minor__ * 10 + __clang_patchlevel__ #endif @@ -178,15 +162,6 @@ #endif #endif -#if defined(__PGIC__) -#define KOKKOS_COMPILER_PGI \ - __PGIC__ * 100 + __PGIC_MINOR__ * 10 + __PGIC_PATCHLEVEL__ - -#if (1740 > KOKKOS_COMPILER_PGI) -#error "Compiling with PGI version earlier than 17.4 is not supported." -#endif -#endif - #if defined(__NVCOMPILER) #define KOKKOS_COMPILER_NVHPC \ __NVCOMPILER_MAJOR__ * 100 + __NVCOMPILER_MINOR__ * 10 + \ @@ -204,16 +179,6 @@ // of the supported OpenMP API version. #endif // #if defined( _OPENMP ) -#if defined(KOKKOS_ENABLE_CXX17) -#define KOKKOS_IMPL_FALLTHROUGH [[fallthrough]]; -#elif defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 710) -#define KOKKOS_IMPL_FALLTHROUGH [[gnu::fallthrough]]; -#elif defined(KOKKOS_COMPILER_CLANG) -#define KOKKOS_IMPL_FALLTHROUGH [[clang::fallthrough]]; -#else -#define KOKKOS_IMPL_FALLTHROUGH -#endif - //---------------------------------------------------------------------------- // Intel compiler macros @@ -224,14 +189,6 @@ #define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1 #define KOKKOS_ENABLE_PRAGMA_VECTOR 1 #endif -#if (1800 > KOKKOS_COMPILER_INTEL) -#define KOKKOS_ENABLE_PRAGMA_SIMD 1 -#endif - -// FIXME Workaround for ICE with intel 17,18,19,20,21 in Trilinos -#if (KOKKOS_COMPILER_INTEL <= 2100) -#define KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS -#endif // FIXME_SYCL #if !defined(KOKKOS_ENABLE_SYCL) @@ -256,8 +213,8 @@ #endif #endif -#if (1700 > KOKKOS_COMPILER_INTEL) -#error "Compiling with Intel version earlier than 17.0 is not supported." +#if (1900 > KOKKOS_COMPILER_INTEL) +#error "Compiling with Intel version earlier than 19.0.5 is not supported." #endif #if !defined(KOKKOS_ENABLE_ASM) && !defined(_WIN32) @@ -276,13 +233,6 @@ #if defined(KOKKOS_ARCH_AVX512MIC) #define KOKKOS_ENABLE_RFO_PREFETCH 1 -#if (KOKKOS_COMPILER_INTEL < 1800) && !defined(KOKKOS_KNL_USE_ASM_WORKAROUND) -#define KOKKOS_KNL_USE_ASM_WORKAROUND 1 -#endif -#endif - -#if (1800 > KOKKOS_COMPILER_INTEL) -#define KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION #endif #if defined(__MIC__) @@ -296,21 +246,6 @@ #if defined(KOKKOS_COMPILER_CRAYC) #endif -//---------------------------------------------------------------------------- -// IBM Compiler macros - -#if defined(KOKKOS_COMPILER_IBM) -#define KOKKOS_ENABLE_PRAGMA_UNROLL 1 -//#define KOKKOS_ENABLE_PRAGMA_IVDEP 1 -//#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1 -//#define KOKKOS_ENABLE_PRAGMA_VECTOR 1 -//#define KOKKOS_ENABLE_PRAGMA_SIMD 1 - -#if !defined(KOKKOS_ENABLE_ASM) -#define KOKKOS_ENABLE_ASM 1 -#endif -#endif - //---------------------------------------------------------------------------- // CLANG compiler macros @@ -319,7 +254,6 @@ //#define KOKKOS_ENABLE_PRAGMA_IVDEP 1 //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1 //#define KOKKOS_ENABLE_PRAGMA_VECTOR 1 -//#define KOKKOS_ENABLE_PRAGMA_SIMD 1 #if !defined(KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION) #define KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION \ @@ -341,7 +275,6 @@ //#define KOKKOS_ENABLE_PRAGMA_IVDEP 1 //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1 //#define KOKKOS_ENABLE_PRAGMA_VECTOR 1 -//#define KOKKOS_ENABLE_PRAGMA_SIMD 1 #if defined(KOKKOS_ARCH_AVX512MIC) #define KOKKOS_ENABLE_RFO_PREFETCH 1 @@ -369,7 +302,6 @@ #define KOKKOS_ENABLE_PRAGMA_IVDEP 1 //#define KOKKOS_ENABLE_PRAGMA_LOOPCOUNT 1 #define KOKKOS_ENABLE_PRAGMA_VECTOR 1 -//#define KOKKOS_ENABLE_PRAGMA_SIMD 1 #endif //---------------------------------------------------------------------------- @@ -408,11 +340,11 @@ #endif #if !defined(KOKKOS_INLINE_FUNCTION_DELETED) -#define KOKKOS_INLINE_FUNCTION_DELETED inline +#define KOKKOS_INLINE_FUNCTION_DELETED #endif #if !defined(KOKKOS_DEFAULTED_FUNCTION) -#define KOKKOS_DEFAULTED_FUNCTION inline +#define KOKKOS_DEFAULTED_FUNCTION #endif #if !defined(KOKKOS_IMPL_HOST_FUNCTION) @@ -476,6 +408,7 @@ #if 1 < ((defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA) ? 1 : 0) + \ (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP) ? 1 : 0) + \ (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL) ? 1 : 0) + \ + (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC) ? 1 : 0) + \ (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET) ? 1 : 0) + \ (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP) ? 1 : 0) + \ (defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS) ? 1 : 0) + \ @@ -485,10 +418,12 @@ #endif // If default is not specified then chose from enabled execution spaces. -// Priority: CUDA, HIP, SYCL, OPENMPTARGET, OPENMP, THREADS, HPX, SERIAL +// Priority: CUDA, HIP, SYCL, OPENACC, OPENMPTARGET, OPENMP, THREADS, HPX, +// SERIAL #if defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_CUDA) #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP) #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL) +#elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC) #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET) #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMP) #elif defined(KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_THREADS) @@ -500,6 +435,8 @@ #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_HIP #elif defined(KOKKOS_ENABLE_SYCL) #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SYCL +#elif defined(KOKKOS_ENABLE_OPENACC) +#define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENACC #elif defined(KOKKOS_ENABLE_OPENMPTARGET) #define KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_OPENMPTARGET #elif defined(KOKKOS_ENABLE_OPENMP) @@ -514,6 +451,7 @@ //---------------------------------------------------------------------------- // Determine for what space the code is being compiled: +#if defined(KOKKOS_ENABLE_DEPRECATED_CODE_3) #if defined(__CUDACC__) && defined(__CUDA_ARCH__) && defined(KOKKOS_ENABLE_CUDA) #define KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_CUDA @@ -526,6 +464,7 @@ #define KOKKOS_ACTIVE_EXECUTION_MEMORY_SPACE_HOST #endif +#endif //---------------------------------------------------------------------------- // Remove surrounding parentheses if present @@ -574,6 +513,29 @@ static constexpr bool kokkos_omp_on_host() { return false; } #endif #endif +#ifdef KOKKOS_ENABLE_OPENACC +#ifdef KOKKOS_COMPILER_NVHPC +#define KOKKOS_IF_ON_DEVICE(CODE) \ + if (__builtin_is_device_code()) { \ + KOKKOS_IMPL_STRIP_PARENS(CODE) \ + } +#define KOKKOS_IF_ON_HOST(CODE) \ + if (!__builtin_is_device_code()) { \ + KOKKOS_IMPL_STRIP_PARENS(CODE) \ + } +#else +// FIXME_OPENACC acc_on_device is a non-constexpr function +#define KOKKOS_IF_ON_DEVICE(CODE) \ + if constexpr (acc_on_device(acc_device_not_host)) { \ + KOKKOS_IMPL_STRIP_PARENS(CODE) \ + } +#define KOKKOS_IF_ON_HOST(CODE) \ + if constexpr (acc_on_device(acc_device_host)) { \ + KOKKOS_IMPL_STRIP_PARENS(CODE) \ + } +#endif +#endif + #if !defined(KOKKOS_IF_ON_HOST) && !defined(KOKKOS_IF_ON_DEVICE) #if (defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__)) || \ (defined(KOKKOS_ENABLE_HIP) && defined(__HIP_DEVICE_COMPILE__)) || \ @@ -603,15 +565,14 @@ static constexpr bool kokkos_omp_on_host() { return false; } #define KOKKOS_ENABLE_TASKDAG #endif +#if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_ENABLE_DEPRECATED_CODE_4) +#define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC +#endif + #define KOKKOS_INVALID_INDEX (~std::size_t(0)) #define KOKKOS_IMPL_CTOR_DEFAULT_ARG KOKKOS_INVALID_INDEX -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -#define KOKKOS_CONSTEXPR_14 constexpr -#define KOKKOS_DEPRECATED_TRAILING_ATTRIBUTE -#endif - // Guard intel compiler version 19 and older // intel error #2651: attribute does not apply to any entity // using <deprecated_type> KOKKOS_DEPRECATED = ... @@ -637,23 +598,14 @@ static constexpr bool kokkos_omp_on_host() { return false; } #define KOKKOS_IMPL_WARNING(desc) KOKKOS_IMPL_DO_PRAGMA(message(#desc)) #endif -// DJS 05/28/2019: Bugfix: Issue 2155 -// Use KOKKOS_ENABLE_CUDA_LDG_INTRINSIC to avoid memory leak in RandomAccess -// View -#if defined(KOKKOS_ENABLE_CUDA) && !defined(KOKKOS_ENABLE_CUDA_LDG_INTRINSIC) -#define KOKKOS_ENABLE_CUDA_LDG_INTRINSIC -#endif - -#if defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20) #define KOKKOS_ATTRIBUTE_NODISCARD [[nodiscard]] -#else -#define KOKKOS_ATTRIBUTE_NODISCARD -#endif #if (defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG) || \ defined(KOKKOS_COMPILER_INTEL) || defined(KOKKOS_COMPILER_PGI)) && \ - !defined(_WIN32) + !defined(_WIN32) && !defined(__ANDROID__) +#if __has_include(<execinfo.h>) #define KOKKOS_IMPL_ENABLE_STACKTRACE +#endif #define KOKKOS_IMPL_ENABLE_CXXABI #endif @@ -664,11 +616,6 @@ static constexpr bool kokkos_omp_on_host() { return false; } #undef __CUDA_ARCH__ #endif -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -#define KOKKOS_THREAD_LOCAL \ - KOKKOS_DEPRECATED_WITH_COMMENT("Use thread_local instead!") thread_local -#endif - #if (defined(KOKKOS_IMPL_WINDOWS_CUDA) || defined(KOKKOS_COMPILER_MSVC)) && \ !defined(KOKKOS_COMPILER_CLANG) // MSVC (as of 16.5.5 at least) does not do empty base class optimization by diff --git a/packages/kokkos/core/src/Kokkos_MasterLock.hpp b/packages/kokkos/core/src/Kokkos_MasterLock.hpp index 5e48595bf0da7d0b1ad3de9d58f714b050961606..1d09617371a62c19f63705e40984646c7584056b 100644 --- a/packages/kokkos/core/src/Kokkos_MasterLock.hpp +++ b/packages/kokkos/core/src/Kokkos_MasterLock.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_MASTER_LOCK_HPP #define KOKKOS_MASTER_LOCK_HPP diff --git a/packages/kokkos/core/src/Kokkos_MathematicalConstants.hpp b/packages/kokkos/core/src/Kokkos_MathematicalConstants.hpp index 8f7b559e786ecdd1841407835c02ffb31e16cdee..51a50d347dee3579ddb1008f1d3cb5cda52650e6 100644 --- a/packages/kokkos/core/src/Kokkos_MathematicalConstants.hpp +++ b/packages/kokkos/core/src/Kokkos_MathematicalConstants.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_MATHEMATICAL_CONSTANTS_HPP #define KOKKOS_MATHEMATICAL_CONSTANTS_HPP #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE @@ -51,20 +23,13 @@ #include <Kokkos_Macros.hpp> #include <type_traits> -namespace Kokkos { -namespace Experimental { +namespace Kokkos::numbers { -#if defined(KOKKOS_ENABLE_CXX17) -#define KOKKOS_IMPL_MATH_CONSTANT(TRAIT, VALUE) \ - template <class T> \ - inline constexpr auto TRAIT##_v = \ - std::enable_if_t<std::is_floating_point_v<T>, T>(VALUE) -#else -#define KOKKOS_IMPL_MATH_CONSTANT(TRAIT, VALUE) \ - template <class T> \ - constexpr auto TRAIT##_v = \ - std::enable_if_t<std::is_floating_point<T>::value, T>(VALUE) -#endif +#define KOKKOS_IMPL_MATH_CONSTANT(TRAIT, VALUE) \ + template <class T> \ + inline constexpr auto TRAIT##_v = \ + std::enable_if_t<std::is_floating_point_v<T>, T>(VALUE); \ + inline constexpr auto TRAIT = TRAIT##_v<double> // clang-format off KOKKOS_IMPL_MATH_CONSTANT(e, 2.718281828459045235360287471352662498L); @@ -84,8 +49,26 @@ KOKKOS_IMPL_MATH_CONSTANT(phi, 1.618033988749894848204586834365638118L); #undef KOKKOS_IMPL_MATH_CONSTANT -} // namespace Experimental -} // namespace Kokkos +} // namespace Kokkos::numbers + +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 +namespace Kokkos::Experimental { +using Kokkos::numbers::e_v; +using Kokkos::numbers::egamma_v; +using Kokkos::numbers::inv_pi_v; +using Kokkos::numbers::inv_sqrt3_v; +using Kokkos::numbers::inv_sqrtpi_v; +using Kokkos::numbers::ln10_v; +using Kokkos::numbers::ln2_v; +using Kokkos::numbers::log10e_v; +using Kokkos::numbers::log2e_v; +using Kokkos::numbers::phi_v; +using Kokkos::numbers::pi_v; +using Kokkos::numbers::sqrt2_v; +using Kokkos::numbers::sqrt3_v; +} // namespace Kokkos::Experimental +#endif + #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_MATHCONSTANTS #undef KOKKOS_IMPL_PUBLIC_INCLUDE #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_MATHCONSTANTS diff --git a/packages/kokkos/core/src/Kokkos_MathematicalFunctions.hpp b/packages/kokkos/core/src/Kokkos_MathematicalFunctions.hpp index 6942f8495877368727fe9d55a063844260cd63d5..5016249edcca8b0952e01a82f55e376773e11ab7 100644 --- a/packages/kokkos/core/src/Kokkos_MathematicalFunctions.hpp +++ b/packages/kokkos/core/src/Kokkos_MathematicalFunctions.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_HPP #define KOKKOS_MATHEMATICAL_FUNCTIONS_HPP @@ -55,13 +27,18 @@ #include <type_traits> #ifdef KOKKOS_ENABLE_SYCL +// FIXME_SYCL +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else #include <CL/sycl.hpp> #endif +#endif namespace Kokkos { namespace Impl { -template <class T, bool = std::is_integral<T>::value> +template <class T, bool = std::is_integral_v<T>> struct promote { using type = double; }; @@ -82,7 +59,7 @@ struct promote<float> { template <class T> using promote_t = typename promote<T>::type; template <class T, class U, - bool = std::is_arithmetic<T>::value&& std::is_arithmetic<U>::value> + bool = std::is_arithmetic_v<T>&& std::is_arithmetic_v<U>> struct promote_2 { using type = decltype(promote_t<T>() + promote_t<U>()); }; @@ -90,6 +67,16 @@ template <class T, class U> struct promote_2<T, U, false> {}; template <class T, class U> using promote_2_t = typename promote_2<T, U>::type; +template <class T, class U, class V, + bool = std::is_arithmetic_v<T>&& std::is_arithmetic_v<U>&& + std::is_arithmetic_v<V>> +struct promote_3 { + using type = decltype(promote_t<T>() + promote_t<U>() + promote_t<V>()); +}; +template <class T, class U, class V> +struct promote_3<T, U, V, false> {}; +template <class T, class U, class V> +using promote_3_t = typename promote_3<T, U, V>::type; } // namespace Impl // NOTE long double overloads are not available on the device @@ -115,132 +102,183 @@ using promote_2_t = typename promote_2<T, U>::type; /* nothing */ #endif -#define KOKKOS_IMPL_MATH_UNARY_FUNCTION(FUNC) \ - KOKKOS_INLINE_FUNCTION float FUNC(float x) { \ - using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(x); \ - } \ - KOKKOS_INLINE_FUNCTION double FUNC(double x) { \ - using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(x); \ - } \ - inline long double FUNC(long double x) { \ - using std::FUNC; \ - return FUNC(x); \ - } \ - KOKKOS_INLINE_FUNCTION float FUNC##f(float x) { \ - using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(x); \ - } \ - inline long double FUNC##l(long double x) { \ - using std::FUNC; \ - return FUNC(x); \ - } \ - template <class T> \ - KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral<T>::value, double> \ - FUNC(T x) { \ - using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(static_cast<double>(x)); \ - } \ - KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED( \ - namespace Experimental { \ - using ::Kokkos::FUNC; \ - using ::Kokkos::FUNC##f; \ - using ::Kokkos::FUNC##l; \ +#define KOKKOS_IMPL_MATH_UNARY_FUNCTION(FUNC) \ + KOKKOS_INLINE_FUNCTION float FUNC(float x) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(x); \ + } \ + KOKKOS_INLINE_FUNCTION double FUNC(double x) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(x); \ + } \ + inline long double FUNC(long double x) { \ + using std::FUNC; \ + return FUNC(x); \ + } \ + KOKKOS_INLINE_FUNCTION float FUNC##f(float x) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(x); \ + } \ + inline long double FUNC##l(long double x) { \ + using std::FUNC; \ + return FUNC(x); \ + } \ + template <class T> \ + KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral_v<T>, double> FUNC( \ + T x) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(static_cast<double>(x)); \ + } \ + KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED( \ + namespace Experimental { \ + using ::Kokkos::FUNC; \ + using ::Kokkos::FUNC##f; \ + using ::Kokkos::FUNC##l; \ }) // isinf, isnan, and isinfinite do not work on Windows with CUDA with std:: // getting warnings about calling host function in device function then // runtime test fails #if defined(_WIN32) && defined(KOKKOS_ENABLE_CUDA) -#define KOKKOS_IMPL_MATH_UNARY_PREDICATE(FUNC) \ - KOKKOS_INLINE_FUNCTION bool FUNC(float x) { return ::FUNC(x); } \ - KOKKOS_INLINE_FUNCTION bool FUNC(double x) { return ::FUNC(x); } \ - inline bool FUNC(long double x) { \ - using std::FUNC; \ - return FUNC(x); \ - } \ - template <class T> \ - KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral<T>::value, bool> \ - FUNC(T x) { \ - return ::FUNC(static_cast<double>(x)); \ - } \ - KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED( \ +#define KOKKOS_IMPL_MATH_UNARY_PREDICATE(FUNC) \ + KOKKOS_INLINE_FUNCTION bool FUNC(float x) { return ::FUNC(x); } \ + KOKKOS_INLINE_FUNCTION bool FUNC(double x) { return ::FUNC(x); } \ + inline bool FUNC(long double x) { \ + using std::FUNC; \ + return FUNC(x); \ + } \ + template <class T> \ + KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral_v<T>, bool> FUNC( \ + T x) { \ + return ::FUNC(static_cast<double>(x)); \ + } \ + KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED( \ namespace Experimental { using ::Kokkos::FUNC; }) #else -#define KOKKOS_IMPL_MATH_UNARY_PREDICATE(FUNC) \ - KOKKOS_INLINE_FUNCTION bool FUNC(float x) { \ +#define KOKKOS_IMPL_MATH_UNARY_PREDICATE(FUNC) \ + KOKKOS_INLINE_FUNCTION bool FUNC(float x) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(x); \ + } \ + KOKKOS_INLINE_FUNCTION bool FUNC(double x) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(x); \ + } \ + inline bool FUNC(long double x) { \ + using std::FUNC; \ + return FUNC(x); \ + } \ + template <class T> \ + KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral_v<T>, bool> FUNC( \ + T x) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(static_cast<double>(x)); \ + } \ + KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED( \ + namespace Experimental { using ::Kokkos::FUNC; }) +#endif + +#define KOKKOS_IMPL_MATH_BINARY_FUNCTION(FUNC) \ + KOKKOS_INLINE_FUNCTION float FUNC(float x, float y) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(x, y); \ + } \ + KOKKOS_INLINE_FUNCTION double FUNC(double x, double y) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(x, y); \ + } \ + inline long double FUNC(long double x, long double y) { \ + using std::FUNC; \ + return FUNC(x, y); \ + } \ + KOKKOS_INLINE_FUNCTION float FUNC##f(float x, float y) { \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(x, y); \ + } \ + inline long double FUNC##l(long double x, long double y) { \ + using std::FUNC; \ + return FUNC(x, y); \ + } \ + template <class T1, class T2> \ + KOKKOS_INLINE_FUNCTION \ + std::enable_if_t<std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2> && \ + !std::is_same_v<T1, long double> && \ + !std::is_same_v<T2, long double>, \ + Kokkos::Impl::promote_2_t<T1, T2>> \ + FUNC(T1 x, T2 y) { \ + using Promoted = Kokkos::Impl::promote_2_t<T1, T2>; \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y)); \ + } \ + template <class T1, class T2> \ + inline std::enable_if_t<std::is_arithmetic_v<T1> && \ + std::is_arithmetic_v<T2> && \ + (std::is_same_v<T1, long double> || \ + std::is_same_v<T2, long double>), \ + long double> \ + FUNC(T1 x, T2 y) { \ + using Promoted = Kokkos::Impl::promote_2_t<T1, T2>; \ + static_assert(std::is_same_v<Promoted, long double>, ""); \ + using std::FUNC; \ + return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y)); \ + } \ + KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED( \ + namespace Experimental { \ + using ::Kokkos::FUNC; \ + using ::Kokkos::FUNC##f; \ + using ::Kokkos::FUNC##l; \ + }) + +#define KOKKOS_IMPL_MATH_TERNARY_FUNCTION(FUNC) \ + KOKKOS_INLINE_FUNCTION float FUNC(float x, float y, float z) { \ using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(x); \ + return FUNC(x, y, z); \ } \ - KOKKOS_INLINE_FUNCTION bool FUNC(double x) { \ + KOKKOS_INLINE_FUNCTION double FUNC(double x, double y, double z) { \ using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(x); \ + return FUNC(x, y, z); \ } \ - inline bool FUNC(long double x) { \ + inline long double FUNC(long double x, long double y, long double z) { \ using std::FUNC; \ - return FUNC(x); \ + return FUNC(x, y, z); \ } \ - template <class T> \ - KOKKOS_INLINE_FUNCTION std::enable_if_t<std::is_integral<T>::value, bool> \ - FUNC(T x) { \ + KOKKOS_INLINE_FUNCTION float FUNC##f(float x, float y, float z) { \ using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(static_cast<double>(x)); \ + return FUNC(x, y, z); \ } \ - KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED( \ - namespace Experimental { using ::Kokkos::FUNC; }) -#endif + inline long double FUNC##l(long double x, long double y, long double z) { \ + using std::FUNC; \ + return FUNC(x, y, z); \ + } \ + template <class T1, class T2, class T3> \ + KOKKOS_INLINE_FUNCTION std::enable_if_t< \ + std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2> && \ + std::is_arithmetic_v<T3> && !std::is_same_v<T1, long double> && \ + !std::is_same_v<T2, long double> && \ + !std::is_same_v<T3, long double>, \ + Kokkos::Impl::promote_3_t<T1, T2, T3>> \ + FUNC(T1 x, T2 y, T3 z) { \ + using Promoted = Kokkos::Impl::promote_3_t<T1, T2, T3>; \ + using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ + return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y), \ + static_cast<Promoted>(z)); \ + } \ + template <class T1, class T2, class T3> \ + inline std::enable_if_t<std::is_arithmetic_v<T1> && \ + std::is_arithmetic_v<T2> && \ + std::is_arithmetic_v<T3> && \ + (std::is_same_v<T1, long double> || \ + std::is_same_v<T2, long double> || \ + std::is_same_v<T3, long double>), \ + long double> \ + FUNC(T1 x, T2 y, T3 z) { \ + using Promoted = Kokkos::Impl::promote_3_t<T1, T2, T3>; \ + static_assert(std::is_same_v<Promoted, long double>); \ + using std::FUNC; \ + return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y), \ + static_cast<Promoted>(z)); \ + } -#define KOKKOS_IMPL_MATH_BINARY_FUNCTION(FUNC) \ - KOKKOS_INLINE_FUNCTION float FUNC(float x, float y) { \ - using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(x, y); \ - } \ - KOKKOS_INLINE_FUNCTION double FUNC(double x, double y) { \ - using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(x, y); \ - } \ - inline long double FUNC(long double x, long double y) { \ - using std::FUNC; \ - return FUNC(x, y); \ - } \ - KOKKOS_INLINE_FUNCTION float FUNC##f(float x, float y) { \ - using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(x, y); \ - } \ - inline long double FUNC##l(long double x, long double y) { \ - using std::FUNC; \ - return FUNC(x, y); \ - } \ - template <class T1, class T2> \ - KOKKOS_INLINE_FUNCTION std::enable_if_t< \ - std::is_arithmetic<T1>::value && std::is_arithmetic<T2>::value && \ - !std::is_same<T1, long double>::value && \ - !std::is_same<T2, long double>::value, \ - Kokkos::Impl::promote_2_t<T1, T2>> \ - FUNC(T1 x, T2 y) { \ - using Promoted = Kokkos::Impl::promote_2_t<T1, T2>; \ - using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::FUNC; \ - return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y)); \ - } \ - template <class T1, class T2> \ - inline std::enable_if_t<std::is_arithmetic<T1>::value && \ - std::is_arithmetic<T2>::value && \ - (std::is_same<T1, long double>::value || \ - std::is_same<T2, long double>::value), \ - long double> \ - FUNC(T1 x, T2 y) { \ - using Promoted = Kokkos::Impl::promote_2_t<T1, T2>; \ - static_assert(std::is_same<Promoted, long double>::value, ""); \ - using std::FUNC; \ - return FUNC(static_cast<Promoted>(x), static_cast<Promoted>(y)); \ - } \ - KOKKOS_IMPL_MATH_FUNCTIONS_DEFINED_IF_DEPRECATED_CODE_ENABLED( \ - namespace Experimental { \ - using ::Kokkos::FUNC; \ - using ::Kokkos::FUNC##f; \ - using ::Kokkos::FUNC##l; \ - }) // Basic operations KOKKOS_INLINE_FUNCTION int abs(int n) { using KOKKOS_IMPL_MATH_FUNCTIONS_NAMESPACE::abs; @@ -282,7 +320,7 @@ KOKKOS_IMPL_MATH_UNARY_FUNCTION(fabs) KOKKOS_IMPL_MATH_BINARY_FUNCTION(fmod) KOKKOS_IMPL_MATH_BINARY_FUNCTION(remainder) // remquo -// fma +KOKKOS_IMPL_MATH_TERNARY_FUNCTION(fma) KOKKOS_IMPL_MATH_BINARY_FUNCTION(fmax) KOKKOS_IMPL_MATH_BINARY_FUNCTION(fmin) KOKKOS_IMPL_MATH_BINARY_FUNCTION(fdim) @@ -338,6 +376,49 @@ KOKKOS_IMPL_MATH_BINARY_FUNCTION(pow) KOKKOS_IMPL_MATH_UNARY_FUNCTION(sqrt) KOKKOS_IMPL_MATH_UNARY_FUNCTION(cbrt) KOKKOS_IMPL_MATH_BINARY_FUNCTION(hypot) +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ + defined(KOKKOS_ENABLE_SYCL) +KOKKOS_INLINE_FUNCTION float hypot(float x, float y, float z) { + return sqrt(x * x + y * y + z * z); +} +KOKKOS_INLINE_FUNCTION double hypot(double x, double y, double z) { + return sqrt(x * x + y * y + z * z); +} +inline long double hypot(long double x, long double y, long double z) { + return sqrt(x * x + y * y + z * z); +} +KOKKOS_INLINE_FUNCTION float hypotf(float x, float y, float z) { + return sqrt(x * x + y * y + z * z); +} +inline long double hypotl(long double x, long double y, long double z) { + return sqrt(x * x + y * y + z * z); +} +template < + class T1, class T2, class T3, + class Promoted = std::enable_if_t< + std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2> && + std::is_arithmetic_v<T3> && !std::is_same_v<T1, long double> && + !std::is_same_v<T2, long double> && + !std::is_same_v<T3, long double>, + Impl::promote_3_t<T1, T2, T3>>> +KOKKOS_INLINE_FUNCTION Promoted hypot(T1 x, T2 y, T3 z) { + return hypot(static_cast<Promoted>(x), static_cast<Promoted>(y), + static_cast<Promoted>(z)); +} +template < + class T1, class T2, class T3, + class = std::enable_if_t< + std::is_arithmetic_v<T1> && std::is_arithmetic_v<T2> && + std::is_arithmetic_v<T3> && + (std::is_same_v<T1, long double> || std::is_same_v<T2, long double> || + std::is_same_v<T3, long double>)>> +inline long double hypot(T1 x, T2 y, T3 z) { + return hypot(static_cast<long double>(x), static_cast<long double>(y), + static_cast<long double>(z)); +} +#else +KOKKOS_IMPL_MATH_TERNARY_FUNCTION(hypot) +#endif // Trigonometric functions KOKKOS_IMPL_MATH_UNARY_FUNCTION(sin) KOKKOS_IMPL_MATH_UNARY_FUNCTION(cos) @@ -402,6 +483,7 @@ KOKKOS_IMPL_MATH_UNARY_PREDICATE(signbit) #undef KOKKOS_IMPL_MATH_UNARY_FUNCTION #undef KOKKOS_IMPL_MATH_UNARY_PREDICATE #undef KOKKOS_IMPL_MATH_BINARY_FUNCTION +#undef KOKKOS_IMPL_MATH_TERNARY_FUNCTION } // namespace Kokkos diff --git a/packages/kokkos/core/src/Kokkos_MathematicalSpecialFunctions.hpp b/packages/kokkos/core/src/Kokkos_MathematicalSpecialFunctions.hpp index 07da1dbd7e4965b231242a0359d8baa05ade98da..63c2b58ef59ad00031be9d69c12cab303ec0ad17 100644 --- a/packages/kokkos/core/src/Kokkos_MathematicalSpecialFunctions.hpp +++ b/packages/kokkos/core/src/Kokkos_MathematicalSpecialFunctions.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_MATHEMATICAL_SPECIAL_FUNCTIONS_HPP #define KOKKOS_MATHEMATICAL_SPECIAL_FUNCTIONS_HPP @@ -124,20 +96,21 @@ KOKKOS_INLINE_FUNCTION Kokkos::complex<RealType> erf( using Kokkos::exp; using Kokkos::fabs; using Kokkos::sin; - using Kokkos::Experimental::epsilon; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::epsilon_v; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::pi_v; using CmplxType = Kokkos::complex<RealType>; - constexpr auto inf = infinity<RealType>::value; - constexpr auto tol = epsilon<RealType>::value; + constexpr auto inf = infinity_v<RealType>; + constexpr auto tol = epsilon_v<RealType>; const RealType fnorm = 1.12837916709551; const RealType gnorm = 0.564189583547756; const RealType eh = 0.606530659712633; const RealType ef = 0.778800783071405; // const RealType tol = 1.0e-13; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; CmplxType cans; @@ -302,20 +275,22 @@ KOKKOS_INLINE_FUNCTION Kokkos::complex<RealType> erfcx( using Kokkos::fabs; using Kokkos::isinf; using Kokkos::sin; - using Kokkos::Experimental::epsilon; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::epsilon_v; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::inv_sqrtpi_v; + using Kokkos::numbers::pi_v; using CmplxType = Kokkos::complex<RealType>; - constexpr auto inf = infinity<RealType>::value; - constexpr auto tol = epsilon<RealType>::value; + constexpr auto inf = infinity_v<RealType>; + constexpr auto tol = epsilon_v<RealType>; const RealType fnorm = 1.12837916709551; - constexpr auto gnorm = Kokkos::Experimental::inv_sqrtpi_v<RealType>; + constexpr auto gnorm = inv_sqrtpi_v<RealType>; const RealType eh = 0.606530659712633; const RealType ef = 0.778800783071405; // const RealType tol = 1.0e-13; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; CmplxType cans; @@ -492,9 +467,10 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_j0(const CmplxType& z, // Output: cbj0 --- J0(z) using Kokkos::fabs; using Kokkos::pow; + using Kokkos::numbers::pi_v; CmplxType cbj0; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; const RealType a[12] = { -0.703125e-01, 0.112152099609375e+00, -0.5725014209747314e+00, 0.6074042001273483e+01, -0.1100171402692467e+03, 0.3038090510922384e+04, @@ -580,13 +556,15 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_y0(const CmplxType& z, // Output: cby0 --- Y0(z) using Kokkos::fabs; using Kokkos::pow; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::egamma_v; + using Kokkos::numbers::pi_v; - constexpr auto inf = infinity<RealType>::value; + constexpr auto inf = infinity_v<RealType>; CmplxType cby0, cbj0; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; - constexpr auto el = Kokkos::Experimental::egamma_v<RealType>; + constexpr auto pi = pi_v<RealType>; + constexpr auto el = egamma_v<RealType>; const RealType a[12] = { -0.703125e-01, 0.112152099609375e+00, -0.5725014209747314e+00, 0.6074042001273483e+01, -0.1100171402692467e+03, 0.3038090510922384e+04, @@ -681,9 +659,10 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_j1(const CmplxType& z, // Output: cbj1 --- J1(z) using Kokkos::fabs; using Kokkos::pow; + using Kokkos::numbers::pi_v; CmplxType cbj1; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; const RealType a1[12] = {0.1171875e+00, -0.144195556640625e+00, 0.6765925884246826e+00, -0.6883914268109947e+01, 0.1215978918765359e+03, -0.3302272294480852e+04, @@ -773,13 +752,15 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_y1(const CmplxType& z, // Output: cby1 --- Y1(z) using Kokkos::fabs; using Kokkos::pow; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::egamma_v; + using Kokkos::numbers::pi_v; - constexpr auto inf = infinity<RealType>::value; + constexpr auto inf = infinity_v<RealType>; CmplxType cby1, cbj0, cbj1, cby0; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; - constexpr auto el = Kokkos::Experimental::egamma_v<RealType>; + constexpr auto pi = pi_v<RealType>; + constexpr auto el = egamma_v<RealType>; const RealType a1[12] = {0.1171875e+00, -0.144195556640625e+00, 0.6765925884246826e+00, -0.6883914268109947e+01, 0.1215978918765359e+03, -0.3302272294480852e+04, @@ -875,8 +856,10 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_i0(const CmplxType& z, // argument regions // bw_start --- Starting point for backward recurrence // Output: cbi0 --- I0(z) + using Kokkos::numbers::pi_v; + CmplxType cbi0; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; const RealType a[12] = {0.125, 7.03125e-2, 7.32421875e-2, @@ -948,13 +931,15 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_k0(const CmplxType& z, // bw_start --- Starting point for backward recurrence // Output: cbk0 --- K0(z) using Kokkos::pow; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::egamma_v; + using Kokkos::numbers::pi_v; - constexpr auto inf = infinity<RealType>::value; + constexpr auto inf = infinity_v<RealType>; CmplxType cbk0, cbi0; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; - constexpr auto el = Kokkos::Experimental::egamma_v<RealType>; + constexpr auto pi = pi_v<RealType>; + constexpr auto el = egamma_v<RealType>; RealType a0 = Kokkos::abs(z); CmplxType ci = CmplxType(0.0, 1.0); @@ -1020,8 +1005,10 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_i1(const CmplxType& z, // argument regions // bw_start --- Starting point for backward recurrence // Output: cbi1 --- I1(z) + using Kokkos::numbers::pi_v; + CmplxType cbi1; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; const RealType b[12] = {-0.375, -1.171875e-1, -1.025390625e-1, @@ -1094,13 +1081,15 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_k1(const CmplxType& z, // bw_start --- Starting point for backward recurrence // Output: cbk1 --- K1(z) using Kokkos::pow; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::egamma_v; + using Kokkos::numbers::pi_v; - constexpr auto inf = infinity<RealType>::value; + constexpr auto inf = infinity_v<RealType>; CmplxType cbk0, cbi0, cbk1, cbi1; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; - constexpr auto el = Kokkos::Experimental::egamma_v<RealType>; + constexpr auto pi = pi_v<RealType>; + constexpr auto el = egamma_v<RealType>; RealType a0 = Kokkos::abs(z); CmplxType ci = CmplxType(0.0, 1.0); @@ -1163,12 +1152,13 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_h10(const CmplxType& z) { // programs CH12N in S. Zhang & J. Jin "Computation of Special Functions" //(Wiley, 1996). using RealType = typename CmplxType::value_type; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::pi_v; - constexpr auto inf = infinity<RealType>::value; + constexpr auto inf = infinity_v<RealType>; CmplxType ch10, cbk0, cbj0, cby0; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; CmplxType ci = CmplxType(0.0, 1.0); if ((z.real() == 0.0) && (z.imag() == 0.0)) { @@ -1193,12 +1183,13 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_h11(const CmplxType& z) { // programs CH12N in S. Zhang & J. Jin "Computation of Special Functions" //(Wiley, 1996). using RealType = typename CmplxType::value_type; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::pi_v; - constexpr auto inf = infinity<RealType>::value; + constexpr auto inf = infinity_v<RealType>; CmplxType ch11, cbk1, cbj1, cby1; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; CmplxType ci = CmplxType(0.0, 1.0); if ((z.real() == 0.0) && (z.imag() == 0.0)) { @@ -1223,12 +1214,13 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_h20(const CmplxType& z) { // programs CH12N in S. Zhang & J. Jin "Computation of Special Functions" //(Wiley, 1996). using RealType = typename CmplxType::value_type; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::pi_v; - constexpr auto inf = infinity<RealType>::value; + constexpr auto inf = infinity_v<RealType>; CmplxType ch20, cbk0, cbj0, cby0; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; CmplxType ci = CmplxType(0.0, 1.0); if ((z.real() == 0.0) && (z.imag() == 0.0)) { @@ -1253,12 +1245,13 @@ KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_h21(const CmplxType& z) { // programs CH12N in S. Zhang & J. Jin "Computation of Special Functions" //(Wiley, 1996). using RealType = typename CmplxType::value_type; - using Kokkos::Experimental::infinity; + using Kokkos::Experimental::infinity_v; + using Kokkos::numbers::pi_v; - constexpr auto inf = infinity<RealType>::value; + constexpr auto inf = infinity_v<RealType>; CmplxType ch21, cbk1, cbj1, cby1; - constexpr auto pi = Kokkos::Experimental::pi_v<RealType>; + constexpr auto pi = pi_v<RealType>; CmplxType ci = CmplxType(0.0, 1.0); if ((z.real() == 0.0) && (z.imag() == 0.0)) { diff --git a/packages/kokkos/core/src/Kokkos_MemoryPool.hpp b/packages/kokkos/core/src/Kokkos_MemoryPool.hpp index 368d4901806792258618bcb77c5fdf7759ed1888..6b47c43727675783d1ee22c54e143dac5abdc5f6 100644 --- a/packages/kokkos/core/src/Kokkos_MemoryPool.hpp +++ b/packages/kokkos/core/src/Kokkos_MemoryPool.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_MEMORYPOOL_HPP #define KOKKOS_MEMORYPOOL_HPP diff --git a/packages/kokkos/core/src/Kokkos_MemoryTraits.hpp b/packages/kokkos/core/src/Kokkos_MemoryTraits.hpp index 079384f153c743b9ec96f5bdc1cef42f3f547ef4..762e1a4a5dc82a65a27436855703605161a3cfd5 100644 --- a/packages/kokkos/core/src/Kokkos_MemoryTraits.hpp +++ b/packages/kokkos/core/src/Kokkos_MemoryTraits.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_MEMORYTRAITS_HPP #define KOKKOS_MEMORYTRAITS_HPP diff --git a/packages/kokkos/core/src/Kokkos_MinMaxClamp.hpp b/packages/kokkos/core/src/Kokkos_MinMaxClamp.hpp index 6cb8d1669b96c3ad215e3fdc3cde9563f76036e7..37a28a80b68e08dd154cf046804416aa581fffdd 100644 --- a/packages/kokkos/core/src/Kokkos_MinMaxClamp.hpp +++ b/packages/kokkos/core/src/Kokkos_MinMaxClamp.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_MIN_MAX_CLAMP_HPP #define KOKKOS_MIN_MAX_CLAMP_HPP diff --git a/packages/kokkos/core/src/Kokkos_NumericTraits.hpp b/packages/kokkos/core/src/Kokkos_NumericTraits.hpp index e529aba8533229c42fe95f884b115a291945bcd0..118bf52c05fa027cb26f53e844b8708e5c723ff2 100644 --- a/packages/kokkos/core/src/Kokkos_NumericTraits.hpp +++ b/packages/kokkos/core/src/Kokkos_NumericTraits.hpp @@ -1,63 +1,37 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_NUMERIC_TRAITS_HPP #define KOKKOS_NUMERIC_TRAITS_HPP #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE -#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERICTRAITS +#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERIC_TRAITS #endif #include <Kokkos_Macros.hpp> +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 +#include <Kokkos_ReductionIdentity.hpp> +#endif #include <cfloat> #include <climits> #include <cmath> #include <cstdint> #include <type_traits> -namespace Kokkos { -namespace Experimental { +namespace Kokkos::Experimental { namespace Impl { // clang-format off template <class> struct infinity_helper {}; @@ -97,27 +71,10 @@ template <> struct finite_max_helper<float> { static constexpr float value = FLT template <> struct finite_max_helper<double> { static constexpr double value = DBL_MAX; }; template <> struct finite_max_helper<long double> { static constexpr long double value = LDBL_MAX; }; template <class> struct epsilon_helper {}; -namespace{ - // FIXME workaround for LDL_EPSILON with XL - template<typename T> - constexpr T machineeps() { - T epsilon = 1, prev = 1, expression = 1; - do { - prev = epsilon; - epsilon /= 2; - expression = 1 + epsilon; - } while (expression > 1); - return prev; - } -} template <> struct epsilon_helper<float> { static constexpr float value = FLT_EPSILON; }; template <> struct epsilon_helper<double> { static constexpr double value = DBL_EPSILON; }; template <> struct epsilon_helper<long double> { -#ifdef KOKKOS_COMPILER_IBM - static constexpr long double value = machineeps<long double>(); -#else static constexpr long double value = LDBL_EPSILON; -#endif }; template <class> struct round_error_helper {}; template <> struct round_error_helper<float> { static constexpr float value = 0.5F; }; @@ -130,7 +87,7 @@ template <> struct norm_min_helper<long double> { static constexpr long double v template <class> struct denorm_min_helper {}; // Workaround for GCC <9.2, Clang <9, Intel // vvvvvvvvvvvvvvvvvvvvvvvvv -#if defined(KOKKOS_ENABLE_CXX17) && defined (FLT_TRUE_MIN) || defined(_MSC_VER) +#if defined (FLT_TRUE_MIN) || defined(_MSC_VER) template <> struct denorm_min_helper<float> { static constexpr float value = FLT_TRUE_MIN; }; template <> struct denorm_min_helper<double> { static constexpr double value = DBL_TRUE_MIN; }; template <> struct denorm_min_helper<long double> { static constexpr long double value = LDBL_TRUE_MIN; }; @@ -139,32 +96,6 @@ template <> struct denorm_min_helper<float> { static constexpr float value = __F template <> struct denorm_min_helper<double> { static constexpr double value = __DBL_DENORM_MIN__; }; template <> struct denorm_min_helper<long double> { static constexpr long double value = __LDBL_DENORM_MIN__; }; #endif -// GCC <10.3 is not able to evaluate T(1) / finite_max_v<T> at compile time when passing -frounding-math -// https://godbolt.org/z/zj9svb1T7 -// Similar issue was reported on IBM Power without the compiler option -#define KOKKOS_IMPL_WORKAROUND_CONSTANT_EXPRESSION_COMPILER_BUG -#ifndef KOKKOS_IMPL_WORKAROUND_CONSTANT_EXPRESSION_COMPILER_BUG -// NOTE see ?lamch routine from LAPACK that determines machine parameters for floating-point arithmetic -template <class T> -constexpr T safe_minimum(T /*ignored*/) { - constexpr auto one = static_cast<T>(1); - constexpr auto eps = epsilon_helper<T>::value; - constexpr auto tiny = norm_min_helper<T>::value; - constexpr auto huge = finite_max_helper<T>::value; - constexpr auto small = one / huge; // error: is not a constant expression - return small >= tiny ? small * (one + eps) : tiny; -} -template <class> struct reciprocal_overflow_threshold_helper {}; -template <> struct reciprocal_overflow_threshold_helper<float> { static constexpr float value = safe_minimum(0.f); }; -template <> struct reciprocal_overflow_threshold_helper<double> { static constexpr double value = safe_minimum(0.); }; -template <> struct reciprocal_overflow_threshold_helper<long double> { static constexpr long double value = safe_minimum(0.l); }; -#else -template <class> struct reciprocal_overflow_threshold_helper {}; -template <> struct reciprocal_overflow_threshold_helper<float> { static constexpr float value = norm_min_helper<float>::value; }; // OK for IEEE-754 floating-point numbers -template <> struct reciprocal_overflow_threshold_helper<double> { static constexpr double value = norm_min_helper<double>::value; }; -template <> struct reciprocal_overflow_threshold_helper<long double> { static constexpr long double value = norm_min_helper<long double>::value; }; -#endif -#undef KOKKOS_IMPL_WORKAROUND_CONSTANT_EXPRESSION_COMPILER_BUG template <class> struct quiet_NaN_helper {}; template <> struct quiet_NaN_helper<float> { static constexpr float value = __builtin_nanf(""); }; template <> struct quiet_NaN_helper<double> { static constexpr double value = __builtin_nan(""); }; @@ -276,17 +207,11 @@ template <> struct max_exponent10_helper<long double> { static constexpr int val // clang-format on } // namespace Impl -#if defined(KOKKOS_ENABLE_CXX17) #define KOKKOS_IMPL_DEFINE_TRAIT(TRAIT) \ template <class T> \ struct TRAIT : Impl::TRAIT##_helper<std::remove_cv_t<T>> {}; \ template <class T> \ inline constexpr auto TRAIT##_v = TRAIT<T>::value; -#else -#define KOKKOS_IMPL_DEFINE_TRAIT(TRAIT) \ - template <class T> \ - struct TRAIT : Impl::TRAIT##_helper<std::remove_cv_t<T>> {}; -#endif // Numeric distinguished value traits KOKKOS_IMPL_DEFINE_TRAIT(infinity) @@ -296,7 +221,6 @@ KOKKOS_IMPL_DEFINE_TRAIT(epsilon) KOKKOS_IMPL_DEFINE_TRAIT(round_error) KOKKOS_IMPL_DEFINE_TRAIT(norm_min) KOKKOS_IMPL_DEFINE_TRAIT(denorm_min) -KOKKOS_IMPL_DEFINE_TRAIT(reciprocal_overflow_threshold) KOKKOS_IMPL_DEFINE_TRAIT(quiet_NaN) KOKKOS_IMPL_DEFINE_TRAIT(signaling_NaN) @@ -312,350 +236,10 @@ KOKKOS_IMPL_DEFINE_TRAIT(max_exponent10) #undef KOKKOS_IMPL_DEFINE_TRAIT -} // namespace Experimental - -template <class T> -struct reduction_identity; /*{ - KOKKOS_FORCEINLINE_FUNCTION constexpr static T sum() { return T(); } // 0 - KOKKOS_FORCEINLINE_FUNCTION constexpr static T prod() // 1 - { static_assert( false, "Missing specialization of -Kokkos::reduction_identity for custom prod reduction type"); return T(); } - KOKKOS_FORCEINLINE_FUNCTION constexpr static T max() // minimum value - { static_assert( false, "Missing specialization of -Kokkos::reduction_identity for custom max reduction type"); return T(); } - KOKKOS_FORCEINLINE_FUNCTION constexpr static T min() // maximum value - { static_assert( false, "Missing specialization of -Kokkos::reduction_identity for custom min reduction type"); return T(); } - KOKKOS_FORCEINLINE_FUNCTION constexpr static T bor() // 0, only for integer -type { static_assert( false, "Missing specialization of -Kokkos::reduction_identity for custom bor reduction type"); return T(); } - KOKKOS_FORCEINLINE_FUNCTION constexpr static T band() // !0, only for integer -type { static_assert( false, "Missing specialization of -Kokkos::reduction_identity for custom band reduction type"); return T(); } - KOKKOS_FORCEINLINE_FUNCTION constexpr static T lor() // 0, only for integer -type { static_assert( false, "Missing specialization of -Kokkos::reduction_identity for custom lor reduction type"); return T(); } - KOKKOS_FORCEINLINE_FUNCTION constexpr static T land() // !0, only for integer -type { static_assert( false, "Missing specialization of -Kokkos::reduction_identity for custom land reduction type"); return T(); } -};*/ - -template <> -struct reduction_identity<signed char> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char sum() { - return static_cast<signed char>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char prod() { - return static_cast<signed char>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char max() { - return SCHAR_MIN; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char min() { - return SCHAR_MAX; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char bor() { - return static_cast<signed char>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char band() { - return ~static_cast<signed char>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char lor() { - return static_cast<signed char>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char land() { - return static_cast<signed char>(1); - } -}; - -template <> -struct reduction_identity<bool> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static bool lor() { - return static_cast<bool>(false); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static bool land() { - return static_cast<bool>(true); - } -}; - -template <> -struct reduction_identity<short> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static short sum() { - return static_cast<short>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static short prod() { - return static_cast<short>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static short max() { return SHRT_MIN; } - KOKKOS_FORCEINLINE_FUNCTION constexpr static short min() { return SHRT_MAX; } - KOKKOS_FORCEINLINE_FUNCTION constexpr static short bor() { - return static_cast<short>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static short band() { - return ~static_cast<short>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static short lor() { - return static_cast<short>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static short land() { - return static_cast<short>(1); - } -}; - -template <> -struct reduction_identity<int> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static int sum() { - return static_cast<int>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static int prod() { - return static_cast<int>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static int max() { return INT_MIN; } - KOKKOS_FORCEINLINE_FUNCTION constexpr static int min() { return INT_MAX; } - KOKKOS_FORCEINLINE_FUNCTION constexpr static int bor() { - return static_cast<int>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static int band() { - return ~static_cast<int>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static int lor() { - return static_cast<int>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static int land() { - return static_cast<int>(1); - } -}; - -template <> -struct reduction_identity<long> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static long sum() { - return static_cast<long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long prod() { - return static_cast<long>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long max() { return LONG_MIN; } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long min() { return LONG_MAX; } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long bor() { - return static_cast<long>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long band() { - return ~static_cast<long>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long lor() { - return static_cast<long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long land() { - return static_cast<long>(1); - } -}; - -template <> -struct reduction_identity<long long> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static long long sum() { - return static_cast<long long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long long prod() { - return static_cast<long long>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long long max() { - return LLONG_MIN; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long long min() { - return LLONG_MAX; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long long bor() { - return static_cast<long long>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long long band() { - return ~static_cast<long long>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long long lor() { - return static_cast<long long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static long long land() { - return static_cast<long long>(1); - } -}; - -template <> -struct reduction_identity<unsigned char> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char sum() { - return static_cast<unsigned char>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char prod() { - return static_cast<unsigned char>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char max() { - return static_cast<unsigned char>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char min() { - return UCHAR_MAX; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char bor() { - return static_cast<unsigned char>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char band() { - return ~static_cast<unsigned char>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char lor() { - return static_cast<unsigned char>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char land() { - return static_cast<unsigned char>(1); - } -}; - -template <> -struct reduction_identity<unsigned short> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short sum() { - return static_cast<unsigned short>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short prod() { - return static_cast<unsigned short>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short max() { - return static_cast<unsigned short>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short min() { - return USHRT_MAX; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short bor() { - return static_cast<unsigned short>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short band() { - return ~static_cast<unsigned short>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short lor() { - return static_cast<unsigned short>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short land() { - return static_cast<unsigned short>(1); - } -}; - -template <> -struct reduction_identity<unsigned int> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int sum() { - return static_cast<unsigned int>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int prod() { - return static_cast<unsigned int>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int max() { - return static_cast<unsigned int>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int min() { - return UINT_MAX; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int bor() { - return static_cast<unsigned int>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int band() { - return ~static_cast<unsigned int>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int lor() { - return static_cast<unsigned int>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int land() { - return static_cast<unsigned int>(1); - } -}; - -template <> -struct reduction_identity<unsigned long> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long sum() { - return static_cast<unsigned long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long prod() { - return static_cast<unsigned long>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long max() { - return static_cast<unsigned long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long min() { - return ULONG_MAX; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long bor() { - return static_cast<unsigned long>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long band() { - return ~static_cast<unsigned long>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long lor() { - return static_cast<unsigned long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long land() { - return static_cast<unsigned long>(1); - } -}; - -template <> -struct reduction_identity<unsigned long long> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long sum() { - return static_cast<unsigned long long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long prod() { - return static_cast<unsigned long long>(1); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long max() { - return static_cast<unsigned long long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long min() { - return ULLONG_MAX; - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long bor() { - return static_cast<unsigned long long>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long band() { - return ~static_cast<unsigned long long>(0x0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long lor() { - return static_cast<unsigned long long>(0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long land() { - return static_cast<unsigned long long>(1); - } -}; - -template <> -struct reduction_identity<float> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static float sum() { - return static_cast<float>(0.0f); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float prod() { - return static_cast<float>(1.0f); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float max() { return -FLT_MAX; } - KOKKOS_FORCEINLINE_FUNCTION constexpr static float min() { return FLT_MAX; } -}; - -template <> -struct reduction_identity<double> { - KOKKOS_FORCEINLINE_FUNCTION constexpr static double sum() { - return static_cast<double>(0.0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static double prod() { - return static_cast<double>(1.0); - } - KOKKOS_FORCEINLINE_FUNCTION constexpr static double max() { return -DBL_MAX; } - KOKKOS_FORCEINLINE_FUNCTION constexpr static double min() { return DBL_MAX; } -}; - -// No __host__ __device__ annotation because long double treated as double in -// device code. May be revisited later if that is not true any more. -template <> -struct reduction_identity<long double> { - constexpr static long double sum() { return static_cast<long double>(0.0); } - constexpr static long double prod() { return static_cast<long double>(1.0); } - constexpr static long double max() { return -LDBL_MAX; } - constexpr static long double min() { return LDBL_MAX; } -}; - -} // namespace Kokkos +} // namespace Kokkos::Experimental -#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERICTRAITS +#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERIC_TRAITS #undef KOKKOS_IMPL_PUBLIC_INCLUDE -#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERICTRAITS +#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_NUMERIC_TRAITS #endif #endif diff --git a/packages/kokkos/core/src/Kokkos_OpenMP.hpp b/packages/kokkos/core/src/Kokkos_OpenMP.hpp index 775b4704489f79a03c1ffecb8d37de6925dd3acc..bbe008afd959f5db2e7eaa2478e98a0f005c509a 100644 --- a/packages/kokkos/core/src/Kokkos_OpenMP.hpp +++ b/packages/kokkos/core/src/Kokkos_OpenMP.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_OPENMP_HPP #define KOKKOS_OPENMP_HPP @@ -107,6 +75,8 @@ class OpenMP { OpenMP(); + OpenMP(int pool_size); + /// \brief Print configuration information to the given output stream. void print_configuration(std::ostream& os, bool verbose = false) const; @@ -128,19 +98,6 @@ class OpenMP { inline static bool is_asynchronous(OpenMP const& = OpenMP()) noexcept; #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - /// \brief Partition the default instance into new instances without creating - /// new masters - /// - /// This is a no-op on OpenMP since the default instance cannot be partitioned - /// without promoting other threads to 'master' - static std::vector<OpenMP> partition(...); - - /// Non-default instances should be ref-counted so that when the last - /// is destroyed the instance resources are released - /// - /// This is a no-op on OpenMP since a non default instance cannot be created - static OpenMP create_instance(...); - /// \brief Partition the default instance and call 'f' on each new 'master' /// thread /// @@ -152,8 +109,7 @@ class OpenMP { int requested_partition_size = 0); #endif - // use UniqueToken - static int concurrency(); + static int concurrency(OpenMP const& = OpenMP()); static void impl_initialize(InitializationSettings const&); @@ -164,13 +120,12 @@ class OpenMP { /// \brief Free any resources being consumed by the default execution space static void impl_finalize(); - inline static int impl_thread_pool_size() noexcept; + inline static int impl_thread_pool_size(OpenMP const& = OpenMP()) noexcept; /** \brief The rank of the executing thread in this thread pool */ - KOKKOS_INLINE_FUNCTION - static int impl_thread_pool_rank() noexcept; + inline static int impl_thread_pool_rank() noexcept; - inline static int impl_thread_pool_size(int depth); + inline static int impl_thread_pool_size(int depth, OpenMP const& = OpenMP()); // use UniqueToken inline static int impl_max_hardware_threads() noexcept; @@ -182,22 +137,21 @@ class OpenMP { static int impl_get_current_max_threads() noexcept; Impl::OpenMPInternal* impl_internal_space_instance() const { -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - return m_space_instance; -#else return m_space_instance.get(); -#endif } static constexpr const char* name() noexcept { return "OpenMP"; } uint32_t impl_instance_id() const noexcept { return 1; } private: -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - Impl::OpenMPInternal* m_space_instance; -#else + friend bool operator==(OpenMP const& lhs, OpenMP const& rhs) { + return lhs.impl_internal_space_instance() == + rhs.impl_internal_space_instance(); + } + friend bool operator!=(OpenMP const& lhs, OpenMP const& rhs) { + return !(lhs == rhs); + } Kokkos::Impl::HostSharedPtr<Impl::OpenMPInternal> m_space_instance; -#endif }; namespace Tools { diff --git a/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp b/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp index 637b4c08f9088508f53d2bf13cce6e840b4006f1..4bcfed90e39d831f4cbf2c7299b6f16b0f8d7acf 100644 --- a/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp +++ b/packages/kokkos/core/src/Kokkos_OpenMPTarget.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_OPENMPTARGET_HPP #define KOKKOS_OPENMPTARGET_HPP @@ -105,7 +73,11 @@ class OpenMPTarget { static void impl_static_fence(const std::string& name); /** \brief Return the maximum amount of concurrency. */ +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 static int concurrency(); +#else + int concurrency() const; +#endif //! Print configuration information to the given output stream. void print_configuration(std::ostream& os, bool verbose = false) const; @@ -129,6 +101,13 @@ class OpenMPTarget { uint32_t impl_instance_id() const noexcept; private: + friend bool operator==(OpenMPTarget const& lhs, OpenMPTarget const& rhs) { + return lhs.impl_internal_space_instance() == + rhs.impl_internal_space_instance(); + } + friend bool operator!=(OpenMPTarget const& lhs, OpenMPTarget const& rhs) { + return !(lhs == rhs); + } Impl::OpenMPTargetInternal* m_space_instance; }; } // namespace Experimental diff --git a/packages/kokkos/core/src/Kokkos_OpenMPTargetSpace.hpp b/packages/kokkos/core/src/Kokkos_OpenMPTargetSpace.hpp index b4897449cb9e769438e3d5a0c48ad39a55cd8bad..ca015da379f4c312d00ae4c91c20893fa8702022 100644 --- a/packages/kokkos/core/src/Kokkos_OpenMPTargetSpace.hpp +++ b/packages/kokkos/core/src/Kokkos_OpenMPTargetSpace.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_OPENMPTARGETSPACE_HPP #define KOKKOS_OPENMPTARGETSPACE_HPP @@ -268,9 +236,9 @@ struct DeepCopy<Kokkos::Experimental::OpenMPTargetSpace, // be greater than zero to avoid error. omp_target_memcpy returns zero on // success. if (n > 0) - OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0, - omp_get_default_device(), - omp_get_default_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( + dst, const_cast<void*>(src), n, 0, 0, omp_get_default_device(), + omp_get_default_device())); } DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { exec.fence( @@ -278,9 +246,9 @@ struct DeepCopy<Kokkos::Experimental::OpenMPTargetSpace, "before " "copy"); if (n > 0) - OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0, - omp_get_default_device(), - omp_get_default_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( + dst, const_cast<void*>(src), n, 0, 0, omp_get_default_device(), + omp_get_default_device())); } }; @@ -289,18 +257,18 @@ struct DeepCopy<Kokkos::Experimental::OpenMPTargetSpace, HostSpace, ExecutionSpace> { DeepCopy(void* dst, const void* src, size_t n) { if (n > 0) - OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0, - omp_get_default_device(), - omp_get_initial_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( + dst, const_cast<void*>(src), n, 0, 0, omp_get_default_device(), + omp_get_initial_device())); } DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { exec.fence( "Kokkos::Impl::DeepCopy<OpenMPTargetSpace, HostSpace>: fence before " "copy"); if (n > 0) - OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0, - omp_get_default_device(), - omp_get_initial_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( + dst, const_cast<void*>(src), n, 0, 0, omp_get_default_device(), + omp_get_initial_device())); } }; @@ -309,18 +277,18 @@ struct DeepCopy<HostSpace, Kokkos::Experimental::OpenMPTargetSpace, ExecutionSpace> { DeepCopy(void* dst, const void* src, size_t n) { if (n > 0) - OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0, - omp_get_initial_device(), - omp_get_default_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( + dst, const_cast<void*>(src), n, 0, 0, omp_get_initial_device(), + omp_get_default_device())); } DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { exec.fence( "Kokkos::Impl::DeepCopy<HostSpace, OpenMPTargetSpace>: fence before " "copy"); if (n > 0) - OMPT_SAFE_CALL(omp_target_memcpy(dst, const_cast<void*>(src), n, 0, 0, - omp_get_initial_device(), - omp_get_default_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( + dst, const_cast<void*>(src), n, 0, 0, omp_get_initial_device(), + omp_get_default_device())); } }; diff --git a/packages/kokkos/core/src/Kokkos_Pair.hpp b/packages/kokkos/core/src/Kokkos_Pair.hpp index 7e5b7ce250021b089cba6b97b972a78dc6633104..d42e07aa42369b1c8cb45decc1aa7c6238e7033f 100644 --- a/packages/kokkos/core/src/Kokkos_Pair.hpp +++ b/packages/kokkos/core/src/Kokkos_Pair.hpp @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER /// \file Kokkos_Pair.hpp @@ -111,13 +85,16 @@ struct pair { : first(p.first), second(p.second) { } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 /// \brief Copy constructor. /// /// This calls the copy constructors of T1 and T2. It won't compile /// if those copy constructors are not defined and public. template <class U, class V> - KOKKOS_FORCEINLINE_FUNCTION constexpr pair(const volatile pair<U, V>& p) + KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION constexpr pair( + const volatile pair<U, V>& p) : first(p.first), second(p.second) {} +#endif /// \brief Assignment operator. /// @@ -130,6 +107,7 @@ struct pair { return *this; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 /// \brief Assignment operator, for volatile <tt>*this</tt>. /// /// \param p [in] Input; right-hand side of the assignment. @@ -142,13 +120,14 @@ struct pair { /// practice, this means that you should not chain assignments with /// volatile lvalues. template <class U, class V> - KOKKOS_FORCEINLINE_FUNCTION void operator=( + KOKKOS_DEPRECATED KOKKOS_FORCEINLINE_FUNCTION void operator=( const volatile pair<U, V>& p) volatile { first = p.first; second = p.second; // We deliberately do not return anything here. See explanation // in public documentation above. } +#endif // from std::pair<U,V> template <class U, class V> diff --git a/packages/kokkos/core/src/Kokkos_Parallel.hpp b/packages/kokkos/core/src/Kokkos_Parallel.hpp index 2b5e39d24d808abcddf36f4840c2d47082a7a905..7c4207222662800481f4c395021437ee901ad1b2 100644 --- a/packages/kokkos/core/src/Kokkos_Parallel.hpp +++ b/packages/kokkos/core/src/Kokkos_Parallel.hpp @@ -1,58 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_Parallel.hpp /// \brief Declaration of parallel operators #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_PARALLEL_HPP #define KOKKOS_PARALLEL_HPP @@ -185,18 +153,6 @@ inline void parallel_for( Kokkos::parallel_for("", policy, functor); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -template <class ExecPolicy, class FunctorType> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the overload taking the label as first argument instead!") -inline void parallel_for( - const ExecPolicy& policy, const FunctorType& functor, - const std::string& str, - std::enable_if_t<is_execution_policy<ExecPolicy>::value>* = nullptr) { - Kokkos::parallel_for(str, policy, functor); -} -#endif - template <class FunctorType> inline void parallel_for(const std::string& str, const size_t work_count, const FunctorType& functor) { @@ -214,16 +170,6 @@ inline void parallel_for(const size_t work_count, const FunctorType& functor) { ::Kokkos::parallel_for("", work_count, functor); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -template <class FunctorType> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the overload taking the label as first argument instead!") -inline void parallel_for(const size_t work_count, const FunctorType& functor, - const std::string& str) { - ::Kokkos::parallel_for(str, work_count, functor); -} -#endif - } // namespace Kokkos #include <Kokkos_Parallel_Reduce.hpp> @@ -423,18 +369,6 @@ inline void parallel_scan( ::Kokkos::parallel_scan("", policy, functor); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -template <class ExecutionPolicy, class FunctorType> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the overload taking the label as first argument instead!") -inline void parallel_scan( - const ExecutionPolicy& policy, const FunctorType& functor, - const std::string& str, - std::enable_if_t<is_execution_policy<ExecutionPolicy>::value>* = nullptr) { - ::Kokkos::parallel_scan(str, policy, functor); -} -#endif - template <class FunctorType> inline void parallel_scan(const std::string& str, const size_t work_count, const FunctorType& functor) { @@ -453,16 +387,6 @@ inline void parallel_scan(const size_t work_count, const FunctorType& functor) { ::Kokkos::parallel_scan("", work_count, functor); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -template <class FunctorType> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the overload taking the label as first argument instead!") -inline void parallel_scan(const size_t work_count, const FunctorType& functor, - const std::string& str) { - ::Kokkos::parallel_scan(str, work_count, functor); -} -#endif - template <class ExecutionPolicy, class FunctorType, class ReturnType, class Enable = std::enable_if_t<is_execution_policy<ExecutionPolicy>::value>> @@ -473,17 +397,26 @@ inline void parallel_scan(const std::string& str, const ExecutionPolicy& policy, ExecutionPolicy inner_policy = policy; Kokkos::Tools::Impl::begin_parallel_scan(inner_policy, functor, str, kpID); - Kokkos::Impl::shared_allocation_tracking_disable(); - Impl::ParallelScanWithTotal<FunctorType, ExecutionPolicy, ReturnType> closure( - functor, inner_policy, return_value); - Kokkos::Impl::shared_allocation_tracking_enable(); - - closure.execute(); + if constexpr (Kokkos::is_view<ReturnType>::value) { + Kokkos::Impl::shared_allocation_tracking_disable(); + Impl::ParallelScanWithTotal<FunctorType, ExecutionPolicy, ReturnType> + closure(functor, inner_policy, return_value); + Kokkos::Impl::shared_allocation_tracking_enable(); + closure.execute(); + } else { + Kokkos::Impl::shared_allocation_tracking_disable(); + Kokkos::View<ReturnType, Kokkos::HostSpace> view(&return_value); + Impl::ParallelScanWithTotal<FunctorType, ExecutionPolicy, ReturnType> + closure(functor, inner_policy, view); + Kokkos::Impl::shared_allocation_tracking_enable(); + closure.execute(); + } Kokkos::Tools::Impl::end_parallel_scan(inner_policy, functor, str, kpID); - policy.space().fence( - "Kokkos::parallel_scan: fence due to result being a value, not a view"); + if (!Kokkos::is_view<ReturnType>::value) + policy.space().fence( + "Kokkos::parallel_scan: fence due to result being a value, not a view"); } template <class ExecutionPolicy, class FunctorType, class ReturnType> @@ -494,18 +427,6 @@ inline void parallel_scan( ::Kokkos::parallel_scan("", policy, functor, return_value); } -#ifdef KOKKOS_ENABLE_DISABLE_DEPRECATED_CODE_3 -template <class ExecutionPolicy, class FunctorType, class ReturnType> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the overload taking the label as first argument instead!") -inline void parallel_scan( - const ExecutionPolicy& policy, const FunctorType& functor, - ReturnType& return_value, const std::string& str, - std::enable_if_t<is_execution_policy<ExecutionPolicy>::value>* = nullptr) { - ::Kokkos::parallel_scan(str, policy, functor, return_value); -} -#endif - template <class FunctorType, class ReturnType> inline void parallel_scan(const std::string& str, const size_t work_count, const FunctorType& functor, @@ -526,16 +447,6 @@ inline void parallel_scan(const size_t work_count, const FunctorType& functor, ::Kokkos::parallel_scan("", work_count, functor, return_value); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -template <class FunctorType, class ReturnType> -KOKKOS_DEPRECATED_WITH_COMMENT( - "Use the overload taking the label as first argument instead!") -inline void parallel_scan(const size_t work_count, const FunctorType& functor, - ReturnType& return_value, const std::string& str) { - ::Kokkos::parallel_scan(str, work_count, functor, return_value); -} -#endif - } // namespace Kokkos //---------------------------------------------------------------------------- diff --git a/packages/kokkos/core/src/Kokkos_Parallel_Reduce.hpp b/packages/kokkos/core/src/Kokkos_Parallel_Reduce.hpp index 9213383ac9736f01dc59c89d58154fa92fd5a9cf..d44bd89a9b5ec85d205b835f11cfd6e64ecff79f 100644 --- a/packages/kokkos/core/src/Kokkos_Parallel_Reduce.hpp +++ b/packages/kokkos/core/src/Kokkos_Parallel_Reduce.hpp @@ -1,60 +1,28 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_PARALLEL_REDUCE_HPP #define KOKKOS_PARALLEL_REDUCE_HPP -#include <Kokkos_NumericTraits.hpp> +#include <Kokkos_ReductionIdentity.hpp> #include <Kokkos_View.hpp> #include <impl/Kokkos_FunctorAnalysis.hpp> #include <impl/Kokkos_Tools_Generic.hpp> @@ -63,12 +31,6 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") namespace Kokkos { -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -template <class T> -using is_reducer_type KOKKOS_DEPRECATED_WITH_COMMENT( - "Use Kokkos::is_reducer instead!") = Kokkos::is_reducer<T>; -#endif - template <class Scalar, class Space> struct Sum { public: @@ -109,6 +71,10 @@ struct Sum { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +Sum(View<Scalar, Properties...> const&) + ->Sum<Scalar, typename View<Scalar, Properties...>::memory_space>; + template <class Scalar, class Space> struct Prod { public: @@ -149,6 +115,10 @@ struct Prod { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +Prod(View<Scalar, Properties...> const&) + ->Prod<Scalar, typename View<Scalar, Properties...>::memory_space>; + template <class Scalar, class Space> struct Min { public: @@ -191,6 +161,10 @@ struct Min { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +Min(View<Scalar, Properties...> const&) + ->Min<Scalar, typename View<Scalar, Properties...>::memory_space>; + template <class Scalar, class Space> struct Max { public: @@ -234,6 +208,10 @@ struct Max { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +Max(View<Scalar, Properties...> const&) + ->Max<Scalar, typename View<Scalar, Properties...>::memory_space>; + template <class Scalar, class Space> struct LAnd { public: @@ -275,6 +253,10 @@ struct LAnd { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +LAnd(View<Scalar, Properties...> const&) + ->LAnd<Scalar, typename View<Scalar, Properties...>::memory_space>; + template <class Scalar, class Space> struct LOr { public: @@ -317,6 +299,10 @@ struct LOr { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +LOr(View<Scalar, Properties...> const&) + ->LOr<Scalar, typename View<Scalar, Properties...>::memory_space>; + template <class Scalar, class Space> struct BAnd { public: @@ -359,6 +345,10 @@ struct BAnd { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +BAnd(View<Scalar, Properties...> const&) + ->BAnd<Scalar, typename View<Scalar, Properties...>::memory_space>; + template <class Scalar, class Space> struct BOr { public: @@ -401,6 +391,10 @@ struct BOr { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +BOr(View<Scalar, Properties...> const&) + ->BOr<Scalar, typename View<Scalar, Properties...>::memory_space>; + template <class Scalar, class Index> struct ValLocScalar { Scalar val; @@ -460,6 +454,12 @@ struct MinLoc { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename... Properties> +MinLoc(View<ValLocScalar<Scalar, Index>, Properties...> const&) + ->MinLoc<Scalar, Index, + typename View<ValLocScalar<Scalar, Index>, + Properties...>::memory_space>; + template <class Scalar, class Index, class Space> struct MaxLoc { private: @@ -507,6 +507,12 @@ struct MaxLoc { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename... Properties> +MaxLoc(View<ValLocScalar<Scalar, Index>, Properties...> const&) + ->MaxLoc<Scalar, Index, + typename View<ValLocScalar<Scalar, Index>, + Properties...>::memory_space>; + template <class Scalar> struct MinMaxScalar { Scalar min_val, max_val; @@ -569,6 +575,11 @@ struct MinMax { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename... Properties> +MinMax(View<MinMaxScalar<Scalar>, Properties...> const&) + ->MinMax<Scalar, + typename View<MinMaxScalar<Scalar>, Properties...>::memory_space>; + template <class Scalar, class Index> struct MinMaxLocScalar { Scalar min_val, max_val; @@ -639,6 +650,12 @@ struct MinMaxLoc { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename... Properties> +MinMaxLoc(View<MinMaxLocScalar<Scalar, Index>, Properties...> const&) + ->MinMaxLoc<Scalar, Index, + typename View<MinMaxLocScalar<Scalar, Index>, + Properties...>::memory_space>; + // -------------------------------------------------- // reducers added to support std algorithms // -------------------------------------------------- @@ -697,6 +714,12 @@ struct MaxFirstLoc { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename... Properties> +MaxFirstLoc(View<ValLocScalar<Scalar, Index>, Properties...> const&) + ->MaxFirstLoc<Scalar, Index, + typename View<ValLocScalar<Scalar, Index>, + Properties...>::memory_space>; + // // MaxFirstLocCustomComparator // recall that comp(a,b) returns true is a < b @@ -756,6 +779,14 @@ struct MaxFirstLocCustomComparator { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename ComparatorType, + typename... Properties> +MaxFirstLocCustomComparator( + View<ValLocScalar<Scalar, Index>, Properties...> const&, ComparatorType) + ->MaxFirstLocCustomComparator<Scalar, Index, ComparatorType, + typename View<ValLocScalar<Scalar, Index>, + Properties...>::memory_space>; + // // MinFirstLoc // @@ -810,6 +841,12 @@ struct MinFirstLoc { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename... Properties> +MinFirstLoc(View<ValLocScalar<Scalar, Index>, Properties...> const&) + ->MinFirstLoc<Scalar, Index, + typename View<ValLocScalar<Scalar, Index>, + Properties...>::memory_space>; + // // MinFirstLocCustomComparator // recall that comp(a,b) returns true is a < b @@ -869,6 +906,14 @@ struct MinFirstLocCustomComparator { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename ComparatorType, + typename... Properties> +MinFirstLocCustomComparator( + View<ValLocScalar<Scalar, Index>, Properties...> const&, ComparatorType) + ->MinFirstLocCustomComparator<Scalar, Index, ComparatorType, + typename View<ValLocScalar<Scalar, Index>, + Properties...>::memory_space>; + // // MinMaxFirstLastLoc // @@ -934,6 +979,12 @@ struct MinMaxFirstLastLoc { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename... Properties> +MinMaxFirstLastLoc(View<MinMaxLocScalar<Scalar, Index>, Properties...> const&) + ->MinMaxFirstLastLoc<Scalar, Index, + typename View<MinMaxLocScalar<Scalar, Index>, + Properties...>::memory_space>; + // // MinMaxFirstLastLocCustomComparator // recall that comp(a,b) returns true is a < b @@ -1003,6 +1054,15 @@ struct MinMaxFirstLastLocCustomComparator { bool references_scalar() const { return references_scalar_v; } }; +template <typename Scalar, typename Index, typename ComparatorType, + typename... Properties> +MinMaxFirstLastLocCustomComparator( + View<MinMaxLocScalar<Scalar, Index>, Properties...> const&, ComparatorType) + ->MinMaxFirstLastLocCustomComparator< + Scalar, Index, ComparatorType, + typename View<MinMaxLocScalar<Scalar, Index>, + Properties...>::memory_space>; + // // FirstLoc // @@ -1061,6 +1121,11 @@ struct FirstLoc { bool references_scalar() const { return references_scalar_v; } }; +template <typename Index, typename... Properties> +FirstLoc(View<FirstLocScalar<Index>, Properties...> const&) + ->FirstLoc<Index, typename View<FirstLocScalar<Index>, + Properties...>::memory_space>; + // // LastLoc // @@ -1119,6 +1184,11 @@ struct LastLoc { bool references_scalar() const { return references_scalar_v; } }; +template <typename Index, typename... Properties> +LastLoc(View<LastLocScalar<Index>, Properties...> const&) + ->LastLoc<Index, + typename View<LastLocScalar<Index>, Properties...>::memory_space>; + template <class Index> struct StdIsPartScalar { Index max_loc_true, min_loc_false; @@ -1186,6 +1256,11 @@ struct StdIsPartitioned { bool references_scalar() const { return references_scalar_v; } }; +template <typename Index, typename... Properties> +StdIsPartitioned(View<StdIsPartScalar<Index>, Properties...> const&) + ->StdIsPartitioned<Index, typename View<StdIsPartScalar<Index>, + Properties...>::memory_space>; + template <class Index> struct StdPartPointScalar { Index min_loc_false; @@ -1247,6 +1322,11 @@ struct StdPartitionPoint { bool references_scalar() const { return references_scalar_v; } }; +template <typename Index, typename... Properties> +StdPartitionPoint(View<StdPartPointScalar<Index>, Properties...> const&) + ->StdPartitionPoint<Index, typename View<StdPartPointScalar<Index>, + Properties...>::memory_space>; + } // namespace Kokkos namespace Kokkos { namespace Impl { @@ -1400,19 +1480,6 @@ struct ParallelReduceAdaptor { const FunctorType& functor, ReturnType& return_value) { execute_impl(label, policy, functor, return_value); } - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - template <typename Dummy = ReturnType> - KOKKOS_DEPRECATED_WITH_COMMENT( - "Array reductions with a raw pointer return type are deprecated. Use a " - "Kokkos::View as return argument!") - static inline std:: - enable_if_t<is_array_reduction && std::is_pointer<Dummy>::value> execute( - const std::string& label, const PolicyType& policy, - const FunctorType& functor, ReturnType& return_value) { - execute_impl(label, policy, functor, return_value); - } -#endif }; } // namespace Impl diff --git a/packages/kokkos/core/src/Kokkos_PointerOwnership.hpp b/packages/kokkos/core/src/Kokkos_PointerOwnership.hpp index 41b18a8d1441dcc0b7f8237c91c1420039a8526a..0132ffb8da5923507304eefd1024d2fa5cf8a7c4 100644 --- a/packages/kokkos/core/src/Kokkos_PointerOwnership.hpp +++ b/packages/kokkos/core/src/Kokkos_PointerOwnership.hpp @@ -1,57 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_IMPL_POINTEROWNERSHIP_HPP #define KOKKOS_IMPL_POINTEROWNERSHIP_HPP diff --git a/packages/kokkos/core/src/Kokkos_Profiling_ProfileSection.hpp b/packages/kokkos/core/src/Kokkos_Profiling_ProfileSection.hpp index 266605c0feca189bf6abbd5a2bc3078dd345cec2..29a04ac3b07ebb2b9676d84128583be1ef948036 100644 --- a/packages/kokkos/core/src/Kokkos_Profiling_ProfileSection.hpp +++ b/packages/kokkos/core/src/Kokkos_Profiling_ProfileSection.hpp @@ -1,46 +1,18 @@ -/* - //@HEADER - // ************************************************************************ - // - // Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). - // - // Under the terms of Contract DE-NA0003525 with NTESS, - // the U.S. Government retains certain rights in this software. - // - // Redistribution and use in source and binary forms, with or without - // modification, are permitted provided that the following conditions are - // met: - // - // 1. Redistributions of source code must retain the above copyright - // notice, this list of conditions and the following disclaimer. - // - // 2. Redistributions in binary form must reproduce the above copyright - // notice, this list of conditions and the following disclaimer in the - // documentation and/or other materials provided with the distribution. - // - // 3. Neither the name of the Corporation nor the names of the - // contributors may be used to endorse or promote products derived from - // this software without specific prior written permission. - // - // THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY - // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE - // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // - // Questions? Contact Christian R. Trott (crtrott@sandia.gov) - // - // ************************************************************************ - //@HEADER - */ +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER #ifndef KOKKOSP_PROFILE_SECTION_HPP #define KOKKOSP_PROFILE_SECTION_HPP @@ -63,11 +35,7 @@ class ProfilingSection { ProfilingSection(ProfilingSection const&) = delete; ProfilingSection& operator=(ProfilingSection const&) = delete; - ProfilingSection(const std::string& sectionName) -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - : secName(sectionName) -#endif - { + ProfilingSection(const std::string& sectionName) { if (Kokkos::Profiling::profileLibraryLoaded()) { Kokkos::Profiling::createProfileSection(sectionName, &secID); } @@ -91,16 +59,7 @@ class ProfilingSection { } } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - KOKKOS_DEPRECATED std::string getName() { return secName; } - - KOKKOS_DEPRECATED uint32_t getSectionID() { return secID; } -#endif - protected: -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - const std::string secName; -#endif uint32_t secID; }; diff --git a/packages/kokkos/core/src/Kokkos_Rank.hpp b/packages/kokkos/core/src/Kokkos_Rank.hpp index 025cf511fe90f4d21616449b226e4ef634ee9fe1..7979580275428b5622eef02e87b8c1970ce4b7b6 100644 --- a/packages/kokkos/core/src/Kokkos_Rank.hpp +++ b/packages/kokkos/core/src/Kokkos_Rank.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_KOKKOS_RANK_HPP #define KOKKOS_KOKKOS_RANK_HPP @@ -66,7 +34,7 @@ struct Rank { static_assert(N != 0u, "Kokkos Error: rank 0 undefined"); static_assert(N != 1u, "Kokkos Error: rank 1 is not a multi-dimensional range"); - static_assert(N < 7u, "Kokkos Error: Unsupported rank..."); + static_assert(N < 9u, "Kokkos Error: Unsupported rank..."); using iteration_pattern = Rank<N, OuterDir, InnerDir>; diff --git a/packages/kokkos/core/src/Kokkos_ReductionIdentity.hpp b/packages/kokkos/core/src/Kokkos_ReductionIdentity.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a6d6eb3232cc032599650de1e3757ea0b424c3f1 --- /dev/null +++ b/packages/kokkos/core/src/Kokkos_ReductionIdentity.hpp @@ -0,0 +1,398 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_REDUCTION_IDENTITY_HPP +#define KOKKOS_REDUCTION_IDENTITY_HPP +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE +#define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY +#endif + +#include <Kokkos_Macros.hpp> +#include <cfloat> +#include <climits> + +namespace Kokkos { + +template <class T> +struct reduction_identity; /*{ + KOKKOS_FORCEINLINE_FUNCTION constexpr static T sum() { return T(); } // 0 + KOKKOS_FORCEINLINE_FUNCTION constexpr static T prod() // 1 + { static_assert( false, "Missing specialization of +Kokkos::reduction_identity for custom prod reduction type"); return T(); } + KOKKOS_FORCEINLINE_FUNCTION constexpr static T max() // minimum value + { static_assert( false, "Missing specialization of +Kokkos::reduction_identity for custom max reduction type"); return T(); } + KOKKOS_FORCEINLINE_FUNCTION constexpr static T min() // maximum value + { static_assert( false, "Missing specialization of +Kokkos::reduction_identity for custom min reduction type"); return T(); } + KOKKOS_FORCEINLINE_FUNCTION constexpr static T bor() // 0, only for integer +type { static_assert( false, "Missing specialization of +Kokkos::reduction_identity for custom bor reduction type"); return T(); } + KOKKOS_FORCEINLINE_FUNCTION constexpr static T band() // !0, only for integer +type { static_assert( false, "Missing specialization of +Kokkos::reduction_identity for custom band reduction type"); return T(); } + KOKKOS_FORCEINLINE_FUNCTION constexpr static T lor() // 0, only for integer +type { static_assert( false, "Missing specialization of +Kokkos::reduction_identity for custom lor reduction type"); return T(); } + KOKKOS_FORCEINLINE_FUNCTION constexpr static T land() // !0, only for integer +type { static_assert( false, "Missing specialization of +Kokkos::reduction_identity for custom land reduction type"); return T(); } +};*/ + +template <> +struct reduction_identity<char> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static char sum() { + return static_cast<char>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static char prod() { + return static_cast<char>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static char max() { return CHAR_MIN; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static char min() { return CHAR_MAX; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static char bor() { + return static_cast<char>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static char band() { + return ~static_cast<char>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static char lor() { + return static_cast<char>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static char land() { + return static_cast<char>(1); + } +}; + +template <> +struct reduction_identity<signed char> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char sum() { + return static_cast<signed char>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char prod() { + return static_cast<signed char>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char max() { + return SCHAR_MIN; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char min() { + return SCHAR_MAX; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char bor() { + return static_cast<signed char>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char band() { + return ~static_cast<signed char>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char lor() { + return static_cast<signed char>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static signed char land() { + return static_cast<signed char>(1); + } +}; + +template <> +struct reduction_identity<bool> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static bool lor() { + return static_cast<bool>(false); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static bool land() { + return static_cast<bool>(true); + } +}; + +template <> +struct reduction_identity<short> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static short sum() { + return static_cast<short>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static short prod() { + return static_cast<short>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static short max() { return SHRT_MIN; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static short min() { return SHRT_MAX; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static short bor() { + return static_cast<short>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static short band() { + return ~static_cast<short>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static short lor() { + return static_cast<short>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static short land() { + return static_cast<short>(1); + } +}; + +template <> +struct reduction_identity<int> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static int sum() { + return static_cast<int>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static int prod() { + return static_cast<int>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static int max() { return INT_MIN; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static int min() { return INT_MAX; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static int bor() { + return static_cast<int>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static int band() { + return ~static_cast<int>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static int lor() { + return static_cast<int>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static int land() { + return static_cast<int>(1); + } +}; + +template <> +struct reduction_identity<long> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static long sum() { + return static_cast<long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long prod() { + return static_cast<long>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long max() { return LONG_MIN; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long min() { return LONG_MAX; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long bor() { + return static_cast<long>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long band() { + return ~static_cast<long>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long lor() { + return static_cast<long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long land() { + return static_cast<long>(1); + } +}; + +template <> +struct reduction_identity<long long> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static long long sum() { + return static_cast<long long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long long prod() { + return static_cast<long long>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long long max() { + return LLONG_MIN; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long long min() { + return LLONG_MAX; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long long bor() { + return static_cast<long long>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long long band() { + return ~static_cast<long long>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long long lor() { + return static_cast<long long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static long long land() { + return static_cast<long long>(1); + } +}; + +template <> +struct reduction_identity<unsigned char> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char sum() { + return static_cast<unsigned char>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char prod() { + return static_cast<unsigned char>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char max() { + return static_cast<unsigned char>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char min() { + return UCHAR_MAX; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char bor() { + return static_cast<unsigned char>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char band() { + return ~static_cast<unsigned char>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char lor() { + return static_cast<unsigned char>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned char land() { + return static_cast<unsigned char>(1); + } +}; + +template <> +struct reduction_identity<unsigned short> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short sum() { + return static_cast<unsigned short>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short prod() { + return static_cast<unsigned short>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short max() { + return static_cast<unsigned short>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short min() { + return USHRT_MAX; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short bor() { + return static_cast<unsigned short>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short band() { + return ~static_cast<unsigned short>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short lor() { + return static_cast<unsigned short>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned short land() { + return static_cast<unsigned short>(1); + } +}; + +template <> +struct reduction_identity<unsigned int> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int sum() { + return static_cast<unsigned int>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int prod() { + return static_cast<unsigned int>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int max() { + return static_cast<unsigned int>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int min() { + return UINT_MAX; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int bor() { + return static_cast<unsigned int>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int band() { + return ~static_cast<unsigned int>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int lor() { + return static_cast<unsigned int>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned int land() { + return static_cast<unsigned int>(1); + } +}; + +template <> +struct reduction_identity<unsigned long> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long sum() { + return static_cast<unsigned long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long prod() { + return static_cast<unsigned long>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long max() { + return static_cast<unsigned long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long min() { + return ULONG_MAX; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long bor() { + return static_cast<unsigned long>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long band() { + return ~static_cast<unsigned long>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long lor() { + return static_cast<unsigned long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long land() { + return static_cast<unsigned long>(1); + } +}; + +template <> +struct reduction_identity<unsigned long long> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long sum() { + return static_cast<unsigned long long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long prod() { + return static_cast<unsigned long long>(1); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long max() { + return static_cast<unsigned long long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long min() { + return ULLONG_MAX; + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long bor() { + return static_cast<unsigned long long>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long band() { + return ~static_cast<unsigned long long>(0x0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long lor() { + return static_cast<unsigned long long>(0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static unsigned long long land() { + return static_cast<unsigned long long>(1); + } +}; + +template <> +struct reduction_identity<float> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static float sum() { + return static_cast<float>(0.0f); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static float prod() { + return static_cast<float>(1.0f); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static float max() { return -FLT_MAX; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static float min() { return FLT_MAX; } +}; + +template <> +struct reduction_identity<double> { + KOKKOS_FORCEINLINE_FUNCTION constexpr static double sum() { + return static_cast<double>(0.0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static double prod() { + return static_cast<double>(1.0); + } + KOKKOS_FORCEINLINE_FUNCTION constexpr static double max() { return -DBL_MAX; } + KOKKOS_FORCEINLINE_FUNCTION constexpr static double min() { return DBL_MAX; } +}; + +// No __host__ __device__ annotation because long double treated as double in +// device code. May be revisited later if that is not true any more. +template <> +struct reduction_identity<long double> { + constexpr static long double sum() { return static_cast<long double>(0.0); } + constexpr static long double prod() { return static_cast<long double>(1.0); } + constexpr static long double max() { return -LDBL_MAX; } + constexpr static long double min() { return LDBL_MAX; } +}; + +} // namespace Kokkos + +#ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY +#undef KOKKOS_IMPL_PUBLIC_INCLUDE +#undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_REDUCTION_IDENTITY +#endif +#endif diff --git a/packages/kokkos/core/src/Kokkos_SYCL.hpp b/packages/kokkos/core/src/Kokkos_SYCL.hpp index a7f169606f087628260e502ccc5eebbaf67c9501..0f8e744eb632a2701c6cc53702e4425285e468b3 100644 --- a/packages/kokkos/core/src/Kokkos_SYCL.hpp +++ b/packages/kokkos/core/src/Kokkos_SYCL.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_SYCL_HPP #define KOKKOS_SYCL_HPP @@ -57,7 +25,12 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") #include <Kokkos_Macros.hpp> #ifdef KOKKOS_ENABLE_SYCL +// FIXME_SYCL +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else #include <CL/sycl.hpp> +#endif #include <Kokkos_SYCL_Space.hpp> #include <Kokkos_Layout.hpp> #include <Kokkos_ScratchSpace.hpp> @@ -134,11 +107,14 @@ class SYCL { static void impl_initialize(InitializationSettings const&); - int sycl_device() const; - static bool impl_is_initialized(); +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 static int concurrency(); +#else + int concurrency() const; +#endif + static const char* name(); inline Impl::SYCLInternal* impl_internal_space_instance() const { @@ -149,6 +125,13 @@ class SYCL { static std::ostream& impl_sycl_info(std::ostream& os, const sycl::device& device); + friend bool operator==(SYCL const& lhs, SYCL const& rhs) { + return lhs.impl_internal_space_instance() == + rhs.impl_internal_space_instance(); + } + friend bool operator!=(SYCL const& lhs, SYCL const& rhs) { + return !(lhs == rhs); + } Kokkos::Impl::HostSharedPtr<Impl::SYCLInternal> m_space_instance; }; @@ -161,7 +144,7 @@ struct DeviceTypeTraits<Kokkos::Experimental::SYCL> { /// \brief An ID to differentiate (for example) Serial from OpenMP in Tooling static constexpr DeviceType id = DeviceType::SYCL; static int device_id(const Kokkos::Experimental::SYCL& exec) { - return exec.sycl_device(); + return exec.impl_internal_space_instance()->m_syclDev; } }; } // namespace Experimental @@ -170,11 +153,9 @@ struct DeviceTypeTraits<Kokkos::Experimental::SYCL> { namespace Experimental { template <class... Args> std::vector<SYCL> partition_space(const SYCL& sycl_space, Args...) { -#ifdef __cpp_fold_expressions static_assert( (... && std::is_arithmetic_v<Args>), "Kokkos Error: partitioning arguments must be integers or floats"); -#endif sycl::context context = sycl_space.sycl_queue().get_context(); sycl::device device = diff --git a/packages/kokkos/core/src/Kokkos_SYCL_Space.hpp b/packages/kokkos/core/src/Kokkos_SYCL_Space.hpp index e147d04dc86c4415276e192ece1eda20c01110c0..239c6e3ce0b40311cb1d486051f61c9641b771ac 100644 --- a/packages/kokkos/core/src/Kokkos_SYCL_Space.hpp +++ b/packages/kokkos/core/src/Kokkos_SYCL_Space.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_SYCLSPACE_HPP #define KOKKOS_SYCLSPACE_HPP diff --git a/packages/kokkos/core/src/Kokkos_ScratchSpace.hpp b/packages/kokkos/core/src/Kokkos_ScratchSpace.hpp index 3e37eb61dcdc59a2ae2556aae0ce04128d0c4e04..a192b77f2802f56f0e7921526d7267c09537036c 100644 --- a/packages/kokkos/core/src/Kokkos_ScratchSpace.hpp +++ b/packages/kokkos/core/src/Kokkos_ScratchSpace.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_SCRATCHSPACE_HPP #define KOKKOS_SCRATCHSPACE_HPP @@ -73,9 +41,8 @@ class ScratchMemorySpace { "Instantiating ScratchMemorySpace on non-execution-space type."); public: - // Alignment of memory chunks returned by 'get' - // must be a power of two - enum { ALIGN = 8 }; + // Minimal overalignment used by view scratch allocations + constexpr static int ALIGN = 8; private: mutable char* m_iter_L0 = nullptr; @@ -87,7 +54,9 @@ class ScratchMemorySpace { mutable int m_offset = 0; mutable int m_default_level = 0; - enum { MASK = ALIGN - 1 }; // Alignment used by View::shmem_size +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + constexpr static int DEFAULT_ALIGNMENT_MASK = ALIGN - 1; +#endif public: //! Tag this class as a memory space @@ -101,39 +70,58 @@ class ScratchMemorySpace { static constexpr const char* name() { return "ScratchMemorySpace"; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + // This function is unused template <typename IntType> - KOKKOS_INLINE_FUNCTION static IntType align(const IntType& size) { - return (size + MASK) & ~MASK; + KOKKOS_DEPRECATED KOKKOS_INLINE_FUNCTION static constexpr IntType align( + const IntType& size) { + return (size + DEFAULT_ALIGNMENT_MASK) & ~DEFAULT_ALIGNMENT_MASK; } +#endif template <typename IntType> KOKKOS_INLINE_FUNCTION void* get_shmem(const IntType& size, int level = -1) const { - return get_shmem_common</*aligned*/ false>(size, 1, level); + return get_shmem_common</*alignment_requested*/ false>(size, 1, level); } template <typename IntType> KOKKOS_INLINE_FUNCTION void* get_shmem_aligned(const IntType& size, const ptrdiff_t alignment, int level = -1) const { - return get_shmem_common</*aligned*/ true>(size, alignment, level); + return get_shmem_common</*alignment_requested*/ true>(size, alignment, + level); } private: - template <bool aligned, typename IntType> - KOKKOS_INLINE_FUNCTION void* get_shmem_common(const IntType& size, - const ptrdiff_t alignment, - int level = -1) const { + template <bool alignment_requested, typename IntType> + KOKKOS_INLINE_FUNCTION void* get_shmem_common( + const IntType& size, [[maybe_unused]] const ptrdiff_t alignment, + int level = -1) const { if (level == -1) level = m_default_level; - auto& m_iter = (level == 0) ? m_iter_L0 : m_iter_L1; - auto& m_end = (level == 0) ? m_end_L0 : m_end_L1; - char* previous = m_iter; - const ptrdiff_t missalign = size_t(m_iter) % alignment; - if (missalign) m_iter += alignment - missalign; - - void* tmp = m_iter + m_offset * (aligned ? size : align(size)); - if (m_end < (m_iter += (aligned ? size : align(size)) * m_multiplier)) { - m_iter = previous; // put it back like it was + auto& m_iter = (level == 0) ? m_iter_L0 : m_iter_L1; + auto m_iter_old = m_iter; + if constexpr (alignment_requested) { + const ptrdiff_t missalign = size_t(m_iter) % alignment; + if (missalign) m_iter += alignment - missalign; + } + + // This is each thread's start pointer for its allocation + // Note: for team scratch m_offset is 0, since every + // thread will get back the same shared pointer + void* tmp = m_iter + m_offset * size; + uintptr_t increment = size * m_multiplier; + + // Cast to uintptr_t to avoid problems with pointer arithmetic using SYCL + const auto end_iter = + reinterpret_cast<uintptr_t>((level == 0) ? m_end_L0 : m_end_L1); + auto current_iter = reinterpret_cast<uintptr_t>(m_iter); + auto capacity = end_iter - current_iter; + + if (increment > capacity) { + // Request did overflow: return nullptr and reset m_iter + m_iter = m_iter_old; + tmp = nullptr; #ifdef KOKKOS_ENABLE_DEBUG // mfh 23 Jun 2015: printf call consumes 25 registers // in a CUDA build, so only print in debug mode. The @@ -141,9 +129,10 @@ class ScratchMemorySpace { KOKKOS_IMPL_DO_NOT_USE_PRINTF( "ScratchMemorySpace<...>::get_shmem: Failed to allocate " "%ld byte(s); remaining capacity is %ld byte(s)\n", - long(size), long(m_end - m_iter)); + long(size), long(capacity)); #endif // KOKKOS_ENABLE_DEBUG - tmp = nullptr; + } else { + m_iter += increment; } return tmp; } diff --git a/packages/kokkos/core/src/Kokkos_Serial.hpp b/packages/kokkos/core/src/Kokkos_Serial.hpp index ffdd1e9fc840595bd73c272ac592a19940f1a000..ede3c96b8bd071941d1d2a993b22157a6725bbc7 100644 --- a/packages/kokkos/core/src/Kokkos_Serial.hpp +++ b/packages/kokkos/core/src/Kokkos_Serial.hpp @@ -1,58 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_Serial.hpp /// \brief Declaration and definition of Kokkos::Serial device. #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_SERIAL_HPP #define KOKKOS_SERIAL_HPP @@ -172,7 +140,11 @@ class Serial { } /** \brief Return the maximum amount of concurrency. */ +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 static int concurrency() { return 1; } +#else + int concurrency() const { return 1; } +#endif //! Print configuration information to the given output stream. void print_configuration(std::ostream& os, bool verbose = false) const; @@ -203,19 +175,18 @@ class Serial { static const char* name(); Impl::SerialInternal* impl_internal_space_instance() const { -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - return m_space_instance; -#else return m_space_instance.get(); -#endif } private: -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - Impl::SerialInternal* m_space_instance; -#else Kokkos::Impl::HostSharedPtr<Impl::SerialInternal> m_space_instance; -#endif + friend bool operator==(Serial const& lhs, Serial const& rhs) { + return lhs.impl_internal_space_instance() == + rhs.impl_internal_space_instance(); + } + friend bool operator!=(Serial const& lhs, Serial const& rhs) { + return !(lhs == rhs); + } //-------------------------------------------------------------------------- }; diff --git a/packages/kokkos/core/src/Kokkos_TaskScheduler.hpp b/packages/kokkos/core/src/Kokkos_TaskScheduler.hpp index c3453b79e7d38dd696cffb485686b84db601a990..690c845b303316f6e40656eeca363a448e114857 100644 --- a/packages/kokkos/core/src/Kokkos_TaskScheduler.hpp +++ b/packages/kokkos/core/src/Kokkos_TaskScheduler.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_TASKSCHEDULER_HPP #define KOKKOS_TASKSCHEDULER_HPP diff --git a/packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp b/packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp index 075a9bae2c1fa60e9615b603692ca5e870972af3..203fb16eaf0b4de3757df42c450bf684d9a547e5 100644 --- a/packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp +++ b/packages/kokkos/core/src/Kokkos_TaskScheduler_fwd.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_TASKSCHEDULER_FWD_HPP #define KOKKOS_TASKSCHEDULER_FWD_HPP diff --git a/packages/kokkos/core/src/Kokkos_Threads.hpp b/packages/kokkos/core/src/Kokkos_Threads.hpp index e6dcad54c1409fc81df6679efa7527230705a5e6..db3b771f2b46b779edfa4c29a6b5bd720555184c 100644 --- a/packages/kokkos/core/src/Kokkos_Threads.hpp +++ b/packages/kokkos/core/src/Kokkos_Threads.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_THREADS_HPP #define KOKKOS_THREADS_HPP @@ -122,7 +90,11 @@ class Threads { "Kokkos::Threads::fence: Unnamed Instance Fence") const; /** \brief Return the maximum amount of concurrency. */ +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 static int concurrency(); +#else + int concurrency() const; +#endif /// \brief Free any resources being consumed by the device. /// @@ -165,6 +137,9 @@ class Threads { static const char* name(); //@} //---------------------------------------- + private: + friend bool operator==(Threads const&, Threads const&) { return true; } + friend bool operator!=(Threads const&, Threads const&) { return false; } }; namespace Tools { diff --git a/packages/kokkos/core/src/Kokkos_Timer.hpp b/packages/kokkos/core/src/Kokkos_Timer.hpp index 38309b0a3e88374abe65169a59369194007e800d..a210b6ff18329eb709243ef688460ddaaf6f2603 100644 --- a/packages/kokkos/core/src/Kokkos_Timer.hpp +++ b/packages/kokkos/core/src/Kokkos_Timer.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TIMER_HPP #define KOKKOS_TIMER_HPP diff --git a/packages/kokkos/core/src/Kokkos_Tuners.hpp b/packages/kokkos/core/src/Kokkos_Tuners.hpp index dba602732c957098b5275adaba1c9bfda61a5efe..618401654e74042d8fdcd98a1a7a242f661a7199 100644 --- a/packages/kokkos/core/src/Kokkos_Tuners.hpp +++ b/packages/kokkos/core/src/Kokkos_Tuners.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_KOKKOS_TUNERS_HPP #define KOKKOS_KOKKOS_TUNERS_HPP diff --git a/packages/kokkos/core/src/Kokkos_UniqueToken.hpp b/packages/kokkos/core/src/Kokkos_UniqueToken.hpp index 3c58423d37dcdce407a6975b701e75dad3d3f60a..18c714f786b8dae8a7889f1c3f77f7a6c6c5a5b1 100644 --- a/packages/kokkos/core/src/Kokkos_UniqueToken.hpp +++ b/packages/kokkos/core/src/Kokkos_UniqueToken.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_UNIQUE_TOKEN_HPP #define KOKKOS_UNIQUE_TOKEN_HPP @@ -94,7 +62,7 @@ class UniqueToken { }; /// \brief Instance scope UniqueToken allows for a max size other than -/// execution_space::concurrency() +/// execution_space().concurrency() /// /// This object should behave like a ref-counted object, so that when the last /// instance is destroyed, resources are free if needed @@ -111,9 +79,9 @@ class UniqueToken<ExecutionSpace, UniqueTokenScope::Instance> /// threads that will attempt to acquire the UniqueToken. This constructor is /// most commonly useful when you: /// 1) Have a loop bound that may be smaller than - /// execution_space::concurrency(). + /// execution_space().concurrency(). /// 2) Want a per-team unique token in the range [0, - /// execution_space::concurrency() / team_size) + /// execution_space().concurrency() / team_size) UniqueToken(size_type max_size, execution_space const& = execution_space()); }; diff --git a/packages/kokkos/core/src/Kokkos_Vectorization.hpp b/packages/kokkos/core/src/Kokkos_Vectorization.hpp index 4314ea4417e0e61fac9a9cae8b891d099787754f..e9477ae84b98e9e76dfa52030dc901e2082aa4d8 100644 --- a/packages/kokkos/core/src/Kokkos_Vectorization.hpp +++ b/packages/kokkos/core/src/Kokkos_Vectorization.hpp @@ -1,57 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// \file Kokkos_Vectorization.hpp /// \brief Declaration and definition of Kokkos::Vectorization interface. #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_VECTORIZATION_HPP #define KOKKOS_VECTORIZATION_HPP diff --git a/packages/kokkos/core/src/Kokkos_View.hpp b/packages/kokkos/core/src/Kokkos_View.hpp index f8dcfc869e195b93f2ed899b89f6f64be62c46e3..85957ba8fa540d88a5786f8328ef0153e2686d0f 100644 --- a/packages/kokkos/core/src/Kokkos_View.hpp +++ b/packages/kokkos/core/src/Kokkos_View.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_VIEW_HPP #define KOKKOS_VIEW_HPP @@ -67,6 +35,11 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") #include <impl/Kokkos_Tools.hpp> +#ifdef KOKKOS_ENABLE_IMPL_MDSPAN +#include <View/MDSpan/Kokkos_MDSpan_Extents.hpp> +#endif +#include <Kokkos_MinMaxClamp.hpp> + //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- @@ -474,11 +447,9 @@ using is_always_assignable = is_always_assignable_impl< std::remove_reference_t<View1>, std::remove_const_t<std::remove_reference_t<View2>>>; -#ifdef KOKKOS_ENABLE_CXX17 template <class T1, class T2> inline constexpr bool is_always_assignable_v = is_always_assignable<T1, T2>::value; -#endif template <class... ViewTDst, class... ViewTSrc> constexpr bool is_assignable(const Kokkos::View<ViewTDst...>& dst, @@ -489,13 +460,8 @@ constexpr bool is_assignable(const Kokkos::View<ViewTDst...>& dst, Kokkos::Impl::ViewMapping<DstTraits, SrcTraits, typename DstTraits::specialize>; -#ifdef KOKKOS_ENABLE_CXX17 return is_always_assignable_v<Kokkos::View<ViewTDst...>, Kokkos::View<ViewTSrc...>> || -#else - return is_always_assignable<Kokkos::View<ViewTDst...>, - Kokkos::View<ViewTSrc...>>::value || -#endif (mapping_type::is_assignable && ((DstTraits::dimension::rank_dynamic >= 1) || (dst.static_extent(0) == src.extent(0))) && @@ -596,6 +562,9 @@ struct is_view<View<D, P...>> : public std::true_type {}; template <class D, class... P> struct is_view<const View<D, P...>> : public std::true_type {}; +template <class T> +inline constexpr bool is_view_v = is_view<T>::value; + template <class DataType, class... Properties> class View : public ViewTraits<DataType, Properties...> { private: @@ -1399,9 +1368,6 @@ class View : public ViewTraits<DataType, Properties...> { .template get_label<typename traits::memory_space>(); } - private: - enum class check_input_args : bool { yes = true, no = false }; - public: //---------------------------------------- // Allocation according to allocation properties and array layout @@ -1410,25 +1376,16 @@ class View : public ViewTraits<DataType, Properties...> { explicit inline View( const Impl::ViewCtorProp<P...>& arg_prop, std::enable_if_t<!Impl::ViewCtorProp<P...>::has_pointer, - typename traits::array_layout> const& arg_layout, - check_input_args check_args = check_input_args::no) + typename traits::array_layout> const& arg_layout) : m_track(), m_map() { - // Append layout and spaces if not input - using alloc_prop_input = Impl::ViewCtorProp<P...>; - - // use 'std::integral_constant<unsigned,I>' for non-types - // to avoid duplicate class error. - using alloc_prop = Impl::ViewCtorProp< - P..., - std::conditional_t<alloc_prop_input::has_label, - std::integral_constant<unsigned int, 0>, - std::string>, - std::conditional_t<alloc_prop_input::has_memory_space, - std::integral_constant<unsigned int, 1>, - typename traits::device_type::memory_space>, - std::conditional_t<alloc_prop_input::has_execution_space, - std::integral_constant<unsigned int, 2>, - typename traits::device_type::execution_space>>; + // Copy the input allocation properties with possibly defaulted properties + // We need to split it in two to avoid MSVC compiler errors + auto prop_copy_tmp = + Impl::with_properties_if_unset(arg_prop, std::string{}); + auto prop_copy = Impl::with_properties_if_unset( + prop_copy_tmp, typename traits::device_type::memory_space{}, + typename traits::device_type::execution_space{}); + using alloc_prop = decltype(prop_copy); static_assert(traits::is_managed, "View allocation constructor requires managed memory"); @@ -1442,28 +1399,21 @@ class View : public ViewTraits<DataType, Properties...> { "execution space"); } - // Copy the input allocation properties with possibly defaulted properties - alloc_prop prop_copy(arg_prop); - - if (check_args == check_input_args::yes) { - size_t i0 = arg_layout.dimension[0]; - size_t i1 = arg_layout.dimension[1]; - size_t i2 = arg_layout.dimension[2]; - size_t i3 = arg_layout.dimension[3]; - size_t i4 = arg_layout.dimension[4]; - size_t i5 = arg_layout.dimension[5]; - size_t i6 = arg_layout.dimension[6]; - size_t i7 = arg_layout.dimension[7]; - - const std::string& alloc_name = - static_cast<Kokkos::Impl::ViewCtorProp<void, std::string> const&>( - prop_copy) - .value; - Impl::runtime_check_rank( - traits::rank, traits::rank_dynamic, - std::is_same<typename traits::specialize, void>::value, i0, i1, i2, - i3, i4, i5, i6, i7, alloc_name); - } + size_t i0 = arg_layout.dimension[0]; + size_t i1 = arg_layout.dimension[1]; + size_t i2 = arg_layout.dimension[2]; + size_t i3 = arg_layout.dimension[3]; + size_t i4 = arg_layout.dimension[4]; + size_t i5 = arg_layout.dimension[5]; + size_t i6 = arg_layout.dimension[6]; + size_t i7 = arg_layout.dimension[7]; + + const std::string& alloc_name = + Impl::get_property<Impl::LabelTag>(prop_copy); + Impl::runtime_check_rank( + traits::rank, traits::rank_dynamic, + std::is_same<typename traits::specialize, void>::value, i0, i1, i2, i3, + i4, i5, i6, i7, alloc_name); //------------------------------------------------------------ #if defined(KOKKOS_ENABLE_CUDA) @@ -1508,8 +1458,7 @@ class View : public ViewTraits<DataType, Properties...> { explicit KOKKOS_INLINE_FUNCTION View( const Impl::ViewCtorProp<P...>& arg_prop, std::enable_if_t<Impl::ViewCtorProp<P...>::has_pointer, - typename traits::array_layout> const& arg_layout, - check_input_args /*ignored*/ = check_input_args::no) // Not checking + typename traits::array_layout> const& arg_layout) : m_track() // No memory tracking , m_map(arg_prop, arg_layout) { @@ -1535,8 +1484,7 @@ class View : public ViewTraits<DataType, Properties...> { const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG) : View(arg_prop, typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3, - arg_N4, arg_N5, arg_N6, arg_N7), - check_input_args::yes) { + arg_N4, arg_N5, arg_N6, arg_N7)) { static_assert(traits::array_layout::is_extent_constructible, "Layout is not constructible from extent arguments. Use " "overload taking a layout object instead."); @@ -1556,8 +1504,7 @@ class View : public ViewTraits<DataType, Properties...> { const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG) : View(arg_prop, typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3, - arg_N4, arg_N5, arg_N6, arg_N7), - check_input_args::yes) { + arg_N4, arg_N5, arg_N6, arg_N7)) { static_assert(traits::array_layout::is_extent_constructible, "Layout is not constructible from extent arguments. Use " "overload taking a layout object instead."); @@ -1569,8 +1516,7 @@ class View : public ViewTraits<DataType, Properties...> { const Label& arg_label, std::enable_if_t<Kokkos::Impl::is_view_label<Label>::value, typename traits::array_layout> const& arg_layout) - : View(Impl::ViewCtorProp<std::string>(arg_label), arg_layout, - check_input_args::yes) {} + : View(Impl::ViewCtorProp<std::string>(arg_label), arg_layout) {} // Allocate label and layout, must disambiguate from subview constructor. template <typename Label> @@ -1587,8 +1533,7 @@ class View : public ViewTraits<DataType, Properties...> { const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG) : View(Impl::ViewCtorProp<std::string>(arg_label), typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3, - arg_N4, arg_N5, arg_N6, arg_N7), - check_input_args::yes) { + arg_N4, arg_N5, arg_N6, arg_N7)) { static_assert(traits::array_layout::is_extent_constructible, "Layout is not constructible from extent arguments. Use " "overload taking a layout object instead."); @@ -1653,8 +1598,7 @@ class View : public ViewTraits<DataType, Properties...> { const size_t arg_N7 = KOKKOS_IMPL_CTOR_DEFAULT_ARG) : View(Impl::ViewCtorProp<pointer_type>(arg_ptr), typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3, - arg_N4, arg_N5, arg_N6, arg_N7), - check_input_args::yes) { + arg_N4, arg_N5, arg_N6, arg_N7)) { static_assert(traits::array_layout::is_extent_constructible, "Layout is not constructible from extent arguments. Use " "overload taking a layout object instead."); @@ -1692,19 +1636,27 @@ class View : public ViewTraits<DataType, Properties...> { arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7)); } + private: + // Want to be able to align to minimum scratch alignment or sizeof or alignof + // elements + static constexpr size_t scratch_value_alignment = + max({sizeof(typename traits::value_type), + alignof(typename traits::value_type), + static_cast<size_t>( + traits::execution_space::scratch_memory_space::ALIGN)}); + + public: static KOKKOS_INLINE_FUNCTION size_t shmem_size(typename traits::array_layout const& arg_layout) { - return map_type::memory_span(arg_layout) + - sizeof(typename traits::value_type); + return map_type::memory_span(arg_layout) + scratch_value_alignment; } explicit KOKKOS_INLINE_FUNCTION View( const typename traits::execution_space::scratch_memory_space& arg_space, const typename traits::array_layout& arg_layout) - : View(Impl::ViewCtorProp<pointer_type>( - reinterpret_cast<pointer_type>(arg_space.get_shmem_aligned( - map_type::memory_span(arg_layout), - sizeof(typename traits::value_type)))), + : View(Impl::ViewCtorProp<pointer_type>(reinterpret_cast<pointer_type>( + arg_space.get_shmem_aligned(map_type::memory_span(arg_layout), + scratch_value_alignment))), arg_layout) {} explicit KOKKOS_INLINE_FUNCTION View( @@ -1722,10 +1674,9 @@ class View : public ViewTraits<DataType, Properties...> { map_type::memory_span(typename traits::array_layout( arg_N0, arg_N1, arg_N2, arg_N3, arg_N4, arg_N5, arg_N6, arg_N7)), - sizeof(typename traits::value_type)))), + scratch_value_alignment))), typename traits::array_layout(arg_N0, arg_N1, arg_N2, arg_N3, - arg_N4, arg_N5, arg_N6, arg_N7), - check_input_args::yes) { + arg_N4, arg_N5, arg_N6, arg_N7)) { static_assert(traits::array_layout::is_extent_constructible, "Layout is not constructible from extent arguments. Use " "overload taking a layout object instead."); @@ -1983,18 +1934,6 @@ KOKKOS_INLINE_FUNCTION DeducedCommonPropsType<Views...> common_view_alloc_prop( } // namespace Kokkos -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -namespace Kokkos { -namespace Impl { - -template <class T> -using is_view KOKKOS_DEPRECATED_WITH_COMMENT("Use Kokkos::is_view instead!") = - Kokkos::is_view<T>; - -} /* namespace Impl */ -} /* namespace Kokkos */ -#endif - #include <impl/Kokkos_ViewUniformType.hpp> #include <impl/Kokkos_Atomic_View.hpp> diff --git a/packages/kokkos/core/src/Kokkos_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Kokkos_WorkGraphPolicy.hpp index 129a489387a46297bdd5ce17d3ad7873cbc1c80b..efa56a086e36ceafae0ce05b22b30b49c7d41d2c 100644 --- a/packages/kokkos/core/src/Kokkos_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/Kokkos_WorkGraphPolicy.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_WORKGRAPHPOLICY_HPP #define KOKKOS_WORKGRAPHPOLICY_HPP diff --git a/packages/kokkos/core/src/Kokkos_hwloc.hpp b/packages/kokkos/core/src/Kokkos_hwloc.hpp index abbec5409e067fae0bce73d3fb37d705a1a421aa..fbf9c137e634b4b4120c8145b5551bbf8692e2f3 100644 --- a/packages/kokkos/core/src/Kokkos_hwloc.hpp +++ b/packages/kokkos/core/src/Kokkos_hwloc.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_HWLOC_HPP #define KOKKOS_HWLOC_HPP diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp index f3216095be34b3898124637123ee2cac6cbc25fa..f54c44d66f01b6f13db5aecbb6d7ab783650aed3 100644 --- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.cpp @@ -1,80 +1,95 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #define KOKKOS_IMPL_PUBLIC_INCLUDE #include <OpenACC/Kokkos_OpenACC.hpp> #include <OpenACC/Kokkos_OpenACC_Instance.hpp> +#include <OpenACC/Kokkos_OpenACC_Traits.hpp> #include <impl/Kokkos_Profiling.hpp> #include <impl/Kokkos_ExecSpaceManager.hpp> +#include <impl/Kokkos_DeviceManagement.hpp> -#include <ostream> +#include <iostream> Kokkos::Experimental::OpenACC::OpenACC() - : m_space_instance(Impl::OpenACCInternal::singleton()) {} + : m_space_instance( + &Kokkos::Experimental::Impl::OpenACCInternal::singleton(), + [](Impl::OpenACCInternal*) {}) { + Impl::OpenACCInternal::singleton().verify_is_initialized( + "OpenACC instance constructor"); +} + +Kokkos::Experimental::OpenACC::OpenACC(int async_arg) + : m_space_instance(new Kokkos::Experimental::Impl::OpenACCInternal, + [](Impl::OpenACCInternal* ptr) { + ptr->finalize(); + delete ptr; + }) { + Impl::OpenACCInternal::singleton().verify_is_initialized( + "OpenACC instance constructor"); + m_space_instance->initialize(async_arg); +} void Kokkos::Experimental::OpenACC::impl_initialize( InitializationSettings const& settings) { - Impl::OpenACCInternal::singleton()->initialize(settings); + if (Impl::OpenACC_Traits::may_fallback_to_host && + acc_get_num_devices(Impl::OpenACC_Traits::dev_type) == 0 && + !settings.has_device_id()) { + if (show_warnings()) { + std::cerr << "Warning: No GPU available for execution, falling back to" + " using the host!" + << std::endl; + } + acc_set_device_type(acc_device_host); + Impl::OpenACCInternal::m_acc_device_num = + acc_get_device_num(acc_device_host); + } else { + using Kokkos::Impl::get_gpu; + int const dev_num = get_gpu(settings); + acc_set_device_num(dev_num, Impl::OpenACC_Traits::dev_type); + Impl::OpenACCInternal::m_acc_device_num = dev_num; + } + Impl::OpenACCInternal::singleton().initialize(); } void Kokkos::Experimental::OpenACC::impl_finalize() { - Impl::OpenACCInternal::singleton()->finalize(); + Impl::OpenACCInternal::singleton().finalize(); } bool Kokkos::Experimental::OpenACC::impl_is_initialized() { - return Impl::OpenACCInternal::singleton()->is_initialized(); + return Impl::OpenACCInternal::singleton().is_initialized(); } void Kokkos::Experimental::OpenACC::print_configuration(std::ostream& os, bool verbose) const { - os << "macro KOKKOS_ENABLE_OPENACC is defined\n"; // FIXME_OPENACC + os << "Device Execution Space:\n"; + os << " KOKKOS_ENABLE_OPENACC: yes\n"; + os << "OpenACC Options:\n"; + os << " KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS: "; +#ifdef KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS + os << "yes\n"; +#else + os << "no\n"; +#endif m_space_instance->print_configuration(os, verbose); } void Kokkos::Experimental::OpenACC::fence(std::string const& name) const { - Impl::OpenACCInternal::singleton()->fence(name); + m_space_instance->fence(name); } void Kokkos::Experimental::OpenACC::impl_static_fence(std::string const& name) { @@ -90,6 +105,14 @@ uint32_t Kokkos::Experimental::OpenACC::impl_instance_id() const noexcept { return m_space_instance->instance_id(); } +int Kokkos::Experimental::OpenACC::acc_async_queue() const { + return m_space_instance->m_async_arg; +} + +int Kokkos::Experimental::OpenACC::acc_device_number() const { + return Impl::OpenACCInternal::m_acc_device_num; +} + namespace Kokkos { namespace Impl { int g_openacc_space_factory_initialized = diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp index 3ad59057b5158772e14e94e0a4cd216d1236451b..a115bc90f886ee7f406f4c8c01849ab10497f5ef 100644 --- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC.hpp @@ -1,55 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_OPENACC_HPP @@ -62,12 +30,17 @@ KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") #include <impl/Kokkos_InitializationSettings.hpp> #include <impl/Kokkos_Profiling_Interface.hpp> #include <OpenACC/Kokkos_OpenACC_Traits.hpp> +#include <impl/Kokkos_HostSharedPtr.hpp> #include <openacc.h> #include <iosfwd> #include <string> +// FIXME_OPENACC: Below macro is temporarily enabled to avoid issues on existing +// OpenACC compilers not supporting lambda with parallel loops. +#define KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS + namespace Kokkos::Experimental::Impl { class OpenACCInternal; } @@ -75,7 +48,15 @@ class OpenACCInternal; namespace Kokkos::Experimental { class OpenACC { - Impl::OpenACCInternal* m_space_instance = nullptr; + Kokkos::Impl::HostSharedPtr<Impl::OpenACCInternal> m_space_instance; + + friend bool operator==(OpenACC const& lhs, OpenACC const& rhs) { + return lhs.impl_internal_space_instance() == + rhs.impl_internal_space_instance(); + } + friend bool operator!=(OpenACC const& lhs, OpenACC const& rhs) { + return !(lhs == rhs); + } public: using execution_space = OpenACC; @@ -89,6 +70,8 @@ class OpenACC { OpenACC(); + explicit OpenACC(int async_arg); + static void impl_initialize(InitializationSettings const& settings); static void impl_finalize(); static bool impl_is_initialized(); @@ -100,9 +83,19 @@ class OpenACC { static void impl_static_fence(std::string const& name); static char const* name() { return "OpenACC"; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 static int concurrency() { return 256000; } // FIXME_OPENACC +#else + int concurrency() const { return 256000; } // FIXME_OPENACC +#endif static bool in_parallel() { return acc_on_device(acc_device_not_host); } uint32_t impl_instance_id() const noexcept; + Impl::OpenACCInternal* impl_internal_space_instance() const { + return m_space_instance.get(); + } + + int acc_async_queue() const; + int acc_device_number() const; }; } // namespace Kokkos::Experimental @@ -112,14 +105,8 @@ struct Kokkos::Tools::Experimental::DeviceTypeTraits< ::Kokkos::Experimental::OpenACC> { static constexpr DeviceType id = ::Kokkos::Profiling::Experimental::DeviceType::OpenACC; - // FIXME_OPENACC: Need to return the device id from the execution space - // instance. In fact, acc_get_device_num() will return the same value as the - // device id from the execution space instance except for the host fallback - // case, where the device id may need to be updated with the value of - // acc_get_device_num(). - static int device_id(const Kokkos::Experimental::OpenACC&) { - using Kokkos::Experimental::Impl::OpenACC_Traits; - return acc_get_device_num(OpenACC_Traits::dev_type); + static int device_id(const Kokkos::Experimental::OpenACC& accInstance) { + return accInstance.acc_device_number(); } }; diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp index bc2ba181562927bfa9154a7f584080384ed177ca..141ec77fd1f01187b61b4cb60041714654580632 100644 --- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.cpp @@ -1,58 +1,29 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #define KOKKOS_IMPL_PUBLIC_INCLUDE #include <OpenACC/Kokkos_OpenACC.hpp> #include <OpenACC/Kokkos_OpenACCSpace.hpp> +#include <OpenACC/Kokkos_OpenACC_DeepCopy.hpp> #include <impl/Kokkos_MemorySpace.hpp> #include <impl/Kokkos_Profiling_Interface.hpp> #include <openacc.h> -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- void *Kokkos::Experimental::OpenACCSpace::allocate( const Kokkos::Experimental::OpenACC &exec_space, const size_t arg_alloc_size) const { @@ -80,24 +51,8 @@ void *Kokkos::Experimental::OpenACCSpace::impl_allocate( const Kokkos::Experimental::OpenACC &exec_space, const char *arg_label, const size_t arg_alloc_size, const size_t arg_logical_size, const Kokkos::Tools::SpaceHandle arg_handle) const { - static_assert(sizeof(void *) == sizeof(uintptr_t), - "Error sizeof(void*) != sizeof(uintptr_t)"); - - void *ptr = nullptr; - - // FIXME_OPENACC multiple device instances are not yet supported, and thus - // exec_space is ignored for now. (void)exec_space; - - ptr = acc_malloc(arg_alloc_size); - - if (Kokkos::Profiling::profileLibraryLoaded()) { - const size_t reported_size = - (arg_logical_size > 0) ? arg_logical_size : arg_alloc_size; - Kokkos::Profiling::allocateData(arg_handle, arg_label, ptr, reported_size); - } - - return ptr; + return impl_allocate(arg_label, arg_alloc_size, arg_logical_size, arg_handle); } void *Kokkos::Experimental::OpenACCSpace::impl_allocate( @@ -109,21 +64,8 @@ void *Kokkos::Experimental::OpenACCSpace::impl_allocate( void *ptr = nullptr; - //[DEBUG] Disabled due to the synchronous behavior of the current - // implementation. - /* - OpenACC::impl_static_fence( - "Kokkos::OpenACCSpace::impl_allocate: Pre OpenACC Allocation"); - */ - ptr = acc_malloc(arg_alloc_size); - //[DEBUG] Disabled due to the synchronous behavior of the current - // implementation. - /* - OpenACC::impl_static_fence( - "Kokkos::OpenACCSpace::impl_allocate: Post OpenACC Allocation"); - */ if (Kokkos::Profiling::profileLibraryLoaded()) { const size_t reported_size = (arg_logical_size > 0) ? arg_logical_size : arg_alloc_size; @@ -159,64 +101,3 @@ void Kokkos::Experimental::OpenACCSpace::impl_deallocate( acc_free(arg_alloc_ptr); } } - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -#ifdef KOKKOS_ENABLE_DEBUG -Kokkos::Impl::SharedAllocationRecord<void, void> SharedAllocationRecord< - Kokkos::Experimental::OpenACCSpace, void>::s_root_record; -#endif - -Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, - void>::~SharedAllocationRecord() { - m_space.deallocate(m_label.c_str(), - SharedAllocationRecord<void, void>::m_alloc_ptr, - (SharedAllocationRecord<void, void>::m_alloc_size - - sizeof(SharedAllocationHeader))); -} - -Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, void>:: - SharedAllocationRecord( - const Kokkos::Experimental::OpenACCSpace &arg_space, - const std::string &arg_label, const size_t arg_alloc_size, - const SharedAllocationRecord<void, void>::function_type arg_dealloc) - // Pass through allocated [ SharedAllocationHeader , user_memory ] - // Pass through deallocation function - : base_t( -#ifdef KOKKOS_ENABLE_DEBUG - &SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, - void>::s_root_record, -#endif - Impl::checked_allocation_with_header(arg_space, arg_label, - arg_alloc_size), - sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, - arg_label), - m_space(arg_space) { - SharedAllocationHeader header; - - this->base_t::_fill_host_accessible_header_info(header, arg_label); - - Kokkos::Impl::DeepCopy<Experimental::OpenACCSpace, HostSpace>( - RecordBase::m_alloc_ptr, &header, sizeof(SharedAllocationHeader)); - Kokkos::fence( - "SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, " - "void>::SharedAllocationRecord(): fence after copying header from " - "HostSpace"); -} - -//============================================================================== -// <editor-fold desc="Explicit instantiations of CRTP Base classes"> {{{1 - -#include <impl/Kokkos_SharedAlloc_timpl.hpp> - -// To avoid additional compilation cost for something that's (mostly?) not -// performance sensitive, we explicitly instantiate these CRTP base classes -// here, where we have access to the associated *_timpl.hpp header files. -template class Kokkos::Impl::HostInaccessibleSharedAllocationRecordCommon< - Kokkos::Experimental::OpenACCSpace>; -template class Kokkos::Impl::SharedAllocationRecordCommon< - Kokkos::Experimental::OpenACCSpace>; - -// </editor-fold> end Explicit instantiations of CRTP Base classes }}}1 -//============================================================================== diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp index a7347e8f91d111dcd6d24eb06c54c9181874903e..4e7170cbbdf350e05e6a36ae77ab2f683d367076 100644 --- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACCSpace.hpp @@ -1,64 +1,30 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 static_assert(false, "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif #endif #ifndef KOKKOS_OPENACC_SPACE_HPP #define KOKKOS_OPENACC_SPACE_HPP #include <Kokkos_Concepts.hpp> - #include <impl/Kokkos_Tools.hpp> -#include <impl/Kokkos_SharedAlloc.hpp> #include <openacc.h> #include <iosfwd> @@ -141,109 +107,4 @@ struct Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::OpenACCSpace, }; /*--------------------------------------------------------------------------*/ -template <> -class Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, - void> - : public HostInaccessibleSharedAllocationRecordCommon< - Kokkos::Experimental::OpenACCSpace> { - private: - friend class HostInaccessibleSharedAllocationRecordCommon< - Kokkos::Experimental::OpenACCSpace>; - friend class SharedAllocationRecordCommon<Kokkos::Experimental::OpenACCSpace>; - friend Kokkos::Experimental::OpenACCSpace; - - using base_t = HostInaccessibleSharedAllocationRecordCommon< - Kokkos::Experimental::OpenACCSpace>; - using RecordBase = SharedAllocationRecord<void, void>; - - SharedAllocationRecord(const SharedAllocationRecord&) = delete; - SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete; - - /**\brief Root record for tracked allocations from this OpenACCSpace - * instance */ - static RecordBase s_root_record; - - const Kokkos::Experimental::OpenACCSpace m_space; - - protected: - ~SharedAllocationRecord(); - SharedAllocationRecord() = default; - - template <typename ExecutionSpace> - SharedAllocationRecord( - const ExecutionSpace& /*exec_space*/, - const Kokkos::Experimental::OpenACCSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &deallocate) - : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size, - arg_dealloc) {} - - SharedAllocationRecord( - const Kokkos::Experimental::OpenACCSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size, - const RecordBase::function_type arg_dealloc = &deallocate); - - public: - KOKKOS_INLINE_FUNCTION static SharedAllocationRecord* allocate( - const Kokkos::Experimental::OpenACCSpace& arg_space, - const std::string& arg_label, const size_t arg_alloc_size) { - if (acc_on_device(acc_device_host)) { - return new SharedAllocationRecord(arg_space, arg_label, arg_alloc_size); - } else { - return nullptr; - } - } -}; - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - -// FIXME_OPENACC: Need to update the DeepCopy implementations below to support -// multiple execution space instances. -// The current OpenACC backend implementation assumes that there is only one -// device execution space instance, and all the device operations (e.g., memory -// transfers, kernel launches, etc.) are implemented to be synchronous, which -// does not violate the Kokkos execution semantics with the single execution -// space instance. -template <class ExecutionSpace> -struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace, - Kokkos::Experimental::OpenACCSpace, - ExecutionSpace> { - DeepCopy(void* dst, const void* src, size_t n) { - // The behavior of acc_memcpy_device when bytes argument is zero is - // clarified only in the latest OpenACC specification (V3.2), and thus the - // value checking is added as a safeguard. (The current NVHPC (V22.5) - // supports OpenACC V2.7.) - if (n > 0) acc_memcpy_device(dst, const_cast<void*>(src), n); - } - DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { - exec.fence(); - if (n > 0) acc_memcpy_device(dst, const_cast<void*>(src), n); - } -}; - -template <class ExecutionSpace> -struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace, - Kokkos::HostSpace, ExecutionSpace> { - DeepCopy(void* dst, const void* src, size_t n) { - if (n > 0) acc_memcpy_to_device(dst, const_cast<void*>(src), n); - } - DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { - exec.fence(); - if (n > 0) acc_memcpy_to_device(dst, const_cast<void*>(src), n); - } -}; - -template <class ExecutionSpace> -struct Kokkos::Impl::DeepCopy< - Kokkos::HostSpace, Kokkos::Experimental::OpenACCSpace, ExecutionSpace> { - DeepCopy(void* dst, const void* src, size_t n) { - if (n > 0) acc_memcpy_from_device(dst, const_cast<void*>(src), n); - } - DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { - exec.fence(); - if (n > 0) acc_memcpy_from_device(dst, const_cast<void*>(src), n); - } -}; - #endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_DeepCopy.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_DeepCopy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4aed7e00f7651eeeba9b2ab9d87c7ccbdb766488 --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_DeepCopy.hpp @@ -0,0 +1,135 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_DEEP_COPY_HPP +#define KOKKOS_OPENACC_DEEP_COPY_HPP + +#include <OpenACC/Kokkos_OpenACC.hpp> +#include <OpenACC/Kokkos_OpenACCSpace.hpp> + +#include <Kokkos_Concepts.hpp> + +#include <openacc.h> + +template <> +struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace, + Kokkos::Experimental::OpenACCSpace, + Kokkos::Experimental::OpenACC> { + DeepCopy(void* dst, const void* src, size_t n) { + // The behavior of acc_memcpy_device when bytes argument is zero is + // clarified only in the latest OpenACC specification (V3.2), and thus the + // value checking is added as a safeguard. (The current NVHPC (V22.5) + // supports OpenACC V2.7.) + if (n > 0) { + acc_memcpy_device(dst, const_cast<void*>(src), n); + } + } + DeepCopy(const Kokkos::Experimental::OpenACC& exec, void* dst, + const void* src, size_t n) { + if (n > 0) { + acc_memcpy_device_async(dst, const_cast<void*>(src), n, + exec.acc_async_queue()); + } + } +}; + +template <class ExecutionSpace> +struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace, + Kokkos::Experimental::OpenACCSpace, + ExecutionSpace> { + DeepCopy(void* dst, const void* src, size_t n) { + if (n > 0) { + acc_memcpy_device(dst, const_cast<void*>(src), n); + } + } + DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { + exec.fence( + "Kokkos::Impl::DeepCopy<OpenACCSpace, OpenACCSpace, " + "ExecutionSpace>::DeepCopy: fence before copy"); + if (n > 0) { + acc_memcpy_device(dst, const_cast<void*>(src), n); + } + } +}; + +template <> +struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace, + Kokkos::HostSpace, + Kokkos::Experimental::OpenACC> { + DeepCopy(void* dst, const void* src, size_t n) { + if (n > 0) acc_memcpy_to_device(dst, const_cast<void*>(src), n); + } + DeepCopy(const Kokkos::Experimental::OpenACC& exec, void* dst, + const void* src, size_t n) { + if (n > 0) + acc_memcpy_to_device_async(dst, const_cast<void*>(src), n, + exec.acc_async_queue()); + } +}; + +template <class ExecutionSpace> +struct Kokkos::Impl::DeepCopy<Kokkos::Experimental::OpenACCSpace, + Kokkos::HostSpace, ExecutionSpace> { + DeepCopy(void* dst, const void* src, size_t n) { + if (n > 0) { + acc_memcpy_to_device(dst, const_cast<void*>(src), n); + } + } + DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { + exec.fence( + "Kokkos::Impl::DeepCopy<OpenACCSpace, HostSpace, " + "ExecutionSpace>::DeepCopy: fence before copy"); + if (n > 0) { + acc_memcpy_to_device(dst, const_cast<void*>(src), n); + } + } +}; + +template <> +struct Kokkos::Impl::DeepCopy<Kokkos::HostSpace, + Kokkos::Experimental::OpenACCSpace, + Kokkos::Experimental::OpenACC> { + DeepCopy(void* dst, const void* src, size_t n) { + if (n > 0) { + acc_memcpy_from_device(dst, const_cast<void*>(src), n); + } + } + DeepCopy(const Kokkos::Experimental::OpenACC& exec, void* dst, + const void* src, size_t n) { + if (n > 0) { + acc_memcpy_from_device_async(dst, const_cast<void*>(src), n, + exec.acc_async_queue()); + } + } +}; + +template <class ExecutionSpace> +struct Kokkos::Impl::DeepCopy< + Kokkos::HostSpace, Kokkos::Experimental::OpenACCSpace, ExecutionSpace> { + DeepCopy(void* dst, const void* src, size_t n) { + if (n > 0) acc_memcpy_from_device(dst, const_cast<void*>(src), n); + } + DeepCopy(const ExecutionSpace& exec, void* dst, const void* src, size_t n) { + exec.fence( + "Kokkos::Impl::DeepCopy<HostSpace, OpenACCSpace, " + "ExecutionSpace>::DeepCopy: fence before copy"); + if (n > 0) { + acc_memcpy_from_device(dst, const_cast<void*>(src), n); + } + } +}; + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1325e61e1d00024ccd932433841ebefdc4b79dd4 --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp @@ -0,0 +1,44 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_FUNCTOR_ADAPTER_HPP +#define KOKKOS_OPENACC_FUNCTOR_ADAPTER_HPP + +#include <type_traits> + +namespace Kokkos::Experimental::Impl { + +template <class Functor, class Policy> +class FunctorAdapter { + Functor m_functor; + using WorkTag = typename Policy::work_tag; + + public: + FunctorAdapter(Functor const &functor) : m_functor(functor) {} + + template <class... Args> + KOKKOS_FUNCTION void operator()(Args &&... args) const { + if constexpr (std::is_void_v<WorkTag>) { + m_functor(static_cast<Args &&>(args)...); + } else { + m_functor(WorkTag(), static_cast<Args &&>(args)...); + } + } +}; + +} // namespace Kokkos::Experimental::Impl + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp index 15d38803f9c5be559f96cf1aad9a663cd207be03..10a76fbd31361b4a5c4265439409e1f929384efb 100644 --- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.cpp @@ -1,52 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #define KOKKOS_IMPL_PUBLIC_INCLUDE -#include <OpenACC/Kokkos_OpenACC_Instance.hpp> #include <OpenACC/Kokkos_OpenACC.hpp> -#include <OpenACC/Kokkos_OpenACC_Traits.hpp> +#include <OpenACC/Kokkos_OpenACC_Instance.hpp> #include <impl/Kokkos_Profiling.hpp> #include <impl/Kokkos_DeviceManagement.hpp> @@ -54,35 +25,34 @@ #include <iostream> -namespace Kokkos { -bool show_warnings() noexcept; -} +// Arbitrary value to denote that we don't know yet what device to use. +int Kokkos::Experimental::Impl::OpenACCInternal::m_acc_device_num = -1; -Kokkos::Experimental::Impl::OpenACCInternal* +Kokkos::Experimental::Impl::OpenACCInternal& Kokkos::Experimental::Impl::OpenACCInternal::singleton() { static OpenACCInternal self; - return &self; + return self; +} + +bool Kokkos::Experimental::Impl::OpenACCInternal::verify_is_initialized( + const char* const label) const { + if (!m_is_initialized) { + Kokkos::abort((std::string("Kokkos::Experimental::OpenACC::") + label + + " : ERROR device not initialized\n") + .c_str()); + } + return m_is_initialized; } -void Kokkos::Experimental::Impl::OpenACCInternal::initialize( - InitializationSettings const& settings) { - if (OpenACC_Traits::may_fallback_to_host && - acc_get_num_devices(OpenACC_Traits::dev_type) == 0 && - !settings.has_device_id()) { - if (show_warnings()) { - std::cerr << "Warning: No GPU available for execution, falling back to" - " using the host!" - << std::endl; - } - acc_set_device_type(acc_device_host); - // FIXME_OPENACC if multiple execution space instances are supported, - // device id variable should be explicitly set to the value returned by - // acc_get_device_num(acc_device_host). - } else { - using Kokkos::Impl::get_gpu; - int const dev_num = get_gpu(settings); - acc_set_device_num(dev_num, OpenACC_Traits::dev_type); +void Kokkos::Experimental::Impl::OpenACCInternal::initialize(int async_arg) { + if ((async_arg < 0) && (async_arg != acc_async_sync) && + (async_arg != acc_async_noval)) { + Kokkos::abort((std::string("Kokkos::Experimental::OpenACC::initialize()") + + " : ERROR async_arg should be a non-negative integer" + + " unless being a special value defined in OpenACC\n") + .c_str()); } + m_async_arg = async_arg; m_is_initialized = true; } @@ -105,14 +75,11 @@ void Kokkos::Experimental::Impl::OpenACCInternal::fence( Kokkos::Experimental::OpenACC>( name, Kokkos::Tools::Experimental::Impl::DirectFenceIDHandle{instance_id()}, - [&]() { - //[DEBUG] disabled due to synchronous behaviors of the current - // parallel construct implementations. acc_wait_all(); - }); + [&]() { acc_wait(m_async_arg); }); } uint32_t Kokkos::Experimental::Impl::OpenACCInternal::instance_id() const noexcept { - return Kokkos::Tools::Experimental::Impl::idForInstance< - Kokkos::Experimental::OpenACC>(reinterpret_cast<uintptr_t>(this)); + return Kokkos::Tools::Experimental::Impl::idForInstance<OpenACC>( + reinterpret_cast<uintptr_t>(this)); } diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp index cb69b4ae7a0524739105c4bb5c835ac365b85a1c..6645616ba51984ce917d543481bb09782fa8e5f9 100644 --- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Instance.hpp @@ -1,52 +1,26 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENACC_INSTANCE_HPP #define KOKKOS_OPENACC_INSTANCE_HPP #include <impl/Kokkos_InitializationSettings.hpp> +#include <openacc.h> + #include <cstdint> #include <iosfwd> #include <string> @@ -56,14 +30,20 @@ namespace Kokkos::Experimental::Impl { class OpenACCInternal { bool m_is_initialized = false; - OpenACCInternal() = default; OpenACCInternal(const OpenACCInternal&) = default; OpenACCInternal& operator=(const OpenACCInternal&) = default; public: - static OpenACCInternal* singleton(); + static int m_acc_device_num; + int m_async_arg = acc_async_sync; + + OpenACCInternal() = default; + + static OpenACCInternal& singleton(); + + bool verify_is_initialized(const char* const label) const; - void initialize(InitializationSettings const& settings); + void initialize(int async_arg = acc_async_sync); void finalize(); bool is_initialized() const; diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4525f37a612d3abd8e5961d43256800cbb9675c4 --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp @@ -0,0 +1,45 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_MDRANGE_POLICY_HPP_ +#define KOKKOS_OPENACC_MDRANGE_POLICY_HPP_ + +#include <KokkosExp_MDRangePolicy.hpp> + +template <> +struct Kokkos::default_outer_direction<Kokkos::Experimental::OpenACC> { + using type = Iterate; + static constexpr Iterate value = Iterate::Left; +}; + +template <> +struct Kokkos::default_inner_direction<Kokkos::Experimental::OpenACC> { + using type = Iterate; + static constexpr Iterate value = Iterate::Left; +}; + +namespace Kokkos { +namespace Impl { + +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, Kokkos::Experimental::OpenACC, + ThreadAndVector> + : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {}; + +} // namespace Impl +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Macros.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Macros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bcd7b2deb9d40cebedd7edf2a7e0398ecaa5adb7 --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Macros.hpp @@ -0,0 +1,23 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_MACROS_HPP +#define KOKKOS_OPENACC_MACROS_HPP + +#define KOKKOS_IMPL_ACC_PRAGMA_HELPER(x) _Pragma(#x) +#define KOKKOS_IMPL_ACC_PRAGMA(x) KOKKOS_IMPL_ACC_PRAGMA_HELPER(acc x) + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_MDRange.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_MDRange.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ac219527c6aa3b0dfb1779fa4a71a6342542525f --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_MDRange.hpp @@ -0,0 +1,695 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_PARALLEL_FOR_MDRANGE_HPP +#define KOKKOS_OPENACC_PARALLEL_FOR_MDRANGE_HPP + +#include <OpenACC/Kokkos_OpenACC.hpp> +#include <OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp> +#include <OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp> +#include <Kokkos_Parallel.hpp> + +namespace Kokkos::Experimental::Impl { + +struct OpenACCCollapse {}; +struct OpenACCTile {}; +using OpenACCIterateLeft = std::integral_constant<Iterate, Iterate::Left>; +using OpenACCIterateRight = std::integral_constant<Iterate, Iterate::Right>; +template <int N> +using OpenACCMDRangeBegin = decltype(MDRangePolicy<OpenACC, Rank<N>>::m_lower); +template <int N> +using OpenACCMDRangeEnd = decltype(MDRangePolicy<OpenACC, Rank<N>>::m_upper); +template <int N> +using OpenACCMDRangeTile = decltype(MDRangePolicy<OpenACC, Rank<N>>::m_tile); + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<2> const& begin, + OpenACCMDRangeEnd<2> const& end, + int async_arg) { + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector collapse(2) copyin(functor) async(async_arg) + // clang-format on + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1); + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<2> const& begin, + OpenACCMDRangeEnd<2> const& end, + int async_arg) { + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; +// clang-format off +#pragma acc parallel loop gang vector collapse(2) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + functor(i0, i1); + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<2> const& begin, + OpenACCMDRangeEnd<2> const& end, + OpenACCMDRangeTile<2> const& tile, + int async_arg) { + int tile0 = tile[0]; + int tile1 = tile[1]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile0,tile1) copyin(functor) async(async_arg) + // clang-format on + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1); + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<2> const& begin, + OpenACCMDRangeEnd<2> const& end, + OpenACCMDRangeTile<2> const& tile, + int async_arg) { + int tile1 = tile[1]; + int tile0 = tile[0]; + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile1,tile0) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + functor(i0, i1); + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<3> const& begin, + OpenACCMDRangeEnd<3> const& end, + int async_arg) { + int begin2 = begin[2]; + int end2 = end[2]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector collapse(3) copyin(functor) async(async_arg) + // clang-format on + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1, i2); + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<3> const& begin, + OpenACCMDRangeEnd<3> const& end, + int async_arg) { + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin2 = begin[2]; + int end2 = end[2]; +// clang-format off +#pragma acc parallel loop gang vector collapse(3) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i2 = begin2; i2 < end2; ++i2) { + functor(i0, i1, i2); + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<3> const& begin, + OpenACCMDRangeEnd<3> const& end, + OpenACCMDRangeTile<3> const& tile, + int async_arg) { + int tile0 = tile[0]; + int tile1 = tile[1]; + int tile2 = tile[2]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile0,tile1,tile2) copyin(functor) async(async_arg) + // clang-format on + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1, i2); + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<3> const& begin, + OpenACCMDRangeEnd<3> const& end, + OpenACCMDRangeTile<3> const& tile, + int async_arg) { + int tile2 = tile[2]; + int tile1 = tile[1]; + int tile0 = tile[0]; + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin2 = begin[2]; + int end2 = end[2]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile2,tile1,tile0) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i2 = begin2; i2 < end2; ++i2) { + functor(i0, i1, i2); + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<4> const& begin, + OpenACCMDRangeEnd<4> const& end, + int async_arg) { + int begin3 = begin[3]; + int end3 = end[3]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector collapse(4) copyin(functor) async(async_arg) + // clang-format on + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1, i2, i3); + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<4> const& begin, + OpenACCMDRangeEnd<4> const& end, + int async_arg) { + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin3 = begin[3]; + int end3 = end[3]; +// clang-format off +#pragma acc parallel loop gang vector collapse(4) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i3 = begin3; i3 < end3; ++i3) { + functor(i0, i1, i2, i3); + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<4> const& begin, + OpenACCMDRangeEnd<4> const& end, + OpenACCMDRangeTile<4> const& tile, + int async_arg) { + int tile0 = tile[0]; + int tile1 = tile[1]; + int tile2 = tile[2]; + int tile3 = tile[3]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile0,tile1,tile2,tile3) copyin(functor) async(async_arg) + // clang-format on + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1, i2, i3); + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<4> const& begin, + OpenACCMDRangeEnd<4> const& end, + OpenACCMDRangeTile<4> const& tile, + int async_arg) { + int tile3 = tile[3]; + int tile2 = tile[2]; + int tile1 = tile[1]; + int tile0 = tile[0]; + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin3 = begin[3]; + int end3 = end[3]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile3,tile2,tile1,tile0) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i3 = begin3; i3 < end3; ++i3) { + functor(i0, i1, i2, i3); + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<5> const& begin, + OpenACCMDRangeEnd<5> const& end, + int async_arg) { + int begin4 = begin[4]; + int end4 = end[4]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector collapse(5) copyin(functor) async(async_arg) + // clang-format on + for (auto i4 = begin4; i4 < end4; ++i4) { + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1, i2, i3, i4); + } + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<5> const& begin, + OpenACCMDRangeEnd<5> const& end, + int async_arg) { + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin4 = begin[4]; + int end4 = end[4]; +// clang-format off +#pragma acc parallel loop gang vector collapse(5) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i4 = begin4; i4 < end4; ++i4) { + functor(i0, i1, i2, i3, i4); + } + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<5> const& begin, + OpenACCMDRangeEnd<5> const& end, + OpenACCMDRangeTile<5> const& tile, + int async_arg) { + int tile0 = tile[0]; + int tile1 = tile[1]; + int tile2 = tile[2]; + int tile3 = tile[3]; + int tile4 = tile[4]; + int begin4 = begin[4]; + int end4 = end[4]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile0,tile1,tile2,tile3,tile4) copyin(functor) async(async_arg) + // clang-format on + for (auto i4 = begin4; i4 < end4; ++i4) { + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1, i2, i3, i4); + } + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<5> const& begin, + OpenACCMDRangeEnd<5> const& end, + OpenACCMDRangeTile<5> const& tile, + int async_arg) { + int tile4 = tile[4]; + int tile3 = tile[3]; + int tile2 = tile[2]; + int tile1 = tile[1]; + int tile0 = tile[0]; + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin4 = begin[4]; + int end4 = end[4]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile4,tile3,tile2,tile1,tile0) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i4 = begin4; i4 < end4; ++i4) { + functor(i0, i1, i2, i3, i4); + } + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<6> const& begin, + OpenACCMDRangeEnd<6> const& end, + int async_arg) { + int begin5 = begin[5]; + int end5 = end[5]; + int begin4 = begin[4]; + int end4 = end[4]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector collapse(6) copyin(functor) async(async_arg) + // clang-format on + for (auto i5 = begin5; i5 < end5; ++i5) { + for (auto i4 = begin4; i4 < end4; ++i4) { + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1, i2, i3, i4, i5); + } + } + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCCollapse, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<6> const& begin, + OpenACCMDRangeEnd<6> const& end, + int async_arg) { + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin4 = begin[4]; + int end4 = end[4]; + int begin5 = begin[5]; + int end5 = end[5]; +// clang-format off +#pragma acc parallel loop gang vector collapse(6) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i4 = begin4; i4 < end4; ++i4) { + for (auto i5 = begin5; i5 < end5; ++i5) { + functor(i0, i1, i2, i3, i4, i5); + } + } + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateLeft, + Functor const& functor, + OpenACCMDRangeBegin<6> const& begin, + OpenACCMDRangeEnd<6> const& end, + OpenACCMDRangeTile<6> const& tile, + int async_arg) { + int tile0 = tile[0]; + int tile1 = tile[1]; + int tile2 = tile[2]; + int tile3 = tile[3]; + int tile4 = tile[4]; + int tile5 = tile[5]; + int begin5 = begin[5]; + int end5 = end[5]; + int begin4 = begin[4]; + int end4 = end[4]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin0 = begin[0]; + int end0 = end[0]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile0,tile1,tile2,tile3,tile4,tile5) copyin(functor) async(async_arg) + // clang-format on + for (auto i5 = begin5; i5 < end5; ++i5) { + for (auto i4 = begin4; i4 < end4; ++i4) { + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i0 = begin0; i0 < end0; ++i0) { + functor(i0, i1, i2, i3, i4, i5); + } + } + } + } + } + } +} + +template <class Functor> +void OpenACCParallelForMDRangePolicy(OpenACCTile, OpenACCIterateRight, + Functor const& functor, + OpenACCMDRangeBegin<6> const& begin, + OpenACCMDRangeEnd<6> const& end, + OpenACCMDRangeTile<6> const& tile, + int async_arg) { + int tile5 = tile[5]; + int tile4 = tile[4]; + int tile3 = tile[3]; + int tile2 = tile[2]; + int tile1 = tile[1]; + int tile0 = tile[0]; + int begin0 = begin[0]; + int end0 = end[0]; + int begin1 = begin[1]; + int end1 = end[1]; + int begin2 = begin[2]; + int end2 = end[2]; + int begin3 = begin[3]; + int end3 = end[3]; + int begin4 = begin[4]; + int end4 = end[4]; + int begin5 = begin[5]; + int end5 = end[5]; +// clang-format off +#pragma acc parallel loop gang vector tile(tile5,tile4,tile3,tile2,tile1,tile0) copyin(functor) async(async_arg) + // clang-format on + for (auto i0 = begin0; i0 < end0; ++i0) { + for (auto i1 = begin1; i1 < end1; ++i1) { + for (auto i2 = begin2; i2 < end2; ++i2) { + for (auto i3 = begin3; i3 < end3; ++i3) { + for (auto i4 = begin4; i4 < end4; ++i4) { + for (auto i5 = begin5; i5 < end5; ++i5) { + functor(i0, i1, i2, i3, i4, i5); + } + } + } + } + } + } +} + +} // namespace Kokkos::Experimental::Impl + +template <class Functor, class... Traits> +class Kokkos::Impl::ParallelFor<Functor, Kokkos::MDRangePolicy<Traits...>, + Kokkos::Experimental::OpenACC> { + using Policy = MDRangePolicy<Traits...>; + Kokkos::Experimental::Impl::FunctorAdapter<Functor, Policy> m_functor; + Policy m_policy; + + public: + ParallelFor(Functor const& functor, Policy const& policy) + : m_functor(functor), m_policy(policy) {} + + void execute() const { + static_assert(1 < Policy::rank && Policy::rank < 7); + static_assert(Policy::inner_direction == Iterate::Left || + Policy::inner_direction == Iterate::Right); + constexpr int rank = Policy::rank; + for (int i = 0; i < rank; ++i) { + if (m_policy.m_lower[i] >= m_policy.m_upper[i]) { + return; + } + } + int const async_arg = m_policy.space().acc_async_queue(); +#if 0 // FIXME_OPENACC: OpenACC requires tile size to be constant. + for (int i = 0; i < rank; ++i) { + if (m_policy.m_tile[i] < 1) { + Kokkos::Experimental::Impl::OpenACCParallelForMDRangePolicy( + Kokkos::Experimental::Impl::OpenACCCollapse(), + std::integral_constant<Iterate, Policy::inner_direction>(), + m_functor, m_policy.m_lower, m_policy.m_upper, async_arg); + return; + } + } + Kokkos::Experimental::Impl::OpenACCParallelForMDRangePolicy( + Kokkos::Experimental::Impl::OpenACCTile(), + std::integral_constant<Iterate, Policy::inner_direction>(), m_functor, + m_policy.m_lower, m_policy.m_upper, m_policy.m_tile, async_arg); +#else + Kokkos::Experimental::Impl::OpenACCParallelForMDRangePolicy( + Kokkos::Experimental::Impl::OpenACCCollapse(), + std::integral_constant<Iterate, Policy::inner_direction>(), m_functor, + m_policy.m_lower, m_policy.m_upper, async_arg); +#endif + } +}; + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Range.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Range.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ede93ec19e122fe0795c0705d470fde6fe776b59 --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Range.hpp @@ -0,0 +1,105 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_PARALLEL_FOR_RANGE_HPP +#define KOKKOS_OPENACC_PARALLEL_FOR_RANGE_HPP + +#include <OpenACC/Kokkos_OpenACC.hpp> +#include <OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp> +#include <OpenACC/Kokkos_OpenACC_ScheduleType.hpp> +#include <Kokkos_Parallel.hpp> + +namespace Kokkos::Experimental::Impl { +template <class IndexType, class Functor> +void OpenACCParallelForRangePolicy(Schedule<Static>, int chunk_size, + IndexType begin, IndexType end, + Functor afunctor, int async_arg) { + // FIXME_OPENACC FIXME_NVHPC workaround compiler bug (incorrect scope + // analysis) + // NVC++-S-1067-Cannot determine bounds for array - functor + auto const functor(afunctor); + if (chunk_size >= 1) { +// clang-format off +#pragma acc parallel loop gang(static:chunk_size) vector copyin(functor) async(async_arg) + // clang-format on + for (auto i = begin; i < end; ++i) { + functor(i); + } + } else { +// clang-format off +#pragma acc parallel loop gang(static:*) vector copyin(functor) async(async_arg) + // clang-format on + for (auto i = begin; i < end; ++i) { + functor(i); + } + } +} + +template <class IndexType, class Functor> +void OpenACCParallelForRangePolicy(Schedule<Dynamic>, int chunk_size, + IndexType begin, IndexType end, + Functor afunctor, int async_arg) { + // FIXME_OPENACC FIXME_NVHPC workaround compiler bug (incorrect scope + // analysis) + // NVC++-S-1067-Cannot determine bounds for array - functor + auto const functor(afunctor); + if (chunk_size >= 1) { +// clang-format off +#pragma acc parallel loop gang(static:chunk_size) vector copyin(functor) async(async_arg) + // clang-format on + for (auto i = begin; i < end; ++i) { + functor(i); + } + } else { +// clang-format off +#pragma acc parallel loop gang vector copyin(functor) async(async_arg) + // clang-format on + for (auto i = begin; i < end; ++i) { + functor(i); + } + } +} +} // namespace Kokkos::Experimental::Impl + +template <class Functor, class... Traits> +class Kokkos::Impl::ParallelFor<Functor, Kokkos::RangePolicy<Traits...>, + Kokkos::Experimental::OpenACC> { + using Policy = Kokkos::RangePolicy<Traits...>; + Kokkos::Experimental::Impl::FunctorAdapter<Functor, Policy> m_functor; + Policy m_policy; + using ScheduleType = Kokkos::Experimental::Impl::OpenACCScheduleType<Policy>; + + public: + ParallelFor(Functor const& functor, Policy const& policy) + : m_functor(functor), m_policy(policy) {} + + void execute() const { + auto const begin = m_policy.begin(); + auto const end = m_policy.end(); + + if (end <= begin) { + return; + } + + int const async_arg = m_policy.space().acc_async_queue(); + int const chunk_size = m_policy.chunk_size(); + + Kokkos::Experimental::Impl::OpenACCParallelForRangePolicy( + ScheduleType(), chunk_size, begin, end, m_functor, async_arg); + } +}; + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Team.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Team.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c08c15879c3656f15665388cf3292e2e67ca16e5 --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelFor_Team.hpp @@ -0,0 +1,206 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_PARALLEL_FOR_TEAM_HPP +#define KOKKOS_OPENACC_PARALLEL_FOR_TEAM_HPP + +#include <openacc.h> +#include <OpenACC/Kokkos_OpenACC_Team.hpp> +#include <OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp> + +#ifdef KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +// Hierarchical Parallelism -> Team level implementation +template <class FunctorType, class... Properties> +class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, + Kokkos::Experimental::OpenACC> { + private: + using Policy = Kokkos::Impl::TeamPolicyInternal<Kokkos::Experimental::OpenACC, + Properties...>; + Kokkos::Experimental::Impl::FunctorAdapter<FunctorType, Policy> m_functor; + using Member = typename Policy::member_type; + + const Policy m_policy; + + public: + inline void execute() const { + auto league_size = m_policy.league_size(); + auto team_size = m_policy.team_size(); + auto vector_length = m_policy.impl_vector_length(); + + auto const a_functor(m_functor); + +#pragma acc parallel loop gang vector num_gangs(league_size) \ + vector_length(team_size* vector_length) copyin(a_functor) + for (int i = 0; i < league_size * team_size * vector_length; i++) { + int league_id = i / (team_size * vector_length); + typename Policy::member_type team(league_id, league_size, team_size, + vector_length); + a_functor(team); + } + } + + inline ParallelFor(const FunctorType& arg_functor, Policy arg_policy) + : m_functor(arg_functor), m_policy(arg_policy) {} +}; + +namespace Kokkos { + +// Hierarchical Parallelism -> Team thread level implementation +#pragma acc routine seq +template <typename iType, class Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + const Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>& + loop_boundaries, + const Lambda& lambda) { + iType j_start = + loop_boundaries.team.team_rank() / loop_boundaries.team.vector_length(); + iType j_end = loop_boundaries.end; + iType j_step = loop_boundaries.team.team_size(); + if (j_start >= loop_boundaries.start) { +#pragma acc loop seq + for (iType j = j_start; j < j_end; j += j_step) { + lambda(j); + } + } +} + +// Hierarchical Parallelism -> Thread vector level implementation +#pragma acc routine seq +template <typename iType, class Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + const Impl::ThreadVectorRangeBoundariesStruct< + iType, Impl::OpenACCTeamMember>& loop_boundaries, + const Lambda& lambda) { + iType j_start = + loop_boundaries.team.team_rank() % loop_boundaries.team.vector_length(); + iType j_end = loop_boundaries.end; + iType j_step = loop_boundaries.team.vector_length(); + if (j_start >= loop_boundaries.start) { +#pragma acc loop seq + for (iType j = j_start; j < j_end; j += j_step) { + lambda(j); + } + } +} + +// Hierarchical Parallelism -> Team vector level implementation +#pragma acc routine seq +template <typename iType, class Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + const Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>& + loop_boundaries, + const Lambda& lambda) { + iType j_start = + loop_boundaries.team.team_rank() % loop_boundaries.team.vector_length(); + iType j_end = loop_boundaries.end; + iType j_step = loop_boundaries.team.vector_length(); + if (j_start >= loop_boundaries.start) { +#pragma acc loop seq + for (iType j = j_start; j < j_end; j += j_step) { + lambda(j); + } + } +} + +} // namespace Kokkos + +#else // KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +// Hierarchical Parallelism -> Team level implementation +template <class FunctorType, class... Properties> +class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, + Kokkos::Experimental::OpenACC> { + private: + using Policy = Kokkos::Impl::TeamPolicyInternal<Kokkos::Experimental::OpenACC, + Properties...>; + Kokkos::Experimental::Impl::FunctorAdapter<FunctorType, Policy> m_functor; + using Member = typename Policy::member_type; + + const Policy m_policy; + + public: + inline void execute() const { + auto league_size = m_policy.league_size(); + auto team_size = m_policy.team_size(); + auto vector_length = m_policy.impl_vector_length(); + + auto const a_functor(m_functor); + +#pragma acc parallel loop gang num_gangs(league_size) num_workers(team_size) \ + vector_length(vector_length) copyin(a_functor) + for (int i = 0; i < league_size; i++) { + int league_id = i; + typename Policy::member_type team(league_id, league_size, team_size, + vector_length); + a_functor(team); + } + } + + inline ParallelFor(const FunctorType& arg_functor, Policy arg_policy) + : m_functor(arg_functor), m_policy(arg_policy) {} +}; + +namespace Kokkos { + +// Hierarchical Parallelism -> Team thread level implementation +#pragma acc routine worker +template <typename iType, class Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + const Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>& + loop_boundaries, + const Lambda& lambda) { +#pragma acc loop worker + for (iType j = loop_boundaries.start; j < loop_boundaries.end; j++) { + lambda(j); + } +} + +// Hierarchical Parallelism -> Thread vector level implementation +#pragma acc routine vector +template <typename iType, class Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + const Impl::ThreadVectorRangeBoundariesStruct< + iType, Impl::OpenACCTeamMember>& loop_boundaries, + const Lambda& lambda) { +#pragma acc loop vector + for (iType i = loop_boundaries.start; i < loop_boundaries.end; i++) { + lambda(i); + } +} + +// Hierarchical Parallelism -> Team vector level implementation +#pragma acc routine vector +template <typename iType, class Lambda> +KOKKOS_INLINE_FUNCTION void parallel_for( + const Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>& + loop_boundaries, + const Lambda& lambda) { +#pragma acc loop vector + for (iType i = loop_boundaries.start; i < loop_boundaries.end; i++) { + lambda(i); + } +} + +} // namespace Kokkos + +#endif /* #ifdef KOKKOS_ENABLE_OPENACC_COLLAPSE_HIERARCHICAL_CONSTRUCTS */ + +#endif /* #ifndef KOKKOS_OPENACC_PARALLEL_FOR_TEAM_HPP */ diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelReduce_Range.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelReduce_Range.hpp new file mode 100644 index 0000000000000000000000000000000000000000..278d9c1d5a68ba8d5db7d9e14bca860331cd1bdf --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ParallelReduce_Range.hpp @@ -0,0 +1,209 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_PARALLEL_REDUCE_RANGE_HPP +#define KOKKOS_OPENACC_PARALLEL_REDUCE_RANGE_HPP + +#include <OpenACC/Kokkos_OpenACC.hpp> +#include <OpenACC/Kokkos_OpenACC_Macros.hpp> +#include <OpenACC/Kokkos_OpenACC_FunctorAdapter.hpp> +#include <OpenACC/Kokkos_OpenACC_ScheduleType.hpp> +#include <Kokkos_Parallel.hpp> +#include <type_traits> + +namespace Kokkos::Experimental::Impl { + +// primary template: catch-all non-implemented custom reducers +template <class Functor, class Reducer, class Policy, + bool = std::is_arithmetic_v<typename Reducer::value_type>> +struct OpenACCParallelReduceHelper { + OpenACCParallelReduceHelper(Functor const&, Reducer const&, Policy const&) { + static_assert(!Kokkos::Impl::always_true<Functor>::value, + "not implemented"); + } +}; + +} // namespace Kokkos::Experimental::Impl + +template <class Functor, class ReducerType, class... Traits> +class Kokkos::Impl::ParallelReduce<Functor, Kokkos::RangePolicy<Traits...>, + ReducerType, Kokkos::Experimental::OpenACC> { + using Policy = RangePolicy<Traits...>; + + using ReducerConditional = + if_c<std::is_same_v<InvalidType, ReducerType>, Functor, ReducerType>; + using ReducerTypeFwd = typename ReducerConditional::type; + using Analysis = + FunctorAnalysis<FunctorPatternInterface::REDUCE, Policy, ReducerTypeFwd>; + + using Pointer = typename Analysis::pointer_type; + using ValueType = typename Analysis::value_type; + + Functor m_functor; + Policy m_policy; + ReducerType m_reducer; + Pointer m_result_ptr; + + public: + ParallelReduce(Functor const& functor, Policy const& policy, + ReducerType const& reducer) + : m_functor(functor), + m_policy(policy), + m_reducer(reducer), + m_result_ptr(reducer.view().data()) {} + + template <class ViewType> + ParallelReduce( + const Functor& functor, const Policy& policy, const ViewType& result, + std::enable_if_t<Kokkos::is_view<ViewType>::value, void*> = nullptr) + : m_functor(functor), + m_policy(policy), + m_reducer(InvalidType()), + m_result_ptr(result.data()) {} + + void execute() const { + auto const begin = m_policy.begin(); + auto const end = m_policy.end(); + + if (end <= begin) { + return; + } + + ValueType val; + typename Analysis::Reducer final_reducer( + &ReducerConditional::select(m_functor, m_reducer)); + final_reducer.init(&val); + + Kokkos::Experimental::Impl::OpenACCParallelReduceHelper( + Kokkos::Experimental::Impl::FunctorAdapter<Functor, Policy>(m_functor), + std::conditional_t<is_reducer_v<ReducerType>, ReducerType, + Sum<ValueType>>(val), + m_policy); + + *m_result_ptr = val; + } +}; + +#define KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_DISPATCH_SCHEDULE(REDUCER, \ + OPERATOR) \ + namespace Kokkos::Experimental::Impl { \ + template <class IndexType, class ValueType, class Functor> \ + void OpenACCParallelReduce##REDUCER(Schedule<Static>, int chunk_size, \ + IndexType begin, IndexType end, \ + ValueType& aval, \ + Functor const& afunctor, \ + int async_arg) { \ + /* FIXME_OPENACC FIXME_NVHPC workaround compiler bug (incorrect scope \ + analysis) \ + NVC++-S-1067-Cannot determine bounds for array - functor */ \ + auto const functor(afunctor); \ + auto val = aval; \ + if (chunk_size >= 1) { \ + /* clang-format off */ \ + KOKKOS_IMPL_ACC_PRAGMA(parallel loop gang(static:chunk_size) vector reduction(OPERATOR:val) copyin(functor) async(async_arg)) \ + /* clang-format on */ \ + for (auto i = begin; i < end; i++) { \ + functor(i, val); \ + } \ + } else { \ + /* clang-format off */ \ + KOKKOS_IMPL_ACC_PRAGMA(parallel loop gang(static:*) vector reduction(OPERATOR:val) copyin(functor) async(async_arg)) \ + /* clang-format on */ \ + for (auto i = begin; i < end; i++) { \ + functor(i, val); \ + } \ + } \ + aval = val; \ + } \ + \ + template <class IndexType, class ValueType, class Functor> \ + void OpenACCParallelReduce##REDUCER(Schedule<Dynamic>, int chunk_size, \ + IndexType begin, IndexType end, \ + ValueType& aval, \ + Functor const& afunctor, \ + int async_arg) { \ + /* FIXME_OPENACC FIXME_NVHPC workaround compiler bug (incorrect scope \ + analysis) \ + NVC++-S-1067-Cannot determine bounds for array - functor */ \ + auto const functor(afunctor); \ + auto val = aval; \ + if (chunk_size >= 1) { \ + /* clang-format off */ \ + KOKKOS_IMPL_ACC_PRAGMA(parallel loop gang(static:chunk_size) vector reduction(OPERATOR:val) copyin(functor) async(async_arg)) \ + /* clang-format on */ \ + for (auto i = begin; i < end; i++) { \ + functor(i, val); \ + } \ + } else { \ + /* clang-format off */ \ + KOKKOS_IMPL_ACC_PRAGMA(parallel loop gang vector reduction(OPERATOR:val) copyin(functor) async(async_arg)) \ + /* clang-format on */ \ + for (auto i = begin; i < end; i++) { \ + functor(i, val); \ + } \ + } \ + aval = val; \ + } \ + } // namespace Kokkos::Experimental::Impl + +#define KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(REDUCER, OPERATOR) \ + KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_DISPATCH_SCHEDULE(REDUCER, OPERATOR) \ + template <class Functor, class Scalar, class Space, class... Traits> \ + struct Kokkos::Experimental::Impl::OpenACCParallelReduceHelper< \ + Functor, Kokkos::REDUCER<Scalar, Space>, Kokkos::RangePolicy<Traits...>, \ + true> { \ + using Policy = RangePolicy<Traits...>; \ + using ScheduleType = \ + Kokkos::Experimental::Impl::OpenACCScheduleType<Policy>; \ + using Reducer = REDUCER<Scalar, Space>; \ + using ValueType = typename Reducer::value_type; \ + \ + OpenACCParallelReduceHelper(Functor const& functor, \ + Reducer const& reducer, \ + Policy const& policy) { \ + auto const begin = policy.begin(); \ + auto const end = policy.end(); \ + \ + if (end <= begin) { \ + return; \ + } \ + \ + ValueType val; \ + reducer.init(val); \ + \ + int const async_arg = policy.space().acc_async_queue(); \ + int const chunk_size = policy.chunk_size(); \ + \ + OpenACCParallelReduce##REDUCER(ScheduleType(), chunk_size, begin, end, \ + val, functor, async_arg); \ + \ + reducer.reference() = val; \ + } \ + } + +KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(Sum, +); +KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(Prod, *); +KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(Min, min); +KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(Max, max); +KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(LAnd, &&); +KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(LOr, ||); +KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(BAnd, &); +KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER(BOr, |); + +#undef KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_HELPER +#undef KOKKOS_IMPL_OPENACC_PARALLEL_REDUCE_DISPATCH_SCHEDULE + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ScheduleType.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ScheduleType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..717adc5a2f829b97d142a406fe685efe9694a42f --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_ScheduleType.hpp @@ -0,0 +1,41 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_SCHEDULE_TYPE_HPP +#define KOKKOS_OPENACC_SCHEDULE_TYPE_HPP + +#include <Kokkos_Concepts.hpp> +#include <type_traits> + +namespace Kokkos::Experimental::Impl { + +template <class Policy, class ScheduleType = typename Policy::schedule_type> +struct OpenACCSchedule { + static_assert(is_execution_policy_v<Policy>); + static_assert(std::is_void_v<ScheduleType> || + std::is_same_v<ScheduleType, Schedule<Static>> || + std::is_same_v<ScheduleType, Schedule<Dynamic>>); + using type = + std::conditional_t<std::is_same_v<ScheduleType, Schedule<Static>>, + Schedule<Static>, Schedule<Dynamic>>; +}; + +template <class Policy> +using OpenACCScheduleType = typename OpenACCSchedule<Policy>::type; + +} // namespace Kokkos::Experimental::Impl + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp new file mode 100644 index 0000000000000000000000000000000000000000..91faa64f733380801b9f58770454be1997087288 --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.cpp @@ -0,0 +1,107 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#define KOKKOS_IMPL_PUBLIC_INCLUDE + +#include <OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp> +#include <OpenACC/Kokkos_OpenACC_DeepCopy.hpp> +#include <impl/Kokkos_MemorySpace.hpp> +#include <Kokkos_HostSpace.hpp> + +#ifdef KOKKOS_ENABLE_DEBUG +Kokkos::Impl::SharedAllocationRecord<void, void> SharedAllocationRecord< + Kokkos::Experimental::OpenACCSpace, void>::s_root_record; +#endif + +Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, + void>::~SharedAllocationRecord() { + m_space.deallocate(m_label.c_str(), + SharedAllocationRecord<void, void>::m_alloc_ptr, + (SharedAllocationRecord<void, void>::m_alloc_size - + sizeof(SharedAllocationHeader))); +} + +Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, void>:: + SharedAllocationRecord( + const Kokkos::Experimental::OpenACCSpace &arg_space, + const std::string &arg_label, const size_t arg_alloc_size, + const SharedAllocationRecord<void, void>::function_type arg_dealloc) + // Pass through allocated [ SharedAllocationHeader , user_memory ] + // Pass through deallocation function + : base_t( +#ifdef KOKKOS_ENABLE_DEBUG + &SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, + void>::s_root_record, +#endif + Impl::checked_allocation_with_header(arg_space, arg_label, + arg_alloc_size), + sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, + arg_label), + m_space(arg_space) { + SharedAllocationHeader header; + + this->base_t::_fill_host_accessible_header_info(header, arg_label); + + Kokkos::Impl::DeepCopy<Experimental::OpenACCSpace, HostSpace>( + RecordBase::m_alloc_ptr, &header, sizeof(SharedAllocationHeader)); + Kokkos::fence( + "SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, " + "void>::SharedAllocationRecord(): fence after copying header from " + "HostSpace"); +} + +Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, void>:: + SharedAllocationRecord( + const Kokkos::Experimental::OpenACC &arg_exec_space, + const Kokkos::Experimental::OpenACCSpace &arg_space, + const std::string &arg_label, const size_t arg_alloc_size, + const SharedAllocationRecord<void, void>::function_type arg_dealloc) + // Pass through allocated [ SharedAllocationHeader , user_memory ] + // Pass through deallocation function + : base_t( +#ifdef KOKKOS_ENABLE_DEBUG + &SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, + void>::s_root_record, +#endif + Impl::checked_allocation_with_header(arg_exec_space, arg_space, + arg_label, arg_alloc_size), + sizeof(SharedAllocationHeader) + arg_alloc_size, arg_dealloc, + arg_label), + m_space(arg_space) { + SharedAllocationHeader header; + + this->base_t::_fill_host_accessible_header_info(header, arg_label); + + Kokkos::Impl::DeepCopy<Experimental::OpenACCSpace, HostSpace>( + arg_exec_space, RecordBase::m_alloc_ptr, &header, + sizeof(SharedAllocationHeader)); +} + +//============================================================================== +// <editor-fold desc="Explicit instantiations of CRTP Base classes"> {{{1 + +#include <impl/Kokkos_SharedAlloc_timpl.hpp> + +// To avoid additional compilation cost for something that's (mostly?) not +// performance sensitive, we explicitly instantiate these CRTP base classes +// here, where we have access to the associated *_timpl.hpp header files. +template class Kokkos::Impl::HostInaccessibleSharedAllocationRecordCommon< + Kokkos::Experimental::OpenACCSpace>; +template class Kokkos::Impl::SharedAllocationRecordCommon< + Kokkos::Experimental::OpenACCSpace>; + +// </editor-fold> end Explicit instantiations of CRTP Base classes }}}1 +//============================================================================== diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cf83a5b27bcb2b5f3b32940ee18811a0dca8af4d --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp @@ -0,0 +1,74 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_SHARED_ALLOCATION_RECORD_HPP +#define KOKKOS_OPENACC_SHARED_ALLOCATION_RECORD_HPP + +#include <OpenACC/Kokkos_OpenACCSpace.hpp> +#include <impl/Kokkos_SharedAlloc.hpp> + +#include <openacc.h> + +template <> +class Kokkos::Impl::SharedAllocationRecord<Kokkos::Experimental::OpenACCSpace, + void> + : public HostInaccessibleSharedAllocationRecordCommon< + Kokkos::Experimental::OpenACCSpace> { + private: + friend class HostInaccessibleSharedAllocationRecordCommon< + Kokkos::Experimental::OpenACCSpace>; + friend class SharedAllocationRecordCommon<Kokkos::Experimental::OpenACCSpace>; + friend Kokkos::Experimental::OpenACCSpace; + + using base_t = HostInaccessibleSharedAllocationRecordCommon< + Kokkos::Experimental::OpenACCSpace>; + using RecordBase = SharedAllocationRecord<void, void>; + + SharedAllocationRecord(const SharedAllocationRecord&) = delete; + SharedAllocationRecord& operator=(const SharedAllocationRecord&) = delete; + + /**\brief Root record for tracked allocations from this OpenACCSpace + * instance */ + static RecordBase s_root_record; + + const Kokkos::Experimental::OpenACCSpace m_space; + + protected: + ~SharedAllocationRecord(); + SharedAllocationRecord() = default; + + template <typename ExecutionSpace> + SharedAllocationRecord( + const ExecutionSpace& /*exec_space*/, + const Kokkos::Experimental::OpenACCSpace& arg_space, + const std::string& arg_label, const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &deallocate) + : SharedAllocationRecord(arg_space, arg_label, arg_alloc_size, + arg_dealloc) {} + + SharedAllocationRecord( + const Kokkos::Experimental::OpenACC& exec_space, + const Kokkos::Experimental::OpenACCSpace& arg_space, + const std::string& arg_label, const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &deallocate); + + SharedAllocationRecord( + const Kokkos::Experimental::OpenACCSpace& arg_space, + const std::string& arg_label, const size_t arg_alloc_size, + const RecordBase::function_type arg_dealloc = &deallocate); +}; + +#endif diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Team.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Team.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3a46f2c483440f85a94a6ed6dc12c37aa402c8a3 --- /dev/null +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Team.hpp @@ -0,0 +1,578 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENACC_TEAM_HPP +#define KOKKOS_OPENACC_TEAM_HPP + +#include <openacc.h> +#include <impl/Kokkos_Traits.hpp> +#include <OpenACC/Kokkos_OpenACC.hpp> +#include <Kokkos_ExecPolicy.hpp> + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + +namespace Kokkos { +namespace Impl { + +class OpenACCTeamMember { + public: + constexpr static int TEAM_REDUCE_SIZE = 512; + // FIXME_OPENACC: default-team-size macros are temporarily used for + // team_size_max and team_size_recommended APIs + constexpr static int DEFAULT_TEAM_SIZE_MAX = 512; + constexpr static int DEFAULT_TEAM_SIZE_REC = 128; + + using execution_space = Kokkos::Experimental::OpenACC; + using scratch_memory_space = execution_space::scratch_memory_space; + using team_handle = OpenACCTeamMember; + + scratch_memory_space m_team_shared; + int m_team_scratch_size[2]; + int m_team_rank; + int m_team_size; + int m_league_rank; + int m_league_size; + int m_vector_length; + + public: + KOKKOS_FUNCTION + const execution_space::scratch_memory_space& team_shmem() const { + return m_team_shared.set_team_thread_mode(0, 1, 0); + } + + KOKKOS_FUNCTION + const execution_space::scratch_memory_space& team_scratch(int level) const { + return m_team_shared.set_team_thread_mode(level, 1, + m_team_scratch_size[level]); + } + + KOKKOS_FUNCTION + const execution_space::scratch_memory_space& thread_scratch(int level) const { + return m_team_shared.set_team_thread_mode(level, team_size(), team_rank()); + } + + KOKKOS_FUNCTION int league_rank() const { return m_league_rank; } + KOKKOS_FUNCTION int league_size() const { return m_league_size; } + KOKKOS_FUNCTION int team_rank() const { return m_team_rank; } + KOKKOS_FUNCTION int vector_length() const { return m_vector_length; } + KOKKOS_FUNCTION int team_size() const { return m_team_size; } + + // FIXME_OPENACC: OpenACC does not provide any explicit barrier constructs + // for device kernels. + KOKKOS_FUNCTION void team_barrier() const { + Kokkos::abort( + "Kokkos::Experimental::OpenACC ERROR: OpenACC does not provide any " + "explicit barrier constructs for device kernels; exit!"); + } + + // FIXME_OPENACC: team_broadcast() is not implemented. + template <class ValueType> + KOKKOS_FUNCTION void team_broadcast(ValueType& value, int thread_id) const { + static_assert(Kokkos::Impl::always_false<ValueType>::value, + "Kokkos Error: team_broadcast() is not implemented for the " + "OpenACC backend"); + return ValueType(); + } + + template <class Closure, class ValueType> + KOKKOS_FUNCTION void team_broadcast(const Closure& f, ValueType& value, + int thread_id) const { + f(value); + team_broadcast(value, thread_id); + } + + // FIXME_OPENACC: team_reduce() is not implemented. + template <class ValueType, class JoinOp> + KOKKOS_FUNCTION ValueType team_reduce(const ValueType& value, + const JoinOp& op_in) const { + static_assert(Kokkos::Impl::always_false<ValueType>::value, + "Kokkos Error: team_reduce() is not implemented for the " + "OpenACC backend"); + return ValueType(); + } + + // FIXME_OPENACC: team_scan() is not implemented. + template <typename ArgType> + KOKKOS_FUNCTION ArgType team_scan(const ArgType& /*value*/, + ArgType* const /*global_accum*/) const { + static_assert( + Kokkos::Impl::always_false<ArgType>::value, + "Kokkos Error: team_scan() is not implemented for the OpenACC backend"); + return ArgType(); + } + + template <typename Type> + KOKKOS_FUNCTION Type team_scan(const Type& value) const { + return this->template team_scan<Type>(value, 0); + } + + //---------------------------------------- + // Private for the driver + + private: + using space = execution_space::scratch_memory_space; + + public: + // FIXME_OPENACC - 512(16*32) bytes at the begining of the scratch space + // for each league is saved for reduction. It should actually be based on the + // ValueType of the reduction variable. + OpenACCTeamMember(const int league_rank, const int league_size, + const int team_size, + const int vector_length) // const TeamPolicyInternal< + // OpenACC, Properties ...> & team + : m_team_size(team_size), + m_league_rank(league_rank), + m_league_size(league_size), + m_vector_length(vector_length) { +#ifdef KOKKOS_COMPILER_NVHPC + m_team_rank = __pgi_vectoridx(); +#else + m_team_rank = 0; +#endif + } + + static int team_reduce_size() { return TEAM_REDUCE_SIZE; } +}; + +template <class... Properties> +class TeamPolicyInternal<Kokkos::Experimental::OpenACC, Properties...> + : public PolicyTraits<Properties...> { + public: + //! Tag this class as a kokkos execution policy + using execution_policy = TeamPolicyInternal; + + using traits = PolicyTraits<Properties...>; + + //---------------------------------------- + + // FIXME_OPENACC: update team_size_max() APIs with realistic + // implementations. + template <class FunctorType> + static int team_size_max(const FunctorType&, const ParallelForTag&) { + return DEFAULT_TEAM_SIZE_MAX; + } + + template <class FunctorType> + static int team_size_max(const FunctorType&, const ParallelReduceTag&) { + return DEFAULT_TEAM_SIZE_MAX; + } + + template <class FunctorType, class ReducerType> + static int team_size_max(const FunctorType&, const ReducerType&, + const ParallelReduceTag&) { + return DEFAULT_TEAM_SIZE_MAX; + } + + // FIXME_OPENACC: update team_size_recommended() APIs with realistic + // implementations. + template <class FunctorType> + static int team_size_recommended(const FunctorType&, const ParallelForTag&) { + return DEFAULT_TEAM_SIZE_REC; + } + + template <class FunctorType> + static int team_size_recommended(const FunctorType&, + const ParallelReduceTag&) { + return DEFAULT_TEAM_SIZE_REC; + } + + template <class FunctorType, class ReducerType> + static int team_size_recommended(const FunctorType&, const ReducerType&, + const ParallelReduceTag&) { + return DEFAULT_TEAM_SIZE_REC; + } + + //---------------------------------------- + + private: + int m_league_size; + int m_team_size; + int m_vector_length; + int m_team_alloc; + int m_team_iter; + std::array<size_t, 2> m_team_scratch_size; + std::array<size_t, 2> m_thread_scratch_size; + bool m_tune_team_size; + bool m_tune_vector_length; + constexpr static const size_t default_team_size = + OpenACCTeamMember::DEFAULT_TEAM_SIZE_REC; + int m_chunk_size; + + void init(const int league_size_request, const int team_size_request, + const int vector_length_request) { + m_league_size = league_size_request; + m_team_size = team_size_request; + m_vector_length = vector_length_request; + set_auto_chunk_size(); + } + + template <typename ExecSpace, typename... OtherProperties> + friend class TeamPolicyInternal; + + public: + bool impl_auto_team_size() const { return m_tune_team_size; } + bool impl_auto_vector_length() const { return m_tune_vector_length; } + void impl_set_team_size(const size_t size) { m_team_size = size; } + void impl_set_vector_length(const size_t length) { + m_tune_vector_length = length; + } + int impl_vector_length() const { return m_vector_length; } + int team_size() const { return m_team_size; } + int league_size() const { return m_league_size; } + size_t scratch_size(const int& level, int team_size_ = -1) const { + if (team_size_ < 0) team_size_ = m_team_size; + return m_team_scratch_size[level] + + team_size_ * m_thread_scratch_size[level]; + } + + Kokkos::Experimental::OpenACC space() const { + return Kokkos::Experimental::OpenACC(); + } + + template <class... OtherProperties> + TeamPolicyInternal(const TeamPolicyInternal<OtherProperties...>& p) + : m_league_size(p.m_league_size), + m_team_size(p.m_team_size), + m_vector_length(p.m_vector_length), + m_team_alloc(p.m_team_alloc), + m_team_iter(p.m_team_iter), + m_team_scratch_size(p.m_team_scratch_size), + m_thread_scratch_size(p.m_thread_scratch_size), + m_tune_team_size(p.m_tune_team_size), + m_tune_vector_length(p.m_tune_vector_length), + m_chunk_size(p.m_chunk_size) {} + + /** \brief Specify league size, request team size */ + TeamPolicyInternal(const typename traits::execution_space&, + int league_size_request, int team_size_request, + int vector_length_request = 1) + : m_team_scratch_size{0, 0}, + m_thread_scratch_size{0, 0}, + m_tune_team_size(false), + m_tune_vector_length(false), + m_chunk_size(0) { + init(league_size_request, team_size_request, vector_length_request); + } + + TeamPolicyInternal(const typename traits::execution_space&, + int league_size_request, + const Kokkos::AUTO_t& /* team_size_request */ + , + int vector_length_request = 1) + : m_team_scratch_size{0, 0}, + m_thread_scratch_size{0, 0}, + m_tune_team_size(true), + m_tune_vector_length(false), + m_chunk_size(0) { + init(league_size_request, default_team_size / vector_length_request, + vector_length_request); + } + + TeamPolicyInternal(const typename traits::execution_space&, + int league_size_request, + const Kokkos::AUTO_t& /* team_size_request */ + , + const Kokkos::AUTO_t& /* vector_length_request */) + : m_team_scratch_size{0, 0}, + m_thread_scratch_size{0, 0}, + m_tune_team_size(true), + m_tune_vector_length(true), + m_chunk_size(0) { + init(league_size_request, default_team_size, 1); + } + TeamPolicyInternal(const typename traits::execution_space&, + int league_size_request, int team_size_request, + const Kokkos::AUTO_t& /* vector_length_request */) + : m_team_scratch_size{0, 0}, + m_thread_scratch_size{0, 0}, + m_tune_team_size(false), + m_tune_vector_length(true), + m_chunk_size(0) { + init(league_size_request, team_size_request, 1); + } + + TeamPolicyInternal(int league_size_request, int team_size_request, + int vector_length_request = 1) + : m_team_scratch_size{0, 0}, + m_thread_scratch_size{0, 0}, + m_tune_team_size(false), + m_tune_vector_length(false), + m_chunk_size(0) { + init(league_size_request, team_size_request, vector_length_request); + } + + TeamPolicyInternal(int league_size_request, + const Kokkos::AUTO_t& /* team_size_request */ + , + int vector_length_request = 1) + : m_team_scratch_size{0, 0}, + m_thread_scratch_size{0, 0}, + m_tune_team_size(true), + m_tune_vector_length(false), + m_chunk_size(0) { + init(league_size_request, default_team_size / vector_length_request, + vector_length_request); + } + + TeamPolicyInternal(int league_size_request, + const Kokkos::AUTO_t& /* team_size_request */ + , + const Kokkos::AUTO_t& /* vector_length_request */) + : m_team_scratch_size{0, 0}, + m_thread_scratch_size{0, 0}, + m_tune_team_size(true), + m_tune_vector_length(true), + m_chunk_size(0) { + init(league_size_request, default_team_size, 1); + } + TeamPolicyInternal(int league_size_request, int team_size_request, + const Kokkos::AUTO_t& /* vector_length_request */) + : m_team_scratch_size{0, 0}, + m_thread_scratch_size{0, 0}, + m_tune_team_size(false), + m_tune_vector_length(true), + m_chunk_size(0) { + init(league_size_request, team_size_request, 1); + } + static size_t vector_length_max() { + return 32; /* TODO: this is bad. Need logic that is compiler and backend + aware */ + } + int team_alloc() const { return m_team_alloc; } + int team_iter() const { return m_team_iter; } + + int chunk_size() const { return m_chunk_size; } + + /** \brief set chunk_size to a discrete value*/ + TeamPolicyInternal& set_chunk_size(typename traits::index_type chunk_size_) { + m_chunk_size = chunk_size_; + return *this; + } + + /** \brief set per team scratch size for a specific level of the scratch + * hierarchy */ + TeamPolicyInternal& set_scratch_size(const int& level, + const PerTeamValue& per_team) { + m_team_scratch_size[level] = per_team.value; + return *this; + } + + /** \brief set per thread scratch size for a specific level of the scratch + * hierarchy */ + TeamPolicyInternal& set_scratch_size(const int& level, + const PerThreadValue& per_thread) { + m_thread_scratch_size[level] = per_thread.value; + return *this; + } + + /** \brief set per thread and per team scratch size for a specific level of + * the scratch hierarchy */ + TeamPolicyInternal& set_scratch_size(const int& level, + const PerTeamValue& per_team, + const PerThreadValue& per_thread) { + m_team_scratch_size[level] = per_team.value; + m_thread_scratch_size[level] = per_thread.value; + return *this; + } + + private: + /** \brief finalize chunk_size if it was set to AUTO*/ + void set_auto_chunk_size() { + int concurrency = 2048 * default_team_size; + + if (m_chunk_size > 0) { + if (!Impl::is_integral_power_of_two(m_chunk_size)) + Kokkos::abort("TeamPolicy blocking granularity must be power of two"); + } + + int new_chunk_size = 1; + while (new_chunk_size * 100 * concurrency < m_league_size) + new_chunk_size *= 2; + if (new_chunk_size < default_team_size) { + new_chunk_size = 1; + while ((new_chunk_size * 40 * concurrency < m_league_size) && + (new_chunk_size < default_team_size)) + new_chunk_size *= 2; + } + m_chunk_size = new_chunk_size; + } + + public: + using member_type = Impl::OpenACCTeamMember; +}; +} // namespace Impl +} // namespace Kokkos + +namespace Kokkos { +namespace Impl { + +template <typename iType> +struct TeamThreadRangeBoundariesStruct<iType, OpenACCTeamMember> { + using index_type = iType; + const iType start; + const iType end; + const OpenACCTeamMember& team; + + TeamThreadRangeBoundariesStruct(const OpenACCTeamMember& thread_, iType count) + : start(0), end(count), team(thread_) {} + TeamThreadRangeBoundariesStruct(const OpenACCTeamMember& thread_, + iType begin_, iType end_) + : start(begin_), end(end_), team(thread_) {} +}; + +template <typename iType> +struct ThreadVectorRangeBoundariesStruct<iType, OpenACCTeamMember> { + using index_type = iType; + const index_type start; + const index_type end; + const OpenACCTeamMember& team; + + ThreadVectorRangeBoundariesStruct(const OpenACCTeamMember& thread_, + index_type count) + : start(0), end(count), team(thread_) {} + ThreadVectorRangeBoundariesStruct(const OpenACCTeamMember& thread_, + index_type begin_, index_type end_) + : start(begin_), end(end_), team(thread_) {} +}; + +template <typename iType> +struct TeamVectorRangeBoundariesStruct<iType, OpenACCTeamMember> { + using index_type = iType; + const index_type start; + const index_type end; + const OpenACCTeamMember& team; + + TeamVectorRangeBoundariesStruct(const OpenACCTeamMember& thread_, + index_type count) + : start(0), end(count), team(thread_) {} + TeamVectorRangeBoundariesStruct(const OpenACCTeamMember& thread_, + index_type begin_, index_type end_) + : start(begin_), end(end_), team(thread_) {} +}; + +} // namespace Impl +} // namespace Kokkos + +namespace Kokkos { + +template <typename iType> +KOKKOS_INLINE_FUNCTION + Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember> + TeamThreadRange(const Impl::OpenACCTeamMember& thread, const iType& count) { + return Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>( + thread, count); +} + +template <typename iType1, typename iType2> +KOKKOS_INLINE_FUNCTION Impl::TeamThreadRangeBoundariesStruct< + typename std::common_type<iType1, iType2>::type, Impl::OpenACCTeamMember> +TeamThreadRange(const Impl::OpenACCTeamMember& thread, const iType1& begin, + const iType2& end) { + using iType = typename std::common_type<iType1, iType2>::type; + return Impl::TeamThreadRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>( + thread, iType(begin), iType(end)); +} + +template <typename iType> +KOKKOS_INLINE_FUNCTION + Impl::ThreadVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember> + ThreadVectorRange(const Impl::OpenACCTeamMember& thread, + const iType& count) { + return Impl::ThreadVectorRangeBoundariesStruct<iType, + Impl::OpenACCTeamMember>( + thread, count); +} + +template <typename iType1, typename iType2> +KOKKOS_INLINE_FUNCTION Impl::ThreadVectorRangeBoundariesStruct< + typename std::common_type<iType1, iType2>::type, Impl::OpenACCTeamMember> +ThreadVectorRange(const Impl::OpenACCTeamMember& thread, + const iType1& arg_begin, const iType2& arg_end) { + using iType = typename std::common_type<iType1, iType2>::type; + return Impl::ThreadVectorRangeBoundariesStruct<iType, + Impl::OpenACCTeamMember>( + thread, iType(arg_begin), iType(arg_end)); +} + +template <typename iType> +KOKKOS_INLINE_FUNCTION + Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember> + TeamVectorRange(const Impl::OpenACCTeamMember& thread, const iType& count) { + return Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>( + thread, count); +} + +template <typename iType1, typename iType2> +KOKKOS_INLINE_FUNCTION Impl::TeamVectorRangeBoundariesStruct< + typename std::common_type<iType1, iType2>::type, Impl::OpenACCTeamMember> +TeamVectorRange(const Impl::OpenACCTeamMember& thread, const iType1& arg_begin, + const iType2& arg_end) { + using iType = typename std::common_type<iType1, iType2>::type; + return Impl::TeamVectorRangeBoundariesStruct<iType, Impl::OpenACCTeamMember>( + thread, iType(arg_begin), iType(arg_end)); +} + +KOKKOS_INLINE_FUNCTION +Impl::ThreadSingleStruct<Impl::OpenACCTeamMember> PerTeam( + const Impl::OpenACCTeamMember& thread) { + return Impl::ThreadSingleStruct<Impl::OpenACCTeamMember>(thread); +} + +KOKKOS_INLINE_FUNCTION +Impl::VectorSingleStruct<Impl::OpenACCTeamMember> PerThread( + const Impl::OpenACCTeamMember& thread) { + return Impl::VectorSingleStruct<Impl::OpenACCTeamMember>(thread); +} +} // namespace Kokkos + +namespace Kokkos { + +template <class FunctorType> +KOKKOS_INLINE_FUNCTION void single( + const Impl::VectorSingleStruct<Impl::OpenACCTeamMember>& + /*single_struct*/, + const FunctorType& lambda) { + lambda(); +} + +template <class FunctorType> +KOKKOS_INLINE_FUNCTION void single( + const Impl::ThreadSingleStruct<Impl::OpenACCTeamMember>& single_struct, + const FunctorType& lambda) { + if (single_struct.team_member.team_rank() == 0) lambda(); +} + +template <class FunctorType, class ValueType> +KOKKOS_INLINE_FUNCTION void single( + const Impl::VectorSingleStruct<Impl::OpenACCTeamMember>& + /*single_struct*/, + const FunctorType& lambda, ValueType& val) { + lambda(val); +} + +template <class FunctorType, class ValueType> +KOKKOS_INLINE_FUNCTION void single( + const Impl::ThreadSingleStruct<Impl::OpenACCTeamMember>& single_struct, + const FunctorType& lambda, ValueType& val) { + if (single_struct.team_member.team_rank() == 0) { + lambda(val); + } + single_struct.team_member.team_broadcast(val, 0); +} +} // namespace Kokkos + +#endif /* #ifndef KOKKOS_OPENACC_TEAM_HPP */ diff --git a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp index f9451ecfe67d0a4e98e2c9378a6fd414130f9395..c8a6dfec6f71d901f7108b020ed691be5795d9ab 100644 --- a/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp +++ b/packages/kokkos/core/src/OpenACC/Kokkos_OpenACC_Traits.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENACC_TRAITS_HPP #define KOKKOS_OPENACC_TRAITS_HPP @@ -51,7 +23,7 @@ namespace Kokkos::Experimental::Impl { struct OpenACC_Traits { #if defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \ - defined(KOKKOS_ARCH_AMPERE) + defined(KOKKOS_ARCH_AMPERE) || defined(KOKKOS_ARCH_HOPPER) static constexpr acc_device_t dev_type = acc_device_nvidia; static constexpr bool may_fallback_to_host = false; #else diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp index 2397aa4785b88a236862f14f814ae147d5bdcf1c..b1ccac51562781983b4e86fdfffe9d50d420b3a1 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.cpp @@ -1,58 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE #endif -#include <cstdio> -#include <cstdlib> - -#include <limits> -#include <iostream> -#include <vector> - #include <Kokkos_Core.hpp> #include <impl/Kokkos_Error.hpp> @@ -60,14 +25,27 @@ #include <impl/Kokkos_Tools.hpp> #include <impl/Kokkos_ExecSpaceManager.hpp> +#include <cstdlib> +#include <iomanip> +#include <iostream> +#include <sstream> +#include <thread> + namespace Kokkos { namespace Impl { -int g_openmp_hardware_max_threads = 1; +void OpenMPInternal::acquire_lock() { + while (1 == desul::atomic_compare_exchange(&m_pool_mutex, 0, 1, + desul::MemoryOrderAcquire(), + desul::MemoryScopeDevice())) { + // do nothing + } +} -thread_local int t_openmp_hardware_id = 0; -// FIXME_OPENMP we can remove this after we remove partition_master -thread_local OpenMPInternal *t_openmp_instance = nullptr; +void OpenMPInternal::release_lock() { + desul::atomic_store(&m_pool_mutex, 0, desul::MemoryOrderRelease(), + desul::MemoryScopeDevice()); +} #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 void OpenMPInternal::validate_partition_impl(const int nthreads, @@ -196,10 +174,7 @@ void OpenMPInternal::resize_thread_data(size_t pool_reduce_bytes, memory_fence(); -#pragma omp parallel num_threads(m_pool_size) - { - const int rank = omp_get_thread_num(); - + for (int rank = 0; rank < m_pool_size; ++rank) { if (nullptr != m_pool[rank]) { m_pool[rank]->disband_pool(); @@ -220,10 +195,7 @@ void OpenMPInternal::resize_thread_data(size_t pool_reduce_bytes, m_pool[rank]->scratch_assign(((char *)ptr) + member_bytes, alloc_bytes, pool_reduce_bytes, team_reduce_bytes, team_shared_bytes, thread_local_bytes); - - memory_fence(); } - /* END #pragma omp parallel */ HostThreadTeamData::organize_pool(m_pool, m_pool_size); } @@ -270,14 +242,12 @@ void OpenMPInternal::initialize(int thread_count) { { if (Kokkos::show_warnings() && nullptr == std::getenv("OMP_PROC_BIND")) { - printf( - "Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment " - "variable not set\n"); - printf( - " In general, for best performance with OpenMP 4.0 or better set " - "OMP_PROC_BIND=spread and OMP_PLACES=threads\n"); - printf(" For best performance with OpenMP 3.1 set OMP_PROC_BIND=true\n"); - printf(" For unit testing set OMP_PROC_BIND=false\n"); + std::cerr + << R"WARNING(Kokkos::OpenMP::initialize WARNING: OMP_PROC_BIND environment variable not set + In general, for best performance with OpenMP 4.0 or better set OMP_PROC_BIND=spread and OMP_PLACES=threads + For best performance with OpenMP 3.1 set OMP_PROC_BIND=true + For unit testing set OMP_PROC_BIND=false +)WARNING" << std::endl; } OpenMP::memory_space space; @@ -308,11 +278,12 @@ void OpenMPInternal::initialize(int thread_count) { } } else { if (Kokkos::show_warnings() && thread_count > process_num_threads) { - printf( - "Kokkos::OpenMP::initialize WARNING: You are likely " - "oversubscribing your CPU cores.\n"); - printf(" process threads available : %3d, requested thread : %3d\n", - process_num_threads, thread_count); + std::cerr << "Kokkos::OpenMP::initialize WARNING: You are likely " + "oversubscribing your CPU cores.\n" + << " process threads available : " << std::setw(3) + << process_num_threads + << ", requested thread : " << std::setw(3) << thread_count + << std::endl; } Impl::g_openmp_hardware_max_threads = thread_count; omp_set_num_threads(Impl::g_openmp_hardware_max_threads); @@ -320,10 +291,7 @@ void OpenMPInternal::initialize(int thread_count) { // setup thread local #pragma omp parallel num_threads(Impl::g_openmp_hardware_max_threads) - { - Impl::t_openmp_hardware_id = omp_get_thread_num(); - Impl::SharedAllocationRecord<void, void>::tracking_enable(); - } + { Impl::SharedAllocationRecord<void, void>::tracking_enable(); } auto &instance = OpenMPInternal::singleton(); instance.m_pool_size = Impl::g_openmp_hardware_max_threads; @@ -341,21 +309,22 @@ void OpenMPInternal::initialize(int thread_count) { } // Check for over-subscription + auto const reported_ranks = mpi_ranks_per_node(); + auto const mpi_local_size = reported_ranks < 0 ? 1 : reported_ranks; + int const procs_per_node = std::thread::hardware_concurrency(); if (Kokkos::show_warnings() && - (Impl::mpi_ranks_per_node() * long(thread_count) > - Impl::processors_per_node())) { + (mpi_local_size * long(thread_count) > procs_per_node)) { std::cerr << "Kokkos::OpenMP::initialize WARNING: You are likely " "oversubscribing your CPU cores." << std::endl; std::cerr << " Detected: " - << Impl::processors_per_node() << " cores per node." << std::endl; + << procs_per_node << " cores per node." << std::endl; std::cerr << " Detected: " - << Impl::mpi_ranks_per_node() << " MPI_ranks per node." - << std::endl; + << mpi_local_size << " MPI_ranks per node." << std::endl; std::cerr << " Requested: " << thread_count << " threads per process." << std::endl; } - // Init the array for used for arbitrarily sized atomics + // Init the array used for arbitrarily sized atomics init_lock_array_host_space(); m_initialized = true; @@ -379,10 +348,7 @@ void OpenMPInternal::finalize() { (void)nthreads; #pragma omp parallel num_threads(nthreads) - { - Impl::t_openmp_hardware_id = 0; - Impl::SharedAllocationRecord<void, void>::tracking_disable(); - } + { Impl::SharedAllocationRecord<void, void>::tracking_disable(); } // allow main thread to track Impl::SharedAllocationRecord<void, void>::tracking_enable(); @@ -422,16 +388,21 @@ bool OpenMPInternal::verify_is_initialized(const char *const label) const { //---------------------------------------------------------------------------- OpenMP::OpenMP() -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - : m_space_instance(&Impl::OpenMPInternal::singleton()) { -} -#else : m_space_instance(&Impl::OpenMPInternal::singleton(), [](Impl::OpenMPInternal *) {}) { Impl::OpenMPInternal::singleton().verify_is_initialized( "OpenMP instance constructor"); } -#endif + +OpenMP::OpenMP(int pool_size) + : m_space_instance(new Impl::OpenMPInternal(pool_size), + [](Impl::OpenMPInternal *ptr) { + ptr->finalize(); + delete ptr; + }) { + Impl::OpenMPInternal::singleton().verify_is_initialized( + "OpenMP instance constructor"); +} int OpenMP::impl_get_current_max_threads() noexcept { return Impl::OpenMPInternal::get_current_max_threads(); @@ -461,13 +432,9 @@ void OpenMP::print_configuration(std::ostream &os, bool /*verbose*/) const { m_space_instance->print_configuration(os); } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -std::vector<OpenMP> OpenMP::partition(...) { return std::vector<OpenMP>(1); } - -OpenMP OpenMP::create_instance(...) { return OpenMP(); } -#endif - -int OpenMP::concurrency() { return Impl::g_openmp_hardware_max_threads; } +int OpenMP::concurrency(OpenMP const &instance) { + return impl_thread_pool_size(instance); +} void OpenMP::fence(const std::string &name) const { Kokkos::Tools::Experimental::Impl::profile_fence_event<Kokkos::OpenMP>( @@ -481,12 +448,4 @@ int g_openmp_space_factory_initialized = } // namespace Impl -#ifdef KOKKOS_ENABLE_CXX14 -namespace Tools { -namespace Experimental { -constexpr DeviceType DeviceTypeTraits<OpenMP>::id; -} -} // namespace Tools -#endif - } // namespace Kokkos diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp index 1a2ee95a79e079b8918767fc409f1286a590ea85..e2d52a141ab085dce80bd0b9280a2b776c27019e 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Instance.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMP_INSTANCE_HPP #define KOKKOS_OPENMP_INSTANCE_HPP @@ -64,16 +36,22 @@ #include <omp.h> +#include <mutex> +#include <numeric> +#include <type_traits> +#include <vector> + namespace Kokkos { namespace Impl { class OpenMPInternal; -extern int g_openmp_hardware_max_threads; +inline int g_openmp_hardware_max_threads = 1; -extern thread_local int t_openmp_hardware_id; +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 // FIXME_OPENMP we can remove this after we remove partition_master -extern thread_local OpenMPInternal* t_openmp_instance; +inline thread_local OpenMPInternal* t_openmp_instance = nullptr; +#endif struct OpenMPTraits { static int constexpr MAX_THREAD_COUNT = 512; @@ -92,6 +70,7 @@ class OpenMPInternal { int m_pool_size; int m_level; + int m_pool_mutex = 0; HostThreadTeamData* m_pool[OpenMPTraits::MAX_THREAD_COUNT]; @@ -106,12 +85,15 @@ class OpenMPInternal { void clear_thread_data(); + int thread_pool_size() const { return m_pool_size; } + + // Acquire lock used to protect access to m_pool + void acquire_lock(); + + // Release lock used to protect access to m_pool + void release_lock(); + #ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - KOKKOS_DEPRECATED static void validate_partition(const int nthreads, - int& num_partitions, - int& partition_size) { - validate_partition_impl(nthreads, num_partitions, partition_size); - } static void validate_partition_impl(const int nthreads, int& num_partitions, int& partition_size); #endif @@ -139,30 +121,40 @@ inline bool OpenMP::impl_is_initialized() noexcept { return Impl::OpenMPInternal::singleton().is_initialized(); } -inline bool OpenMP::in_parallel(OpenMP const&) noexcept { - // FIXME_OPENMP We are forced to use t_openmp_instance because the function is - // static and does not use the OpenMP object - return ((Impl::OpenMPInternal::singleton().m_level < omp_get_level()) && - (!Impl::t_openmp_instance || - Impl::t_openmp_instance->m_level < omp_get_level())); +inline bool OpenMP::in_parallel(OpenMP const& exec_space) noexcept { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 + return ( + (exec_space.impl_internal_space_instance()->m_level < omp_get_level()) && + (!Impl::t_openmp_instance || + Impl::t_openmp_instance->m_level < omp_get_level())); +#else + return exec_space.impl_internal_space_instance()->m_level < omp_get_level(); +#endif } -inline int OpenMP::impl_thread_pool_size() noexcept { - // FIXME_OPENMP We are forced to use t_openmp_instance because the function is - // static - return OpenMP::in_parallel() +inline int OpenMP::impl_thread_pool_size(OpenMP const& exec_space) noexcept { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 + return OpenMP::in_parallel(exec_space) ? omp_get_num_threads() : (Impl::t_openmp_instance ? Impl::t_openmp_instance->m_pool_size - : Impl::OpenMPInternal::singleton().m_pool_size); + : exec_space.impl_internal_space_instance()->m_pool_size); +#else + return OpenMP::in_parallel(exec_space) + ? omp_get_num_threads() + : exec_space.impl_internal_space_instance()->m_pool_size; +#endif } -KOKKOS_INLINE_FUNCTION -int OpenMP::impl_thread_pool_rank() noexcept { - // FIXME_OPENMP We are forced to use t_openmp_instance because the function is - // static +inline int OpenMP::impl_thread_pool_rank() noexcept { + // FIXME_OPENMP Can we remove this when removing partition_master? It's only + // used in one partition_master test +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 KOKKOS_IF_ON_HOST( (return Impl::t_openmp_instance ? 0 : omp_get_thread_num();)) +#else + KOKKOS_IF_ON_HOST((return omp_get_thread_num();)) +#endif KOKKOS_IF_ON_DEVICE((return -1;)) } @@ -332,9 +324,11 @@ class UniqueToken<OpenMP, UniqueTokenScope::Global> { } /// \brief acquire value such that 0 <= value < size() + // FIXME this is wrong when using nested parallelism. In that case multiple + // threads have the same thread ID. KOKKOS_INLINE_FUNCTION int acquire() const noexcept { - KOKKOS_IF_ON_HOST((return Kokkos::Impl::t_openmp_hardware_id;)) + KOKKOS_IF_ON_HOST((return omp_get_thread_num();)) KOKKOS_IF_ON_DEVICE((return 0;)) } @@ -346,13 +340,13 @@ class UniqueToken<OpenMP, UniqueTokenScope::Global> { } // namespace Experimental -inline int OpenMP::impl_thread_pool_size(int depth) { - return depth < 2 ? impl_thread_pool_size() : 1; +inline int OpenMP::impl_thread_pool_size(int depth, OpenMP const& exec_space) { + return depth < 2 ? impl_thread_pool_size(exec_space) : 1; } KOKKOS_INLINE_FUNCTION int OpenMP::impl_hardware_thread_id() noexcept { - KOKKOS_IF_ON_HOST((return Impl::t_openmp_hardware_id;)) + KOKKOS_IF_ON_HOST((return omp_get_thread_num();)) KOKKOS_IF_ON_DEVICE((return -1;)) } @@ -361,6 +355,59 @@ inline int OpenMP::impl_max_hardware_threads() noexcept { return Impl::g_openmp_hardware_max_threads; } +namespace Experimental { +namespace Impl { +// Partitioning an Execution Space: expects space and integer arguments for +// relative weight +template <typename T> +inline std::vector<OpenMP> create_OpenMP_instances( + OpenMP const& main_instance, std::vector<T> const& weights) { + static_assert( + std::is_arithmetic<T>::value, + "Kokkos Error: partitioning arguments must be integers or floats"); + if (weights.size() == 0) { + Kokkos::abort("Kokkos::abort: Partition weights vector is empty."); + } + std::vector<OpenMP> instances(weights.size()); + double total_weight = std::accumulate(weights.begin(), weights.end(), 0.); + int const main_pool_size = + main_instance.impl_internal_space_instance()->thread_pool_size(); + + int resources_left = main_pool_size; + for (unsigned int i = 0; i < weights.size() - 1; ++i) { + int instance_pool_size = (weights[i] / total_weight) * main_pool_size; + if (instance_pool_size == 0) { + Kokkos::abort("Kokkos::abort: Instance has no resource allocated to it"); + } + instances[i] = OpenMP(instance_pool_size); + resources_left -= instance_pool_size; + } + // Last instance get all resources left + if (resources_left <= 0) { + Kokkos::abort( + "Kokkos::abort: Partition not enough resources left to create the last " + "instance."); + } + instances[weights.size() - 1] = resources_left; + + return instances; +} +} // namespace Impl + +template <typename... Args> +std::vector<OpenMP> partition_space(OpenMP const& main_instance, Args... args) { + // Unpack the arguments and create the weight vector. Note that if not all of + // the types are the same, you will get a narrowing warning. + std::vector<std::common_type_t<Args...>> const weights = {args...}; + return Impl::create_OpenMP_instances(main_instance, weights); +} + +template <typename T> +std::vector<OpenMP> partition_space(OpenMP const& main_instance, + std::vector<T>& weights) { + return Impl::create_OpenMP_instances(main_instance, weights); +} +} // namespace Experimental } // namespace Kokkos #endif diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..aa97ea92a8f7c062f9bd1537b0c2cdb62fc9b3ed --- /dev/null +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp @@ -0,0 +1,32 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENMP_MDRANGEPOLICY_HPP_ +#define KOKKOS_OPENMP_MDRANGEPOLICY_HPP_ + +#include <KokkosExp_MDRangePolicy.hpp> + +namespace Kokkos { +namespace Impl { + +// Settings for TeamMDRangePolicy +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, OpenMP, ThreadAndVector> + : HostBasedNestLevel<Rank, ThreadAndVector> {}; + +} // namespace Impl +} // namespace Kokkos +#endif diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp index 94c465dc2e03c67accd86470ea69d425afcfc1df..cbd687bec57025a19bf9a22694c6b1123f8bbdd2 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Parallel.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMP_PARALLEL_HPP #define KOKKOS_OPENMP_PARALLEL_HPP @@ -72,6 +44,11 @@ namespace Kokkos { namespace Impl { +inline bool execute_in_serial(OpenMP const& space = OpenMP()) { + return (OpenMP::in_parallel(space) && + !(omp_get_nested() && (omp_get_level() == 1))); +} + template <class FunctorType, class... Traits> class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> { private: @@ -113,7 +90,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> { // prevent bug in NVHPC 21.9/CUDA 11.4 (entering zero iterations loop) if (m_policy.begin() >= m_policy.end()) return; #pragma omp parallel for schedule(dynamic KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \ - num_threads(OpenMP::impl_thread_pool_size()) + num_threads(m_instance->thread_pool_size()) KOKKOS_PRAGMA_IVDEP_IF_ENABLED for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) { exec_work(m_functor, iwork); @@ -124,8 +101,15 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> { std::enable_if_t<!std::is_same<typename Policy::schedule_type::type, Kokkos::Dynamic>::value> execute_parallel() const { +// Specifying an chunksize with GCC compiler leads to performance regression +// with static schedule. +#ifdef KOKKOS_COMPILER_GNU +#pragma omp parallel for schedule(static) \ + num_threads(m_instance->thread_pool_size()) +#else #pragma omp parallel for schedule(static KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \ - num_threads(OpenMP::impl_thread_pool_size()) + num_threads(m_instance->thread_pool_size()) +#endif KOKKOS_PRAGMA_IVDEP_IF_ENABLED for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) { exec_work(m_functor, iwork); @@ -134,7 +118,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> { public: inline void execute() const { - if (OpenMP::in_parallel()) { + if (execute_in_serial(m_policy.space())) { exec_range(m_functor, m_policy.begin(), m_policy.end()); return; } @@ -145,7 +129,7 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> { constexpr bool is_dynamic = std::is_same<typename Policy::schedule_type::type, Kokkos::Dynamic>::value; -#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size()) +#pragma omp parallel num_threads(m_instance->thread_pool_size()) { HostThreadTeamData& data = *(m_instance->get_thread_data()); @@ -173,11 +157,15 @@ class ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::OpenMP> { inline ParallelFor(const FunctorType& arg_functor, Policy arg_policy) : m_instance(nullptr), m_functor(arg_functor), m_policy(arg_policy) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif } }; @@ -193,21 +181,17 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, using WorkRange = typename Policy::WorkRange; using Member = typename Policy::member_type; + using index_type = typename Policy::index_type; using iterate_type = typename Kokkos::Impl::HostIterateTile< MDRangePolicy, FunctorType, typename MDRangePolicy::work_tag, void>; OpenMPInternal* m_instance; - const FunctorType m_functor; - const MDRangePolicy m_mdr_policy; - const Policy m_policy; // construct as RangePolicy( 0, num_tiles - // ).set_chunk_size(1) in ctor + const iterate_type m_iter; - inline static void exec_range(const MDRangePolicy& mdr_policy, - const FunctorType& functor, const Member ibeg, - const Member iend) { + inline void exec_range(const Member ibeg, const Member iend) const { KOKKOS_PRAGMA_IVDEP_IF_ENABLED for (Member iwork = ibeg; iwork < iend; ++iwork) { - iterate_type(mdr_policy, functor)(iwork); + m_iter(iwork); } } @@ -215,11 +199,11 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, typename std::enable_if_t<std::is_same<typename Policy::schedule_type::type, Kokkos::Dynamic>::value> execute_parallel() const { -#pragma omp parallel for schedule(dynamic KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \ - num_threads(OpenMP::impl_thread_pool_size()) +#pragma omp parallel for schedule(dynamic, 1) \ + num_threads(m_instance->thread_pool_size()) KOKKOS_PRAGMA_IVDEP_IF_ENABLED - for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) { - iterate_type(m_mdr_policy, m_functor)(iwork); + for (index_type iwork = 0; iwork < m_iter.m_rp.m_num_tiles; ++iwork) { + m_iter(iwork); } } @@ -227,21 +211,22 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, typename std::enable_if<!std::is_same<typename Policy::schedule_type::type, Kokkos::Dynamic>::value>::type execute_parallel() const { -#pragma omp parallel for schedule(static KOKKOS_OPENMP_OPTIONAL_CHUNK_SIZE) \ - num_threads(OpenMP::impl_thread_pool_size()) +#pragma omp parallel for schedule(static, 1) \ + num_threads(m_instance->thread_pool_size()) KOKKOS_PRAGMA_IVDEP_IF_ENABLED - for (auto iwork = m_policy.begin(); iwork < m_policy.end(); ++iwork) { - iterate_type(m_mdr_policy, m_functor)(iwork); + for (index_type iwork = 0; iwork < m_iter.m_rp.m_num_tiles; ++iwork) { + m_iter(iwork); } } public: inline void execute() const { - if (OpenMP::in_parallel()) { - ParallelFor::exec_range(m_mdr_policy, m_functor, m_policy.begin(), - m_policy.end()); +#ifndef KOKKOS_COMPILER_INTEL + if (execute_in_serial(m_iter.m_rp.space())) { + exec_range(0, m_iter.m_rp.m_num_tiles); return; } +#endif #ifndef KOKKOS_INTERNAL_DISABLE_NATIVE_OPENMP execute_parallel<Policy>(); @@ -250,12 +235,11 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, std::is_same<typename Policy::schedule_type::type, Kokkos::Dynamic>::value; -#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size()) +#pragma omp parallel num_threads(m_instance->thread_pool_size()) { HostThreadTeamData& data = *(m_instance->get_thread_data()); - data.set_work_partition(m_policy.end() - m_policy.begin(), - m_policy.chunk_size()); + data.set_work_partition(m_iter.m_rp.m_num_tiles, 1); if (is_dynamic) { // Make sure work partition is set before stealing @@ -268,9 +252,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, range = is_dynamic ? data.get_work_stealing_chunk() : data.get_work_partition(); - ParallelFor::exec_range(m_mdr_policy, m_functor, - range.first + m_policy.begin(), - range.second + m_policy.begin()); + exec_range(range.first, range.second); } while (is_dynamic && 0 <= range.first); } @@ -279,15 +261,16 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, } inline ParallelFor(const FunctorType& arg_functor, MDRangePolicy arg_policy) - : m_instance(nullptr), - m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) { + : m_instance(nullptr), m_iter(arg_policy, arg_functor) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif } template <typename Policy, typename Functor> static int max_tile_size_product(const Policy&, const Functor&) { @@ -379,6 +362,8 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, const size_t pool_reduce_bytes = Analysis::value_size(ReducerConditional::select(m_functor, m_reducer)); + m_instance->acquire_lock(); + m_instance->resize_thread_data(pool_reduce_bytes, 0 // team_reduce_bytes , 0 // team_shared_bytes @@ -386,7 +371,22 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, 0 // thread_local_bytes ); - const int pool_size = OpenMP::impl_thread_pool_size(); + if (execute_in_serial(m_policy.space())) { + const pointer_type ptr = + m_result_ptr + ? m_result_ptr + : pointer_type( + m_instance->get_thread_data(0)->pool_reduce_local()); + + reference_type update = final_reducer.init(ptr); + + ParallelReduce::template exec_range<WorkTag>(m_functor, m_policy.begin(), + m_policy.end(), update); + + final_reducer.final(ptr); + return; + } + const int pool_size = m_instance->thread_pool_size(); #pragma omp parallel num_threads(pool_size) { HostThreadTeamData& data = *(m_instance->get_thread_data()); @@ -436,6 +436,8 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, m_result_ptr[j] = ptr[j]; } } + + m_instance->release_lock(); } //---------------------------------------- @@ -452,11 +454,15 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, m_policy(arg_policy), m_reducer(InvalidType()), m_result_ptr(arg_view.data()) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif /*static_assert( std::is_same< typename ViewType::memory_space , Kokkos::HostSpace >::value , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace" @@ -470,11 +476,15 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, m_policy(arg_policy), m_reducer(reducer), m_result_ptr(reducer.view().data()) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif /*static_assert( std::is_same< typename ViewType::memory_space , Kokkos::HostSpace >::value , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace" @@ -514,30 +524,23 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, WorkTag, reference_type>; OpenMPInternal* m_instance; - const FunctorType m_functor; - const MDRangePolicy m_mdr_policy; - const Policy m_policy; // construct as RangePolicy( 0, num_tiles - // ).set_chunk_size(1) in ctor + const iterate_type m_iter; const ReducerType m_reducer; const pointer_type m_result_ptr; - inline static void exec_range(const MDRangePolicy& mdr_policy, - const FunctorType& functor, const Member ibeg, - const Member iend, reference_type update) { + inline void exec_range(const Member ibeg, const Member iend, + reference_type update) const { for (Member iwork = ibeg; iwork < iend; ++iwork) { - iterate_type(mdr_policy, functor, update)(iwork); + m_iter(iwork, update); } } public: inline void execute() const { - enum { - is_dynamic = std::is_same<typename Policy::schedule_type::type, - Kokkos::Dynamic>::value - }; + const size_t pool_reduce_bytes = Analysis::value_size( + ReducerConditional::select(m_iter.m_func, m_reducer)); - const size_t pool_reduce_bytes = - Analysis::value_size(ReducerConditional::select(m_functor, m_reducer)); + m_instance->acquire_lock(); m_instance->resize_thread_data(pool_reduce_bytes, 0 // team_reduce_bytes , @@ -547,15 +550,39 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, ); typename Analysis::Reducer final_reducer( - &ReducerConditional::select(m_functor, m_reducer)); + &ReducerConditional::select(m_iter.m_func, m_reducer)); + +#ifndef KOKKOS_COMPILER_INTEL + if (execute_in_serial(m_iter.m_rp.space())) { + const pointer_type ptr = + m_result_ptr + ? m_result_ptr + : pointer_type( + m_instance->get_thread_data(0)->pool_reduce_local()); - const int pool_size = OpenMP::impl_thread_pool_size(); + reference_type update = final_reducer.init(ptr); + + ParallelReduce::exec_range(0, m_iter.m_rp.m_num_tiles, update); + + final_reducer.final(ptr); + + m_instance->release_lock(); + + return; + } +#endif + + enum { + is_dynamic = std::is_same<typename Policy::schedule_type::type, + Kokkos::Dynamic>::value + }; + + const int pool_size = m_instance->thread_pool_size(); #pragma omp parallel num_threads(pool_size) { HostThreadTeamData& data = *(m_instance->get_thread_data()); - data.set_work_partition(m_policy.end() - m_policy.begin(), - m_policy.chunk_size()); + data.set_work_partition(m_iter.m_rp.m_num_tiles, 1); if (is_dynamic) { // Make sure work partition is set before stealing @@ -571,9 +598,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, range = is_dynamic ? data.get_work_stealing_chunk() : data.get_work_partition(); - ParallelReduce::exec_range(m_mdr_policy, m_functor, - range.first + m_policy.begin(), - range.second + m_policy.begin(), update); + ParallelReduce::exec_range(range.first, range.second, update); } while (is_dynamic && 0 <= range.first); } @@ -594,12 +619,14 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, if (m_result_ptr) { const int n = Analysis::value_count( - ReducerConditional::select(m_functor, m_reducer)); + ReducerConditional::select(m_iter.m_func, m_reducer)); for (int j = 0; j < n; ++j) { m_result_ptr[j] = ptr[j]; } } + + m_instance->release_lock(); } //---------------------------------------- @@ -612,16 +639,18 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, !Kokkos::is_reducer<ReducerType>::value, void*> = nullptr) : m_instance(nullptr), - m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), + m_iter(arg_policy, arg_functor), m_reducer(InvalidType()), m_result_ptr(arg_view.data()) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif /*static_assert( std::is_same< typename ViewType::memory_space , Kokkos::HostSpace >::value , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace" @@ -631,16 +660,18 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, inline ParallelReduce(const FunctorType& arg_functor, MDRangePolicy arg_policy, const ReducerType& reducer) : m_instance(nullptr), - m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), + m_iter(arg_policy, arg_functor), m_reducer(reducer), m_result_ptr(reducer.view().data()) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif /*static_assert( std::is_same< typename ViewType::memory_space , Kokkos::HostSpace >::value , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace" @@ -717,7 +748,19 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, 0 // thread_local_bytes ); -#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size()) + if (execute_in_serial(m_policy.space())) { + typename Analysis::Reducer final_reducer(&m_functor); + + reference_type update = final_reducer.init( + pointer_type(m_instance->get_thread_data(0)->pool_reduce_local())); + + ParallelScan::template exec_range<WorkTag>(m_functor, m_policy.begin(), + m_policy.end(), update, true); + + return; + } + +#pragma omp parallel num_threads(m_instance->thread_pool_size()) { HostThreadTeamData& data = *(m_instance->get_thread_data()); typename Analysis::Reducer final_reducer(&m_functor); @@ -768,11 +811,15 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, inline ParallelScan(const FunctorType& arg_functor, const Policy& arg_policy) : m_instance(nullptr), m_functor(arg_functor), m_policy(arg_policy) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif } //---------------------------------------- @@ -791,13 +838,14 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, using WorkRange = typename Policy::WorkRange; using Member = typename Policy::member_type; + using value_type = typename Analysis::value_type; using pointer_type = typename Analysis::pointer_type; using reference_type = typename Analysis::reference_type; OpenMPInternal* m_instance; const FunctorType m_functor; const Policy m_policy; - ReturnType& m_returnvalue; + const pointer_type m_result_ptr; template <class TagType> inline static std::enable_if_t<std::is_void<TagType>::value> exec_range( @@ -823,6 +871,8 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, const int value_count = Analysis::value_count(m_functor); const size_t pool_reduce_bytes = 2 * Analysis::value_size(m_functor); + m_instance->acquire_lock(); + m_instance->resize_thread_data(pool_reduce_bytes, 0 // team_reduce_bytes , 0 // team_shared_bytes @@ -830,7 +880,23 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, 0 // thread_local_bytes ); -#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size()) + if (execute_in_serial(m_policy.space())) { + typename Analysis::Reducer final_reducer(&m_functor); + + reference_type update = final_reducer.init( + pointer_type(m_instance->get_thread_data(0)->pool_reduce_local())); + + this->template exec_range<WorkTag>(m_functor, m_policy.begin(), + m_policy.end(), update, true); + + *m_result_ptr = update; + + m_instance->release_lock(); + + return; + } + +#pragma omp parallel num_threads(m_instance->thread_pool_size()) { HostThreadTeamData& data = *(m_instance->get_thread_data()); typename Analysis::Reducer final_reducer(&m_functor); @@ -875,25 +941,36 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, m_functor, range.begin(), range.end(), update_base, true); if (omp_get_thread_num() == omp_get_num_threads() - 1) { - m_returnvalue = update_base; + *m_result_ptr = update_base; } } + + m_instance->release_lock(); } //---------------------------------------- - inline ParallelScanWithTotal(const FunctorType& arg_functor, - const Policy& arg_policy, - ReturnType& arg_returnvalue) + template <class ViewType> + ParallelScanWithTotal(const FunctorType& arg_functor, + const Policy& arg_policy, + const ViewType& arg_result_view) : m_instance(nullptr), m_functor(arg_functor), m_policy(arg_policy), - m_returnvalue(arg_returnvalue) { + m_result_ptr(arg_result_view.data()) { + static_assert( + Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space, + Kokkos::HostSpace>::accessible, + "Kokkos::OpenMP parallel_scan result must be host-accessible!"); +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif } //---------------------------------------- @@ -972,10 +1049,22 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, const size_t team_shared_size = m_shmem_size; const size_t thread_local_size = 0; // Never shrinks + m_instance->acquire_lock(); + m_instance->resize_thread_data(pool_reduce_size, team_reduce_size, team_shared_size, thread_local_size); -#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size()) + if (execute_in_serial(m_policy.space())) { + ParallelFor::template exec_team<WorkTag>( + m_functor, *(m_instance->get_thread_data()), 0, + m_policy.league_size(), m_policy.league_size()); + + m_instance->release_lock(); + + return; + } + +#pragma omp parallel num_threads(m_instance->thread_pool_size()) { HostThreadTeamData& data = *(m_instance->get_thread_data()); @@ -1010,6 +1099,8 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, data.disband_team(); } + + m_instance->release_lock(); } inline ParallelFor(const FunctorType& arg_functor, const Policy& arg_policy) @@ -1019,11 +1110,15 @@ class ParallelFor<FunctorType, Kokkos::TeamPolicy<Properties...>, m_shmem_size(arg_policy.scratch_size(0) + arg_policy.scratch_size(1) + FunctorTeamShmemSize<FunctorType>::value( arg_functor, arg_policy.team_size())) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif } }; @@ -1124,10 +1219,30 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, const size_t team_shared_size = m_shmem_size + m_policy.scratch_size(1); const size_t thread_local_size = 0; // Never shrinks + m_instance->acquire_lock(); + m_instance->resize_thread_data(pool_reduce_size, team_reduce_size, team_shared_size, thread_local_size); - const int pool_size = OpenMP::impl_thread_pool_size(); + if (execute_in_serial(m_policy.space())) { + HostThreadTeamData& data = *(m_instance->get_thread_data()); + pointer_type ptr = + m_result_ptr ? m_result_ptr : pointer_type(data.pool_reduce_local()); + reference_type update = final_reducer.init(ptr); + const int league_rank_begin = 0; + const int league_rank_end = m_policy.league_size(); + ParallelReduce::template exec_team<WorkTag>( + m_functor, data, update, league_rank_begin, league_rank_end, + m_policy.league_size()); + + final_reducer.final(ptr); + + m_instance->release_lock(); + + return; + } + + const int pool_size = m_instance->thread_pool_size(); #pragma omp parallel num_threads(pool_size) { HostThreadTeamData& data = *(m_instance->get_thread_data()); @@ -1201,6 +1316,8 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_result_ptr[j] = ptr[j]; } } + + m_instance->release_lock(); } //---------------------------------------- @@ -1220,11 +1337,15 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_shmem_size(arg_policy.scratch_size(0) + arg_policy.scratch_size(1) + FunctorTeamShmemSize<FunctorType>::value( arg_functor, arg_policy.team_size())) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif } inline ParallelReduce(const FunctorType& arg_functor, Policy arg_policy, @@ -1237,11 +1358,15 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, m_shmem_size(arg_policy.scratch_size(0) + arg_policy.scratch_size(1) + FunctorTeamShmemSize<FunctorType>::value( arg_functor, arg_policy.team_size())) { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 if (t_openmp_instance) { m_instance = t_openmp_instance; } else { m_instance = arg_policy.space().impl_internal_space_instance(); } +#else + m_instance = arg_policy.space().impl_internal_space_instance(); +#endif /*static_assert( std::is_same< typename ViewType::memory_space , Kokkos::HostSpace >::value , "Reduction result on Kokkos::OpenMP must be a Kokkos::View in HostSpace" diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp index 4babcf03d9c143d7221bcd8c7d554455835aefc9..3e67d8d62527d151b65dd097b6bf0aaee68f8011 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp index ec1ede0e2abf59dea97f5902c0ea372b7e99b050..d6fd45ae9ae5e3cfa07bbbbe0055fcdb40e4534e 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Task.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_OPENMP_TASK_HPP #define KOKKOS_IMPL_OPENMP_TASK_HPP @@ -100,6 +72,8 @@ class TaskQueueSpecialization<SimpleTaskScheduler<Kokkos::OpenMP, QueueType>> { execution_space().impl_internal_space_instance(); const int pool_size = get_max_team_count(scheduler.get_execution_space()); + instance->acquire_lock(); + // TODO @tasking @new_feature DSH allow team sizes other than 1 const int team_size = 1; // Threads per core instance->resize_thread_data(0, /* global reduce buffer */ @@ -177,10 +151,12 @@ class TaskQueueSpecialization<SimpleTaskScheduler<Kokkos::OpenMP, QueueType>> { } self.disband_team(); } // end pragma omp parallel + + instance->release_lock(); } static uint32_t get_max_team_count(execution_space const& espace) { - return static_cast<uint32_t>(espace.impl_thread_pool_size()); + return static_cast<uint32_t>(OpenMP::impl_thread_pool_size(espace)); } // TODO @tasking @optimization DSH specialize this for trivially destructible @@ -258,7 +234,9 @@ class TaskQueueSpecializationConstrained< Impl::OpenMPInternal* instance = execution_space().impl_internal_space_instance(); - const int pool_size = OpenMP::impl_thread_pool_size(); + const int pool_size = instance->thread_pool_size(); + + instance->acquire_lock(); const int team_size = 1; // Threads per core instance->resize_thread_data(0 /* global reduce buffer */ @@ -361,6 +339,8 @@ class TaskQueueSpecializationConstrained< } self.disband_team(); } // end pragma omp parallel + + instance->release_lock(); } template <typename TaskType> diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Team.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Team.hpp index 73533178b6f4d943c7bfe776ac38c24d081a40f8..280b1701ad603a812bd07c4fd22f62a4be6a3da8 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Team.hpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMP_TEAM_HPP #define KOKKOS_OPENMP_TEAM_HPP @@ -62,10 +34,7 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> using traits = PolicyTraits<Properties...>; - const typename traits::execution_space& space() const { - static typename traits::execution_space m_space; - return m_space; - } + const typename traits::execution_space& space() const { return m_space; } template <class ExecSpace, class... OtherProperties> friend class TeamPolicyInternal; @@ -84,12 +53,13 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> m_chunk_size = p.m_chunk_size; m_tune_team = p.m_tune_team; m_tune_vector = p.m_tune_vector; + m_space = p.m_space; } //---------------------------------------- template <class FunctorType> int team_size_max(const FunctorType&, const ParallelForTag&) const { - int pool_size = traits::execution_space::impl_thread_pool_size(1); + int pool_size = traits::execution_space::impl_thread_pool_size(1, m_space); int max_host_team_size = Impl::HostThreadTeamData::max_team_members; return pool_size < max_host_team_size ? pool_size : max_host_team_size; } @@ -98,7 +68,7 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> template <class FunctorType> int team_size_max(const FunctorType&, const ParallelReduceTag&) const { - int pool_size = traits::execution_space::impl_thread_pool_size(1); + int pool_size = traits::execution_space::impl_thread_pool_size(1, m_space); int max_host_team_size = Impl::HostThreadTeamData::max_team_members; return pool_size < max_host_team_size ? pool_size : max_host_team_size; } @@ -109,12 +79,12 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> } template <class FunctorType> int team_size_recommended(const FunctorType&, const ParallelForTag&) const { - return traits::execution_space::impl_thread_pool_size(2); + return traits::execution_space::impl_thread_pool_size(2, m_space); } template <class FunctorType> int team_size_recommended(const FunctorType&, const ParallelReduceTag&) const { - return traits::execution_space::impl_thread_pool_size(2); + return traits::execution_space::impl_thread_pool_size(2, m_space); } template <class FunctorType, class ReducerType> inline int team_size_recommended(const FunctorType& f, const ReducerType&, @@ -147,9 +117,13 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> bool m_tune_team; bool m_tune_vector; + typename traits::execution_space m_space; + inline void init(const int league_size_request, const int team_size_request) { - const int pool_size = traits::execution_space::impl_thread_pool_size(0); - const int team_grain = traits::execution_space::impl_thread_pool_size(2); + const int pool_size = + traits::execution_space::impl_thread_pool_size(0, m_space); + const int team_grain = + traits::execution_space::impl_thread_pool_size(2, m_space); const int max_host_team_size = Impl::HostThreadTeamData::max_team_members; const int team_max = ((pool_size < max_host_team_size) ? pool_size : max_host_team_size); @@ -163,12 +137,17 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> // Round team size up to a multiple of 'team_gain' const int team_size_grain = team_grain * ((m_team_size + team_grain - 1) / team_grain); + + // more helpful than "floating point exception occured" + if (0 == team_size_grain) { + Kokkos::abort("Kokkos::abort: Requested Team Size rounded up to 0!"); + } const int team_count = pool_size / team_size_grain; // Constraint : pool_size = m_team_alloc * team_count m_team_alloc = pool_size / team_count; - // Maxumum number of iterations each team will take: + // Maximum number of iterations each team will take: m_team_iter = (m_league_size + team_count - 1) / team_count; set_auto_chunk_size(); @@ -190,18 +169,19 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> } /** \brief Specify league size, request team size */ - TeamPolicyInternal(const typename traits::execution_space&, + TeamPolicyInternal(const typename traits::execution_space& space, int league_size_request, int team_size_request, int /* vector_length_request */ = 1) : m_team_scratch_size{0, 0}, m_thread_scratch_size{0, 0}, m_chunk_size(0), m_tune_team(false), - m_tune_vector(false) { + m_tune_vector(false), + m_space(space) { init(league_size_request, team_size_request); } - TeamPolicyInternal(const typename traits::execution_space&, + TeamPolicyInternal(const typename traits::execution_space& space, int league_size_request, const Kokkos::AUTO_t& /* team_size_request */ , @@ -210,12 +190,13 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> m_thread_scratch_size{0, 0}, m_chunk_size(0), m_tune_team(true), - m_tune_vector(false) { + m_tune_vector(false), + m_space(space) { init(league_size_request, - traits::execution_space::impl_thread_pool_size(2)); + traits::execution_space::impl_thread_pool_size(2, m_space)); } - TeamPolicyInternal(const typename traits::execution_space&, + TeamPolicyInternal(const typename traits::execution_space& space, int league_size_request, const Kokkos::AUTO_t& /* team_size_request */ , @@ -224,19 +205,21 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> m_thread_scratch_size{0, 0}, m_chunk_size(0), m_tune_team(true), - m_tune_vector(true) { + m_tune_vector(true), + m_space(space) { init(league_size_request, - traits::execution_space::impl_thread_pool_size(2)); + traits::execution_space::impl_thread_pool_size(2, m_space)); } - TeamPolicyInternal(const typename traits::execution_space&, + TeamPolicyInternal(const typename traits::execution_space& space, int league_size_request, const int team_size_request, const Kokkos::AUTO_t& /* vector_length_request */) : m_team_scratch_size{0, 0}, m_thread_scratch_size{0, 0}, m_chunk_size(0), m_tune_team(false), - m_tune_vector(true) { + m_tune_vector(true), + m_space(space) { init(league_size_request, team_size_request); } @@ -260,7 +243,7 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> m_tune_team(true), m_tune_vector(false) { init(league_size_request, - traits::execution_space::impl_thread_pool_size(2)); + traits::execution_space::impl_thread_pool_size(2, m_space)); } TeamPolicyInternal(int league_size_request, @@ -273,7 +256,7 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> m_tune_team(true), m_tune_vector(true) { init(league_size_request, - traits::execution_space::impl_thread_pool_size(2)); + traits::execution_space::impl_thread_pool_size(2, m_space)); } TeamPolicyInternal(int league_size_request, int team_size_request, @@ -328,7 +311,8 @@ class TeamPolicyInternal<Kokkos::OpenMP, Properties...> /** \brief finalize chunk_size if it was set to AUTO*/ inline void set_auto_chunk_size() { int concurrency = - traits::execution_space::impl_thread_pool_size(0) / m_team_alloc; + traits::execution_space::impl_thread_pool_size(0, m_space) / + m_team_alloc; if (concurrency == 0) concurrency = 1; if (m_chunk_size > 0) { diff --git a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp index 55d9c58607315d8f5d53473648c8c72cf975101a..6cc52815de9a6200b450fcd4c218fbceff340247 100644 --- a/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/OpenMP/Kokkos_OpenMP_WorkGraphPolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMP_WORKGRAPHPOLICY_HPP #define KOKKOS_OPENMP_WORKGRAPHPOLICY_HPP @@ -74,7 +46,11 @@ class ParallelFor<FunctorType, Kokkos::WorkGraphPolicy<Traits...>, public: inline void execute() { -#pragma omp parallel num_threads(OpenMP::impl_thread_pool_size()) + // We need to introduce pool_size to work around NVHPC 22.5 ICE + // We need to use [[maybe_unused]] to work around an unused-variable warning + // from HIP + [[maybe_unused]] int pool_size = OpenMP::impl_thread_pool_size(); +#pragma omp parallel num_threads(pool_size) { // Spin until COMPLETED_TOKEN. // END_TOKEN indicates no work is currently available. diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp index 5ff9bf32b6f7f94cada3641519c6a740f76652b0..f30abb0c875ac7454e280ba4b6697d2fa5a26539 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp index ff07ce4f3ae86a32e0272891f5113536af38df07..29641165d2c67c4369b3f9f01dc4f1faf2cf8d6f 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Abort.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMPTARGET_ABORT_HPP #define KOKKOS_OPENMPTARGET_ABORT_HPP diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp index 1ca30631af920badd089559874a7d24a7cfb63f7..fd0b47f15196a3ac49b30007ce20d945ec6134e5 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Error.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMPTARGET_ERROR_HPP #define KOKKOS_OPENMPTARGET_ERROR_HPP @@ -64,7 +36,7 @@ inline void ompt_internal_safe_call(int e, const char* name, } } -#define OMPT_SAFE_CALL(call) \ +#define KOKKOS_IMPL_OMPT_SAFE_CALL(call) \ Kokkos::Impl::ompt_internal_safe_call(call, #call, __FILE__, __LINE__) } // namespace Impl diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp index d3bec5aebff8c425aaf5c4cc5060844f6cf55874..40da73ebc641c11e1e0b9a8ce14134f72ea73f23 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -159,9 +131,9 @@ int* OpenMPTargetExec::get_lock_array(int num_teams) { for (int i = 0; i < lock_array_elem; ++i) h_lock_array[i] = 0; - OMPT_SAFE_CALL(omp_target_memcpy(m_lock_array, h_lock_array, m_lock_size, 0, - 0, omp_get_default_device(), - omp_get_initial_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL( + omp_target_memcpy(m_lock_array, h_lock_array, m_lock_size, 0, 0, + omp_get_default_device(), omp_get_initial_device())); omp_target_free(h_lock_array, omp_get_initial_device()); } diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp index 52f5dcb83e8f3d7390ae8c7382fb0405363350ae..6d62a3c7e4b7d7b9f0cbeee441c92c38c99dbee6 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMPTARGETEXEC_HPP #define KOKKOS_OPENMPTARGETEXEC_HPP @@ -749,8 +721,8 @@ class OpenMPTargetExec { // teams possible is calculated based on NVIDIA's Volta GPU. In // future this value should be based on the chosen architecture for the // OpenMPTarget backend. - enum { MAX_ACTIVE_THREADS = 2080 * 80 }; - enum { MAX_ACTIVE_TEAMS = MAX_ACTIVE_THREADS / 32 }; + static constexpr int MAX_ACTIVE_THREADS = 2080 * 80; + static constexpr int MAX_ACTIVE_TEAMS = MAX_ACTIVE_THREADS / 32; private: static void* scratch_ptr; @@ -785,13 +757,11 @@ namespace Impl { class OpenMPTargetExecTeamMember { public: - enum { TEAM_REDUCE_SIZE = 512 }; - - /** \brief Thread states for team synchronization */ - enum { Active = 0, Rendezvous = 1 }; + static constexpr int TEAM_REDUCE_SIZE = 512; using execution_space = Kokkos::Experimental::OpenMPTarget; using scratch_memory_space = execution_space::scratch_memory_space; + using team_handle = OpenMPTargetExecTeamMember; scratch_memory_space m_team_shared; size_t m_team_scratch_size[2]; @@ -1112,11 +1082,6 @@ class TeamPolicyInternal<Kokkos::Experimental::OpenMPTarget, Properties...> m_tune_vector_length = length; } inline int impl_vector_length() const { return m_vector_length; } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - KOKKOS_DEPRECATED inline int vector_length() const { - return impl_vector_length(); - } -#endif inline int team_size() const { return m_team_size; } inline int league_size() const { return m_league_size; } inline size_t scratch_size(const int& level, int team_size_ = -1) const { @@ -1601,7 +1566,6 @@ KOKKOS_INLINE_FUNCTION void parallel_scan( // Note this thing is called .member in the CUDA specialization of // TeamThreadRangeBoundariesStruct auto& member = loop_bounds.team; - const auto team_size = member.team_size(); const auto team_rank = member.team_rank(); #if defined(KOKKOS_IMPL_TEAM_SCAN_WORKAROUND) @@ -1614,8 +1578,9 @@ KOKKOS_INLINE_FUNCTION void parallel_scan( } #pragma omp barrier #else - const auto nchunk = (end - start + team_size - 1) / team_size; - value_type accum = 0; + const auto team_size = member.team_size(); + const auto nchunk = (end - start + team_size - 1) / team_size; + value_type accum = 0; // each team has to process one or // more chunks of the prefix scan for (iType i = 0; i < nchunk; ++i) { diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp index a9bc085912356ec90bbef0c63688cd3f91d11a95..4a33961205224faea928b14eeb29d572ad44174c 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -93,7 +65,13 @@ void OpenMPTargetInternal::fence(const std::string& name, [&]() {}); } } -int OpenMPTargetInternal::concurrency() { return 128000; } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 +int OpenMPTargetInternal::concurrency() { +#else +int OpenMPTargetInternal::concurrency() const { +#endif + return 128000; // FIXME_OPENMPTARGET +} const char* OpenMPTargetInternal::name() { return "OpenMPTarget"; } void OpenMPTargetInternal::print_configuration(std::ostream& os, bool /*verbose*/) const { @@ -115,8 +93,9 @@ void OpenMPTargetInternal::impl_initialize() { // FIXME_OPENMPTARGET: Only fix the number of teams for NVIDIA architectures // from Pascal and upwards. -#if defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \ - defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) +#if defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \ + defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) || \ + defined(KOKKOS_ARCH_HOPPER) #if defined(KOKKOS_COMPILER_CLANG) && (KOKKOS_COMPILER_CLANG >= 1300) omp_set_num_teams(512); #endif @@ -203,9 +182,9 @@ UniqueToken<Kokkos::Experimental::OpenMPTarget, Kokkos::kokkos_malloc<Kokkos::Experimental::OpenMPTargetSpace>( "Kokkos::OpenMPTarget::m_uniquetoken_ptr", size)); std::vector<uint32_t> h_buf(count, 0); - OMPT_SAFE_CALL(omp_target_memcpy(ptr, h_buf.data(), size, 0, 0, - omp_get_default_device(), - omp_get_initial_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(ptr, h_buf.data(), size, 0, 0, + omp_get_default_device(), + omp_get_initial_device())); Kokkos::Impl::OpenMPTargetExec::m_uniquetoken_ptr = ptr; } diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp index 8e4baf8c0529f31d226d91470dbe7cc9674d6272..9f4349c00ef65c404eefbf7352449c50d67a51cf 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Instance.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMPTARGET_INSTANCE_HPP #define KOKKOS_OPENMPTARGET_INSTANCE_HPP diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d718f56d38b0382dc16d0684a5bf6efa42bd68cb --- /dev/null +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp @@ -0,0 +1,33 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_OPENMPTARGET_MDRANGEPOLICY_HPP_ +#define KOKKOS_OPENMPTARGET_MDRANGEPOLICY_HPP_ + +#include <KokkosExp_MDRangePolicy.hpp> + +namespace Kokkos { +namespace Impl { + +template <typename Rank, + ::Kokkos::Impl::TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, Kokkos::Experimental::OpenMPTarget, + ThreadAndVector> + : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {}; + +} // namespace Impl +} // namespace Kokkos +#endif diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp index dfb9ea70a1af0458933ef22c695b1a689359add0..71ce4b18f2896545b1d4d50edef1590f561e5a22 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMPTARGET_PARALLEL_HPP #define KOKKOS_OPENMPTARGET_PARALLEL_HPP @@ -112,9 +84,9 @@ struct ParallelReduceCommon { static void memcpy_result(PointerType dest, PointerType src, size_t size, bool ptr_on_device) { if (ptr_on_device) { - OMPT_SAFE_CALL(omp_target_memcpy(dest, src, size, 0, 0, - omp_get_default_device(), - omp_get_initial_device())); + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy(dest, src, size, 0, 0, + omp_get_default_device(), + omp_get_initial_device())); } else { *dest = *src; } @@ -319,11 +291,11 @@ struct ParallelReduceSpecialize<FunctorType, Kokkos::RangePolicy<PolicyArgs...>, // If there is no work to be done, copy back the initialized values and // exit. if (!ptr_on_device) - OMPT_SAFE_CALL(omp_target_memcpy( + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0, omp_get_initial_device(), omp_get_default_device())); else - OMPT_SAFE_CALL(omp_target_memcpy( + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0, omp_get_default_device(), omp_get_default_device())); @@ -400,11 +372,11 @@ struct ParallelReduceSpecialize<FunctorType, Kokkos::RangePolicy<PolicyArgs...>, // If the result view is on the host, copy back the values via memcpy. if (!ptr_on_device) - OMPT_SAFE_CALL(omp_target_memcpy( + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0, omp_get_initial_device(), omp_get_default_device())); else - OMPT_SAFE_CALL(omp_target_memcpy( + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0, omp_get_default_device(), omp_get_default_device())); } @@ -542,6 +514,9 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, const FunctorType m_functor; const Policy m_policy; + value_type* m_result_ptr; + const bool m_result_ptr_device_accessible; + template <class TagType> std::enable_if_t<std::is_void<TagType>::value> call_with_tag( const FunctorType& f, const idx_type& idx, value_type& val, @@ -648,6 +623,8 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, local_offset_value = offset_value; if (idx < N) call_with_tag<WorkTag>(a_functor, idx, local_offset_value, true); + if (idx == N - 1 && m_result_ptr_device_accessible) + *m_result_ptr = local_offset_value; } } } @@ -676,8 +653,13 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, //---------------------------------------- - ParallelScan(const FunctorType& arg_functor, const Policy& arg_policy) - : m_functor(arg_functor), m_policy(arg_policy) {} + ParallelScan(const FunctorType& arg_functor, const Policy& arg_policy, + pointer_type arg_result_ptr = nullptr, + bool arg_result_ptr_device_accessible = false) + : m_functor(arg_functor), + m_policy(arg_policy), + m_result_ptr(arg_result_ptr), + m_result_ptr_device_accessible(arg_result_ptr_device_accessible) {} //---------------------------------------- }; @@ -690,7 +672,6 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, using base_t = ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, Kokkos::Experimental::OpenMPTarget>; using value_type = typename base_t::value_type; - value_type& m_returnvalue; public: void execute() const { @@ -714,18 +695,24 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, base_t::impl_execute(element_values, chunk_values, count); - const int size = base_t::Analysis::value_size(base_t::m_functor); - DeepCopy<HostSpace, Kokkos::Experimental::OpenMPTargetSpace>( - &m_returnvalue, chunk_values.data() + (n_chunks - 1), size); - } else { - m_returnvalue = 0; + if (!base_t::m_result_ptr_device_accessible) { + const int size = base_t::Analysis::value_size(base_t::m_functor); + DeepCopy<HostSpace, Kokkos::Experimental::OpenMPTargetSpace>( + base_t::m_result_ptr, chunk_values.data() + (n_chunks - 1), size); + } + } else if (!base_t::m_result_ptr_device_accessible) { + *base_t::m_result_ptr = 0; } } + template <class ViewType> ParallelScanWithTotal(const FunctorType& arg_functor, const typename base_t::Policy& arg_policy, - ReturnType& arg_returnvalue) - : base_t(arg_functor, arg_policy), m_returnvalue(arg_returnvalue) {} + const ViewType& arg_result_view) + : base_t(arg_functor, arg_policy, arg_result_view.data(), + MemorySpaceAccess<Kokkos::Experimental::OpenMPTargetSpace, + typename ViewType::memory_space>::accessible) { + } }; } // namespace Impl } // namespace Kokkos @@ -1094,11 +1081,11 @@ struct ParallelReduceSpecialize<FunctorType, TeamPolicyInternal<PolicyArgs...>, // If there is no work to be done, copy back the initialized values and // exit. if (!ptr_on_device) - OMPT_SAFE_CALL(omp_target_memcpy( + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0, omp_get_initial_device(), omp_get_default_device())); else - OMPT_SAFE_CALL(omp_target_memcpy( + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0, omp_get_default_device(), omp_get_default_device())); @@ -1158,11 +1145,11 @@ struct ParallelReduceSpecialize<FunctorType, TeamPolicyInternal<PolicyArgs...>, // If the result view is on the host, copy back the values via memcpy. if (!ptr_on_device) - OMPT_SAFE_CALL(omp_target_memcpy( + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0, omp_get_initial_device(), omp_get_default_device())); else - OMPT_SAFE_CALL(omp_target_memcpy( + KOKKOS_IMPL_OMPT_SAFE_CALL(omp_target_memcpy( ptr, scratch_ptr, value_count * sizeof(ValueType), 0, 0, omp_get_default_device(), omp_get_default_device())); } diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp index 2399b424f58cf9bf632d64e87b3da2383f8f8270..21bdb67e34f5432e315d0450fa28ff5188ca543f 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Parallel_MDRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMPTARGET_PARALLEL_MDRANGE_HPP #define KOKKOS_OPENMPTARGET_PARALLEL_MDRANGE_HPP @@ -458,12 +430,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, using pointer_type = typename Analysis::pointer_type; using reference_type = typename Analysis::reference_type; - enum { - HasJoin = - Impl::FunctorAnalysis<Impl::FunctorPatternInterface::REDUCE, Policy, - FunctorType>::has_join_member_function - }; - enum { UseReducer = is_reducer<ReducerType>::value }; + static constexpr bool UseReducer = is_reducer<ReducerType>::value; const pointer_type m_result_ptr; const FunctorType m_functor; diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp index 1ada2b1911af954e7b1fbe2a91a60fdda6530eb4..458c4c9a43e617b0ad3c6bcecf823acc931fb109 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp index f7ba01dffecb950de6320e1028d2c8d36744e089..c9aa7b128f17eda3782b903c07c001217b406acd 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Task.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_OPENMP_TASK_HPP #define KOKKOS_IMPL_OPENMP_TASK_HPP diff --git a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp index fa348611b953aa62704cb760521a275a04729985..c7f146871bd5ab1518cb28e2d4000feaf71698a6 100644 --- a/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp +++ b/packages/kokkos/core/src/OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMPTARGET_UNIQUE_TOKEN_HPP #define KOKKOS_OPENMPTARGET_UNIQUE_TOKEN_HPP diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp index 840db4327cb363409e058602885f7b079ae85e31..e38b011c89b5987707a61aa3b2f7709260bdd25d 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -93,9 +65,13 @@ SYCL::SYCL(const sycl::queue& stream) m_space_instance->initialize(stream); } +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 int SYCL::concurrency() { return Impl::SYCLInternal::singleton().m_maxConcurrency; } +#else +int SYCL::concurrency() const { return m_space_instance->m_maxConcurrency; } +#endif const char* SYCL::name() { return "SYCL"; } @@ -142,10 +118,6 @@ void SYCL::impl_static_fence(const std::string& name) { }); } -int SYCL::sycl_device() const { - return impl_internal_space_instance()->m_syclDev; -} - void SYCL::impl_initialize(InitializationSettings const& settings) { std::vector<sycl::device> gpu_devices = sycl::device::get_devices(sycl::info::device_type::gpu); @@ -155,14 +127,16 @@ void SYCL::impl_initialize(InitializationSettings const& settings) { #if !defined(KOKKOS_ARCH_INTEL_GPU) && !defined(KOKKOS_ARCH_KEPLER) && \ !defined(KOKKOS_ARCH_MAXWELL) && !defined(KOKKOS_ARCH_PASCAL) && \ !defined(KOKKOS_ARCH_VOLTA) && !defined(KOKKOS_ARCH_TURING75) && \ - !defined(KOKKOS_ARCH_AMPERE) + !defined(KOKKOS_ARCH_AMPERE) && !defined(KOKKOS_ARCH_HOPPER) if (!settings.has_device_id() && gpu_devices.empty()) { Impl::SYCLInternal::singleton().initialize(sycl::device()); + Impl::SYCLInternal::m_syclDev = 0; return; } #endif - using Kokkos::Impl::get_gpu; - Impl::SYCLInternal::singleton().initialize(gpu_devices[get_gpu(settings)]); + const auto id = ::Kokkos::Impl::get_gpu(settings); + Impl::SYCLInternal::singleton().initialize(gpu_devices[id]); + Impl::SYCLInternal::m_syclDev = id; } std::ostream& SYCL::impl_sycl_info(std::ostream& os, diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Abort.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Abort.hpp index e376f012f73acdb7ddd4875bf23e4f7dfcf385ba..9e6d9fd7e23ff779b03fd5786ac4b15986abd0dd 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Abort.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Abort.hpp @@ -1,53 +1,30 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_ABORT_HPP #define KOKKOS_SYCL_ABORT_HPP #include <Kokkos_Macros.hpp> #if defined(KOKKOS_ENABLE_SYCL) +// FIXME_SYCL +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else #include <CL/sycl.hpp> +#endif namespace Kokkos { namespace Impl { diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp index 160f6068482b0884abdef061a8a8f83fb018b2db..62b7977fcc0325410ea876b95a6f55cbfe3109e7 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_DeepCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCLDEEPCOPY_HPP #define KOKKOS_SYCLDEEPCOPY_HPP diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp index 3adbb16268e35999458d6f5c2db7fbe3e79ea6f3..d7b0271e15d10893e8f0ed233c5a5033769fad54 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Conversion.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.5 +// Kokkos v. 4.0 // Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_HALF_HPP_ #define KOKKOS_SYCL_HALF_HPP_ @@ -48,7 +20,7 @@ #ifdef KOKKOS_IMPL_SYCL_HALF_TYPE_DEFINED #include <Kokkos_Half.hpp> -#include <Kokkos_NumericTraits.hpp> // reduction_identity +#include <Kokkos_ReductionIdentity.hpp> namespace Kokkos { namespace Experimental { diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp index cf7d513b990e0e82e51939ca6b333b67610e4314..8932c15883044c1c7341955490cb5c6dad70e2f7 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Half_Impl_Type.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.5 +// Kokkos v. 4.0 // Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_HALF_IMPL_TYPE_HPP_ #define KOKKOS_SYCL_HALF_IMPL_TYPE_HPP_ @@ -48,7 +20,12 @@ #include <Kokkos_Macros.hpp> #ifdef KOKKOS_ENABLE_SYCL +// FIXME_SYCL +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else #include <CL/sycl.hpp> +#endif #ifndef KOKKOS_IMPL_HALF_TYPE_DEFINED // Make sure no one else tries to define half_t diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.cpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.cpp index 37721247a73ae8d0b0d3723b424d7833c5b9a3dc..0e1738d6acbc7b0833418f10f3d6b1a0ea31f1e0 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.cpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -138,20 +110,6 @@ void SYCLInternal::initialize(const sycl::queue& q) { m_maxWorkgroupSize * 2 * d.template get_info<sycl::info::device::max_compute_units>(); - // Setup concurent bitset for obtaining unique tokens from within an - // executing kernel. - { - const int32_t buffer_bound = - Kokkos::Impl::concurrent_bitset::buffer_bound(m_maxConcurrency); - using Record = Kokkos::Impl::SharedAllocationRecord< - Kokkos::Experimental::SYCLDeviceUSMSpace, void>; - Record* const r = - Record::allocate(Kokkos::Experimental::SYCLDeviceUSMSpace(*m_queue), - "Kokkos::Experimental::SYCL::InternalScratchBitset", - sizeof(uint32_t) * buffer_bound); - Record::increment(r); - } - m_maxShmemPerBlock = d.template get_info<sycl::info::device::local_mem_size>(); @@ -356,6 +314,8 @@ void SYCLInternal::USMObjectMem<Kind>::reset() { m_q.reset(); } +int SYCLInternal::m_syclDev; + template class SYCLInternal::USMObjectMem<sycl::usm::alloc::shared>; template class SYCLInternal::USMObjectMem<sycl::usm::alloc::device>; template class SYCLInternal::USMObjectMem<sycl::usm::alloc::host>; diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp index 45a7887873e66127315eade103f71d3cde38746f..58775647f0c7ef52d1ab55b41a1cc05493310579 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Instance.hpp @@ -1,52 +1,29 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_INSTANCE_HPP_ #define KOKKOS_SYCL_INSTANCE_HPP_ #include <optional> +// FIXME_SYCL +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else #include <CL/sycl.hpp> +#endif #include <impl/Kokkos_Error.hpp> #include <impl/Kokkos_Profiling.hpp> @@ -72,7 +49,7 @@ class SYCLInternal { bool force_shrink = false); uint32_t impl_get_instance_id() const; - int m_syclDev = 0; + static int m_syclDev; size_t m_maxWorkgroupSize = 0; uint32_t m_maxConcurrency = 0; diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp index 3e90ec1fb50b21e92f4f2ce589f98e2e755967ea..d212e2dacc3aa298d01b1c0a8d75e4897b19b419 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_MDRangePolicy.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #ifndef KOKKOS_SYCL_MDRANGEPOLICY_HPP_ #define KOKKOS_SYCL_MDRANGEPOLICY_HPP_ @@ -32,6 +48,12 @@ inline TileSizeProperties get_tile_size_properties<Kokkos::Experimental::SYCL>( return properties; } -} // Namespace Impl +// Settings for TeamMDRangePolicy +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, Kokkos::Experimental::SYCL, + ThreadAndVector> + : AcceleratorBasedNestLevel<Rank, ThreadAndVector> {}; + +} // namespace Impl } // Namespace Kokkos #endif diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp index cf292f957ca9113ac594839cd351819f7e1dbc23..73475f92a6c10e546a0d283a361172c412bf6ec7 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Range.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_PARALLEL_RANGE_HPP_ #define KOKKOS_SYCL_PARALLEL_RANGE_HPP_ @@ -56,7 +28,7 @@ struct FunctorWrapperRangePolicyParallelFor { void operator()(sycl::item<1> item) const { const typename Policy::index_type id = item.get_linear_id() + m_begin; - if constexpr (std::is_void<WorkTag>::value) + if constexpr (std::is_void_v<WorkTag>) m_functor_wrapper.get_functor()(id); else m_functor_wrapper.get_functor()(WorkTag(), id); @@ -65,6 +37,27 @@ struct FunctorWrapperRangePolicyParallelFor { typename Policy::index_type m_begin; FunctorWrapper m_functor_wrapper; }; + +// Same as above but for a user-provided workgroup size +template <typename FunctorWrapper, typename Policy> +struct FunctorWrapperRangePolicyParallelForCustom { + using WorkTag = typename Policy::work_tag; + + void operator()(sycl::item<1> item) const { + const typename Policy::index_type id = item.get_linear_id(); + if (id < m_work_size) { + const auto shifted_id = id + m_begin; + if constexpr (std::is_void_v<WorkTag>) + m_functor_wrapper.get_functor()(shifted_id); + else + m_functor_wrapper.get_functor()(WorkTag(), shifted_id); + } + } + + typename Policy::index_type m_begin; + FunctorWrapper m_functor_wrapper; + typename Policy::index_type m_work_size; +}; } // namespace Kokkos::Impl template <class FunctorType, class... Traits> @@ -74,9 +67,8 @@ class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, using Policy = Kokkos::RangePolicy<Traits...>; private: - using Member = typename Policy::member_type; - using WorkTag = typename Policy::work_tag; - using LaunchBounds = typename Policy::launch_bounds; + using Member = typename Policy::member_type; + using WorkTag = typename Policy::work_tag; const FunctorType m_functor; const Policy m_policy; @@ -90,12 +82,29 @@ class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::RangePolicy<Traits...>, sycl::queue& q = space.sycl_queue(); auto parallel_for_event = q.submit([&](sycl::handler& cgh) { - FunctorWrapperRangePolicyParallelFor<Functor, Policy> f{policy.begin(), - functor}; - sycl::range<1> range(policy.end() - policy.begin()); cgh.depends_on(memcpy_event); - cgh.parallel_for<FunctorWrapperRangePolicyParallelFor<Functor, Policy>>( - range, f); + if (policy.chunk_size() <= 1) { + FunctorWrapperRangePolicyParallelFor<Functor, Policy> f{policy.begin(), + functor}; + sycl::range<1> range(policy.end() - policy.begin()); + cgh.parallel_for<FunctorWrapperRangePolicyParallelFor<Functor, Policy>>( + range, f); + } else { + // Use the chunk size as workgroup size. We need to make sure that the + // range the kernel is launched with is a multiple of the workgroup + // size. Hence, we need to restrict the execution of the functor in the + // kernel to the actual range. + const auto actual_range = policy.end() - policy.begin(); + const auto wgroup_size = policy.chunk_size(); + const auto launch_range = + (actual_range + wgroup_size - 1) / wgroup_size * wgroup_size; + FunctorWrapperRangePolicyParallelForCustom<Functor, Policy> f{ + policy.begin(), functor, actual_range}; + sycl::nd_range<1> range(launch_range, wgroup_size); + cgh.parallel_for< + FunctorWrapperRangePolicyParallelForCustom<Functor, Policy>>(range, + f); + } }); q.ext_oneapi_submit_barrier(std::vector<sycl::event>{parallel_for_event}); @@ -140,7 +149,6 @@ class Kokkos::Impl::ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, private: using array_index_type = typename Policy::array_index_type; using index_type = typename Policy::index_type; - using LaunchBounds = typename Policy::launch_bounds; using WorkTag = typename Policy::work_tag; const FunctorType m_functor; diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp index e980a82a580a1284244328884856de8b8765bced..c7959c1c1c5eb04b9c4523ed2e4bbddedd7d5db2 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Reduce.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_PARALLEL_REDUCE_HPP #define KOKKOS_SYCL_PARALLEL_REDUCE_HPP @@ -267,23 +239,13 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, *space.impl_internal_space_instance(); sycl::queue& q = space.sycl_queue(); - // FIXME_SYCL optimize - constexpr size_t wgroup_size = 128; constexpr size_t values_per_thread = 2; std::size_t size = policy.end() - policy.begin(); - const auto init_size = std::max<std::size_t>( - ((size + values_per_thread - 1) / values_per_thread + wgroup_size - 1) / - wgroup_size, - 1); const unsigned int value_count = Analysis::value_count(ReducerConditional::select(m_functor, m_reducer)); - const auto results_ptr = - static_cast<sycl::device_ptr<value_type>>(instance.scratch_space( - sizeof(value_type) * std::max(value_count, 1u) * init_size)); + sycl::device_ptr<value_type> results_ptr = nullptr; sycl::global_ptr<value_type> device_accessible_result_ptr = m_result_ptr_device_accessible ? m_result_ptr : nullptr; - auto scratch_flags = static_cast<sycl::device_ptr<unsigned int>>( - instance.scratch_flags(sizeof(unsigned int))); sycl::event last_reduction_event; @@ -291,6 +253,10 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, // working with the global scratch memory but don't copy back to // m_result_ptr yet. if (size <= 1) { + results_ptr = + static_cast<sycl::device_ptr<value_type>>(instance.scratch_space( + sizeof(value_type) * std::max(value_count, 1u))); + auto parallel_reduce_event = q.submit([&](sycl::handler& cgh) { const auto begin = policy.begin(); cgh.depends_on(memcpy_events); @@ -323,25 +289,23 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, // until only one workgroup does the reduction and thus gets the final // value. if (size > 1) { - auto n_wgroups = ((size + values_per_thread - 1) / values_per_thread + - wgroup_size - 1) / - wgroup_size; - auto parallel_reduce_event = q.submit([&](sycl::handler& cgh) { - sycl::accessor<value_type, 1, sycl::access::mode::read_write, - sycl::access::target::local> - local_mem(sycl::range<1>(wgroup_size) * std::max(value_count, 1u), - cgh); - sycl::accessor<unsigned int, 1, sycl::access::mode::read_write, - sycl::access::target::local> - num_teams_done(1, cgh); - - const auto begin = policy.begin(); - - cgh.depends_on(memcpy_events); + auto scratch_flags = static_cast<sycl::device_ptr<unsigned int>>( + instance.scratch_flags(sizeof(unsigned int))); + + auto reduction_lambda_factory = + [&](sycl::accessor<value_type, 1, sycl::access::mode::read_write, + sycl::access::target::local> + local_mem, + sycl::accessor<unsigned int, 1, sycl::access::mode::read_write, + sycl::access::target::local> + num_teams_done, + sycl::device_ptr<value_type> results_ptr) { + const auto begin = policy.begin(); + + auto lambda = [=](sycl::nd_item<1> item) { + const auto n_wgroups = item.get_group_range()[0]; + const auto wgroup_size = item.get_local_range()[0]; - cgh.parallel_for( - sycl::nd_range<1>(n_wgroups * wgroup_size, wgroup_size), - [=](sycl::nd_item<1> item) { const auto local_id = item.get_local_linear_id(); const auto global_id = wgroup_size * item.get_group_linear_id() * values_per_thread + @@ -441,9 +405,69 @@ class ParallelReduce<FunctorType, Kokkos::RangePolicy<Traits...>, ReducerType, std::min(n_wgroups, wgroup_size)); } } - }); + }; + return lambda; + }; + + auto parallel_reduce_event = q.submit([&](sycl::handler& cgh) { + sycl::accessor<unsigned int, 1, sycl::access::mode::read_write, + sycl::access::target::local> + num_teams_done(1, cgh); + + auto dummy_reduction_lambda = + reduction_lambda_factory({1, cgh}, num_teams_done, nullptr); + + static sycl::kernel kernel = [&] { + sycl::kernel_id functor_kernel_id = + sycl::get_kernel_id<decltype(dummy_reduction_lambda)>(); + auto kernel_bundle = + sycl::get_kernel_bundle<sycl::bundle_state::executable>( + q.get_context(), std::vector{functor_kernel_id}); + return kernel_bundle.get_kernel(functor_kernel_id); + }(); + auto multiple = kernel.get_info<sycl::info::kernel_device_specific:: + preferred_work_group_size_multiple>( + q.get_device()); + auto max = + kernel + .get_info<sycl::info::kernel_device_specific::work_group_size>( + q.get_device()); + +// FIXME_SYCL 1024 seems to be invalid when running on a Volta70. +#ifndef KOKKOS_ARCH_INTEL_GPU + if (max > 512) max = 512; +#endif + + const size_t wgroup_size = + static_cast<size_t>(max / multiple) * multiple; + + const std::size_t init_size = + ((size + values_per_thread - 1) / values_per_thread + wgroup_size - + 1) / + wgroup_size; + results_ptr = + static_cast<sycl::device_ptr<value_type>>(instance.scratch_space( + sizeof(value_type) * std::max(value_count, 1u) * init_size)); + + auto n_wgroups = ((size + values_per_thread - 1) / values_per_thread + + wgroup_size - 1) / + wgroup_size; + + sycl::accessor<value_type, 1, sycl::access::mode::read_write, + sycl::access::target::local> + local_mem(sycl::range<1>(wgroup_size) * std::max(value_count, 1u), + cgh); + + cgh.depends_on(memcpy_events); + + auto reduction_lambda = + reduction_lambda_factory(local_mem, num_teams_done, results_ptr); + cgh.parallel_for( + sycl::nd_range<1>(n_wgroups * wgroup_size, wgroup_size), + reduction_lambda); }); - last_reduction_event = q.ext_oneapi_submit_barrier( + + last_reduction_event = q.ext_oneapi_submit_barrier( std::vector<sycl::event>{parallel_reduce_event}); } diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp index e2afc9783961cf24bfa6677e7e44a1899b218884..cf651ced95e5c1f34ad8705189b6cd15f8c526ba 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Scan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKO_SYCL_PARALLEL_SCAN_HPP #define KOKKO_SYCL_PARALLEL_SCAN_HPP @@ -142,6 +114,8 @@ class ParallelScanSYCLBase { const FunctorType m_functor; const Policy m_policy; pointer_type m_scratch_space = nullptr; + const pointer_type m_result_ptr; + const bool m_result_ptr_device_accessible; // Only let one Parallel/Scan modify the shared memory. The // constructor acquires the mutex which is released in the destructor. @@ -254,7 +228,11 @@ class ParallelScanSYCLBase { // Write results to global memory auto update_global_results = q.submit([&](sycl::handler& cgh) { - auto global_mem = m_scratch_space; + auto global_mem = m_scratch_space; + auto result_ptr_device_accessible = m_result_ptr_device_accessible; + // The compiler failed with CL_INVALID_ARG_VALUE if using m_result_ptr + // directly. + auto result_ptr = m_result_ptr_device_accessible ? m_result_ptr : nullptr; cgh.parallel_for(sycl::range<1>(len), [=](sycl::item<1> item) { auto global_id = item.get_id(0); @@ -264,6 +242,8 @@ class ParallelScanSYCLBase { else functor_wrapper.get_functor()(WorkTag(), global_id, update, true); global_mem[global_id] = update; + if (global_id == len - 1 && result_ptr_device_accessible) + *result_ptr = update; }); }); q.ext_oneapi_submit_barrier( @@ -313,9 +293,13 @@ class ParallelScanSYCLBase { post_functor(); } - ParallelScanSYCLBase(const FunctorType& arg_functor, const Policy& arg_policy) + ParallelScanSYCLBase(const FunctorType& arg_functor, const Policy& arg_policy, + pointer_type arg_result_ptr, + bool arg_result_ptr_device_accessible) : m_functor(arg_functor), m_policy(arg_policy), + m_result_ptr(arg_result_ptr), + m_result_ptr_device_accessible(arg_result_ptr_device_accessible), m_shared_memory_lock(m_policy.space() .impl_internal_space_instance() ->m_mutexScratchSpace) {} @@ -334,7 +318,7 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, ParallelScan(const FunctorType& arg_functor, const typename Base::Policy& arg_policy) - : Base(arg_functor, arg_policy) {} + : Base(arg_functor, arg_policy, nullptr, false) {} }; //---------------------------------------------------------------------------- @@ -342,30 +326,32 @@ class ParallelScan<FunctorType, Kokkos::RangePolicy<Traits...>, template <class FunctorType, class ReturnType, class... Traits> class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, ReturnType, Kokkos::Experimental::SYCL> - : private ParallelScanSYCLBase<FunctorType, Traits...> { + : public ParallelScanSYCLBase<FunctorType, Traits...> { public: using Base = ParallelScanSYCLBase<FunctorType, Traits...>; - ReturnType& m_returnvalue; const Kokkos::Experimental::SYCL& m_exec; inline void execute() { Base::impl_execute([&]() { const long long nwork = Base::m_policy.end() - Base::m_policy.begin(); - if (nwork > 0) { + if (nwork > 0 && !Base::m_result_ptr_device_accessible) { const int size = Base::Analysis::value_size(Base::m_functor); DeepCopy<HostSpace, Kokkos::Experimental::SYCLDeviceUSMSpace, - Kokkos::Experimental::SYCL>( - m_exec, &m_returnvalue, Base::m_scratch_space + nwork - 1, size); + Kokkos::Experimental::SYCL>(m_exec, Base::m_result_ptr, + Base::m_scratch_space + nwork - 1, + size); } }); } + template <class ViewType> ParallelScanWithTotal(const FunctorType& arg_functor, const typename Base::Policy& arg_policy, - ReturnType& arg_returnvalue) - : Base(arg_functor, arg_policy), - m_returnvalue(arg_returnvalue), + const ViewType& arg_result_view) + : Base(arg_functor, arg_policy, arg_result_view.data(), + MemorySpaceAccess<Experimental::SYCLDeviceUSMSpace, + typename ViewType::memory_space>::accessible), m_exec(arg_policy.space()) {} }; diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp index 5ac7d8af3089f0acd4a3923b4811ae0aec080472..601580b2d8b7b591844bd102fd2165c324e1ab60 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Parallel_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_PARALLEL_TEAM_HPP #define KOKKOS_SYCL_PARALLEL_TEAM_HPP @@ -164,9 +136,6 @@ class TeamPolicyInternal<Kokkos::Experimental::SYCL, Properties...> inline void impl_set_vector_length(size_t size) { m_vector_length = size; } inline void impl_set_team_size(size_t size) { m_team_size = size; } int impl_vector_length() const { return m_vector_length; } -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - KOKKOS_DEPRECATED int vector_length() const { return impl_vector_length(); } -#endif int team_size() const { return m_team_size; } @@ -335,9 +304,10 @@ class TeamPolicyInternal<Kokkos::Experimental::SYCL, Properties...> return std::min({ int(m_space.impl_internal_space_instance()->m_maxWorkgroupSize), // FIXME_SYCL Avoid requesting to many registers on NVIDIA GPUs. -#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \ - defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \ - defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) +#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \ + defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \ + defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) || \ + defined(KOKKOS_ARCH_HOPPER) 256, #endif max_threads_for_memory @@ -367,9 +337,10 @@ class TeamPolicyInternal<Kokkos::Experimental::SYCL, Properties...> return std::min<int>({ int(m_space.impl_internal_space_instance()->m_maxWorkgroupSize), // FIXME_SYCL Avoid requesting to many registers on NVIDIA GPUs. -#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \ - defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \ - defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) +#if defined(KOKKOS_ARCH_KEPLER) || defined(KOKKOS_ARCH_MAXWELL) || \ + defined(KOKKOS_ARCH_PASCAL) || defined(KOKKOS_ARCH_VOLTA) || \ + defined(KOKKOS_ARCH_TURING75) || defined(KOKKOS_ARCH_AMPERE) || \ + defined(KOKKOS_ARCH_HOPPER) 256, #endif max_threads_for_memory @@ -690,7 +661,7 @@ class ParallelReduce<FunctorType, Kokkos::TeamPolicy<Properties...>, [&](sycl::accessor<value_type, 1, sycl::access::mode::read_write, sycl::access::target::local> local_mem, - sycl::device_ptr<value_type> results_ptr) mutable { + sycl::device_ptr<value_type> results_ptr) { sycl::global_ptr<value_type> device_accessible_result_ptr = m_result_ptr_device_accessible ? m_result_ptr : nullptr; auto lambda = [=](sycl::nd_item<2> item) { diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Space.cpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Space.cpp index 07ca907fa5adbaab309e32a36e8b37a97678fe33..6151b3eaafbd4217d046f42d00895e24c5f6cb29 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Space.cpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Space.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp index a8c60412cbca1318e5e3c6654a45cd725b3389f8..674037ed9590fecc7a8ded10a3b1cf43a9324e28 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_TEAM_HPP #define KOKKOS_SYCL_TEAM_HPP @@ -63,6 +35,7 @@ class SYCLTeamMember { public: using execution_space = Kokkos::Experimental::SYCL; using scratch_memory_space = execution_space::scratch_memory_space; + using team_handle = SYCLTeamMember; private: mutable sycl::local_ptr<void> m_team_reduce; @@ -364,10 +337,11 @@ class SYCLTeamMember { // Private for the driver KOKKOS_INLINE_FUNCTION - SYCLTeamMember(sycl::local_ptr<void> shared, const int shared_begin, - const int shared_size, + SYCLTeamMember(sycl::local_ptr<void> shared, const std::size_t shared_begin, + const std::size_t shared_size, sycl::device_ptr<void> scratch_level_1_ptr, - const int scratch_level_1_size, const sycl::nd_item<2> item) + const std::size_t scratch_level_1_size, + const sycl::nd_item<2> item) : m_team_reduce(shared), m_team_shared(static_cast<sycl::local_ptr<char>>(shared) + shared_begin, shared_size, scratch_level_1_ptr, scratch_level_1_size), diff --git a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp index 82bfae46f590165823dfe74b5487dd32ea3a54f7..2f0a67b3dd06a71cdd95b20000931cb047f222dd 100644 --- a/packages/kokkos/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp +++ b/packages/kokkos/core/src/SYCL/Kokkos_SYCL_UniqueToken.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_UNIQUE_TOKEN_HPP #define KOKKOS_SYCL_UNIQUE_TOKEN_HPP diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial.cpp b/packages/kokkos/core/src/Serial/Kokkos_Serial.cpp index 9205e82560a34c0ef383ee1d8ed43c6352fd8e2c..df91d8499ac02ce4cbd7e42fce525f9956a29744 100644 --- a/packages/kokkos/core/src/Serial/Kokkos_Serial.cpp +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -173,14 +145,8 @@ void SerialInternal::resize_thread_team_data(size_t pool_reduce_bytes, } // namespace Impl Serial::Serial() -#ifdef KOKKOS_IMPL_WORKAROUND_ICE_IN_TRILINOS_WITH_OLD_INTEL_COMPILERS - : m_space_instance(&Impl::SerialInternal::singleton()) { -} -#else : m_space_instance(&Impl::SerialInternal::singleton(), - [](Impl::SerialInternal*) {}) { -} -#endif + [](Impl::SerialInternal*) {}) {} void Serial::print_configuration(std::ostream& os, bool /*verbose*/) const { os << "Host Serial Execution Space:\n"; @@ -216,12 +182,4 @@ int g_serial_space_factory_initialized = } // namespace Impl -#ifdef KOKKOS_ENABLE_CXX14 -namespace Tools { -namespace Experimental { -constexpr DeviceType DeviceTypeTraits<Serial>::id; -} -} // namespace Tools -#endif - } // namespace Kokkos diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_MDRangePolicy.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_MDRangePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4ffe64af07120333c2068123a68bcb5e381125ec --- /dev/null +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_MDRangePolicy.hpp @@ -0,0 +1,32 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_SERIAL_MDRANGEPOLICY_HPP_ +#define KOKKOS_SERIAL_MDRANGEPOLICY_HPP_ + +#include <KokkosExp_MDRangePolicy.hpp> + +namespace Kokkos { +namespace Impl { + +// Settings for TeamMDRangePolicy +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, Serial, ThreadAndVector> + : HostBasedNestLevel<Rank, ThreadAndVector> {}; + +} // namespace Impl +} // namespace Kokkos +#endif diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp index d726a86f76493187e193f8687f834fe90df0d8f5..afdecd2f054652d5937c6e0eb23688debc37460e 100644 --- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_MDRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKO_SERIAL_PARALLEL_MDRANGE_HPP #define KOKKO_SERIAL_PARALLEL_MDRANGE_HPP @@ -61,14 +33,12 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, using iterate_type = typename Kokkos::Impl::HostIterateTile< MDRangePolicy, FunctorType, typename MDRangePolicy::work_tag, void>; - const FunctorType m_functor; - const MDRangePolicy m_mdr_policy; - const Policy m_policy; + const iterate_type m_iter; void exec() const { - const typename Policy::member_type e = m_policy.end(); - for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) { - iterate_type(m_mdr_policy, m_functor)(i); + const typename Policy::member_type e = m_iter.m_rp.m_num_tiles; + for (typename Policy::member_type i = 0; i < e; ++i) { + m_iter(i); } } @@ -85,9 +55,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, } inline ParallelFor(const FunctorType& arg_functor, const MDRangePolicy& arg_policy) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) {} + : m_iter(arg_policy, arg_functor) {} }; template <class FunctorType, class ReducerType, class... Traits> @@ -117,17 +85,14 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, using iterate_type = typename Kokkos::Impl::HostIterateTile<MDRangePolicy, FunctorType, WorkTag, reference_type>; - - const FunctorType m_functor; - const MDRangePolicy m_mdr_policy; - const Policy m_policy; + const iterate_type m_iter; const ReducerType m_reducer; const pointer_type m_result_ptr; inline void exec(reference_type update) const { - const typename Policy::member_type e = m_policy.end(); - for (typename Policy::member_type i = m_policy.begin(); i < e; ++i) { - iterate_type(m_mdr_policy, m_functor, update)(i); + const typename Policy::member_type e = m_iter.m_rp.m_num_tiles; + for (typename Policy::member_type i = 0; i < e; ++i) { + m_iter(i, update); } } @@ -142,13 +107,14 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, return 1024; } inline void execute() const { - const size_t pool_reduce_size = - Analysis::value_size(ReducerConditional::select(m_functor, m_reducer)); + const size_t pool_reduce_size = Analysis::value_size( + ReducerConditional::select(m_iter.m_func, m_reducer)); const size_t team_reduce_size = 0; // Never shrinks const size_t team_shared_size = 0; // Never shrinks const size_t thread_local_size = 0; // Never shrinks - auto* internal_instance = m_policy.space().impl_internal_space_instance(); + auto* internal_instance = + m_iter.m_rp.space().impl_internal_space_instance(); // Need to lock resize_thread_team_data std::lock_guard<std::mutex> lock( internal_instance->m_thread_team_data_mutex); @@ -163,7 +129,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, internal_instance->m_thread_team_data.pool_reduce_local()); typename Analysis::Reducer final_reducer( - &ReducerConditional::select(m_functor, m_reducer)); + &ReducerConditional::select(m_iter.m_func, m_reducer)); reference_type update = final_reducer.init(ptr); @@ -179,9 +145,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, std::enable_if_t<Kokkos::is_view<HostViewType>::value && !Kokkos::is_reducer<ReducerType>::value, void*> = nullptr) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), + : m_iter(arg_policy, arg_functor), m_reducer(InvalidType()), m_result_ptr(arg_result_view.data()) { static_assert(Kokkos::is_view<HostViewType>::value, @@ -195,9 +159,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, inline ParallelReduce(const FunctorType& arg_functor, MDRangePolicy arg_policy, const ReducerType& reducer) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), + : m_iter(arg_policy, arg_functor), m_reducer(reducer), m_result_ptr(reducer.view().data()) { /*static_assert( std::is_same< typename ViewType::memory_space diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp index 84262227f54ad9dafcdc114417fdde2984313132..f35c13170b8d5b0210dec7183d2433f20fd7303f 100644 --- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Range.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKO_SERIAL_PARALLEL_RANGE_HPP #define KOKKO_SERIAL_PARALLEL_RANGE_HPP @@ -272,12 +244,13 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, using Analysis = FunctorAnalysis<FunctorPatternInterface::SCAN, Policy, FunctorType>; + using value_type = typename Analysis::value_type; using pointer_type = typename Analysis::pointer_type; using reference_type = typename Analysis::reference_type; const FunctorType m_functor; const Policy m_policy; - ReturnType& m_returnvalue; + const pointer_type m_result_ptr; template <class TagType> inline std::enable_if_t<std::is_void<TagType>::value> exec( @@ -320,15 +293,22 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, this->template exec<WorkTag>(update); - m_returnvalue = update; + *m_result_ptr = update; } - inline ParallelScanWithTotal(const FunctorType& arg_functor, - const Policy& arg_policy, - ReturnType& arg_returnvalue) + template <class ViewType, + class Enable = std::enable_if_t<Kokkos::is_view<ViewType>::value>> + ParallelScanWithTotal(const FunctorType& arg_functor, + const Policy& arg_policy, + const ViewType& arg_result_view) : m_functor(arg_functor), m_policy(arg_policy), - m_returnvalue(arg_returnvalue) {} + m_result_ptr(arg_result_view.data()) { + static_assert( + Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space, + Kokkos::HostSpace>::accessible, + "Kokkos::Serial parallel_scan result must be host-accessible!"); + } }; } // namespace Impl diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp index 782ae75feb5e195feec743d4ca32523eee1ddd95..c5156f1f7f21913589070fe13404a3c801d3252c 100644 --- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Parallel_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKO_SERIAL_PARALLEL_TEAM_HPP #define KOKKO_SERIAL_PARALLEL_TEAM_HPP diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp index 468f27eebd4da29fab83bae37beb518e2da2c99d..0a7ba2852e492c5a910894ac1ecf1f9ff7195ecf 100644 --- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp index 8d8c1d748dade42ddd8a09050a29afbd45800c84..c744f34760ca6a0d42362ac3124bd769bcd957e2 100644 --- a/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_Task.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_SERIAL_TASK_HPP #define KOKKOS_IMPL_SERIAL_TASK_HPP diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp index cc845f3dca7eac39519a965d2f4be1a19ac55020..c8f46d63397c1e8da1679a2e3c48f5afb5f1d086 100644 --- a/packages/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_UniqueToken.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SERIAL_UNIQUE_TOKEN_HPP #define KOKKOS_SERIAL_UNIQUE_TOKEN_HPP diff --git a/packages/kokkos/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp index 05980170b841daae67941b07c51fca6fa9a03e57..7e5cd8d88a3da1af62f8c76eba05e3bcff57b837 100644 --- a/packages/kokkos/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/Serial/Kokkos_Serial_WorkGraphPolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SERIAL_WORKGRAPHPOLICY_HPP #define KOKKOS_SERIAL_WORKGRAPHPOLICY_HPP diff --git a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp index 346eb1dc08d6e789385a4a590075f79b4d256d42..8f39c726c722a2a1c555905a3f3219074d497ad6 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp +++ b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -780,17 +752,18 @@ void ThreadsExec::initialize(int thread_count_arg) { } // Check for over-subscription + auto const reported_ranks = mpi_ranks_per_node(); + auto const mpi_local_size = reported_ranks < 0 ? 1 : reported_ranks; + int const procs_per_node = std::thread::hardware_concurrency(); if (Kokkos::show_warnings() && - (Impl::mpi_ranks_per_node() * long(thread_count) > - Impl::processors_per_node())) { + (mpi_local_size * long(thread_count) > procs_per_node)) { std::cerr << "Kokkos::Threads::initialize WARNING: You are likely " "oversubscribing your CPU cores." << std::endl; std::cerr << " Detected: " - << Impl::processors_per_node() << " cores per node." << std::endl; + << procs_per_node << " cores per node." << std::endl; std::cerr << " Detected: " - << Impl::mpi_ranks_per_node() << " MPI_ranks per node." - << std::endl; + << mpi_local_size << " MPI_ranks per node." << std::endl; std::cerr << " Requested: " << thread_count << " threads per process." << std::endl; } @@ -859,7 +832,12 @@ void ThreadsExec::finalize() { namespace Kokkos { +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 int Threads::concurrency() { return impl_thread_pool_size(0); } +#else +int Threads::concurrency() const { return impl_thread_pool_size(0); } +#endif + void Threads::fence(const std::string &name) const { Impl::ThreadsExec::internal_fence(name, Impl::fence_is_static::no); } @@ -891,12 +869,4 @@ int g_threads_space_factory_initialized = } // namespace Impl -#ifdef KOKKOS_ENABLE_CXX14 -namespace Tools { -namespace Experimental { -constexpr DeviceType DeviceTypeTraits<Threads>::id; -} -} // namespace Tools -#endif - } /* namespace Kokkos */ diff --git a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp index 238a7655457944445752b40c7e55f93d76d378d1..8b15928debce7048c80bac661deb157a8ffaab7a 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp +++ b/packages/kokkos/core/src/Threads/Kokkos_ThreadsExec.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_THREADSEXEC_HPP #define KOKKOS_THREADSEXEC_HPP @@ -109,7 +81,7 @@ class ThreadsExec { // Which thread am I stealing from currently int m_current_steal_target; // This thread's owned work_range - Kokkos::pair<long, long> m_work_range __attribute__((aligned(16))); + alignas(16) Kokkos::pair<long, long> m_work_range; // Team Offset if one thread determines work_range for others long m_team_work_index; diff --git a/packages/kokkos/core/src/Threads/Kokkos_ThreadsTeam.hpp b/packages/kokkos/core/src/Threads/Kokkos_ThreadsTeam.hpp index 02ce9325065e11e311252b2c931245318f289dc4..3f734f08d4f986fcb48c1691d14a794bc744a4de 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_ThreadsTeam.hpp +++ b/packages/kokkos/core/src/Threads/Kokkos_ThreadsTeam.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_THREADSTEAM_HPP #define KOKKOS_THREADSTEAM_HPP @@ -74,6 +46,7 @@ class ThreadsExecTeamMember { public: using execution_space = Kokkos::Threads; using scratch_memory_space = execution_space::scratch_memory_space; + using team_handle = ThreadsExecTeamMember; private: using space = execution_space::scratch_memory_space; @@ -782,7 +755,7 @@ class TeamPolicyInternal<Kokkos::Threads, Properties...> private: /** \brief finalize chunk_size if it was set to AUTO*/ inline void set_auto_chunk_size() { - int64_t concurrency = traits::execution_space::concurrency() / m_team_alloc; + int64_t concurrency = space().concurrency() / m_team_alloc; if (concurrency == 0) concurrency = 1; if (m_chunk_size > 0) { diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_MDRangePolicy.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_MDRangePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..50d66aae6ab0022695d7ed3c2af80612071ce1c2 --- /dev/null +++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_MDRangePolicy.hpp @@ -0,0 +1,32 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_THREADS_MDRANGEPOLICY_HPP_ +#define KOKKOS_THREADS_MDRANGEPOLICY_HPP_ + +#include <KokkosExp_MDRangePolicy.hpp> + +namespace Kokkos { +namespace Impl { + +// Settings for TeamMDRangePolicy +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct ThreadAndVectorNestLevel<Rank, Threads, ThreadAndVector> + : HostBasedNestLevel<Rank, ThreadAndVector> {}; + +} // namespace Impl +} // namespace Kokkos +#endif diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp index 6d1a38da1da1ae79334ff2fbd248c86bbed83437..35392e3bfb054004ef3f01239e84b15362bc8cfe 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp +++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_MDRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_THREADS_PARALLEL_MDRANGE_HPP #define KOKKOS_THREADS_PARALLEL_MDRANGE_HPP @@ -67,20 +39,11 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, using iterate_type = typename Kokkos::Impl::HostIterateTile< MDRangePolicy, FunctorType, typename MDRangePolicy::work_tag, void>; - const FunctorType m_functor; - const MDRangePolicy m_mdr_policy; - const Policy m_policy; // construct as RangePolicy( 0, num_tiles - // ).set_chunk_size(1) in ctor - - inline static void exec_range(const MDRangePolicy &mdr_policy, - const FunctorType &functor, const Member ibeg, - const Member iend) { -#if defined(KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION) && \ - defined(KOKKOS_ENABLE_PRAGMA_IVDEP) -#pragma ivdep -#endif + const iterate_type m_iter; + + inline void exec_range(const Member ibeg, const Member iend) const { for (Member i = ibeg; i < iend; ++i) { - iterate_type(mdr_policy, functor)(i); + m_iter(i); } } @@ -93,10 +56,11 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, exec_schedule(ThreadsExec &exec, const void *arg) { const ParallelFor &self = *((const ParallelFor *)arg); - WorkRange range(self.m_policy, exec.pool_rank(), exec.pool_size()); + auto const num_tiles = self.m_iter.m_rp.m_num_tiles; + WorkRange range(Policy(0, num_tiles).set_chunk_size(1), exec.pool_rank(), + exec.pool_size()); - ParallelFor::exec_range(self.m_mdr_policy, self.m_functor, range.begin(), - range.end()); + self.exec_range(range.begin(), range.end()); exec.fan_in(); } @@ -106,23 +70,21 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, exec_schedule(ThreadsExec &exec, const void *arg) { const ParallelFor &self = *((const ParallelFor *)arg); - WorkRange range(self.m_policy, exec.pool_rank(), exec.pool_size()); + auto const num_tiles = self.m_iter.m_rp.m_num_tiles; + WorkRange range(Policy(0, num_tiles).set_chunk_size(1), exec.pool_rank(), + exec.pool_size()); - exec.set_work_range(range.begin(), range.end(), self.m_policy.chunk_size()); + exec.set_work_range(range.begin(), range.end(), 1); exec.reset_steal_target(); exec.barrier(); long work_index = exec.get_work_index(); while (work_index != -1) { - const Member begin = - static_cast<Member>(work_index) * self.m_policy.chunk_size(); - const Member end = - begin + self.m_policy.chunk_size() < self.m_policy.end() - ? begin + self.m_policy.chunk_size() - : self.m_policy.end(); - - ParallelFor::exec_range(self.m_mdr_policy, self.m_functor, begin, end); + const Member begin = static_cast<Member>(work_index); + const Member end = begin + 1 < num_tiles ? begin + 1 : num_tiles; + + self.exec_range(begin, end); work_index = exec.get_work_index(); } @@ -136,9 +98,7 @@ class ParallelFor<FunctorType, Kokkos::MDRangePolicy<Traits...>, } ParallelFor(const FunctorType &arg_functor, const MDRangePolicy &arg_policy) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)) {} + : m_iter(arg_policy, arg_functor) {} template <typename Policy, typename Functor> static int max_tile_size_product(const Policy &, const Functor &) { @@ -180,22 +140,14 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, typename Kokkos::Impl::HostIterateTile<MDRangePolicy, FunctorType, WorkTag, reference_type>; - const FunctorType m_functor; - const MDRangePolicy m_mdr_policy; - const Policy m_policy; // construct as RangePolicy( 0, num_tiles - // ).set_chunk_size(1) in ctor + const iterate_type m_iter; const ReducerType m_reducer; const pointer_type m_result_ptr; - inline static void exec_range(const MDRangePolicy &mdr_policy, - const FunctorType &functor, const Member &ibeg, - const Member &iend, reference_type update) { -#if defined(KOKKOS_ENABLE_AGGRESSIVE_VECTORIZATION) && \ - defined(KOKKOS_ENABLE_PRAGMA_IVDEP) -#pragma ivdep -#endif + inline void exec_range(const Member &ibeg, const Member &iend, + reference_type update) const { for (Member i = ibeg; i < iend; ++i) { - iterate_type(mdr_policy, functor, update)(i); + m_iter(i, update); } } @@ -207,13 +159,16 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, static std::enable_if_t<std::is_same<Schedule, Kokkos::Static>::value> exec_schedule(ThreadsExec &exec, const void *arg) { const ParallelReduce &self = *((const ParallelReduce *)arg); - const WorkRange range(self.m_policy, exec.pool_rank(), exec.pool_size()); + + const auto num_tiles = self.m_iter.m_rp.m_num_tiles; + const WorkRange range(Policy(0, num_tiles).set_chunk_size(1), + exec.pool_rank(), exec.pool_size()); typename Analysis::Reducer reducer( - &ReducerConditional::select(self.m_functor, self.m_reducer)); + &ReducerConditional::select(self.m_iter.m_func, self.m_reducer)); - ParallelReduce::exec_range( - self.m_mdr_policy, self.m_functor, range.begin(), range.end(), + self.exec_range( + range.begin(), range.end(), reducer.init(static_cast<pointer_type>(exec.reduce_memory()))); exec.fan_in_reduce(reducer); @@ -223,27 +178,25 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, static std::enable_if_t<std::is_same<Schedule, Kokkos::Dynamic>::value> exec_schedule(ThreadsExec &exec, const void *arg) { const ParallelReduce &self = *((const ParallelReduce *)arg); - const WorkRange range(self.m_policy, exec.pool_rank(), exec.pool_size()); - exec.set_work_range(range.begin(), range.end(), self.m_policy.chunk_size()); + const auto num_tiles = self.m_iter.m_rp.m_num_tiles; + const WorkRange range(Policy(0, num_tiles).set_chunk_size(1), + exec.pool_rank(), exec.pool_size()); + + exec.set_work_range(range.begin(), range.end(), 1); exec.reset_steal_target(); exec.barrier(); long work_index = exec.get_work_index(); typename Analysis::Reducer reducer( - &ReducerConditional::select(self.m_functor, self.m_reducer)); + &ReducerConditional::select(self.m_iter.m_func, self.m_reducer)); reference_type update = reducer.init(static_cast<pointer_type>(exec.reduce_memory())); while (work_index != -1) { - const Member begin = - static_cast<Member>(work_index) * self.m_policy.chunk_size(); - const Member end = - begin + self.m_policy.chunk_size() < self.m_policy.end() - ? begin + self.m_policy.chunk_size() - : self.m_policy.end(); - ParallelReduce::exec_range(self.m_mdr_policy, self.m_functor, begin, end, - update); + const Member begin = static_cast<Member>(work_index); + const Member end = begin + 1 < num_tiles ? begin + 1 : num_tiles; + self.exec_range(begin, end, update); work_index = exec.get_work_index(); } @@ -252,9 +205,9 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, public: inline void execute() const { - ThreadsExec::resize_scratch( - Analysis::value_size(ReducerConditional::select(m_functor, m_reducer)), - 0); + ThreadsExec::resize_scratch(Analysis::value_size(ReducerConditional::select( + m_iter.m_func, m_reducer)), + 0); ThreadsExec::start(&ParallelReduce::exec, this); @@ -265,7 +218,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, (pointer_type)ThreadsExec::root_reduce_scratch(); const unsigned n = Analysis::value_count( - ReducerConditional::select(m_functor, m_reducer)); + ReducerConditional::select(m_iter.m_func, m_reducer)); for (unsigned i = 0; i < n; ++i) { m_result_ptr[i] = data[i]; } @@ -279,9 +232,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, std::enable_if_t<Kokkos::is_view<HostViewType>::value && !Kokkos::is_reducer<ReducerType>::value, void *> = nullptr) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), + : m_iter(arg_policy, arg_functor), m_reducer(InvalidType()), m_result_ptr(arg_result_view.data()) { static_assert(Kokkos::is_view<HostViewType>::value, @@ -294,9 +245,7 @@ class ParallelReduce<FunctorType, Kokkos::MDRangePolicy<Traits...>, ReducerType, inline ParallelReduce(const FunctorType &arg_functor, MDRangePolicy arg_policy, const ReducerType &reducer) - : m_functor(arg_functor), - m_mdr_policy(arg_policy), - m_policy(Policy(0, m_mdr_policy.m_num_tiles).set_chunk_size(1)), + : m_iter(arg_policy, arg_functor), m_reducer(reducer), m_result_ptr(reducer.view().data()) { /*static_assert( std::is_same< typename ViewType::memory_space diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp index 971a0bb9c2bd2d1f4005fddf58bc47041df07a93..7d3527facdf174b40513228a117656fab64a67f8 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp +++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Range.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_THREADS_PARALLEL_RANGE_HPP #define KOKKOS_THREADS_PARALLEL_RANGE_HPP @@ -405,12 +377,13 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, using Analysis = Impl::FunctorAnalysis<Impl::FunctorPatternInterface::SCAN, Policy, FunctorType>; + using value_type = typename Analysis::value_type; using pointer_type = typename Analysis::pointer_type; using reference_type = typename Analysis::reference_type; const FunctorType m_functor; const Policy m_policy; - ReturnType &m_returnvalue; + const pointer_type m_result_ptr; template <class TagType> inline static std::enable_if_t<std::is_void<TagType>::value> exec_range( @@ -461,7 +434,7 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, exec.fan_in(); if (exec.pool_rank() == exec.pool_size() - 1) { - self.m_returnvalue = update; + *self.m_result_ptr = update; } } @@ -472,11 +445,18 @@ class ParallelScanWithTotal<FunctorType, Kokkos::RangePolicy<Traits...>, ThreadsExec::fence(); } + template <class ViewType> ParallelScanWithTotal(const FunctorType &arg_functor, - const Policy &arg_policy, ReturnType &arg_returnvalue) + const Policy &arg_policy, + const ViewType &arg_result_view) : m_functor(arg_functor), m_policy(arg_policy), - m_returnvalue(arg_returnvalue) {} + m_result_ptr(arg_result_view.data()) { + static_assert( + Kokkos::Impl::MemorySpaceAccess<typename ViewType::memory_space, + Kokkos::HostSpace>::accessible, + "Kokkos::Threads parallel_scan result must be host-accessible!"); + } }; } // namespace Impl diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp index bdda110d37cef39df4d9aa977d9acf7b25fc2fb0..a602078c5229eb5323d1be14d2f8936ecef2a32b 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp +++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_Parallel_Team.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_THREADS_PARALLEL_TEAM_HPP #define KOKKOS_THREADS_PARALLEL_TEAM_HPP diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp index f9901198f7db469b17514dc89283fb8fbcc6b21e..29887f958e5444686b0935c5ec143c4eac9d89e1 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp +++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_UniqueToken.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_THREADS_UNIQUETOKEN_HPP #define KOKKOS_THREADS_UNIQUETOKEN_HPP diff --git a/packages/kokkos/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp b/packages/kokkos/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp index 5e8ac4604c044e5f37544bdf84ec7a0f155f43ce..7c29ce57395d5ea6cdba296fa6307882fdde1e72 100644 --- a/packages/kokkos/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp +++ b/packages/kokkos/core/src/Threads/Kokkos_Threads_WorkGraphPolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_THREADS_WORKGRAPHPOLICY_HPP #define KOKKOS_THREADS_WORKGRAPHPOLICY_HPP diff --git a/packages/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp b/packages/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp index 77b2730b1b6b2db13397d58d16fd8101e88e2ef8..9baba9459bad0e320398d78b4e97f99b074adb76 100644 --- a/packages/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp +++ b/packages/kokkos/core/src/View/Hooks/Kokkos_ViewHooks.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXPERIMENTAL_VIEWHOOKS_HPP #define KOKKOS_EXPERIMENTAL_VIEWHOOKS_HPP diff --git a/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Extents.hpp b/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Extents.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fb5195254344c4295a1339ec871df37be37d7622 --- /dev/null +++ b/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Extents.hpp @@ -0,0 +1,111 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +static_assert(false, + "Including non-public Kokkos header files is not allowed."); +#endif + +#ifndef KOKKOS_EXPERIMENTAL_MDSPAN_EXTENTS_HPP +#define KOKKOS_EXPERIMENTAL_MDSPAN_EXTENTS_HPP + +#include "Kokkos_MDSpan_Header.hpp" + +namespace Kokkos::Impl { + +// Forward declarations from impl/Kokkos_ViewMapping.hpp +// We cannot include directly since ViewMapping is used elsewhere in View. +// After View is fully moved to mdspan we can include it only from here. +template <class DataType> +struct ViewArrayAnalysis; + +template <std::size_t... Vals> +struct ViewDimension; + +template <class T, class Dim> +struct ViewDataType; +} // namespace Kokkos::Impl + +namespace Kokkos::Experimental::Impl { + +// A few things to note -- +// - mdspan allows for 0-rank extents similarly to View, so we don't need +// special handling of this case +// - View dynamic dimensions must be appear before static dimensions. This isn't +// a requirement in mdspan but won't cause an issue here +template <std::size_t N> +struct ExtentFromDimension { + static constexpr std::size_t value = N; +}; + +// Kokkos uses a dimension of '0' to denote a dynamic dimension. +template <> +struct ExtentFromDimension<std::size_t{0}> { + static constexpr std::size_t value = std::experimental::dynamic_extent; +}; + +template <std::size_t N> +struct DimensionFromExtent { + static constexpr std::size_t value = N; +}; + +template <> +struct DimensionFromExtent<std::experimental::dynamic_extent> { + static constexpr std::size_t value = std::size_t{0}; +}; + +template <class IndexType, class Dimension, class Indices> +struct ExtentsFromDimension; + +template <class IndexType, class Dimension, std::size_t... Indices> +struct ExtentsFromDimension<IndexType, Dimension, + std::index_sequence<Indices...>> { + using type = std::experimental::extents< + IndexType, + ExtentFromDimension<Dimension::static_extent(Indices)>::value...>; +}; + +template <class Extents, class Indices> +struct DimensionsFromExtent; + +template <class Extents, std::size_t... Indices> +struct DimensionsFromExtent<Extents, std::index_sequence<Indices...>> { + using type = ::Kokkos::Impl::ViewDimension< + DimensionFromExtent<Extents::static_extent(Indices)>::value...>; +}; + +template <class IndexType, class DataType> +struct ExtentsFromDataType { + using array_analysis = ::Kokkos::Impl::ViewArrayAnalysis<DataType>; + using dimension_type = typename array_analysis::dimension; + + using type = typename ExtentsFromDimension< + IndexType, dimension_type, + std::make_index_sequence<dimension_type::rank>>::type; +}; + +template <class T, class Extents> +struct DataTypeFromExtents { + using extents_type = Extents; + using dimension_type = typename DimensionsFromExtent< + Extents, std::make_index_sequence<extents_type::rank()>>::type; + + // Will cause a compile error if it is malformed (i.e. dynamic after static) + using type = typename ::Kokkos::Impl::ViewDataType<T, dimension_type>::type; +}; +} // namespace Kokkos::Experimental::Impl + +#endif // KOKKOS_EXPERIMENTAL_MDSPAN_EXTENTS_HPP diff --git a/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Header.hpp b/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Header.hpp new file mode 100644 index 0000000000000000000000000000000000000000..495b891cca3b8c1f5d4c55f823453d44e41d76d3 --- /dev/null +++ b/packages/kokkos/core/src/View/MDSpan/Kokkos_MDSpan_Header.hpp @@ -0,0 +1,34 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +static_assert(false, + "Including non-public Kokkos header files is not allowed."); +#endif + +#ifndef KOKKOS_EXPERIMENTAL_MDSPAN_HPP +#define KOKKOS_EXPERIMENTAL_MDSPAN_HPP + +// Look for the right mdspan +#if __has_include(<mdspan>) +#include <mdspan> +namespace mdspan_ns = std; +#else +#include <experimental/mdspan> +namespace mdspan_ns = std::experimental; +#endif + +#endif // KOKKOS_EXPERIMENTAL_MDSPAN_HPP diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_CUDA.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_CUDA.hpp index aedb8d035cd8945fffad4332fd0bea8874a61b0a..215b18f221980a921f5bfed7c1c60668da4ad13a 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_CUDA.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_CUDA.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_CUDA_HPP #define KOKKOS_DECLARE_CUDA_HPP diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_HBWSpace.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_HBWSpace.hpp index ff5133ed286d3cc845245e878c0b4c8e0a407ecf..1328c93135243c7906643157af5d66b8dc4d1cbb 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_HBWSpace.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_HBWSpace.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_HBWSPACE_HPP #define KOKKOS_DECLARE_HBWSPACE_HPP diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_HIP.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_HIP.hpp index b3bf14dbf2408d68cd76e618f4e5c9346dca21b4..09ea8826004be8bc409e708a626972f25668b39c 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_HIP.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_HIP.hpp @@ -1,52 +1,44 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_HIP_HPP #define KOKKOS_DECLARE_HIP_HPP #if defined(KOKKOS_ENABLE_HIP) -#include <Kokkos_HIP.hpp> +#include <HIP/Kokkos_HIP.hpp> +#include <HIP/Kokkos_HIP_Space.hpp> +#include <HIP/Kokkos_HIP_DeepCopy.hpp> +#include <HIP/Kokkos_HIP_Half_Impl_Type.hpp> +#include <HIP/Kokkos_HIP_Half_Conversion.hpp> +#include <HIP/Kokkos_HIP_Instance.hpp> +#include <HIP/Kokkos_HIP_MDRangePolicy.hpp> +#include <HIP/Kokkos_HIP_Parallel_Range.hpp> +#include <HIP/Kokkos_HIP_Parallel_MDRange.hpp> +#include <HIP/Kokkos_HIP_Parallel_Team.hpp> +#include <HIP/Kokkos_HIP_SharedAllocationRecord.hpp> +#include <HIP/Kokkos_HIP_UniqueToken.hpp> + +namespace Kokkos { +namespace Experimental { +using HIPSpace = ::Kokkos::HIPSpace; +using HIPHostPinnedSpace = ::Kokkos::HIPHostPinnedSpace; +using HIPManagedSpace = ::Kokkos::HIPManagedSpace; +using HIP = ::Kokkos::HIP; +} // namespace Experimental +} // namespace Kokkos #endif #endif diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_HPX.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_HPX.hpp index 2cbecc9e76c47d3b1fee87de9c74f3acc1051852..73f94591f528256313d8d57a16bae994ef653b1b 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_HPX.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_HPX.hpp @@ -1,52 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_HPX_HPP #define KOKKOS_DECLARE_HPX_HPP #if defined(KOKKOS_ENABLE_HPX) #include <Kokkos_HPX.hpp> +#include <HPX/Kokkos_HPX_MDRangePolicy.hpp> #endif #endif diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENACC.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENACC.hpp index 5c09b7a3b65b3a65b9331476fec317108a739827..137286c741b413e6bbe581e6912ad2f3b455b198 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENACC.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENACC.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_OPENACC_HPP #define KOKKOS_DECLARE_OPENACC_HPP @@ -48,7 +20,13 @@ #if defined(KOKKOS_ENABLE_OPENACC) #include <OpenACC/Kokkos_OpenACC.hpp> #include <OpenACC/Kokkos_OpenACCSpace.hpp> -#include <OpenACC/Kokkos_OpenACC_Traits.hpp> +#include <OpenACC/Kokkos_OpenACC_DeepCopy.hpp> +#include <OpenACC/Kokkos_OpenACC_SharedAllocationRecord.hpp> +#include <OpenACC/Kokkos_OpenACC_ParallelFor_Range.hpp> +#include <OpenACC/Kokkos_OpenACC_ParallelReduce_Range.hpp> +#include <OpenACC/Kokkos_OpenACC_MDRangePolicy.hpp> +#include <OpenACC/Kokkos_OpenACC_ParallelFor_MDRange.hpp> +#include <OpenACC/Kokkos_OpenACC_ParallelFor_Team.hpp> #endif #endif diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMP.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMP.hpp index 069dd5c160bec56a485b667da9c58c548943be42..1e1314145d203154ecf01a09e2e110f87c4673f9 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMP.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMP.hpp @@ -1,52 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_OPENMP_HPP #define KOKKOS_DECLARE_OPENMP_HPP #if defined(KOKKOS_ENABLE_OPENMP) #include <Kokkos_OpenMP.hpp> +#include <OpenMP/Kokkos_OpenMP_MDRangePolicy.hpp> #endif #endif diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp index b193d1e741bc19d1725994839c682fa84f2267f9..0bd89ef4cf4ba9af2f59a61b622c6f7efa200743 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_OPENMPTARGET.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_OPENMPTARGET_HPP #define KOKKOS_DECLARE_OPENMPTARGET_HPP @@ -48,6 +20,7 @@ #if defined(KOKKOS_ENABLE_OPENMPTARGET) #include <Kokkos_OpenMPTarget.hpp> #include <Kokkos_OpenMPTargetSpace.hpp> +#include <OpenMPTarget/Kokkos_OpenMPTarget_MDRangePolicy.hpp> #include <OpenMPTarget/Kokkos_OpenMPTarget_UniqueToken.hpp> #endif diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_SERIAL.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_SERIAL.hpp index 45661b5af29949b54dca0126e90bd605e2bea6c6..bb59ae2ce8bea2b9fb9817398b00bb3451039150 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_SERIAL.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_SERIAL.hpp @@ -1,52 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_SERIAL_HPP #define KOKKOS_DECLARE_SERIAL_HPP #if defined(KOKKOS_ENABLE_SERIAL) #include <Kokkos_Serial.hpp> +#include <Serial/Kokkos_Serial_MDRangePolicy.hpp> #endif #endif diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_SYCL.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_SYCL.hpp index 72a26b27f4e70dfa42a2449252932b255a762ed0..0c8dddbeb3cc19a1eb6ffc1ab8c57b10bcd1870a 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_SYCL.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_SYCL.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_SYCL_HPP #define KOKKOS_DECLARE_SYCL_HPP diff --git a/packages/kokkos/core/src/decl/Kokkos_Declare_THREADS.hpp b/packages/kokkos/core/src/decl/Kokkos_Declare_THREADS.hpp index adb8f12a9c7b1b97a112f631d3455ef9f20d2b9b..b7af04be3c33da95de03427cf0c1ee60c79c01dd 100644 --- a/packages/kokkos/core/src/decl/Kokkos_Declare_THREADS.hpp +++ b/packages/kokkos/core/src/decl/Kokkos_Declare_THREADS.hpp @@ -1,52 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DECLARE_THREADS_HPP #define KOKKOS_DECLARE_THREADS_HPP #if defined(KOKKOS_ENABLE_THREADS) #include <Kokkos_Threads.hpp> +#include <Threads/Kokkos_Threads_MDRangePolicy.hpp> #endif #endif diff --git a/packages/kokkos/core/src/dummy.cpp b/packages/kokkos/core/src/dummy.cpp index 4f5f14e7d323e97a5289d271be98667c59b5cf34..929380b6c33b3ea6b581f3d5c137de88293e4bb9 100644 --- a/packages/kokkos/core/src/dummy.cpp +++ b/packages/kokkos/core/src/dummy.cpp @@ -1,4 +1,18 @@ - +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER namespace Kokkos { namespace AvoidCompilerWarnings { diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp index 4bda5e9411f05bfd76495c346f053acf958a84a7..5151a3dc6407e79c17912b511ea5971195f6fd88 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_CUDA.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_FWD_HPP_ #define KOKKOS_CUDA_FWD_HPP_ diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp index d9dada27a01ddf24eb36dd5b3030ecc2c2e8c41b..21ba7fad01cf0be4e2b1857a15860a8b3e4be74b 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HBWSpace.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HBWSPACE_FWD_HPP_ #define KOKKOS_HBWSPACE_FWD_HPP_ diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp index 27540865a5950ba10096fadfb57b752e6fdef0a0..82cc98be27d349da79781639e6d2c6437007af31 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HIP.hpp @@ -1,58 +1,28 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HIP_FWD_HPP_ #define KOKKOS_HIP_FWD_HPP_ #if defined(KOKKOS_ENABLE_HIP) namespace Kokkos { -namespace Experimental { class HIPSpace; ///< Memory space on HIP GPU class HIPHostPinnedSpace; ///< Memory space on Host accessible to HIP GPU class HIPManagedSpace; ///< Memory migratable between Host and HIP GPU class HIP; ///< Execution space for HIP GPU -} // namespace Experimental } // namespace Kokkos #endif #endif diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp index 8949c527fc62a1cad4cf0cc9de197f8eee57165f..636f74676ed1b78ac60c2f33a171ba0fcf2e3827 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_HPX.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HPX_FWD_HPP_ #define KOKKOS_HPX_FWD_HPP_ diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp index d733f993d023d8247c14bc3a0594068b95b64786..0e81d5b4ef99cc5f65056980e9b776c334b1c83c 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENACC.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENACC_FWD_HPP_ #define KOKKOS_OPENACC_FWD_HPP_ diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp index fc2223d3e29dc9f5e227dd3f84c1f5be05572b84..b6058d4751d16d70909dab6c1d33bc2e965a214f 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMP.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMP_FWD_HPP_ #define KOKKOS_OPENMP_FWD_HPP_ diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp index 8d12b8b701482295f53373609608dcb6ac4b038e..2846694899ca5118804b65b6df866635f86259b5 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_OPENMPTARGET.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_OPENMPTARGET_FWD_HPP_ #define KOKKOS_OPENMPTARGET_FWD_HPP_ diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp index 8f253d0a7504102d8c7fbe0d5d4aaec6c3ad6e14..b5d6b3a3f0524ce6bd41c216b6f27b1f080e2c54 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_SERIAL.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SERIAL_FWD_HPP_ #define KOKKOS_SERIAL_FWD_HPP_ diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp index 0ce680cd69efb1de0e9cbebadfda1f739e325630..400794f86591f41946d31f1fed42e64466fe12de 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_SYCL.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SYCL_FWD_HPP_ #define KOKKOS_SYCL_FWD_HPP_ diff --git a/packages/kokkos/core/src/fwd/Kokkos_Fwd_THREADS.hpp b/packages/kokkos/core/src/fwd/Kokkos_Fwd_THREADS.hpp index af53777ddea2311f55198a14407238d7bc5c466a..db674affe138a5c7c5af94746f7517210d06fc7b 100644 --- a/packages/kokkos/core/src/fwd/Kokkos_Fwd_THREADS.hpp +++ b/packages/kokkos/core/src/fwd/Kokkos_Fwd_THREADS.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_THREADS_FWD_HPP_ #define KOKKOS_THREADS_FWD_HPP_ diff --git a/packages/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp b/packages/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp index 2b2120ce49b30da1db2c07b9aa6cd8a3ca1be321..e2b606004fece193df834ee95c2b7617aef84281 100644 --- a/packages/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp +++ b/packages/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HOST_EXP_ITERATE_TILE_HPP #define KOKKOS_HOST_EXP_ITERATE_TILE_HPP @@ -1914,8 +1886,8 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, m_func(m_tag, args...); } - RP const& m_rp; - Functor const& m_func; + RP const m_rp; + Functor const m_func; std::conditional_t<std::is_void<Tag>::value, int, Tag> m_tag; }; @@ -1930,12 +1902,10 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, using value_type = ValueType; - inline HostIterateTile(RP const& rp, Functor const& func, value_type& v) + inline HostIterateTile(RP const& rp, Functor const& func) : m_rp(rp) // Cuda 7.0 does not like braces... , - m_func(func), - m_v(v) // use with non-void ValueType struct - { + m_func(func) { // Errors due to braces rather than parenthesis for init (with cuda 7.0) // /home/ndellin/kokkos/core/src/impl/KokkosExp_Host_IterateTile.hpp:1216:98: // error: too many braces around initializer for ‘int’ [-fpermissive] @@ -1973,7 +1943,7 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, #if KOKKOS_ENABLE_NEW_LOOP_MACROS template <typename IType> - inline void operator()(IType tile_idx) const { + inline void operator()(IType tile_idx, value_type& val) const { point_type m_offset; point_type m_tiledims; @@ -1996,7 +1966,7 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, const bool full_tile = check_iteration_bounds(m_tiledims, m_offset); Tile_Loop_Type<RP::rank, (RP::inner_direction == Iterate::Left), index_type, - Tag>::apply(m_v, m_func, full_tile, m_offset, m_rp.m_tile, + Tag>::apply(val, m_func, full_tile, m_offset, m_rp.m_tile, m_tiledims); } @@ -2315,7 +2285,6 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, } // end Iterate::Right } // end op() rank == 8 -#endif template <typename... Args> std::enable_if_t<(sizeof...(Args) == RP::rank && std::is_void<Tag>::value), @@ -2330,10 +2299,10 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, apply(Args&&... args) const { m_func(m_tag, args..., m_v); } +#endif - RP const& m_rp; - Functor const& m_func; - value_type& m_v; + RP const m_rp; + Functor const m_func; std::conditional_t<std::is_void<Tag>::value, int, Tag> m_tag; }; @@ -2352,15 +2321,10 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, // 'array-ness' [], only // underlying type remains - inline HostIterateTile( - RP const& rp, Functor const& func, - value_type* v) // v should be an array; treat as pointer for - // compatibility since size is not known nor needed here - : m_rp(rp) // Cuda 7.0 does not like braces... + inline HostIterateTile(RP const& rp, Functor const& func) + : m_rp(rp) // Cuda 7.0 does not like braces... , - m_func(func), - m_v(v) // use with non-void ValueType struct - {} + m_func(func) {} inline bool check_iteration_bounds(point_type& partial_tile, point_type& offset) const { @@ -2392,7 +2356,7 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, #if KOKKOS_ENABLE_NEW_LOOP_MACROS template <typename IType> - inline void operator()(IType tile_idx) const { + inline void operator()(IType tile_idx, value_type* val) const { point_type m_offset; point_type m_tiledims; @@ -2415,7 +2379,7 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, const bool full_tile = check_iteration_bounds(m_tiledims, m_offset); Tile_Loop_Type<RP::rank, (RP::inner_direction == Iterate::Left), index_type, - Tag>::apply(m_v, m_func, full_tile, m_offset, m_rp.m_tile, + Tag>::apply(val, m_func, full_tile, m_offset, m_rp.m_tile, m_tiledims); } @@ -2734,8 +2698,6 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, } // end Iterate::Right } // end op() rank == 8 -#endif - template <typename... Args> std::enable_if_t<(sizeof...(Args) == RP::rank && std::is_void<Tag>::value), void> @@ -2749,10 +2711,10 @@ struct HostIterateTile<RP, Functor, Tag, ValueType, apply(Args&&... args) const { m_func(m_tag, args..., m_v); } +#endif - RP const& m_rp; - Functor const& m_func; - value_type* m_v; + RP const m_rp; + Functor const m_func; std::conditional_t<std::is_void<Tag>::value, int, Tag> m_tag; }; diff --git a/packages/kokkos/core/src/impl/KokkosExp_IterateTileGPU.hpp b/packages/kokkos/core/src/impl/KokkosExp_IterateTileGPU.hpp index 957c3b638c5e23cc08b6efdd8a16afe415e366a3..e1273ab9e3bd65804072ada103b556a29228053b 100644 --- a/packages/kokkos/core/src/impl/KokkosExp_IterateTileGPU.hpp +++ b/packages/kokkos/core/src/impl/KokkosExp_IterateTileGPU.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXP_ITERATE_TILE_GPU_HPP #define KOKKOS_EXP_ITERATE_TILE_GPU_HPP diff --git a/packages/kokkos/core/src/impl/KokkosExp_ViewMapping.hpp b/packages/kokkos/core/src/impl/KokkosExp_ViewMapping.hpp index a41ffb1e8a0572b4b1a06be8c27bfab0126c9500..81e9d5e6aa589a6dfc3b883c173203eb64a50bf3 100644 --- a/packages/kokkos/core/src/impl/KokkosExp_ViewMapping.hpp +++ b/packages/kokkos/core/src/impl/KokkosExp_ViewMapping.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Deprecated file for backward compatibility diff --git a/packages/kokkos/core/src/impl/Kokkos_AnalyzePolicy.hpp b/packages/kokkos/core/src/impl/Kokkos_AnalyzePolicy.hpp index 2ffcd626d673420f62989d59f6be397961a8be16..d77ec0c7537fd465c9029c89705e64d913f35168 100644 --- a/packages/kokkos/core/src/impl/Kokkos_AnalyzePolicy.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_AnalyzePolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_ANALYZE_POLICY_HPP #define KOKKOS_IMPL_ANALYZE_POLICY_HPP @@ -206,28 +178,14 @@ struct ExecPolicyTraitsWithDefaults : AnalysisResults { //------------------------------------------------------------------------------ -constexpr bool warn_if_deprecated(std::false_type) { return true; } -KOKKOS_DEPRECATED_WITH_COMMENT( - "Invalid WorkTag template argument in execution policy!!") -constexpr bool warn_if_deprecated(std::true_type) { return true; } -#define KOKKOS_IMPL_STATIC_WARNING(...) \ - static_assert( \ - warn_if_deprecated(std::integral_constant<bool, __VA_ARGS__>()), "") - template <typename... Traits> struct PolicyTraits : ExecPolicyTraitsWithDefaults<AnalyzeExecPolicy<void, Traits...>> { using base_t = ExecPolicyTraitsWithDefaults<AnalyzeExecPolicy<void, Traits...>>; using base_t::base_t; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - KOKKOS_IMPL_STATIC_WARNING(!std::is_empty<typename base_t::work_tag>::value && - !std::is_void<typename base_t::work_tag>::value); -#endif }; -#undef KOKKOS_IMPL_STATIC_WARNING - } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Assembly.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Assembly.hpp index a31dd1cf49365bd1b05d0f188637e398417a0dd7..59d70e7f7c8523d67a4ec97bd41b25b6a7fc5ec0 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Assembly.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Assembly.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_ATOMIC_ASSEMBLY_HPP) diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp index e203c0a2bd1e85797fd41928860b3e1f40ba2024..08091ab9ce4c56da255e153fac714e3962026d0f 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Strong.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> @@ -315,9 +287,9 @@ KOKKOS_INLINE_FUNCTION T atomic_compare_exchange(volatile T* const dest_v, // dummy for non-CUDA Kokkos headers being processed by NVCC #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA) template <typename T> -__inline__ __device__ T -atomic_compare_exchange(volatile T* const, const Kokkos::Impl::identity_t<T>, - const Kokkos::Impl::identity_t<T>) { +__inline__ __device__ T atomic_compare_exchange( + volatile T* const, const Kokkos::Impl::type_identity_t<T>, + const Kokkos::Impl::type_identity_t<T>) { return T(); } #endif diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp index ad5b010558d94d753bc880ce09195366c794b193..884927783602b6cf427164b4635ff7a53db045f2 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Compare_Exchange_Weak.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Decrement.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Decrement.hpp index 47961b5c717fcd88c2b6a66266a42a6df256a00b..aac5233b3a579662bfe0b2ff2fad75521bc747dd 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Decrement.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Decrement.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp index a8f77d8353fad6f6cff5d290c893c35705c86f27..abfc1f631a5a428f83c61fa332bd169fc52a7201 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Exchange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> @@ -389,14 +361,14 @@ inline void atomic_assign(volatile T* const dest_v, const T val) { // dummy for non-CUDA Kokkos headers being processed by NVCC #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA) template <typename T> -__inline__ __device__ T atomic_exchange(volatile T* const, - const Kokkos::Impl::identity_t<T>) { +__inline__ __device__ T +atomic_exchange(volatile T* const, const Kokkos::Impl::type_identity_t<T>) { return T(); } template <typename T> -__inline__ __device__ void atomic_assign(volatile T* const, - const Kokkos::Impl::identity_t<T>) {} +__inline__ __device__ void atomic_assign( + volatile T* const, const Kokkos::Impl::type_identity_t<T>) {} #endif } // namespace Kokkos diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp index c188f45427be2d189392264e37daac83c6620eac..a8c421fbdbd84e169eb9046f5593573b5de4a189 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Add.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> @@ -171,8 +143,7 @@ __inline__ __device__ T atomic_fetch_add( #if !defined(__CUDA_ARCH__) || defined(KOKKOS_IMPL_CUDA_CLANG_WORKAROUND) #if defined(KOKKOS_ENABLE_GNU_ATOMICS) || defined(KOKKOS_ENABLE_INTEL_ATOMICS) -#if defined(KOKKOS_ENABLE_ASM) && (defined(KOKKOS_ENABLE_ISA_X86_64) || \ - defined(KOKKOS_KNL_USE_ASM_WORKAROUND)) +#if defined(KOKKOS_ENABLE_ASM) && defined(KOKKOS_ENABLE_ISA_X86_64) inline int atomic_fetch_add(volatile int* dest, const int val) { #if defined(KOKKOS_ENABLE_RFO_PREFETCH) _mm_prefetch((const char*)dest, _MM_HINT_ET0); @@ -380,7 +351,7 @@ T atomic_fetch_add(volatile T* const dest_v, std::add_const_t<T> val) { #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA) template <typename T> __inline__ __device__ T atomic_fetch_add(volatile T* const, - Kokkos::Impl::identity_t<T>) { + Kokkos::Impl::type_identity_t<T>) { return T(); } #endif diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_And.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_And.hpp index 50bd2b0fa146cd68c5ec655efef01b506cdef41d..25049db8f0b87ae33b94a9570f6f2e96f3d64982 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_And.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_And.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> @@ -176,7 +148,7 @@ T atomic_fetch_and(volatile T* const dest_v, const T val) { #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA) template <typename T> __inline__ __device__ T atomic_fetch_and(volatile T* const, - Kokkos::Impl::identity_t<T>) { + Kokkos::Impl::type_identity_t<T>) { return T(); } #endif diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp index 7a04a8c7cab1889608c958fd2b0102f776ad17d8..fa581bc1552fc75b3ade87071a92755e70b3c95f 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Or.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> @@ -177,7 +149,7 @@ T atomic_fetch_or(volatile T* const dest_v, const T val) { #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA) template <typename T> __inline__ __device__ T atomic_fetch_or(volatile T* const, - Kokkos::Impl::identity_t<T>) { + Kokkos::Impl::type_identity_t<T>) { return T(); } #endif diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp index 6aaf36970c3d914e2ab87a7c3bd8b640492dc529..a4db7d7cf45fc5bf7a30dd1ac286007453554b1f 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Fetch_Sub.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> @@ -312,7 +284,7 @@ T atomic_fetch_sub(volatile T* const dest_v, const T val) { #if defined(__CUDA_ARCH__) && !defined(KOKKOS_ENABLE_CUDA) template <typename T> __inline__ __device__ T atomic_fetch_sub(volatile T* const, - Kokkos::Impl::identity_t<T>) { + Kokkos::Impl::type_identity_t<T>) { return T(); } #endif diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic.hpp index aac0d12c8173061970c192a3eff41e348059202a..69d101fb8ea09706a3494fa974558a92a89d40c3 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_ATOMIC_GENERIC_HPP) diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp index 7ab6358434e1c0129672fcf04a7d5eba83e61e87..af43bf66795b88369465c89e16f460df33a92030 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Generic_Secondary.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_ATOMIC_GENERIC_SECONDARY_HPP) #define KOKKOS_ATOMIC_GENERIC_SECONDARY_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Increment.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Increment.hpp index 65630aa84cdf9845afca761d56e68c6ffe3ef269..b40e7dfecb2693c3bf434326395e2882721cb841 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Increment.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Increment.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #if defined(KOKKOS_ENABLE_RFO_PREFETCH) #include <xmmintrin.h> diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Load.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Load.hpp index f4437326dddceab23a47525fc3ae8c89af199f66..fc4a04b501362a23f741cccd2726b99249dc7e49 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Load.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Load.hpp @@ -1,45 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_KOKKOS_ATOMIC_LOAD_HPP #define KOKKOS_IMPL_KOKKOS_ATOMIC_LOAD_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Memory_Order.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Memory_Order.hpp index 72a6dfa9a466e0161b4b98ec8069f99187c748a2..d8c68212676a3e536f348b6c4214a89e37a9e7fe 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Memory_Order.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Memory_Order.hpp @@ -1,45 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_ATOMIC_MEMORY_ORDER_HPP #define KOKKOS_KOKKOS_ATOMIC_MEMORY_ORDER_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_MinMax.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_MinMax.hpp index 7338a5c545f25f58662c2e05c4a20bda4992e203..42898c82a4631a5efb564ef95c41ea0ad5b6f2f2 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_MinMax.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_MinMax.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_ATOMIC_MINMAX_HPP) diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Store.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Store.hpp index ffe018b4d6120212d8c03c1b6d05106e3e6011a3..3c82e0e3dd0f84d126cf3912054434913ad52f1e 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Store.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Store.hpp @@ -1,45 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_KOKKOS_ATOMIC_STORE_HPP #define KOKKOS_IMPL_KOKKOS_ATOMIC_STORE_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_View.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_View.hpp index f763f8c7916e4875e6c1b2a6c3733c89c532f6bb..45d01c9f9f33bc90dd1e42dab4c8207970023586 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_View.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_View.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_ATOMIC_VIEW_HPP #define KOKKOS_ATOMIC_VIEW_HPP @@ -60,19 +32,14 @@ class AtomicDataElement { using value_type = typename ViewTraits::value_type; using const_value_type = typename ViewTraits::const_value_type; using non_const_value_type = typename ViewTraits::non_const_value_type; - volatile value_type* const ptr; + value_type* const ptr; KOKKOS_INLINE_FUNCTION AtomicDataElement(value_type* ptr_, AtomicViewConstTag) : ptr(ptr_) {} KOKKOS_INLINE_FUNCTION const_value_type operator=(const_value_type& val) const { - *ptr = val; - return val; - } - KOKKOS_INLINE_FUNCTION - const_value_type operator=(volatile const_value_type& val) const { - *ptr = val; + Kokkos::Impl::atomic_store(ptr, val, Kokkos::Impl::memory_order_relaxed); return val; } @@ -111,129 +78,67 @@ class AtomicDataElement { const_value_type tmp = Kokkos::atomic_fetch_add(ptr, val); return tmp + val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator+=(volatile const_value_type& val) const { - const_value_type tmp = Kokkos::atomic_fetch_add(ptr, val); - return tmp + val; - } KOKKOS_INLINE_FUNCTION const_value_type operator-=(const_value_type& val) const { const_value_type tmp = Kokkos::atomic_fetch_sub(ptr, val); return tmp - val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator-=(volatile const_value_type& val) const { - const_value_type tmp = Kokkos::atomic_fetch_sub(ptr, val); - return tmp - val; - } KOKKOS_INLINE_FUNCTION const_value_type operator*=(const_value_type& val) const { return Kokkos::atomic_mul_fetch(ptr, val); } - KOKKOS_INLINE_FUNCTION - const_value_type operator*=(volatile const_value_type& val) const { - return Kokkos::atomic_mul_fetch(ptr, val); - } KOKKOS_INLINE_FUNCTION const_value_type operator/=(const_value_type& val) const { return Kokkos::atomic_div_fetch(ptr, val); } - KOKKOS_INLINE_FUNCTION - const_value_type operator/=(volatile const_value_type& val) const { - return Kokkos::atomic_div_fetch(ptr, val); - } KOKKOS_INLINE_FUNCTION const_value_type operator%=(const_value_type& val) const { return Kokkos::atomic_mod_fetch(ptr, val); } - KOKKOS_INLINE_FUNCTION - const_value_type operator%=(volatile const_value_type& val) const { - return Kokkos::atomic_mod_fetch(ptr, val); - } KOKKOS_INLINE_FUNCTION const_value_type operator&=(const_value_type& val) const { return Kokkos::atomic_and_fetch(ptr, val); } - KOKKOS_INLINE_FUNCTION - const_value_type operator&=(volatile const_value_type& val) const { - return Kokkos::atomic_and_fetch(ptr, val); - } KOKKOS_INLINE_FUNCTION const_value_type operator^=(const_value_type& val) const { return Kokkos::atomic_xor_fetch(ptr, val); } - KOKKOS_INLINE_FUNCTION - const_value_type operator^=(volatile const_value_type& val) const { - return Kokkos::atomic_xor_fetch(ptr, val); - } KOKKOS_INLINE_FUNCTION const_value_type operator|=(const_value_type& val) const { return Kokkos::atomic_or_fetch(ptr, val); } - KOKKOS_INLINE_FUNCTION - const_value_type operator|=(volatile const_value_type& val) const { - return Kokkos::atomic_or_fetch(ptr, val); - } KOKKOS_INLINE_FUNCTION const_value_type operator<<=(const_value_type& val) const { return Kokkos::atomic_lshift_fetch(ptr, val); } - KOKKOS_INLINE_FUNCTION - const_value_type operator<<=(volatile const_value_type& val) const { - return Kokkos::atomic_lshift_fetch(ptr, val); - } KOKKOS_INLINE_FUNCTION const_value_type operator>>=(const_value_type& val) const { return Kokkos::atomic_rshift_fetch(ptr, val); } - KOKKOS_INLINE_FUNCTION - const_value_type operator>>=(volatile const_value_type& val) const { - return Kokkos::atomic_rshift_fetch(ptr, val); - } KOKKOS_INLINE_FUNCTION const_value_type operator+(const_value_type& val) const { return *ptr + val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator+(volatile const_value_type& val) const { - return *ptr + val; - } KOKKOS_INLINE_FUNCTION const_value_type operator-(const_value_type& val) const { return *ptr - val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator-(volatile const_value_type& val) const { - return *ptr - val; - } KOKKOS_INLINE_FUNCTION const_value_type operator*(const_value_type& val) const { return *ptr * val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator*(volatile const_value_type& val) const { - return *ptr * val; - } KOKKOS_INLINE_FUNCTION const_value_type operator/(const_value_type& val) const { return *ptr / val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator/(volatile const_value_type& val) const { - return *ptr / val; - } KOKKOS_INLINE_FUNCTION const_value_type operator%(const_value_type& val) const { return *ptr ^ val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator%(volatile const_value_type& val) const { - return *ptr ^ val; - } KOKKOS_INLINE_FUNCTION const_value_type operator!() const { return !*ptr; } @@ -242,40 +147,20 @@ class AtomicDataElement { const_value_type operator&&(const_value_type& val) const { return *ptr && val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator&&(volatile const_value_type& val) const { - return *ptr && val; - } KOKKOS_INLINE_FUNCTION const_value_type operator||(const_value_type& val) const { return *ptr | val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator||(volatile const_value_type& val) const { - return *ptr | val; - } KOKKOS_INLINE_FUNCTION const_value_type operator&(const_value_type& val) const { return *ptr & val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator&(volatile const_value_type& val) const { - return *ptr & val; - } KOKKOS_INLINE_FUNCTION const_value_type operator|(const_value_type& val) const { return *ptr | val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator|(volatile const_value_type& val) const { - return *ptr | val; - } KOKKOS_INLINE_FUNCTION const_value_type operator^(const_value_type& val) const { return *ptr ^ val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator^(volatile const_value_type& val) const { - return *ptr ^ val; - } KOKKOS_INLINE_FUNCTION const_value_type operator~() const { return ~*ptr; } @@ -284,63 +169,33 @@ class AtomicDataElement { const_value_type operator<<(const unsigned int& val) const { return *ptr << val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator<<(volatile const unsigned int& val) const { - return *ptr << val; - } KOKKOS_INLINE_FUNCTION const_value_type operator>>(const unsigned int& val) const { return *ptr >> val; } - KOKKOS_INLINE_FUNCTION - const_value_type operator>>(volatile const unsigned int& val) const { - return *ptr >> val; - } KOKKOS_INLINE_FUNCTION bool operator==(const AtomicDataElement& val) const { return *ptr == val; } - KOKKOS_INLINE_FUNCTION - bool operator==(volatile const AtomicDataElement& val) const { - return *ptr == val; - } KOKKOS_INLINE_FUNCTION bool operator!=(const AtomicDataElement& val) const { return *ptr != val; } - KOKKOS_INLINE_FUNCTION - bool operator!=(volatile const AtomicDataElement& val) const { - return *ptr != val; - } KOKKOS_INLINE_FUNCTION bool operator>=(const_value_type& val) const { return *ptr >= val; } - KOKKOS_INLINE_FUNCTION - bool operator>=(volatile const_value_type& val) const { return *ptr >= val; } KOKKOS_INLINE_FUNCTION bool operator<=(const_value_type& val) const { return *ptr <= val; } - KOKKOS_INLINE_FUNCTION - bool operator<=(volatile const_value_type& val) const { return *ptr <= val; } KOKKOS_INLINE_FUNCTION bool operator<(const_value_type& val) const { return *ptr < val; } - KOKKOS_INLINE_FUNCTION - bool operator<(volatile const_value_type& val) const { return *ptr < val; } KOKKOS_INLINE_FUNCTION bool operator>(const_value_type& val) const { return *ptr > val; } - KOKKOS_INLINE_FUNCTION - bool operator>(volatile const_value_type& val) const { return *ptr > val; } - - KOKKOS_INLINE_FUNCTION - operator const_value_type() const { - // return Kokkos::atomic_load(ptr); - return *ptr; - } KOKKOS_INLINE_FUNCTION - operator non_const_value_type() volatile const { - return Kokkos::Impl::atomic_load(ptr); + operator value_type() const { + return Kokkos::Impl::atomic_load(ptr, Kokkos::Impl::memory_order_relaxed); } }; @@ -365,19 +220,6 @@ class AtomicViewDataHandle { operator typename ViewTraits::value_type*() const { return ptr; } }; -template <unsigned Size> -struct Kokkos_Atomic_is_only_allowed_with_32bit_and_64bit_scalars; - -template <> -struct Kokkos_Atomic_is_only_allowed_with_32bit_and_64bit_scalars<4> { - using type = int; -}; - -template <> -struct Kokkos_Atomic_is_only_allowed_with_32bit_and_64bit_scalars<8> { - using type = int64_t; -}; - } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/impl/Kokkos_Atomic_Windows.hpp b/packages/kokkos/core/src/impl/Kokkos_Atomic_Windows.hpp index c5207b51e9fadc631566551c1eaf451a0a1ad081..ffb0d2bae27ecfb0f595addf8cbd9592c1ecc396 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Atomic_Windows.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Atomic_Windows.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_ATOMIC_WINDOWS_HPP #define KOKKOS_ATOMIC_WINDOWS_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_BitOps.hpp b/packages/kokkos/core/src/impl/Kokkos_BitOps.hpp index a41d19aafa303823cf543a048c28c821c05ffdcd..16a28f2419faa4f0d40ef1c9809ea3b4d53f1333 100644 --- a/packages/kokkos/core/src/impl/Kokkos_BitOps.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_BitOps.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_BITOPS_HPP #define KOKKOS_BITOPS_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp b/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp index a8fc928d10d4e44e6ba4e29695777d7a3f5b7bdb..85ffaaf9698df1279e27ccbdd0d2934350fed4dd 100644 --- a/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.cpp @@ -1,124 +1,56 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE #endif -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#elif defined(__APPLE__) -#include <sys/types.h> -#include <sys/sysctl.h> -#else -#include <unistd.h> -#endif -#include <cstdio> -#include <cstdlib> -#include <cstring> -#include <cerrno> -#include <string> +#include <impl/Kokkos_CPUDiscovery.hpp> -namespace Kokkos { -namespace Impl { +#include <cstdlib> // getenv +#include <string> -int processors_per_node() { -#ifdef _SC_NPROCESSORS_ONLN - int const num_procs = sysconf(_SC_NPROCESSORS_ONLN); - int const num_procs_max = sysconf(_SC_NPROCESSORS_CONF); - if ((num_procs < 1) || (num_procs_max < 1)) { - return -1; +int Kokkos::Impl::mpi_ranks_per_node() { + for (char const* env_var : { + "OMPI_COMM_WORLD_LOCAL_SIZE", // OpenMPI + "MV2_COMM_WORLD_LOCAL_SIZE", // MVAPICH2 + "MPI_LOCALNRANKS", // MPICH + // SLURM??? + "PMI_LOCAL_SIZE", // PMI + }) { + char const* str = std::getenv(env_var); + if (str) { + return std::stoi(str); + } } - return num_procs; -#elif defined(__APPLE__) - int ncpu; - int activecpu; - size_t size = sizeof(int); - sysctlbyname("hw.ncpu", &ncpu, &size, nullptr, 0); - sysctlbyname("hw.activecpu", &activecpu, &size, nullptr, 0); - if (ncpu < 1 || activecpu < 1) - return -1; - else - return activecpu; -#else return -1; -#endif -} - -int mpi_ranks_per_node() { - char *str; - int ppn = 1; - // if ((str = getenv("SLURM_TASKS_PER_NODE"))) { - // ppn = std::stoi(str); - // if(ppn<=0) ppn = 1; - //} - if ((str = getenv("MV2_COMM_WORLD_LOCAL_SIZE"))) { - ppn = std::stoi(str); - if (ppn <= 0) ppn = 1; - } - if ((str = getenv("OMPI_COMM_WORLD_LOCAL_SIZE"))) { - ppn = std::stoi(str); - if (ppn <= 0) ppn = 1; - } - return ppn; } -int mpi_local_rank_on_node() { - char *str; - int local_rank = 0; - // if ((str = getenv("SLURM_LOCALID"))) { - // local_rank = std::stoi(str); - //} - if ((str = getenv("MV2_COMM_WORLD_LOCAL_RANK"))) { - local_rank = std::stoi(str); - } - if ((str = getenv("OMPI_COMM_WORLD_LOCAL_RANK"))) { - local_rank = std::stoi(str); +int Kokkos::Impl::mpi_local_rank_on_node() { + for (char const* env_var : { + "OMPI_COMM_WORLD_LOCAL_RANK", // OpenMPI + "MV2_COMM_WORLD_LOCAL_RANK", // MVAPICH2 + "MPI_LOCALRANKID", // MPICH + "SLURM_LOCALID", // SLURM + "PMI_LOCAL_RANK", // PMI + }) { + char const* str = std::getenv(env_var); + if (str) { + return std::stoi(str); + } } - return local_rank; + return -1; } - -} // namespace Impl -} // namespace Kokkos diff --git a/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.hpp b/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.hpp index 6ba14c85b1c8d6bbaf2e8afc97780df1cace4b32..27b8cd3a7c17baaad6951279ca77ba5fedb26c57 100644 --- a/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_CPUDiscovery.hpp @@ -1,50 +1,21 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ namespace Kokkos { namespace Impl { -int processors_per_node(); int mpi_ranks_per_node(); int mpi_local_rank_on_node(); diff --git a/packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp b/packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp index 1a372d8c954a604a27e30a04930824cfec5a7afc..855654408e28fdaea7ae46d8701624cd760aac78 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ChaseLev.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD @@ -58,7 +30,7 @@ #include <impl/Kokkos_LinkedListNode.hpp> // KOKKOS_EXPECTS #include <Kokkos_Atomic.hpp> // atomic_compare_exchange, atomic_fence -#include "Kokkos_LIFO.hpp" +#include <impl/Kokkos_LIFO.hpp> //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- diff --git a/packages/kokkos/core/src/impl/Kokkos_ClockTic.hpp b/packages/kokkos/core/src/impl/Kokkos_ClockTic.hpp index ecece72cf958c937702dd18b4a22642e479c857c..9e8c70076c6d192349f6aab09e4ad35877c3e9d1 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ClockTic.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ClockTic.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CLOCKTIC_HPP #define KOKKOS_CLOCKTIC_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Combined_Reducer.hpp b/packages/kokkos/core/src/impl/Kokkos_Combined_Reducer.hpp index 21a202994fbcdad4fe4d20d89776795ee7cd81e2..d7304779c77c76fa623da9601d2048cb9079365b 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Combined_Reducer.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Combined_Reducer.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_COMBINED_REDUCER_HPP #define KOKKOS_COMBINED_REDUCER_HPP @@ -51,7 +23,6 @@ #include <Kokkos_Parallel_Reduce.hpp> #include <Kokkos_ExecPolicy.hpp> #include <Kokkos_AnonymousSpace.hpp> -#include <impl/Kokkos_Utilities.hpp> // comma operator fold emulation #include <utility> @@ -152,15 +123,11 @@ struct CombinedReducerStorageImpl { // model Reducer KOKKOS_INLINE_FUNCTION - constexpr _fold_comma_emulation_return _init(value_type& val) const { - m_reducer.init(val); - return _fold_comma_emulation_return{}; - } + constexpr void _init(value_type& val) const { m_reducer.init(val); } - KOKKOS_INLINE_FUNCTION constexpr _fold_comma_emulation_return _join( - value_type& dest, value_type const& src) const { + KOKKOS_INLINE_FUNCTION constexpr void _join(value_type& dest, + value_type const& src) const { m_reducer.join(dest, src); - return _fold_comma_emulation_return{}; } }; @@ -231,16 +198,16 @@ struct CombinedReducerImpl<std::integer_sequence<size_t, Idxs...>, Space, KOKKOS_FUNCTION constexpr void join(value_type& dest, value_type const& src) const noexcept { - emulate_fold_comma_operator( - this->CombinedReducerStorageImpl<Idxs, Reducers>::_join( - dest.template get<Idxs, typename Reducers::value_type>(), - src.template get<Idxs, typename Reducers::value_type>())...); + (this->CombinedReducerStorageImpl<Idxs, Reducers>::_join( + dest.template get<Idxs, typename Reducers::value_type>(), + src.template get<Idxs, typename Reducers::value_type>()), + ...); } KOKKOS_FUNCTION constexpr void init(value_type& dest) const noexcept { - emulate_fold_comma_operator( - this->CombinedReducerStorageImpl<Idxs, Reducers>::_init( - dest.template get<Idxs, typename Reducers::value_type>())...); + (this->CombinedReducerStorageImpl<Idxs, Reducers>::_init( + dest.template get<Idxs, typename Reducers::value_type>()), + ...); } // TODO figure out if we also need to call through to final @@ -274,11 +241,11 @@ struct CombinedReducerImpl<std::integer_sequence<size_t, Idxs...>, Space, static void write_value_back_to_original_references( const ExecutionSpace& exec_space, value_type const& value, Reducers const&... reducers_that_reference_original_values) noexcept { - emulate_fold_comma_operator( - (write_one_value_back<ExecutionSpace, Idxs>( - exec_space, reducers_that_reference_original_values.view(), - value.template get<Idxs, typename Reducers::value_type>()), - 0)...); + (write_one_value_back<ExecutionSpace, Idxs>( + exec_space, reducers_that_reference_original_values.view(), + value.template get<Idxs, typename Reducers::value_type>()), + + ...); } }; diff --git a/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.cpp b/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.cpp index ca56352f4e8fd45228185115a23f3cad7cbcaeee..a12de7a01cbad606db469cfbee566e15798f6fb0 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.hpp b/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.hpp index b22bc3e342812abf546dd68960f5333791779dbb..95f4050d08a7047f91809eaf93e75259262ef491 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Command_Line_Parsing.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_COMMAND_LINE_PARSING_HPP #define KOKKOS_COMMAND_LINE_PARSING_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_ConcurrentBitset.hpp b/packages/kokkos/core/src/impl/Kokkos_ConcurrentBitset.hpp index dafe57f8da71cd22ea09a4e93a84f3196b24ca5c..ca4edce5c3884ac89e24c578767d4a15f231ccf1 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ConcurrentBitset.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ConcurrentBitset.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CONCURRENTBITSET_HPP #define KOKKOS_CONCURRENTBITSET_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Core.cpp b/packages/kokkos/core/src/impl/Kokkos_Core.cpp index a5bd0032374ffc5e0e73627e33aeb3fa7c1b788e..a35510dd64ec7e08e88e751bc2d87ae2702c5b01 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Core.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_Core.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -52,6 +24,7 @@ #include <impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp> #include <impl/Kokkos_DeviceManagement.hpp> #include <impl/Kokkos_ExecSpaceManager.hpp> +#include <impl/Kokkos_CPUDiscovery.hpp> #include <algorithm> #include <cctype> @@ -160,7 +133,7 @@ int get_device_count() { #if defined(KOKKOS_ENABLE_CUDA) return Kokkos::Cuda::detect_device_count(); #elif defined(KOKKOS_ENABLE_HIP) - return Kokkos::Experimental::HIP::detect_device_count(); + return Kokkos::HIP::detect_device_count(); #elif defined(KOKKOS_ENABLE_SYCL) return sycl::device::get_devices(sycl::info::device_type::gpu).size(); #elif defined(KOKKOS_ENABLE_OPENACC) @@ -231,7 +204,7 @@ void Kokkos::Impl::ExecSpaceManager::print_configuration(std::ostream& os, } } -int Kokkos::Impl::get_ctest_gpu(const char* local_rank_str) { +int Kokkos::Impl::get_ctest_gpu(int local_rank) { auto const* ctest_kokkos_device_type = std::getenv("CTEST_KOKKOS_DEVICE_TYPE"); if (!ctest_kokkos_device_type) { @@ -246,7 +219,7 @@ int Kokkos::Impl::get_ctest_gpu(const char* local_rank_str) { // Make sure rank is within bounds of resource groups specified by CTest auto resource_group_count = std::stoi(ctest_resource_group_count_str); - auto local_rank = std::stoi(local_rank_str); + assert(local_rank >= 0); if (local_rank >= resource_group_count) { std::ostringstream ss; ss << "Error: local rank " << local_rank @@ -428,20 +401,10 @@ int Kokkos::Impl::get_gpu(const InitializationSettings& settings) { Kokkos::abort("implementation bug"); } - char const* local_rank_str = nullptr; - for (char const* env_var : { - "OMPI_COMM_WORLD_LOCAL_RANK", // OpenMPI - "MV2_COMM_WORLD_LOCAL_RANK", // MVAPICH2 - "MPI_LOCALRANKID", // MPICH - "SLURM_LOCALID", // SLURM - "PMI_LOCAL_RANK" // PMI - }) { - local_rank_str = std::getenv(env_var); - if (local_rank_str) break; - } + int const mpi_local_rank = mpi_local_rank_on_node(); // use first GPU available for execution if unable to detect local MPI rank - if (!local_rank_str) { + if (mpi_local_rank < 0) { if (settings.has_map_device_id_by()) { std::cerr << "Warning: unable to detect local MPI rank." << " Falling back to the first GPU available for execution." @@ -453,10 +416,10 @@ int Kokkos::Impl::get_gpu(const InitializationSettings& settings) { // use device assigned by CTest when resource allocation is activated if (std::getenv("CTEST_KOKKOS_DEVICE_TYPE") && std::getenv("CTEST_RESOURCE_GROUP_COUNT")) { - return get_ctest_gpu(local_rank_str); + return get_ctest_gpu(mpi_local_rank); } - return visible_devices[std::stoi(local_rank_str) % visible_devices.size()]; + return visible_devices[mpi_local_rank % visible_devices.size()]; } namespace { @@ -532,11 +495,6 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) { std::to_string(KOKKOS_COMPILER_GNU)); declare_configuration_metadata("tools_only", "compiler_family", "gnu"); #endif -#ifdef KOKKOS_COMPILER_IBM - declare_configuration_metadata("compiler_version", "KOKKOS_COMPILER_IBM", - std::to_string(KOKKOS_COMPILER_IBM)); - declare_configuration_metadata("tools_only", "compiler_family", "ibm"); -#endif #ifdef KOKKOS_COMPILER_INTEL declare_configuration_metadata("compiler_version", "KOKKOS_COMPILER_INTEL", std::to_string(KOKKOS_COMPILER_INTEL)); @@ -592,13 +550,6 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) { declare_configuration_metadata("vectorization", "KOKKOS_ENABLE_PRAGMA_LOOPCOUNT", "no"); #endif -#ifdef KOKKOS_ENABLE_PRAGMA_SIMD - declare_configuration_metadata("vectorization", "KOKKOS_ENABLE_PRAGMA_SIMD", - "yes"); -#else - declare_configuration_metadata("vectorization", "KOKKOS_ENABLE_PRAGMA_SIMD", - "no"); -#endif #ifdef KOKKOS_ENABLE_PRAGMA_UNROLL declare_configuration_metadata("vectorization", "KOKKOS_ENABLE_PRAGMA_UNROLL", "yes"); @@ -632,11 +583,6 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) { #else declare_configuration_metadata("options", "KOKKOS_ENABLE_ASM", "no"); #endif -#ifdef KOKKOS_ENABLE_CXX14 - declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX14", "yes"); -#else - declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX14", "no"); -#endif #ifdef KOKKOS_ENABLE_CXX17 declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX17", "yes"); #else @@ -647,6 +593,11 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) { #else declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX20", "no"); #endif +#ifdef KOKKOS_ENABLE_CXX23 + declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX23", "yes"); +#else + declare_configuration_metadata("options", "KOKKOS_ENABLE_CXX23", "no"); +#endif #ifdef KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK declare_configuration_metadata("options", "KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK", "yes"); @@ -671,6 +622,150 @@ void pre_initialize_internal(const Kokkos::InitializationSettings& settings) { #endif declare_configuration_metadata("architecture", "Default Device", typeid(Kokkos::DefaultExecutionSpace).name()); + +#if defined(KOKKOS_ARCH_A64FX) + declare_configuration_metadata("architecture", "CPU architecture", "A64FX"); +#elif defined(KOKKOS_ARCH_AMDAVX) + declare_configuration_metadata("architecture", "CPU architecture", "AMDAVX"); +#elif defined(KOKKOS_ARCH_ARMV80) + declare_configuration_metadata("architecture", "CPU architecture", "ARMV80"); +#elif defined(KOKKOS_ARCH_ARMV81) + declare_configuration_metadata("architecture", "CPU architecture", "ARMV81"); +#elif defined(KOKKOS_ARCH_ARMV8_THUNDERX) + declare_configuration_metadata("architecture", "CPU architecture", + "ARMV8_THUNDERX"); +#elif defined(KOKKOS_ARCH_ARMV8_THUNDERX2) + declare_configuration_metadata("architecture", "CPU architecture", + "ARMV8_THUNDERX2"); +#elif defined(KOKKOS_ARCH_BDW) + declare_configuration_metadata("architecture", "CPU architecture", "BDW"); +#elif defined(KOKKOS_ARCH_BGQ) + declare_configuration_metadata("architecture", "CPU architecture", "BGQ"); +#elif defined(KOKKOS_ARCH_HSW) + declare_configuration_metadata("architecture", "CPU architecture", "HSW"); +#elif defined(KOKKOS_ARCH_ICL) + declare_configuration_metadata("architecture", "CPU architecture", "ICL"); +#elif defined(KOKKOS_ARCH_ICX) + declare_configuration_metadata("architecture", "CPU architecture", "ICX"); +#elif defined(KOKKOS_ARCH_KNC) + declare_configuration_metadata("architecture", "CPU architecture", "KNC"); +#elif defined(KOKKOS_ARCH_KNL) + declare_configuration_metadata("architecture", "CPU architecture", "KNL"); +#elif defined(KOKKOS_ARCH_NATIVE) + declare_configuration_metadata("architecture", "CPU architecture", "NATIVE"); +#elif defined(KOKKOS_ARCH_POWER7) + declare_configuration_metadata("architecture", "CPU architecture", "POWER7"); +#elif defined(KOKKOS_ARCH_POWER8) + declare_configuration_metadata("architecture", "CPU architecture", "POWER8"); +#elif defined(KOKKOS_ARCH_POWER9) + declare_configuration_metadata("architecture", "CPU architecture", "POWER9"); +#elif defined(KOKKOS_ARCH_SKL) + declare_configuration_metadata("architecture", "CPU architecture", "SKL"); +#elif defined(KOKKOS_ARCH_SKX) + declare_configuration_metadata("architecture", "CPU architecture", "SKX"); +#elif defined(KOKKOS_ARCH_SNB) + declare_configuration_metadata("architecture", "CPU architecture", "SNB"); +#elif defined(KOKKOS_ARCH_SPR) + declare_configuration_metadata("architecture", "CPU architecture", "SPR"); +#elif defined(KOKKOS_ARCH_WSM) + declare_configuration_metadata("architecture", "CPU architecture", "WSM"); +#elif defined(KOKKOS_ARCH_AMD_ZEN) + declare_configuration_metadata("architecture", "CPU architecture", "AMD_ZEN"); +#elif defined(KOKKOS_ARCH_AMD_ZEN2) + declare_configuration_metadata("architecture", "CPU architecture", + "AMD_ZEN2"); +#elif defined(KOKKOS_ARCH_AMD_ZEN3) + declare_configuration_metadata("architecture", "CPU architecture", + "AMD_ZEN3"); +#else + declare_configuration_metadata("architecture", "CPU architecture", "none"); +#endif + +#if defined(KOKKOS_ARCH_INTEL_GEN) + declare_configuration_metadata("architecture", "GPU architecture", + "INTEL_GEN"); +#elif defined(KOKKOS_ARCH_INTEL_DG1) + declare_configuration_metadata("architecture", "GPU architecture", + "INTEL_DG1"); +#elif defined(KOKKOS_ARCH_INTEL_GEN9) + declare_configuration_metadata("architecture", "GPU architecture", + "INTEL_GEN9"); +#elif defined(KOKKOS_ARCH_INTEL_GEN11) + declare_configuration_metadata("architecture", "GPU architecture", + "INTEL_GEN11"); +#elif defined(KOKKOS_ARCH_INTEL_GEN12LP) + declare_configuration_metadata("architecture", "GPU architecture", + "INTEL_GEN12LP"); +#elif defined(KOKKOS_ARCH_INTEL_XEHP) + declare_configuration_metadata("architecture", "GPU architecture", + "INTEL_XEHP"); +#elif defined(KOKKOS_ARCH_INTEL_PVC) + declare_configuration_metadata("architecture", "GPU architecture", + "INTEL_PVC"); + +#elif defined(KOKKOS_ARCH_KEPLER30) + declare_configuration_metadata("architecture", "GPU architecture", + "KEPLER30"); +#elif defined(KOKKOS_ARCH_KEPLER32) + declare_configuration_metadata("architecture", "GPU architecture", + "KEPLER32"); +#elif defined(KOKKOS_ARCH_KEPLER35) + declare_configuration_metadata("architecture", "GPU architecture", + "KEPLER35"); +#elif defined(KOKKOS_ARCH_KEPLER37) + declare_configuration_metadata("architecture", "GPU architecture", + "KELPER37"); +#elif defined(KOKKOS_ARCH_MAXWELL50) + declare_configuration_metadata("architecture", "GPU architecture", + "MAXWELL50"); +#elif defined(KOKKOS_ARCH_MAXWELL52) + declare_configuration_metadata("architecture", "GPU architecture", + "MAXWELL52"); +#elif defined(KOKKOS_ARCH_MAXWELL53) + declare_configuration_metadata("architecture", "GPU architecture", + "MAXWELL53"); +#elif defined(KOKKOS_ARCH_PASCAL60) + declare_configuration_metadata("architecture", "GPU architecture", + "PASCAL60"); +#elif defined(KOKKOS_ARCH_PASCAL61) + declare_configuration_metadata("architecture", "GPU architecture", + "PASCAL61"); +#elif defined(KOKKOS_ARCH_VOLTA70) + declare_configuration_metadata("architecture", "GPU architecture", "VOLTA70"); +#elif defined(KOKKOS_ARCH_VOLTA72) + declare_configuration_metadata("architecture", "GPU architecture", "VOLTA72"); +#elif defined(KOKKOS_ARCH_TURING75) + declare_configuration_metadata("architecture", "GPU architecture", + "TURING75"); +#elif defined(KOKKOS_ARCH_AMPERE80) + declare_configuration_metadata("architecture", "GPU architecture", + "AMPERE80"); +#elif defined(KOKKOS_ARCH_AMPERE86) + declare_configuration_metadata("architecture", "GPU architecture", + "AMPERE86"); +#elif defined(KOKKOS_ARCH_ADA89) + declare_configuration_metadata("architecture", "GPU architecture", "ADA89"); +#elif defined(KOKKOS_ARCH_HOPPER90) + declare_configuration_metadata("architecture", "GPU architecture", + "HOPPER90"); +#elif defined(KOKKOS_ARCH_VEGA900) + declare_configuration_metadata("architecture", "GPU architecture", "VEGA900"); +#elif defined(KOKKOS_ARCH_VEGA906) + declare_configuration_metadata("architecture", "GPU architecture", "VEGA906"); +#elif defined(KOKKOS_ARCH_VEGA908) + declare_configuration_metadata("architecture", "GPU architecture", "VEGA908"); +#elif defined(KOKKOS_ARCH_VEGA90A) + declare_configuration_metadata("architecture", "GPU architecture", "VEGA90A"); +#elif defined(KOKKOS_ARCH_NAVI1030) + declare_configuration_metadata("architecture", "GPU architecture", + "NAVI1030"); +#elif defined(KOKKOS_ARCH_NAVI1100) + declare_configuration_metadata("architecture", "GPU architecture", + "NAVI1100"); + +#else + declare_configuration_metadata("architecture", "GPU architecture", "none"); +#endif } void post_initialize_internal(const Kokkos::InitializationSettings& settings) { @@ -690,7 +785,7 @@ void initialize_internal(const Kokkos::InitializationSettings& settings) { post_initialize_internal(settings); } -void finalize_internal() { +void pre_finalize_internal() { typename decltype(finalize_hooks)::size_type numSuccessfulCalls = 0; while (!finalize_hooks.empty()) { auto f = finalize_hooks.top(); @@ -719,9 +814,9 @@ void finalize_internal() { } Kokkos::Profiling::finalize(); +} - Kokkos::Impl::ExecSpaceManager::get_instance().finalize_spaces(); - +void post_finalize_internal() { g_is_initialized = false; g_is_finalized = true; g_show_warnings = true; @@ -1070,8 +1165,19 @@ void Kokkos::Impl::parse_environment_variables( } //---------------------------------------------------------------------------- +namespace { +bool kokkos_initialize_was_called() { + return Kokkos::is_initialized() || Kokkos::is_finalized(); +} +bool kokkos_finalize_was_called() { return Kokkos::is_finalized(); } +} // namespace void Kokkos::initialize(int& argc, char* argv[]) { + if (kokkos_initialize_was_called()) { + Kokkos::abort( + "Error: Kokkos::initialize() has already been called." + " Kokkos can be initialized at most once.\n"); + } InitializationSettings settings; Impl::parse_environment_variables(settings); Impl::parse_command_line_arguments(argc, argv, settings); @@ -1079,6 +1185,11 @@ void Kokkos::initialize(int& argc, char* argv[]) { } void Kokkos::initialize(InitializationSettings const& settings) { + if (kokkos_initialize_was_called()) { + Kokkos::abort( + "Error: Kokkos::initialize() has already been called." + " Kokkos can be initialized at most once.\n"); + } InitializationSettings tmp; Impl::parse_environment_variables(tmp); combine(tmp, settings); @@ -1093,15 +1204,27 @@ void Kokkos::Impl::post_initialize(const InitializationSettings& settings) { post_initialize_internal(settings); } +void Kokkos::Impl::pre_finalize() { pre_finalize_internal(); } + +void Kokkos::Impl::post_finalize() { post_finalize_internal(); } + void Kokkos::push_finalize_hook(std::function<void()> f) { finalize_hooks.push(f); } -void Kokkos::finalize() { finalize_internal(); } - -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -KOKKOS_DEPRECATED void Kokkos::finalize_all() { finalize_internal(); } -#endif +void Kokkos::finalize() { + if (!kokkos_initialize_was_called()) { + Kokkos::abort( + "Error: Kokkos::finalize() may only be called after Kokkos has been " + "initialized.\n"); + } + if (kokkos_finalize_was_called()) { + Kokkos::abort("Error: Kokkos::finalize() has already been called.\n"); + } + pre_finalize_internal(); + Impl::ExecSpaceManager::get_instance().finalize_spaces(); + post_finalize_internal(); +} #ifdef KOKKOS_COMPILER_INTEL void Kokkos::fence() { fence("Kokkos::fence: Unnamed Global Fence"); } @@ -1112,7 +1235,7 @@ namespace { void print_helper(std::ostream& os, const std::map<std::string, std::string>& print_me) { for (const auto& kv : print_me) { - os << kv.first << ": " << kv.second << '\n'; + os << " " << kv.first << ": " << kv.second << '\n'; } } } // namespace @@ -1141,13 +1264,11 @@ void Kokkos::print_configuration(std::ostream& os, bool verbose) { Impl::ExecSpaceManager::get_instance().print_configuration(os, verbose); } -KOKKOS_ATTRIBUTE_NODISCARD bool Kokkos::is_initialized() noexcept { +[[nodiscard]] bool Kokkos::is_initialized() noexcept { return g_is_initialized; } -KOKKOS_ATTRIBUTE_NODISCARD bool Kokkos::is_finalized() noexcept { - return g_is_finalized; -} +[[nodiscard]] bool Kokkos::is_finalized() noexcept { return g_is_finalized; } bool Kokkos::show_warnings() noexcept { return g_show_warnings; } @@ -1164,7 +1285,3 @@ void _kokkos_pgi_compiler_bug_workaround() {} } // end namespace Impl #endif } // namespace Kokkos - -Kokkos::Impl::InitializationSettingsHelper<std::string>::storage_type const - Kokkos::Impl::InitializationSettingsHelper<std::string>::unspecified = - "some string we don't expect user would ever provide"; diff --git a/packages/kokkos/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp b/packages/kokkos/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp index 1edcca8f5e45dd2de4724fff42f9d1d7be4d57af..c71c21d2ac988d923710ada399ddbd8c0384570a 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Default_GraphNodeKernel.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_HOST_GRAPHNODEKERNEL_HPP #define KOKKOS_KOKKOS_HOST_GRAPHNODEKERNEL_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp b/packages/kokkos/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp index 37041534718984b98e42f767a5bbde58f0490277..223ae391ab40f1b4347a4a7613d41fddd9ad69f0 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Default_GraphNode_Impl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_HOST_GRAPHNODE_IMPL_HPP #define KOKKOS_KOKKOS_HOST_GRAPHNODE_IMPL_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Default_Graph_Impl.hpp b/packages/kokkos/core/src/impl/Kokkos_Default_Graph_Impl.hpp index e4667ca0121849511a44f1ca49fe0ca9646b24d9..d65b448f1f71a7335458e505252e3dd589a86fb1 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Default_Graph_Impl.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Default_Graph_Impl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HOST_GRAPH_IMPL_HPP #define KOKKOS_HOST_GRAPH_IMPL_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Default_Graph_fwd.hpp b/packages/kokkos/core/src/impl/Kokkos_Default_Graph_fwd.hpp index cdbed72888288ffb71a3bf8ee4e3e837c3c90219..e028d944c1da9d9ba03ea221ee23157c7d89ba1f 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Default_Graph_fwd.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Default_Graph_fwd.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_HOST_GRAPH_FWD_HPP #define KOKKOS_KOKKOS_HOST_GRAPH_FWD_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_DeviceManagement.hpp b/packages/kokkos/core/src/impl/Kokkos_DeviceManagement.hpp index 34421f0fe58447c47af872cb259ddab3d0f79413..bd89c8b19ca9d323d12d9139c885dfefa92e0bc1 100644 --- a/packages/kokkos/core/src/impl/Kokkos_DeviceManagement.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_DeviceManagement.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_DEVICE_MANAGEMENT_HPP #define KOKKOS_DEVICE_MANAGEMENT_HPP @@ -52,7 +24,7 @@ class InitializationSettings; namespace Impl { int get_gpu(const Kokkos::InitializationSettings& settings); // This declaration is provided for testing purposes only -int get_ctest_gpu(const char* local_rank_str); +int get_ctest_gpu(int local_rank); // ditto std::vector<int> get_visible_devices( Kokkos::InitializationSettings const& settings, int device_count); diff --git a/packages/kokkos/core/src/impl/Kokkos_EBO.hpp b/packages/kokkos/core/src/impl/Kokkos_EBO.hpp index 87d6c044a57756a9bb49d1b930f364c116c9dfb9..8ba94ba4ccc46bd2f8fd93cce0347cdf8ab4b067 100644 --- a/packages/kokkos/core/src/impl/Kokkos_EBO.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_EBO.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EBO_HPP #define KOKKOS_EBO_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Error.cpp b/packages/kokkos/core/src/impl/Kokkos_Error.cpp index 750228331578bab658f14106d80b9cb9e231409a..efd0fb998e1ac854a7eb483375cfd69aa57a915a 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Error.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_Error.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/impl/Kokkos_Error.hpp b/packages/kokkos/core/src/impl/Kokkos_Error.hpp index 63b40f297e08bc7b61214c14e6024e53b33e9832..e2054d4ce076e766c9b6acaee45b86afa9d8517e 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Error.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Error.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_ERROR_HPP #define KOKKOS_IMPL_ERROR_HPP @@ -58,10 +30,6 @@ #include <SYCL/Kokkos_SYCL_Abort.hpp> #endif -#ifndef KOKKOS_ABORT_MESSAGE_BUFFER_SIZE -#define KOKKOS_ABORT_MESSAGE_BUFFER_SIZE 2048 -#endif // ifndef KOKKOS_ABORT_MESSAGE_BUFFER_SIZE - namespace Kokkos { namespace Impl { @@ -69,8 +37,7 @@ namespace Impl { #if defined(KOKKOS_ENABLE_CUDA) && defined(__CUDA_ARCH__) -#if defined(__APPLE__) || defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK) -// cuda_abort does not abort when building for macOS. +#if defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK) // required to workaround failures in random number generator unit tests with // pre-volta architectures #define KOKKOS_IMPL_ABORT_NORETURN @@ -89,7 +56,7 @@ namespace Impl { #elif defined(KOKKOS_ENABLE_SYCL) && defined(__SYCL_DEVICE_ONLY__) // FIXME_SYCL SYCL doesn't abort #define KOKKOS_IMPL_ABORT_NORETURN -#elif !defined(KOKKOS_ENABLE_OPENMPTARGET) +#elif !defined(KOKKOS_ENABLE_OPENMPTARGET) && !defined(KOKKOS_ENABLE_OPENACC) // Host aborts #define KOKKOS_IMPL_ABORT_NORETURN [[noreturn]] #else @@ -97,14 +64,18 @@ namespace Impl { #define KOKKOS_IMPL_ABORT_NORETURN #endif -#ifdef KOKKOS_ENABLE_SYCL // FIXME_SYCL +// FIXME_SYCL +// Accomodate host pass for device functions that are not [[noreturn]] +#if defined(KOKKOS_ENABLE_SYCL) || \ + (defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK)) #define KOKKOS_IMPL_ABORT_NORETURN_DEVICE #else #define KOKKOS_IMPL_ABORT_NORETURN_DEVICE KOKKOS_IMPL_ABORT_NORETURN #endif -#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ - defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ + defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \ + defined(KOKKOS_ENABLE_OPENACC) KOKKOS_IMPL_ABORT_NORETURN_DEVICE inline KOKKOS_IMPL_DEVICE_FUNCTION void device_abort(const char *const msg) { #if defined(KOKKOS_ENABLE_CUDA) @@ -113,8 +84,8 @@ device_abort(const char *const msg) { ::Kokkos::Impl::hip_abort(msg); #elif defined(KOKKOS_ENABLE_SYCL) ::Kokkos::Impl::sycl_abort(msg); -#elif defined(KOKKOS_ENABLE_OPENMPTARGET) - printf("%s", msg); // FIXME_OPENMPTARGET +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) || defined(KOKKOS_ENABLE_OPENACC) + printf("%s", msg); // FIXME_OPENMPTARGET FIXME_OPENACC #else #error faulty logic #endif @@ -186,8 +157,7 @@ class RawMemoryAllocationFailure : public std::bad_alloc { ~RawMemoryAllocationFailure() noexcept override = default; - KOKKOS_ATTRIBUTE_NODISCARD - const char *what() const noexcept override { + [[nodiscard]] const char *what() const noexcept override { if (m_failure_mode == FailureMode::OutOfMemoryError) { return "Memory allocation error: out of memory"; } else if (m_failure_mode == FailureMode::AllocationNotAligned) { @@ -197,23 +167,24 @@ class RawMemoryAllocationFailure : public std::bad_alloc { return nullptr; // unreachable } - KOKKOS_ATTRIBUTE_NODISCARD - size_t attempted_size() const noexcept { return m_attempted_size; } + [[nodiscard]] size_t attempted_size() const noexcept { + return m_attempted_size; + } - KOKKOS_ATTRIBUTE_NODISCARD - size_t attempted_alignment() const noexcept { return m_attempted_alignment; } + [[nodiscard]] size_t attempted_alignment() const noexcept { + return m_attempted_alignment; + } - KOKKOS_ATTRIBUTE_NODISCARD - AllocationMechanism allocation_mechanism() const noexcept { + [[nodiscard]] AllocationMechanism allocation_mechanism() const noexcept { return m_mechanism; } - KOKKOS_ATTRIBUTE_NODISCARD - FailureMode failure_mode() const noexcept { return m_failure_mode; } + [[nodiscard]] FailureMode failure_mode() const noexcept { + return m_failure_mode; + } void print_error_message(std::ostream &o) const; - KOKKOS_ATTRIBUTE_NODISCARD - std::string get_error_message() const; + [[nodiscard]] std::string get_error_message() const; virtual void append_additional_error_information(std::ostream &) const {} }; diff --git a/packages/kokkos/core/src/impl/Kokkos_ExecPolicy.cpp b/packages/kokkos/core/src/impl/Kokkos_ExecPolicy.cpp index 75b89c73a9cb03b36e955fff45e46719caa7b4a1..04c5e0bd22a29abeea7b6b835e74d5d3c80992e0 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ExecPolicy.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_ExecPolicy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp b/packages/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp index 354bdde9bf7696e621226260f2dfd279dea566fd..f0edc8ac47d3716b8db70316289cee5f2a4415b7 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ExecSpaceManager.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXEC_SPACE_MANAGER_HPP #define KOKKOS_EXEC_SPACE_MANAGER_HPP @@ -52,55 +24,90 @@ #include <iosfwd> #include <map> #include <string> +#include <utility> namespace { template <class T> using public_member_types_t = std::enable_if_t< - Kokkos::is_execution_space<typename T::execution_space>::value && - Kokkos::is_memory_space<typename T::memory_space>::value && - Kokkos::is_device<typename T::device_type>::value && - Kokkos::is_array_layout<typename T::array_layout>::value && - std::is_integral<typename T::size_type>::value && - Kokkos::is_memory_space<typename T::scratch_memory_space>::value>; + Kokkos::is_execution_space_v<typename T::execution_space> && + Kokkos::is_memory_space_v<typename T::memory_space> && + Kokkos::is_device_v<typename T::device_type> && + Kokkos::is_array_layout_v<typename T::array_layout> && + std::is_integral_v<typename T::size_type> && + Kokkos::is_memory_space_v<typename T::scratch_memory_space>>; template <class T> using print_configuration_t = std::enable_if_t< - std::is_void<decltype(std::declval<T const&>().print_configuration( - std::declval<std::ostream&>()))>::value && - std::is_void<decltype(std::declval<T const&>().print_configuration( - std::declval<std::ostream&>(), false))>::value>; + std::is_void_v<decltype(std::declval<T const&>().print_configuration( + std::declval<std::ostream&>()))> && + std::is_void_v<decltype(std::declval<T const&>().print_configuration( + std::declval<std::ostream&>(), false))>>; template <class T> using initialize_finalize_t = std::enable_if_t< - std::is_void<decltype(T::impl_initialize( - std::declval<Kokkos::InitializationSettings const&>()))>::value && - std::is_void<decltype(T::impl_finalize())>::value>; + std::is_void_v<decltype(T::impl_initialize( + std::declval<Kokkos::InitializationSettings const&>()))> && + std::is_void_v<decltype(T::impl_finalize())>>; template <class T> using fence_t = std::enable_if_t< - std::is_void<decltype(std::declval<T const&>().fence())>::value && - std::is_void<decltype(std::declval<T const&>().fence("name"))>::value && - std::is_void<decltype(T::impl_static_fence("name"))>::value>; + std::is_void_v<decltype(std::declval<T const&>().fence())> && + std::is_void_v<decltype(std::declval<T const&>().fence("name"))> && + std::is_void_v<decltype(T::impl_static_fence("name"))>>; + +template <class T> +using concurrency_t = std::enable_if_t< + std::is_same_v<int, decltype(std::declval<T const&>().concurrency())>>; + +template <class T> +constexpr bool check_is_semiregular() { + static_assert(std::is_default_constructible_v<T>); + static_assert(std::is_copy_constructible_v<T>); + static_assert(std::is_move_constructible_v<T>); + static_assert(std::is_copy_assignable_v<T>); + static_assert(std::is_move_assignable_v<T>); + static_assert(std::is_destructible_v<T>); + return true; +} -#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, "") // FIXME C++17 +template <class T> +using equal_to_t = + decltype(std::declval<T const&>() == std::declval<T const&>()); + +template <class T> +using not_equal_to_t = + decltype(std::declval<T const&>() != std::declval<T const&>()); + +template <class T> +constexpr bool check_is_equality_comparable() { + using Kokkos::is_detected_exact_v; + static_assert(is_detected_exact_v<bool, equal_to_t, T>); + static_assert(is_detected_exact_v<bool, not_equal_to_t, T>); + return true; +} + +template <class T> +constexpr bool check_is_regular() { + static_assert(check_is_semiregular<T>() && check_is_equality_comparable<T>()); + return true; +} template <class ExecutionSpace> constexpr bool check_valid_execution_space() { - using Kokkos::is_detected; - STATIC_ASSERT(std::is_default_constructible<ExecutionSpace>::value); - STATIC_ASSERT(is_detected<public_member_types_t, ExecutionSpace>::value); - STATIC_ASSERT(is_detected<print_configuration_t, ExecutionSpace>::value); - STATIC_ASSERT(is_detected<initialize_finalize_t, ExecutionSpace>::value); - STATIC_ASSERT(is_detected<fence_t, ExecutionSpace>::value); + using Kokkos::is_detected_v; + static_assert(std::is_default_constructible_v<ExecutionSpace>); + static_assert(is_detected_v<public_member_types_t, ExecutionSpace>); + static_assert(is_detected_v<print_configuration_t, ExecutionSpace>); + static_assert(is_detected_v<initialize_finalize_t, ExecutionSpace>); + static_assert(is_detected_v<fence_t, ExecutionSpace>); + static_assert(is_detected_v<concurrency_t, ExecutionSpace>); #ifndef KOKKOS_ENABLE_HPX // FIXME_HPX - STATIC_ASSERT(sizeof(ExecutionSpace) <= 2 * sizeof(void*)); + static_assert(sizeof(ExecutionSpace) <= 2 * sizeof(void*)); #endif return true; } -#undef STATIC_ASSERT - } // namespace namespace Kokkos { @@ -116,7 +123,8 @@ struct ExecSpaceBase { template <class ExecutionSpace> struct ExecSpaceDerived : ExecSpaceBase { - static_assert(check_valid_execution_space<ExecutionSpace>(), ""); + static_assert(check_valid_execution_space<ExecutionSpace>()); + static_assert(check_is_regular<ExecutionSpace>()); void initialize(InitializationSettings const& settings) final { ExecutionSpace::impl_initialize(settings); } diff --git a/packages/kokkos/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp b/packages/kokkos/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp index 3068ef3db0389d48149d2d9ce28efac3112f1c27..4726a87b97cb2bc79ccbd267cf67927fab315cd4 100644 --- a/packages/kokkos/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_FixedBufferMemoryPool.hpp @@ -1,45 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_KOKKOS_FIXEDBUFFERMEMORYPOOL_HPP #define KOKKOS_IMPL_KOKKOS_FIXEDBUFFERMEMORYPOOL_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_FunctorAnalysis.hpp b/packages/kokkos/core/src/impl/Kokkos_FunctorAnalysis.hpp index 6569e49014fa2410a66e0025f0e0b6a2d4ffaad6..5ef017a004fb920e2033738fe65b8a72d5eeedcf 100644 --- a/packages/kokkos/core/src/impl/Kokkos_FunctorAnalysis.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_FunctorAnalysis.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_FUNCTORANALYSIS_HPP #define KOKKOS_FUNCTORANALYSIS_HPP @@ -655,6 +627,11 @@ struct FunctorAnalysis { detected_volatile_join_no_tag<F>::value)>> : public has_volatile_join_no_tag_function<F> { enum : bool { value = true }; +#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 + static_assert(Impl::dependent_false_v<F>, + "Reducer with a join() operator taking " + "volatile-qualified parameters is no longer supported"); +#endif }; template <class F = Functor, typename = void> @@ -673,6 +650,11 @@ struct FunctorAnalysis { detected_volatile_join_tag<F>::value)>> : public has_volatile_join_tag_function<F> { enum : bool { value = true }; +#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 + static_assert(Impl::dependent_false_v<F>, + "Reducer with a join() operator taking " + "volatile-qualified parameters is no longer supported"); +#endif }; //---------------------------------------- diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphImpl.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphImpl.hpp index 9bf9e29d0fdee715aad9eb7a8db4e22db99140a7..56f95c814d88480b3037e2bd77454562388a9872 100644 --- a/packages/kokkos/core/src/impl/Kokkos_GraphImpl.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_GraphImpl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_KOKKOS_GRAPHIMPL_HPP #define KOKKOS_IMPL_KOKKOS_GRAPHIMPL_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphImpl_Utilities.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphImpl_Utilities.hpp index 109d37a05db2c0b2b52e7361ed3e1e7ab5008c10..2ab05cb8e439f0124670c54001f27658e0a123de 100644 --- a/packages/kokkos/core/src/impl/Kokkos_GraphImpl_Utilities.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_GraphImpl_Utilities.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_GRAPHIMPL_UTILITIES_HPP #define KOKKOS_KOKKOS_GRAPHIMPL_UTILITIES_HPP @@ -85,10 +57,9 @@ struct is_compatible_type_erasure< std::enable_if_t<!std::is_same<TSrc, TDst>::value || !std::is_same<USrc, UDst>::value || !std::is_same<VSrc, VDst>::value>> - : std::integral_constant< - bool, is_compatible_type_erasure<TSrc, TDst>::value && - is_compatible_type_erasure<USrc, UDst>::value && - is_compatible_type_erasure<VSrc, VDst>::value> {}; + : std::bool_constant<is_compatible_type_erasure<TSrc, TDst>::value && + is_compatible_type_erasure<USrc, UDst>::value && + is_compatible_type_erasure<VSrc, VDst>::value> {}; // </editor-fold> end is_compatible_type_erasure }}}1 //============================================================================== diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphImpl_fwd.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphImpl_fwd.hpp index 37c53075d01df464ee790b3db8546385b2447398..1656b5bb77e0c4f2b7b374e44720f6719d38dcd8 100644 --- a/packages/kokkos/core/src/impl/Kokkos_GraphImpl_fwd.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_GraphImpl_fwd.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_KOKKOS_GRAPHIMPL_FWD_HPP #define KOKKOS_IMPL_KOKKOS_GRAPHIMPL_FWD_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphNodeCustomization.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphNodeCustomization.hpp index fc75f945a1ff0f7b10ee4aa12b4e25c40e6ef7a7..f4513679ad29210894d02dea29604c8b2da4fc19 100644 --- a/packages/kokkos/core/src/impl/Kokkos_GraphNodeCustomization.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_GraphNodeCustomization.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_KOKKOS_GRAPHNODECUSTOMIZATION_HPP #define KOKKOS_IMPL_KOKKOS_GRAPHNODECUSTOMIZATION_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_GraphNodeImpl.hpp b/packages/kokkos/core/src/impl/Kokkos_GraphNodeImpl.hpp index 2515995c0e3861fff03c8e1345a12dd25c1e0c52..fe8cb89c4fe43ed81aafb2a0930bc6f0b645e948 100644 --- a/packages/kokkos/core/src/impl/Kokkos_GraphNodeImpl.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_GraphNodeImpl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_GRAPHNODEIMPL_HPP #define KOKKOS_IMPL_GRAPHNODEIMPL_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_HBWSpace.cpp b/packages/kokkos/core/src/impl/Kokkos_HBWSpace.cpp index d533ec05cdcf5a5d9b808e9ae497d698c7d2c1b0..7402f1a74476c8184ccbb3873c25d7069ebbde2a 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HBWSpace.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_HBWSpace.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -219,13 +191,7 @@ void SharedAllocationRecord<Kokkos::Experimental::HBWSpace, void>::deallocate( } SharedAllocationRecord<Kokkos::Experimental::HBWSpace, - void>::~SharedAllocationRecord() -#if defined( \ - KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION) - noexcept -#endif -{ - + void>::~SharedAllocationRecord() { m_space.deallocate(m_label.c_str(), SharedAllocationRecord<void, void>::m_alloc_ptr, SharedAllocationRecord<void, void>::m_alloc_size, diff --git a/packages/kokkos/core/src/impl/Kokkos_HostBarrier.cpp b/packages/kokkos/core/src/impl/Kokkos_HostBarrier.cpp index 9ad2dae55181622aa38458e1409a296711476ffd..e2722d8bfeaf8dc4dd57253a39d7a042097738d2 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HostBarrier.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_HostBarrier.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/impl/Kokkos_HostBarrier.hpp b/packages/kokkos/core/src/impl/Kokkos_HostBarrier.hpp index 49142940be34e5f5ca8666f5240f63c326cc4b35..76500bc56339088691952fcdfe1876edc960fd33 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HostBarrier.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_HostBarrier.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_HOST_BARRIER_HPP #define KOKKOS_HOST_BARRIER_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_HostSharedPtr.hpp b/packages/kokkos/core/src/impl/Kokkos_HostSharedPtr.hpp index a2a792a88ee678e077e1d324fee005d6f23e1242..de99947e12b83650aec0654a3f5070ab20daac80 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HostSharedPtr.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_HostSharedPtr.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_HOST_SHARED_PTR_HPP #define KOKKOS_IMPL_HOST_SHARED_PTR_HPP @@ -68,10 +40,8 @@ class HostSharedPtr { template <class Deleter> HostSharedPtr(T* element_ptr, const Deleter& deleter) : m_element_ptr(element_ptr) { -#ifdef KOKKOS_ENABLE_CXX17 static_assert(std::is_invocable_v<Deleter, T*> && std::is_copy_constructible_v<Deleter>); -#endif if (element_ptr) { try { m_control = new Control{deleter, 1}; diff --git a/packages/kokkos/core/src/impl/Kokkos_HostSpace.cpp b/packages/kokkos/core/src/impl/Kokkos_HostSpace.cpp index 4bf90489193e5e0938a30d1fb96751fc7bc87dea..b47ce3beecd797dcfab7af1a075dd1fde08896ca 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HostSpace.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_HostSpace.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -260,12 +232,7 @@ SharedAllocationRecord<void, void> SharedAllocationRecord<Kokkos::HostSpace, void>::s_root_record; #endif -SharedAllocationRecord<Kokkos::HostSpace, void>::~SharedAllocationRecord() -#if defined( \ - KOKKOS_IMPL_INTEL_WORKAROUND_NOEXCEPT_SPECIFICATION_VIRTUAL_FUNCTION) - noexcept -#endif -{ +SharedAllocationRecord<Kokkos::HostSpace, void>::~SharedAllocationRecord() { m_space.deallocate(m_label.c_str(), SharedAllocationRecord<void, void>::m_alloc_ptr, SharedAllocationRecord<void, void>::m_alloc_size, diff --git a/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.cpp b/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.cpp index e6ef73295420abe6b83bd9b8209d5bd35714cd99..096dfd6b7f3f8a5f9550fd5793f20bc0658bddcd 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.hpp b/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.hpp index 88d37672d26433b5259fdae354068aa538550dac..2bb4c3e99b34fc4ef7fc6506fd42c61d1812b8c2 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_HostSpace_deepcopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_HOSTSPACE_DEEPCOPY_HPP #define KOKKOS_IMPL_HOSTSPACE_DEEPCOPY_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.cpp b/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.cpp index 1f1acca5df7a6dfb1c78c193c0eb4d41be93a7d2..bfe5902bf7ffd7665e1db721fa5ae1a9fe2d6b0e 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.hpp b/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.hpp index 7f39f188600297168242432e69c83b779dec20ef..1fec93237ac2c49b1d961d68fcbc45eca15db4a6 100644 --- a/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_HostThreadTeam.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_HOSTTHREADTEAM_HPP #define KOKKOS_IMPL_HOSTTHREADTEAM_HPP @@ -420,6 +392,7 @@ class HostThreadTeamMember { using execution_space = HostExecSpace; using thread_team_member = HostThreadTeamMember; using host_thread_team_member = HostThreadTeamMember; + using team_handle = HostThreadTeamMember; private: scratch_memory_space m_scratch; @@ -498,7 +471,7 @@ class HostThreadTeamMember { const int source_team_rank) const noexcept { KOKKOS_IF_ON_HOST((if (1 < m_data.m_team_size) { - T volatile* const shared_value = (T*)m_data.team_reduce(); + T* const shared_value = (T*)m_data.team_reduce(); // Don't overwrite shared memory until all threads arrive @@ -507,13 +480,15 @@ class HostThreadTeamMember { // only this thread returned from 'team_rendezvous' // with a return value of 'true' - *shared_value = value; + Kokkos::Impl::atomic_store(shared_value, value, + Kokkos::Impl::memory_order_release); m_data.team_rendezvous_release(); // This thread released all other threads from 'team_rendezvous' // with a return value of 'false' } else { - value = *shared_value; + value = Kokkos::Impl::atomic_load(shared_value, + Kokkos::Impl::memory_order_acquire); } })) @@ -528,7 +503,7 @@ class HostThreadTeamMember { const int source_team_rank) const noexcept { KOKKOS_IF_ON_HOST(( - T volatile* const shared_value = (T*)m_data.team_reduce(); + T* const shared_value = (T*)m_data.team_reduce(); // Don't overwrite shared memory until all threads arrive @@ -540,13 +515,17 @@ class HostThreadTeamMember { f(value); if (1 < m_data.m_team_size) { - *shared_value = value; + Kokkos::Impl::atomic_store(shared_value, value, + Kokkos::Impl::memory_order_release); } m_data.team_rendezvous_release(); // This thread released all other threads from 'team_rendezvous' // with a return value of 'false' - } else { value = *shared_value; })) + } else { + value = Kokkos::Impl::atomic_load(shared_value, + Kokkos::Impl::memory_order_acquire); + })) KOKKOS_IF_ON_DEVICE( ((void)f; (void)value; (void)source_team_rank; diff --git a/packages/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp b/packages/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp index ceb35f0247f03ef571404d43d71f9ab13d54930d..ab4350f3a7a49d7b0448b32df05cb7555044dd8b 100644 --- a/packages/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_InitializationSettings.hpp @@ -1,53 +1,25 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_INITIALIZATION_SETTINGS_HPP #define KOKKOS_INITIALIZATION_SETTINGS_HPP #include <Kokkos_Macros.hpp> -#include <climits> +#include <optional> #include <string> namespace Kokkos { @@ -78,63 +50,18 @@ struct InitArguments { }; #endif -namespace Impl { -// FIXME_CXX17 replace with std::optional -template <class> -struct InitializationSettingsHelper; -template <> -struct InitializationSettingsHelper<int> { - using value_type = int; - using storage_type = int; - - static constexpr storage_type unspecified = INT_MIN; -}; -template <> -struct InitializationSettingsHelper<bool> { - using value_type = bool; - using storage_type = char; - - static constexpr storage_type unspecified = CHAR_MAX; - static_assert(static_cast<storage_type>(true) != unspecified && - static_cast<storage_type>(false) != unspecified, - ""); -}; -template <> -struct InitializationSettingsHelper<std::string> { - using value_type = std::string; - using storage_type = std::string; - - static storage_type const unspecified; -}; -} // namespace Impl - class InitializationSettings { -#define KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME) \ - impl_do_not_use_i_really_mean_it_##NAME##_ - -#define KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER_TYPE(NAME) impl_##NAME##_type - -#define KOKKOS_IMPL_DECLARE(TYPE, NAME) \ - private: \ - using KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER_TYPE(NAME) = TYPE; \ - Impl::InitializationSettingsHelper<TYPE>::storage_type \ - KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME) = \ - Impl::InitializationSettingsHelper<TYPE>::unspecified; \ - \ - public: \ - InitializationSettings& set_##NAME( \ - Impl::InitializationSettingsHelper<TYPE>::value_type NAME) { \ - KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME) = NAME; \ - return *this; \ - } \ - bool has_##NAME() const noexcept { \ - return KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME) != \ - Impl::InitializationSettingsHelper< \ - KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER_TYPE(NAME)>::unspecified; \ - } \ - KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER_TYPE(NAME) get_##NAME() const noexcept { \ - return KOKKOS_IMPL_INIT_ARGS_DATA_MEMBER(NAME); \ - } \ +#define KOKKOS_IMPL_DECLARE(TYPE, NAME) \ + private: \ + std::optional<TYPE> m_##NAME; \ + \ + public: \ + InitializationSettings& set_##NAME(TYPE NAME) { \ + m_##NAME = NAME; \ + return *this; \ + } \ + bool has_##NAME() const noexcept { return static_cast<bool>(m_##NAME); } \ + TYPE get_##NAME() const noexcept { return *m_##NAME; } \ static_assert(true, "no-op to require trailing semicolon") public: diff --git a/packages/kokkos/core/src/impl/Kokkos_LIFO.hpp b/packages/kokkos/core/src/impl/Kokkos_LIFO.hpp index 286c56743af8f51cd5bca27b333db59ee8e6d911..da7b24352d9552e6e3adbcc03b15b3446de0f2ff 100644 --- a/packages/kokkos/core/src/impl/Kokkos_LIFO.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_LIFO.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp b/packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp index 1ed502db5be61a2501b57f08969ff47ce12bdbe5..99f3d1e4fc8964319bd9cd6164f2373b8e9f8e00 100644 --- a/packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_LinkedListNode.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_MemoryPool.cpp b/packages/kokkos/core/src/impl/Kokkos_MemoryPool.cpp index f82e88fad96bf04417b2481d616ca9096c5cc18a..ec004a36dad3efc34cc285c7cd5f0c1676ab851d 100644 --- a/packages/kokkos/core/src/impl/Kokkos_MemoryPool.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_MemoryPool.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -50,6 +22,7 @@ #include <ostream> #include <sstream> +#include <cstdint> //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- diff --git a/packages/kokkos/core/src/impl/Kokkos_MemoryPoolAllocator.hpp b/packages/kokkos/core/src/impl/Kokkos_MemoryPoolAllocator.hpp index 7dede48a14da83be482a2c87ebd09b97d0e99333..69cb9ccd049664d633181f6aaaf54c121950af5c 100644 --- a/packages/kokkos/core/src/impl/Kokkos_MemoryPoolAllocator.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_MemoryPoolAllocator.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_MemorySpace.cpp b/packages/kokkos/core/src/impl/Kokkos_MemorySpace.cpp index a80ea0a1dafafa8756bf7e223a366f1a634f39b3..2f0e01c5b28da1c4db310f7b4f6f095bd5626a91 100644 --- a/packages/kokkos/core/src/impl/Kokkos_MemorySpace.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_MemorySpace.cpp @@ -1,45 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /** @file Kokkos_MemorySpace.cpp * diff --git a/packages/kokkos/core/src/impl/Kokkos_MemorySpace.hpp b/packages/kokkos/core/src/impl/Kokkos_MemorySpace.hpp index dee11bbdb42b7e8ea34be6424592146d697926c4..44956dd7c5d904af38bf3d64d32e15a4f6e9946d 100644 --- a/packages/kokkos/core/src/impl/Kokkos_MemorySpace.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_MemorySpace.hpp @@ -1,45 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2019) Sandia Corporation +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /** @file Kokkos_MemorySpace.hpp * diff --git a/packages/kokkos/core/src/impl/Kokkos_Memory_Fence.hpp b/packages/kokkos/core/src/impl/Kokkos_Memory_Fence.hpp index 1df5d13b957c8e5d29e0ad1bedb88054bac604a4..392116a56e50b83f03dc23c4eda6625400b2b542 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Memory_Fence.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Memory_Fence.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact H. Carter Edwards (hcedwar@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> #if defined(KOKKOS_ATOMIC_HPP) && !defined(KOKKOS_MEMORY_FENCE_HPP) diff --git a/packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp b/packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp index 209ba1920039ff434a2cfd4390c322dd30647bf3..6895f4271f6a8614eddfc8f1b906cf11aea872be 100644 --- a/packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_MultipleTaskQueue.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_MULTIPLETASKQUEUE_HPP #define KOKKOS_IMPL_MULTIPLETASKQUEUE_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_NumericTraits.cpp b/packages/kokkos/core/src/impl/Kokkos_NumericTraits.cpp deleted file mode 100644 index 5ff094032faa37b906b835d1ff7b8bd2ec46de2a..0000000000000000000000000000000000000000 --- a/packages/kokkos/core/src/impl/Kokkos_NumericTraits.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE -#define KOKKOS_IMPL_PUBLIC_INCLUDE -#endif - -#include <Kokkos_NumericTraits.hpp> - -// NOTE These out-of class definitions are only required with C++14. Since -// C++17, a static data member declared constexpr is implicitly inline. - -#if !defined(KOKKOS_ENABLE_CXX17) -namespace Kokkos { -namespace Experimental { -namespace Impl { -#define OUT_OF_CLASS_DEFINITION_FLOATING_POINT(TRAIT) \ - constexpr float TRAIT##_helper<float>::value; \ - constexpr double TRAIT##_helper<double>::value; \ - constexpr long double TRAIT##_helper<long double>::value - -#define OUT_OF_CLASS_DEFINITION_INTEGRAL(TRAIT) \ - constexpr bool TRAIT##_helper<bool>::value; \ - constexpr char TRAIT##_helper<char>::value; \ - constexpr signed char TRAIT##_helper<signed char>::value; \ - constexpr unsigned char TRAIT##_helper<unsigned char>::value; \ - constexpr short TRAIT##_helper<short>::value; \ - constexpr unsigned short TRAIT##_helper<unsigned short>::value; \ - constexpr int TRAIT##_helper<int>::value; \ - constexpr unsigned int TRAIT##_helper<unsigned int>::value; \ - constexpr long int TRAIT##_helper<long int>::value; \ - constexpr unsigned long int TRAIT##_helper<unsigned long int>::value; \ - constexpr long long int TRAIT##_helper<long long int>::value; \ - constexpr unsigned long long int TRAIT##_helper<unsigned long long int>::value - -#define OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(TRAIT) \ - constexpr int TRAIT##_helper<float>::value; \ - constexpr int TRAIT##_helper<double>::value; \ - constexpr int TRAIT##_helper<long double>::value - -#define OUT_OF_CLASS_DEFINITION_INTEGRAL_2(TRAIT) \ - constexpr int TRAIT##_helper<bool>::value; \ - constexpr int TRAIT##_helper<char>::value; \ - constexpr int TRAIT##_helper<signed char>::value; \ - constexpr int TRAIT##_helper<unsigned char>::value; \ - constexpr int TRAIT##_helper<short>::value; \ - constexpr int TRAIT##_helper<unsigned short>::value; \ - constexpr int TRAIT##_helper<int>::value; \ - constexpr int TRAIT##_helper<unsigned int>::value; \ - constexpr int TRAIT##_helper<long int>::value; \ - constexpr int TRAIT##_helper<unsigned long int>::value; \ - constexpr int TRAIT##_helper<long long int>::value; \ - constexpr int TRAIT##_helper<unsigned long long int>::value - -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(infinity); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(epsilon); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(round_error); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(norm_min); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(denorm_min); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(reciprocal_overflow_threshold); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(quiet_NaN); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(signaling_NaN); - -OUT_OF_CLASS_DEFINITION_INTEGRAL(finite_min); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(finite_min); -OUT_OF_CLASS_DEFINITION_INTEGRAL(finite_max); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT(finite_max); - -OUT_OF_CLASS_DEFINITION_INTEGRAL_2(digits); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(digits); -OUT_OF_CLASS_DEFINITION_INTEGRAL_2(digits10); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(digits10); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(max_digits10); -OUT_OF_CLASS_DEFINITION_INTEGRAL_2(radix); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(radix); - -OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(min_exponent); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(min_exponent10); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(max_exponent); -OUT_OF_CLASS_DEFINITION_FLOATING_POINT_2(max_exponent10); -} // namespace Impl -} // namespace Experimental -} // namespace Kokkos -#endif diff --git a/packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp b/packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp index 1a3cbaba2859fdbd6b946a1e85422b5de7489ff3..4fc661344ba3568b9fbd5a1820b99c021578f46c 100644 --- a/packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_OptionalRef.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp b/packages/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp index 4fdb85b6a0ecc6dff59268637ebf8be7352a5500..a83d43a9bdc9f28e7fe00179f6fe4ef0408c65c4 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ParseCommandLineArgumentsAndEnvironmentVariables.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_PARSE_COMMAND_LINE_ARGUMENTS_AND_ENVIRONMENT_VARIABLES_HPP #define KOKKOS_PARSE_COMMAND_LINE_ARGUMENTS_AND_ENVIRONMENT_VARIABLES_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling.cpp b/packages/kokkos/core/src/impl/Kokkos_Profiling.cpp index 480b1a392bf019b4c37c452a09801fe8ef8f3458..e3cfcb6a29e4cff19f398845e41774cbb1fe66f4 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Profiling.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_Profiling.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -655,9 +627,9 @@ void initialize(const std::string& profileLibrary) { char* envProfileLibrary = const_cast<char*>(profileLibrary.c_str()); - const auto envProfileCopy = - std::make_unique<char[]>(strlen(envProfileLibrary) + 1); - sprintf(envProfileCopy.get(), "%s", envProfileLibrary); + const size_t envProfileLen = strlen(envProfileLibrary) + 1; + const auto envProfileCopy = std::make_unique<char[]>(envProfileLen); + snprintf(envProfileCopy.get(), envProfileLen, "%s", envProfileLibrary); char* profileLibraryName = strtok(envProfileCopy.get(), ";"); diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling.hpp b/packages/kokkos/core/src/impl/Kokkos_Profiling.hpp index cb17a0cd836167297621a751dc83991f7f4dc4fb..025d8d3d18e69c27dec7dd2e569bfcf530e48dc8 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Profiling.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Profiling.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_KOKKOS_PROFILING_HPP #define KOKKOS_IMPL_KOKKOS_PROFILING_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling_C_Interface.h b/packages/kokkos/core/src/impl/Kokkos_Profiling_C_Interface.h index a069fb831b096035701ac40bce494de976e0ee76..731a11e917ad758759938531e52fddf7efd30533 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Profiling_C_Interface.h +++ b/packages/kokkos/core/src/impl/Kokkos_Profiling_C_Interface.h @@ -2,43 +2,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER */ diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp b/packages/kokkos/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp index be6f756d0c2fc71976d48df2a76570b58ea8ee1b..1db44815c21910f43ff4dcfab8b3f57edfddc5b9 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Profiling_DeviceInfo.hpp @@ -1,46 +1,18 @@ -/* - //@HEADER - // ************************************************************************ - // - // Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). - // - // Under the terms of Contract DE-NA0003525 with NTESS, - // the U.S. Government retains certain rights in this software. - // - // Redistribution and use in source and binary forms, with or without - // modification, are permitted provided that the following conditions are - // met: - // - // 1. Redistributions of source code must retain the above copyright - // notice, this list of conditions and the following disclaimer. - // - // 2. Redistributions in binary form must reproduce the above copyright - // notice, this list of conditions and the following disclaimer in the - // documentation and/or other materials provided with the distribution. - // - // 3. Neither the name of the Corporation nor the names of the - // contributors may be used to endorse or promote products derived from - // this software without specific prior written permission. - // - // THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY - // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE - // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // - // Questions? Contact Christian R. Trott (crtrott@sandia.gov) - // - // ************************************************************************ - //@HEADER -*/ +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER #ifndef KOKKOSP_DEVICE_INFO_HPP #define KOKKOSP_DEVICE_INFO_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp b/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp index 428a3cb17b7a941e843f4f90c01124a657282dd0..af71932e47beb57e8e4ed312e262ae8b8dc03597 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Profiling_Interface.hpp @@ -1,46 +1,18 @@ -/* - //@HEADER - // ************************************************************************ - // - // Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). - // - // Under the terms of Contract DE-NA0003525 with NTESS, - // the U.S. Government retains certain rights in this software. - // - // Redistribution and use in source and binary forms, with or without - // modification, are permitted provided that the following conditions are - // met: - // - // 1. Redistributions of source code must retain the above copyright - // notice, this list of conditions and the following disclaimer. - // - // 2. Redistributions in binary form must reproduce the above copyright - // notice, this list of conditions and the following disclaimer in the - // documentation and/or other materials provided with the distribution. - // - // 3. Neither the name of the Corporation nor the names of the - // contributors may be used to endorse or promote products derived from - // this software without specific prior written permission. - // - // THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY - // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE - // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // - // Questions? Contact Christian R. Trott (crtrott@sandia.gov) - // - // ************************************************************************ - //@HEADER - */ +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER #ifndef KOKKOSP_INTERFACE_HPP #define KOKKOSP_INTERFACE_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_QuadPrecisionMath.hpp b/packages/kokkos/core/src/impl/Kokkos_QuadPrecisionMath.hpp index c7936e950d7ebaec8c9987a65577b85f5952abf0..02e2936ddde269e8d626bc55c8bf6206ff9a0d01 100644 --- a/packages/kokkos/core/src/impl/Kokkos_QuadPrecisionMath.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_QuadPrecisionMath.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_QUAD_PRECISION_MATH_HPP #define KOKKOS_QUAD_PRECISION_MATH_HPP @@ -50,6 +22,7 @@ #if defined(KOKKOS_ENABLE_LIBQUADMATH) #include <Kokkos_NumericTraits.hpp> +#include <Kokkos_ReductionIdentity.hpp> #include <Kokkos_MathematicalConstants.hpp> #include <Kokkos_MathematicalFunctions.hpp> @@ -62,7 +35,6 @@ //<editor-fold desc="numeric traits __float128 specializations"> namespace Kokkos { namespace Experimental { -#if defined(KOKKOS_ENABLE_CXX17) #define KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(TRAIT, TYPE, VALUE_TYPE, VALUE) \ template <> \ struct TRAIT<TYPE> { \ @@ -70,32 +42,18 @@ namespace Experimental { }; \ template <> \ inline constexpr auto TRAIT##_v<TYPE> = TRAIT<TYPE>::value; -#else -#define KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(TRAIT, TYPE, VALUE_TYPE, VALUE) \ - template <> \ - struct TRAIT<TYPE> { \ - static constexpr VALUE_TYPE value = VALUE; \ - }; -#endif // clang-format off // Numeric distinguished value traits -// Workaround GCC bug https://godbolt.org/z/qWb5oe4dx -// error: '__builtin_huge_valq()' is not a constant expression -#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 710) KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(infinity, __float128, __float128, HUGE_VALQ) -#endif KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(finite_min, __float128, __float128, -FLT128_MAX) KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(finite_max, __float128, __float128, FLT128_MAX) KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(epsilon, __float128, __float128, FLT128_EPSILON) KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(round_error, __float128, __float128, static_cast<__float128>(0.5)) KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(norm_min, __float128, __float128, FLT128_MIN) KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(denorm_min, __float128, __float128, FLT128_DENORM_MIN) -KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(reciprocal_overflow_threshold, __float128, __float128, FLT128_MIN) -#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 710) KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(quiet_NaN, __float128, __float128, __builtin_nanq("")) KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(signaling_NaN, __float128, __float128, __builtin_nansq("")) -#endif // Numeric characteristics traits KOKKOS_IMPL_SPECIALIZE_NUMERIC_TRAIT(digits, __float128, int, FLT128_MANT_DIG) @@ -143,7 +101,7 @@ inline __float128 fabs(__float128 x) { return ::fabsq(x); } inline __float128 fmod(__float128 x, __float128 y) { return ::fmodq(x, y); } inline __float128 remainder(__float128 x, __float128 y) { return ::remainderq(x, y); } // remquo -// fma +inline __float128 fma(__float128 x, __float128 y, __float128 z) { return ::fmaq(x, y, z); } inline __float128 fmax(__float128 x, __float128 y) { return ::fmaxq(x, y); } inline __float128 fmin(__float128 x, __float128 y) { return ::fminq(x, y); } inline __float128 fdim(__float128 x, __float128 y) { return ::fdimq(x, y); } @@ -201,9 +159,7 @@ inline __float128 nearbyint(__float128 x) { return ::nearbyintq(x); } // scalbn // scalbln // ilog -#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 610) inline __float128 logb(__float128 x) { return ::logbq(x); } -#endif inline __float128 nextafter(__float128 x, __float128 y) { return ::nextafterq(x, y); } // nexttoward inline __float128 copysign(__float128 x, __float128 y) { return ::copysignq(x, y); } @@ -225,8 +181,7 @@ inline bool signbit(__float128 x) { return ::signbitq(x); } //</editor-fold> //<editor-fold desc="Mathematical constants __float128 specializations"> -namespace Kokkos { -namespace Experimental { +namespace Kokkos::numbers { // clang-format off template <> constexpr __float128 e_v <__float128> = 2.718281828459045235360287471352662498Q; template <> constexpr __float128 log2e_v <__float128> = 1.442695040888963407359924681001892137Q; @@ -242,8 +197,7 @@ template <> constexpr __float128 inv_sqrt3_v <__float128> = 0.577350269189625764 template <> constexpr __float128 egamma_v <__float128> = 0.577215664901532860606512090082402431Q; template <> constexpr __float128 phi_v <__float128> = 1.618033988749894848204586834365638118Q; // clang-format on -} // namespace Experimental -} // namespace Kokkos +} // namespace Kokkos::numbers //</editor-fold> #endif diff --git a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp index aff6332cc083ac9feff0e62185ddb21f84430474..ccc5b60f5fb32c230759b5ce23ae98eacaa55cce 100644 --- a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE @@ -51,8 +23,6 @@ namespace Kokkos { namespace Impl { -thread_local int SharedAllocationRecord<void, void>::t_tracking_enabled = 1; - #ifdef KOKKOS_ENABLE_DEBUG bool SharedAllocationRecord<void, void>::is_sane( SharedAllocationRecord<void, void>* arg_record) { @@ -311,12 +281,14 @@ SharedAllocationRecord<void, void>* SharedAllocationRecord< void SharedAllocationRecord<void, void>::print_host_accessible_records( std::ostream& s, const char* const space_name, const SharedAllocationRecord* const root, const bool detail) { - const SharedAllocationRecord<void, void>* r = root; + // Print every node except the root, which does not represent an actual + // allocation. + const SharedAllocationRecord<void, void>* r = root->m_next; char buffer[256]; if (detail) { - do { + while (r != root) { // Formatting dependent on sizeof(uintptr_t) const char* format_string; @@ -339,28 +311,24 @@ void SharedAllocationRecord<void, void>::print_host_accessible_records( r->m_alloc_ptr->m_label); s << buffer; r = r->m_next; - } while (r != root); + } } else { - do { - if (r->m_alloc_ptr) { - // Formatting dependent on sizeof(uintptr_t) - const char* format_string; - - if (sizeof(uintptr_t) == sizeof(unsigned long)) { - format_string = "%s [ 0x%.12lx + %ld ] %s\n"; - } else if (sizeof(uintptr_t) == sizeof(unsigned long long)) { - format_string = "%s [ 0x%.12llx + %ld ] %s\n"; - } + while (r != root) { + // Formatting dependent on sizeof(uintptr_t) + const char* format_string; - snprintf(buffer, 256, format_string, space_name, - reinterpret_cast<uintptr_t>(r->data()), r->size(), - r->m_alloc_ptr->m_label); - } else { - snprintf(buffer, 256, "%s [ 0 + 0 ]\n", space_name); + if (sizeof(uintptr_t) == sizeof(unsigned long)) { + format_string = "%s [ 0x%.12lx + %ld ] %s\n"; + } else if (sizeof(uintptr_t) == sizeof(unsigned long long)) { + format_string = "%s [ 0x%.12llx + %ld ] %s\n"; } + + snprintf(buffer, 256, format_string, space_name, + reinterpret_cast<uintptr_t>(r->data()), r->size(), + r->m_alloc_ptr->m_label); s << buffer; r = r->m_next; - } while (r != root); + } } } #else diff --git a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.hpp b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.hpp index 02dcd1ec652efcd9b95e9e4902cd626ed16bb600..6bb87ca84b2f5089f1d7568fb09ebf3dcc2482c2 100644 --- a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SHARED_ALLOC_HPP #define KOKKOS_SHARED_ALLOC_HPP @@ -65,7 +37,7 @@ class SharedAllocationHeader { private: using Record = SharedAllocationRecord<void, void>; -#ifdef KOKKOS_ARCH_VEGA +#if defined(KOKKOS_ARCH_VEGA) || defined(KOKKOS_ARCH_NAVI) static constexpr unsigned maximum_label_length = (1u << 8 /* 256 */) - sizeof(Record*); #else @@ -98,7 +70,7 @@ class SharedAllocationHeader { template <> class SharedAllocationRecord<void, void> { protected: -#ifdef KOKKOS_ARCH_VEGA +#if defined(KOKKOS_ARCH_VEGA) || defined(KOKKOS_ARCH_NAVI) static_assert(sizeof(SharedAllocationHeader) == (1u << 8 /* 256 */), "sizeof(SharedAllocationHeader) != 256"); #else @@ -141,7 +113,7 @@ class SharedAllocationRecord<void, void> { SharedAllocationHeader* arg_alloc_ptr, size_t arg_alloc_size, function_type arg_dealloc, const std::string& label); private: - static thread_local int t_tracking_enabled; + static inline thread_local int t_tracking_enabled = 1; public: virtual std::string get_label() const { return std::string("Unmanaged"); } diff --git a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc_timpl.hpp b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc_timpl.hpp index 276217c7d4f78cae7ac925e51d074cf3d60c195f..9aa96e27d150140c25a17a5e18e32e98303f095c 100644 --- a/packages/kokkos/core/src/impl/Kokkos_SharedAlloc_timpl.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_SharedAlloc_timpl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (12/8/20) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_SHAREDALLOC_TIMPL_HPP #define KOKKOS_IMPL_SHAREDALLOC_TIMPL_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp b/packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp index 06bfe276c73bc888fe2ae2ace36a93d3936f9101..268aaa5bd6eb7bc8ee82cbde1c6e90990d60f0a3 100644 --- a/packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_SimpleTaskScheduler.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SIMPLETASKSCHEDULER_HPP #define KOKKOS_SIMPLETASKSCHEDULER_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp b/packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp index aa84fbbf6e2e3ea3b090a9b52afb90f51a042d1b..12ce75ea68dba09df192dd4aae1b71f4f69a80a4 100644 --- a/packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_SingleTaskQueue.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_SINGLETASKQUEUE_HPP #define KOKKOS_IMPL_SINGLETASKQUEUE_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Spinwait.cpp b/packages/kokkos/core/src/impl/Kokkos_Spinwait.cpp index d0954291fa9a119bf755625aa96dd749fb0e8875..0a7eda29bcf1b8862e8b97166865d995662ee893 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Spinwait.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_Spinwait.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/impl/Kokkos_Spinwait.hpp b/packages/kokkos/core/src/impl/Kokkos_Spinwait.hpp index 085157521d38cf7ea3266364097f2b89861f22b5..c57b17d646a2493cf11e94f8a396abe3ea54c256 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Spinwait.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Spinwait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SPINWAIT_HPP #define KOKKOS_SPINWAIT_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Stacktrace.cpp b/packages/kokkos/core/src/impl/Kokkos_Stacktrace.cpp index e1f59c1d8666e951bcc4378b3effef541fb861dc..3b8dc4efc356d8beb8928b3d01a4577b6fdf9b86 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Stacktrace.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_Stacktrace.cpp @@ -1,3 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/impl/Kokkos_Stacktrace.hpp b/packages/kokkos/core/src/impl/Kokkos_Stacktrace.hpp index b5cf4ee1b647f1cdf86bccfe3e73b68ec7127d7b..9dc0179a05cb3ed50547382a33913ced83d1a868 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Stacktrace.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Stacktrace.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #ifndef KOKKOS_STACKTRACE_HPP #define KOKKOS_STACKTRACE_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_StringManipulation.hpp b/packages/kokkos/core/src/impl/Kokkos_StringManipulation.hpp index 644dcf7faaa3a6b1ba41349ad01ca512b26a0ac2..c7baf6d0c3df9016c90963e7c4355b908078ee5a 100644 --- a/packages/kokkos/core/src/impl/Kokkos_StringManipulation.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_StringManipulation.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_STRING_MANIPULATION_HPP #define KOKKOS_STRING_MANIPULATION_HPP @@ -195,11 +167,7 @@ KOKKOS_FUNCTION constexpr to_chars_result to_chars_i(char *first, char *last, if (value == 0) { *first = '0'; return {first + 1, {}}; - } else if -#ifdef KOKKOS_ENABLE_CXX17 - constexpr -#endif - (std::is_signed<Integral>::value) { + } else if constexpr (std::is_signed<Integral>::value) { if (value < 0) { *first++ = '-'; unsigned_val = Unsigned(~value) + Unsigned(1); diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp index bb89ab914471d61dde22a2009a57d41094428308..ac99d071594958a16689f9ebb435a8adeb164559 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskBase.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp index 5e2ebb058aeaaaf79ae9e0916549d41e394fa97e..789ba1469697a50dd85707119c0daeb346ca0593 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskNode.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp index 09113628a76f8c9282ae8d30e0f29e7c407ed962..9e6a55b3f6726c913f26040bd4bf746bf7ced1b2 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskPolicyData.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_TASKPOLICYDATA_HPP #define KOKKOS_IMPL_TASKPOLICYDATA_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp index 4f565f019ca16d40124a14fd5bf955dfbfe6321a..5f182dc33f2580ff9806ca612d071b8e07343fca 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueue.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp index 82af5625e87ecb77ca5070f2fce5b78c37ce0168..18dc3c757bf827766a06278caac8848b069ee614 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueueCommon.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_TASKQUEUECOMMON_HPP #define KOKKOS_IMPL_TASKQUEUECOMMON_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp index c8039fa77dd1f7b94c7ee8073533a4bc8a390eab..aef919e8346e2456b61315a9f3f0736cd2b681d1 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMemoryManager.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_TASKQUEUEMEMORYMANAGER_HPP #define KOKKOS_IMPL_TASKQUEUEMEMORYMANAGER_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp index 31c737650abffa0ed4275e71a2d847ecdf9567a6..e653f70fe91bfed21e92798f67319f040388c5c3 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp index 1af97918b8a057444b9653202838a7dff06bb143..114483ca0a5b4d74367ac66211d8a3445f97b783 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueueMultiple_impl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_TASKQUEUEMULTIPLE_IMPL_HPP #define KOKKOS_IMPL_TASKQUEUEMULTIPLE_IMPL_HPP @@ -58,13 +30,7 @@ namespace Impl { template <class ExecSpace, class MemorySpace> void TaskQueueMultiple<ExecSpace, MemorySpace>::Destroy::destroy_shared_allocation() { -// KOKKOS WORKAROUND for CUDA 10.1 with GCC 7.3.0 -#if (KOKKOS_COMPILER_CUDA_VERSION == 101) && defined(KOKKOS_COMPILER_NVCC) && \ - (KOKKOS_COMPILER_GNU >= 730) - (*m_queue).get_team_queue(0).~TaskQueueMultiple(); -#else m_queue->get_team_queue(0).~TaskQueueMultiple(); -#endif } } /* namespace Impl */ diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp index 324227cf5e615f184492de9471fa0f78700ae11a..68ff36579fd7226cce83f9b4c04fa2d881cfa684 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskQueue_impl.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_TASKQUEUE_IMPL_HPP #define KOKKOS_IMPL_TASKQUEUE_IMPL_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp index 7c893547d280afb1966c91825dff398ee233a65a..6161b945b495f53700913945b165ccbb79ea8216 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskResult.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // Experimental unified task-data parallel manycore LDRD diff --git a/packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp b/packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp index 1d6c766a75ef4b5345ba6d267f52bb7a814b0d25..7dc34cc065a1a5ce7a41b43da7273c7b36a12827 100644 --- a/packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_TaskTeamMember.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TASKTEAMMEMBER_HPP #define KOKKOS_TASKTEAMMEMBER_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_TeamMDPolicy.hpp b/packages/kokkos/core/src/impl/Kokkos_TeamMDPolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5395c9cf4318d8ec7457526c9d70681541654a19 --- /dev/null +++ b/packages/kokkos/core/src/impl/Kokkos_TeamMDPolicy.hpp @@ -0,0 +1,278 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE +#include <Kokkos_Macros.hpp> +static_assert(false, + "Including non-public Kokkos header files is not allowed."); +#endif + +#ifndef KOKKOS_IMPL_TEAMMDPOLICY_HPP +#define KOKKOS_IMPL_TEAMMDPOLICY_HPP + +namespace Kokkos { + +namespace Impl { + +// Tag class to choose the nested loop specialization +// - LastNestLevel means call the actual closure +// - ParThread means use TeamThreadRange +// - ParVector means use ThreadVectorRange +template <TeamMDRangeLastNestLevel LastNestLevel, + TeamMDRangeParThread ParThread, TeamMDRangeParVector ParVector> +struct TeamMDRangeMode { + static constexpr TeamMDRangeLastNestLevel last_nest_level = LastNestLevel; + static constexpr TeamMDRangeParThread par_thread = ParThread; + static constexpr TeamMDRangeParVector par_vector = ParVector; +}; + +// Tag class to keep track of the loop nest level and where to deploy thread and +// vector parallelism +// - Rank is Kokkos::Rank<TotalNestLevel, Iter> +// - total_nest_level is the total number of loop nests +// - iter is whether to go forward or backward through ranks (i.e. the +// iteration order for MDRangePolicy) +// - ParThreadNestLevel is the nesting level on which to deploy thread +// parallelism +// - ParVectorNestLevel is the nesting level on which to deploy vector +// parallelism +// - CurrentNestLevel is the nest level of interest +template <typename Rank, int ParThreadNestLevel, int ParVectorNestLevel, + int CurrentNestLevel> +struct TeamMDRangeNestingTracker { + using NestLevelType = int; + static constexpr Iterate iter = Rank::outer_direction; + static constexpr NestLevelType total_nest_level = Rank::rank; + static constexpr NestLevelType par_thread_nest_level = ParThreadNestLevel; + static constexpr NestLevelType par_vector_nest_level = ParVectorNestLevel; + static constexpr NestLevelType current_nest_level = CurrentNestLevel; + + // We have to recursively process ranks [0..total_nest_level-1] + using RangeMode = + TeamMDRangeMode<(iter == Iterate::Right) + ? static_cast<TeamMDRangeLastNestLevel>( + current_nest_level == total_nest_level) + : static_cast<TeamMDRangeLastNestLevel>( + current_nest_level == -1), + static_cast<TeamMDRangeParThread>(current_nest_level == + par_thread_nest_level), + static_cast<TeamMDRangeParVector>(current_nest_level == + par_vector_nest_level)>; +}; + +// Structs to determine on which nested level parallelization happens. +// - Rank is Kokkos::Rank<TotalNestLevel, Iter> +// - TotalNestLevel is the total number of loop nests +// - Iter is whether to go forward or backward through ranks (i.e. the +// iteration order for MDRangePolicy) +// - ThreadAndVector determines whether both vector and thread parallelism is +// in use +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct HostBasedNestLevel { + static constexpr bool is_direction_left = + (Rank::outer_direction == Iterate::Left); + static constexpr int par_rt = is_direction_left ? Rank::rank - 1 : 0; + static constexpr int par_rv = is_direction_left ? 0 : Rank::rank - 1; + static constexpr int invalid = -2; +}; + +template <typename Rank, TeamMDRangeThreadAndVector ThreadAndVector> +struct AcceleratorBasedNestLevel { + static constexpr bool is_direction_left = + (Rank::outer_direction == Iterate::Left); + + // If vector parallelism is in use, deploy thread parallelism on + // the second to the last nested level; otherwise, thread parallelism on the + // last nested level + static constexpr int left_par_rt = + (ThreadAndVector == TeamMDRangeThreadAndVector::Both) ? 1 : 0; + + static constexpr int right_par_rt = + (ThreadAndVector == TeamMDRangeThreadAndVector::Both) ? Rank::rank - 2 + : Rank::rank - 1; + + static constexpr int par_rt = is_direction_left ? left_par_rt : right_par_rt; + + // Vector parallelism will always be on the last index + static constexpr int par_rv = is_direction_left ? 0 : Rank::rank - 1; + static constexpr int invalid = -2; +}; + +template <typename TeamHandle> +KOKKOS_INLINE_FUNCTION auto nested_policy( + TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel, + TeamMDRangeParThread::ParThread, + TeamMDRangeParVector::NotParVector>, + TeamHandle const team, int count) { + return TeamThreadRange(team, count); +} + +template <typename TeamHandle> +KOKKOS_INLINE_FUNCTION auto nested_policy( + TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel, + TeamMDRangeParThread::NotParThread, + TeamMDRangeParVector::ParVector>, + TeamHandle const team, int count) { + return ThreadVectorRange(team, count); +} + +template <typename TeamHandle> +KOKKOS_INLINE_FUNCTION auto nested_policy( + TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel, + TeamMDRangeParThread::ParThread, + TeamMDRangeParVector::ParVector>, + TeamHandle const team, int count) { + return TeamVectorRange(team, count); +} + +// TeamMDRangeNestingTracker is only needed to deduce template parameters +template <typename Rank, int ParThreadNestLevel, int ParVectorNestLevel, + int CurrentNestLevel, typename Policy, typename Lambda, + typename... Args> +KOKKOS_INLINE_FUNCTION void nested_loop( + TeamMDRangeMode<TeamMDRangeLastNestLevel::LastNestLevel, + TeamMDRangeParThread::NotParThread, + TeamMDRangeParVector::NotParVector> const, + TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel, + CurrentNestLevel>, + Policy const&, Lambda const& lambda, Impl::NoReductionTag&&, Args... args) { + lambda(args...); +} + +template <typename Rank, int ParThreadNestLevel, int ParVectorNestLevel, + int CurrentNestLevel, typename Policy, typename Lambda, + typename ReducerValueType, typename... Args> +KOKKOS_INLINE_FUNCTION void nested_loop( + TeamMDRangeMode<TeamMDRangeLastNestLevel::LastNestLevel, + TeamMDRangeParThread::NotParThread, + TeamMDRangeParVector::NotParVector> const, + TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel, + CurrentNestLevel>, + Policy const&, Lambda const& lambda, ReducerValueType& val, Args... args) { + lambda(args..., val); +} + +// Nested loop for serial iteration +template <typename Rank, int ParThreadNestLevel, int ParVectorNestLevel, + int CurrentNestLevel, typename Policy, typename Lambda, + typename ReducerValueType, typename... Args> +KOKKOS_INLINE_FUNCTION void nested_loop( + TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel, + TeamMDRangeParThread::NotParThread, + TeamMDRangeParVector::NotParVector> const, + TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel, + CurrentNestLevel>, + Policy const& policy, Lambda const& lambda, ReducerValueType&& val, + Args... args) { + constexpr int next_nest_level = + CurrentNestLevel + (Rank::outer_direction == Iterate::Right ? 1 : -1); + using NextNestingTracker = + TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel, + next_nest_level>; + using TeamMDNextMode = typename NextNestingTracker::RangeMode; + + for (int i = 0; i != policy.boundaries[CurrentNestLevel]; ++i) { + if constexpr (Rank::outer_direction == Iterate::Right) { + nested_loop(TeamMDNextMode(), NextNestingTracker(), policy, lambda, + std::forward<ReducerValueType>(val), args..., i); + } else { + nested_loop(TeamMDNextMode(), NextNestingTracker(), policy, lambda, + std::forward<ReducerValueType>(val), i, args...); + } + } +} + +template <TeamMDRangeParThread ParThread, TeamMDRangeParVector ParVector, + typename Rank, int ParThreadNestLevel, int ParVectorNestLevel, + int CurrentNestLevel, typename Policy, typename Lambda, + typename ReducerValueType, typename... Args> +KOKKOS_INLINE_FUNCTION void nested_loop( + TeamMDRangeMode<TeamMDRangeLastNestLevel::NotLastNestLevel, ParThread, + ParVector> const mode, + TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel, + CurrentNestLevel>, + Policy const& policy, Lambda const& lambda, ReducerValueType&& val, + Args... args) { + constexpr int next_nest_level = + CurrentNestLevel + (Rank::outer_direction == Iterate::Right ? 1 : -1); + using NextNestingTracker = + TeamMDRangeNestingTracker<Rank, ParThreadNestLevel, ParVectorNestLevel, + next_nest_level>; + using TeamMDNextMode = typename NextNestingTracker::RangeMode; + + // This recursively processes ranks from [0..TotalNestLevel-1] + // args... is passed by value because it should always be ints + parallel_for( + nested_policy(mode, policy.team, policy.boundaries[CurrentNestLevel]), + [&](int const& i) { + if constexpr (Rank::outer_direction == Iterate::Right) { + nested_loop(TeamMDNextMode(), NextNestingTracker(), policy, lambda, + std::forward<ReducerValueType>(val), args..., i); + } else { + nested_loop(TeamMDNextMode(), NextNestingTracker(), policy, lambda, + std::forward<ReducerValueType>(val), i, args...); + } + }); +} + +template <typename Rank, typename TeamMDPolicy, typename Lambda, + typename ReductionValueType> +KOKKOS_INLINE_FUNCTION void md_parallel_impl(TeamMDPolicy const& policy, + Lambda const& lambda, + ReductionValueType&& val) { + static_assert(TeamMDPolicy::total_nest_level >= 2 && + TeamMDPolicy::total_nest_level <= 8); + + using TeamHandle = typename TeamMDPolicy::TeamHandleType; + + constexpr auto total_nest_level = TeamMDPolicy::total_nest_level; + constexpr auto iter = TeamMDPolicy::iter; + constexpr auto thread_and_vector = + ((TeamMDPolicy::par_thread == Impl::TeamMDRangeParThread::ParThread) && + (TeamMDPolicy::par_vector == Impl::TeamMDRangeParVector::ParVector)) + ? Impl::TeamMDRangeThreadAndVector::Both + : Impl::TeamMDRangeThreadAndVector::NotBoth; + constexpr auto begin_rank = + (iter == Iterate::Right) ? 0 : (total_nest_level - 1); + + using ThreadAndVectorNestLevel = + Impl::ThreadAndVectorNestLevel<Rank, typename TeamHandle::execution_space, + thread_and_vector>; + + constexpr auto par_thread_nest_level = + (TeamMDPolicy::par_thread == TeamMDRangeParThread::ParThread) + ? ThreadAndVectorNestLevel::par_rt + : ThreadAndVectorNestLevel::invalid; + constexpr auto par_vector_nest_level = + (TeamMDPolicy::par_vector == TeamMDRangeParVector::ParVector) + ? ThreadAndVectorNestLevel::par_rv + : ThreadAndVectorNestLevel::invalid; + + using InitNestingTracker = + TeamMDRangeNestingTracker<Rank, par_thread_nest_level, + par_vector_nest_level, begin_rank>; + + using InitTeamMDMode = typename InitNestingTracker::RangeMode; + + nested_loop(InitTeamMDMode(), InitNestingTracker(), policy, lambda, + std::forward<ReductionValueType>(val)); +} + +} // namespace Impl + +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/core/src/impl/Kokkos_Tools.hpp b/packages/kokkos/core/src/impl/Kokkos_Tools.hpp index 8d6ec64685ee51ed2320e31bf7b8ee535d5f2c28..fbc648175d69e53356ff8ca12db4f79a77283ca9 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Tools.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Tools.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /** * Header file to include all of Kokkos Tooling support diff --git a/packages/kokkos/core/src/impl/Kokkos_Tools_Generic.hpp b/packages/kokkos/core/src/impl/Kokkos_Tools_Generic.hpp index 702fc0997bf96fb7a85b282c559ba57111b9faa0..4ccb64ce4f410ebfbf32341b2fd1272a9e954686 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Tools_Generic.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Tools_Generic.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_KOKKOS_TOOLS_GENERIC_HPP #define KOKKOS_IMPL_KOKKOS_TOOLS_GENERIC_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Traits.hpp b/packages/kokkos/core/src/impl/Kokkos_Traits.hpp index 38edc118db6e62d8a7602e90e6c3b18cd9dc8722..45ee60e931d882379900036669effe9d09120650 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Traits.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Traits.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOSTRAITS_HPP #define KOKKOSTRAITS_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Utilities.hpp b/packages/kokkos/core/src/impl/Kokkos_Utilities.hpp index 37b74103d3c6c1a158fe6d64da2a2aeb407902d4..c3504ffce5a783f9523cbaf40bb3149ace6934d4 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Utilities.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Utilities.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CORE_IMPL_UTILITIES_HPP #define KOKKOS_CORE_IMPL_UTILITIES_HPP @@ -57,28 +29,25 @@ namespace Kokkos { namespace Impl { +template <typename... Is> +struct always_true : std::true_type {}; + +//============================================================================== + +#if defined(__cpp_lib_type_identity) +// since C++20 +using std::type_identity; +using std::type_identity_t; +#else template <typename T> -struct identity { +struct type_identity { using type = T; }; template <typename T> -using identity_t = typename identity<T>::type; - -template <typename... Is> -struct always_true : std::true_type {}; - -#if defined(__cpp_lib_void_t) -// since C++17 -using std::void_t; -#else -template <class...> -using void_t = void; +using type_identity_t = typename type_identity<T>::type; #endif -//============================================================================== -// <editor-fold desc="remove_cvref_t"> {{{1 - #if defined(__cpp_lib_remove_cvref) // since C++20 using std::remove_cvref; @@ -93,9 +62,6 @@ template <class T> using remove_cvref_t = typename remove_cvref<T>::type; #endif -// </editor-fold> end remove_cvref_t }}}1 -//============================================================================== - //============================================================================== // <editor-fold desc="is_specialization_of"> {{{1 @@ -108,26 +74,6 @@ struct is_specialization_of<Template<Args...>, Template> : std::true_type {}; // </editor-fold> end is_specialization_of }}}1 //============================================================================== -//============================================================================== -// <editor-fold desc="Folding emulation"> {{{1 - -// acts like void for comma fold emulation -struct _fold_comma_emulation_return {}; - -template <class... Ts> -constexpr KOKKOS_INLINE_FUNCTION _fold_comma_emulation_return -emulate_fold_comma_operator(Ts&&...) noexcept { - return _fold_comma_emulation_return{}; -} - -#define KOKKOS_IMPL_FOLD_COMMA_OPERATOR(expr) \ - ::Kokkos::Impl::emulate_fold_comma_operator( \ - ::std::initializer_list<::Kokkos::Impl::_fold_comma_emulation_return>{ \ - ((expr), ::Kokkos::Impl::_fold_comma_emulation_return{})...}) - -// </editor-fold> end Folding emulation }}}1 -//============================================================================== - //============================================================================== // destruct_delete is a unique_ptr deleter for objects // created by placement new into already allocated memory @@ -176,7 +122,7 @@ struct _type_list_remove_first_impl<Entry, type_list<Entry, Ts...>, template <class Entry, class... OutTs> struct _type_list_remove_first_impl<Entry, type_list<>, type_list<OutTs...>> - : identity<type_list<OutTs...>> {}; + : type_identity<type_list<OutTs...>> {}; template <class Entry, class List> struct type_list_remove_first @@ -191,23 +137,9 @@ struct type_list_remove_first template <template <class> class UnaryPred, class List> struct type_list_any; -#ifdef KOKKOS_ENABLE_CXX17 template <template <class> class UnaryPred, class... Ts> struct type_list_any<UnaryPred, type_list<Ts...>> : std::bool_constant<(UnaryPred<Ts>::value || ...)> {}; -#else -template <template <class> class UnaryPred, class T, class... Ts> -struct type_list_any<UnaryPred, type_list<T, Ts...>> { - using type = typename std::conditional_t< - UnaryPred<T>::value, std::true_type, - type_list_any<UnaryPred, type_list<Ts...>>>::type; - static constexpr auto value = type::value; -}; - -template <template <class> class UnaryPred> -struct type_list_any<UnaryPred, type_list<>> : std::false_type {}; - -#endif // </editor-fold> end type_list_any }}}2 //------------------------------------------------------------------------------ @@ -263,6 +195,15 @@ using filter_type_list_t = // </editor-fold> end type_list }}}1 //============================================================================== +//============================================================================== +// The weird !sizeof(F*) to express false is to make the +// expression dependent on the type of F, and thus only applicable +// at instantiation and not first-pass semantic analysis of the +// template definition. +template <typename T> +constexpr bool dependent_false_v = !sizeof(T*); +//============================================================================== + } // namespace Impl } // namespace Kokkos diff --git a/packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp b/packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp index 6773263340274928f1baa4bbe3308755ba2494e2..6009e132014569460334e11d0bd508e3d21a9299 100644 --- a/packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_VLAEmulation.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_VLAEMULATION_HPP #define KOKKOS_IMPL_VLAEMULATION_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewArray.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewArray.hpp index 12a5fa288fdb1951ceed0a062387a80df45f2e89..c76bde49933442b9a6ef24905aeea5ab8dea41cf 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ViewArray.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ViewArray.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXPERIMENTAL_VIEW_ARRAY_MAPPING_HPP #define KOKKOS_EXPERIMENTAL_VIEW_ARRAY_MAPPING_HPP @@ -356,6 +328,8 @@ class ViewMapping<Traits, Kokkos::Array<>> { using execution_space = typename alloc_prop::execution_space; using memory_space = typename Traits::memory_space; + static_assert( + SpaceAccessibility<execution_space, memory_space>::accessible); using functor_type = ViewValueFunctor<typename Traits::device_type, scalar_type>; using record_type = @@ -370,18 +344,11 @@ class ViewMapping<Traits, Kokkos::Array<>> { const size_t alloc_size = (m_impl_offset.span() * Array_N * MemorySpanSize + MemorySpanMask) & ~size_t(MemorySpanMask); - const auto &alloc_name = - static_cast<Kokkos::Impl::ViewCtorProp<void, std::string> const &>( - arg_prop) - .value; + const auto &alloc_name = Impl::get_property<Impl::LabelTag>(arg_prop); const execution_space &exec_space = - static_cast<Kokkos::Impl::ViewCtorProp<void, execution_space> const &>( - arg_prop) - .value; + Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop); const memory_space &mem_space = - static_cast<Kokkos::Impl::ViewCtorProp<void, memory_space> const &>( - arg_prop) - .value; + Impl::get_property<Impl::MemorySpaceTag>(arg_prop); // Allocate memory from the memory space and create tracking record. record_type *const record = @@ -390,22 +357,36 @@ class ViewMapping<Traits, Kokkos::Array<>> { alloc_size) : record_type::allocate(mem_space, alloc_name, alloc_size); - if (alloc_size) { - m_impl_handle = - handle_type(reinterpret_cast<pointer_type>(record->data())); - - if (alloc_prop::initialize) { - // The functor constructs and destroys - record->m_destroy = - execution_space_specified - ? functor_type(exec_space, (pointer_type)m_impl_handle, - m_impl_offset.span() * Array_N, alloc_name) - : functor_type((pointer_type)m_impl_handle, - m_impl_offset.span() * Array_N, alloc_name); + m_impl_handle = handle_type(reinterpret_cast<pointer_type>(record->data())); + functor_type functor = + execution_space_specified + ? functor_type(exec_space, (pointer_type)m_impl_handle, + m_impl_offset.span() * Array_N, alloc_name) + : functor_type((pointer_type)m_impl_handle, + m_impl_offset.span() * Array_N, alloc_name); + +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ + defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) + if (false) { + // Make sure the destroy functor gets instantiated. + // This avoids "cudaErrorInvalidDeviceFunction"-type errors. + functor.destroy_shared_allocation(); + } +#endif + + // Only initialize if the allocation is non-zero. + // May be zero if one of the dimensions is zero. + if constexpr (alloc_prop::initialize) + if (alloc_size) { + // Assume destruction is only required when construction is requested. + // The ViewValueFunctor has both value construction and destruction + // operators. + record->m_destroy = std::move(functor); + + // Construct values record->m_destroy.construct_shared_allocation(); } - } return record; } diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewCtor.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewCtor.hpp index 8bc8f8686487212d5ac380f35447e2ad0d6a5752..92c17d0cf568b9a3dc179dec07f2dcd7c7c33b8d 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ViewCtor.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ViewCtor.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXPERIMENTAL_IMPL_VIEW_CTOR_PROP_HPP #define KOKKOS_EXPERIMENTAL_IMPL_VIEW_CTOR_PROP_HPP @@ -102,27 +74,14 @@ struct ViewCtorProp<void, CommonViewAllocProp<Specialize, T>> { using type = CommonViewAllocProp<Specialize, T>; - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION ViewCtorProp(const type &arg) : value(arg) {} - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION ViewCtorProp(type &&arg) : value(arg) {} type value; }; -/* std::integral_constant<unsigned,I> are dummy arguments - * that avoid duplicate base class errors - */ -template <unsigned I> -struct ViewCtorProp<void, std::integral_constant<unsigned, I>> { - ViewCtorProp() = default; - ViewCtorProp(const ViewCtorProp &) = default; - ViewCtorProp &operator=(const ViewCtorProp &) = default; - - template <typename P> - KOKKOS_INLINE_FUNCTION ViewCtorProp(const P &) {} -}; - /* Property flags have constexpr value */ template <typename P> struct ViewCtorProp< @@ -178,7 +137,7 @@ struct ViewCtorProp<void, T *> { using type = T *; - KOKKOS_INLINE_FUNCTION + KOKKOS_FUNCTION ViewCtorProp(const type arg) : value(arg) {} type value; @@ -187,19 +146,20 @@ struct ViewCtorProp<void, T *> { // For some reason I don't understand I needed this specialization explicitly // for NVCC/MSVC template <typename T> -struct ViewCtorProp<T *> { - ViewCtorProp() = default; - ViewCtorProp(const ViewCtorProp &) = default; - ViewCtorProp &operator=(const ViewCtorProp &) = default; - - using type = T *; - - KOKKOS_INLINE_FUNCTION - ViewCtorProp(const type arg) : value(arg) {} - - enum : bool { has_pointer = true }; - using pointer_type = type; - type value; +struct ViewCtorProp<T *> : public ViewCtorProp<void, T *> { + static constexpr bool has_memory_space = false; + static constexpr bool has_execution_space = false; + static constexpr bool has_pointer = true; + static constexpr bool has_label = false; + static constexpr bool allow_padding = false; + static constexpr bool initialize = true; + + using memory_space = void; + using execution_space = void; + using pointer_type = T *; + + KOKKOS_FUNCTION ViewCtorProp(const pointer_type arg) + : ViewCtorProp<void, pointer_type>(arg) {} }; // If we use `ViewCtorProp<Args...>` and `ViewCtorProp<void, Args>...` directly @@ -230,14 +190,15 @@ struct ViewCtorProp : public ViewCtorProp<void, P>... { public: /* Flags for the common properties */ - enum { has_memory_space = var_memory_space::value }; - enum { has_execution_space = var_execution_space::value }; - enum { has_pointer = var_pointer::value }; - enum { has_label = Kokkos::Impl::has_type<std::string, P...>::value }; - enum { allow_padding = Kokkos::Impl::has_type<AllowPadding_t, P...>::value }; - enum { - initialize = !Kokkos::Impl::has_type<WithoutInitializing_t, P...>::value - }; + static constexpr bool has_memory_space = var_memory_space::value; + static constexpr bool has_execution_space = var_execution_space::value; + static constexpr bool has_pointer = var_pointer::value; + static constexpr bool has_label = + Kokkos::Impl::has_type<std::string, P...>::value; + static constexpr bool allow_padding = + Kokkos::Impl::has_type<AllowPadding_t, P...>::value; + static constexpr bool initialize = + !Kokkos::Impl::has_type<WithoutInitializing_t, P...>::value; using memory_space = typename var_memory_space::type; using execution_space = typename var_execution_space::type; @@ -250,12 +211,12 @@ struct ViewCtorProp : public ViewCtorProp<void, P>... { inline ViewCtorProp(Args const &... args) : ViewCtorProp<void, P>(args)... {} template <typename... Args> - KOKKOS_INLINE_FUNCTION ViewCtorProp(pointer_type arg0, Args const &... args) + KOKKOS_FUNCTION ViewCtorProp(pointer_type arg0, Args const &... args) : ViewCtorProp<void, pointer_type>(arg0), ViewCtorProp<void, typename ViewCtorProp<void, Args>::type>(args)... {} /* Copy from a matching property subset */ - KOKKOS_INLINE_FUNCTION ViewCtorProp(pointer_type arg0) + KOKKOS_FUNCTION ViewCtorProp(pointer_type arg0) : ViewCtorProp<void, pointer_type>(arg0) {} // If we use `ViewCtorProp<Args...>` and `ViewCtorProp<void, Args>...` here @@ -273,6 +234,117 @@ struct ViewCtorProp : public ViewCtorProp<void, P>... { } }; +template <typename... P> +auto with_properties_if_unset(const ViewCtorProp<P...> &view_ctor_prop) { + return view_ctor_prop; +} + +template <typename... P, typename Property, typename... Properties> +auto with_properties_if_unset(const ViewCtorProp<P...> &view_ctor_prop, + [[maybe_unused]] const Property &property, + const Properties &... properties) { + if constexpr ((is_execution_space<Property>::value && + !ViewCtorProp<P...>::has_execution_space) || + (is_memory_space<Property>::value && + !ViewCtorProp<P...>::has_memory_space) || + (is_view_label<Property>::value && + !ViewCtorProp<P...>::has_label) || + (std::is_same_v<Property, WithoutInitializing_t> && + ViewCtorProp<P...>::initialize)) { + using NewViewCtorProp = ViewCtorProp<P..., Property>; + NewViewCtorProp new_view_ctor_prop(view_ctor_prop); + static_cast<ViewCtorProp<void, Property> &>(new_view_ctor_prop).value = + property; + return with_properties_if_unset(new_view_ctor_prop, properties...); + } else + return with_properties_if_unset(view_ctor_prop, properties...); + +// A workaround placed to prevent spurious "missing return statement at the +// end of non-void function" warnings from CUDA builds (issue #5470). Because +// KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK removes [[noreturn]] attribute from +// cuda_abort(), an unreachable while(true); is placed as a fallback method +#if (defined(KOKKOS_COMPILER_NVCC) && (KOKKOS_COMPILER_NVCC < 1150)) || \ + (defined(KOKKOS_COMPILER_INTEL) && (KOKKOS_COMPILER_INTEL <= 2100)) + Kokkos::abort( + "Prevents an incorrect warning: missing return statement at end of " + "non-void function"); +#ifdef KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK + while (true) + ; +#endif +#endif +} + +struct ExecutionSpaceTag {}; +struct MemorySpaceTag {}; +struct LabelTag {}; +struct PointerTag {}; + +template <typename Tag, typename... P> +KOKKOS_FUNCTION const auto &get_property( + const ViewCtorProp<P...> &view_ctor_prop) { + if constexpr (std::is_same_v<Tag, ExecutionSpaceTag>) { + static_assert(ViewCtorProp<P...>::has_execution_space); + using execution_space_type = typename ViewCtorProp<P...>::execution_space; + return static_cast<const ViewCtorProp<void, execution_space_type> &>( + view_ctor_prop) + .value; + } else if constexpr (std::is_same_v<Tag, MemorySpaceTag>) { + static_assert(ViewCtorProp<P...>::has_memory_space); + using memory_space_type = typename ViewCtorProp<P...>::memory_space; + return static_cast<const ViewCtorProp<void, memory_space_type> &>( + view_ctor_prop) + .value; + } else if constexpr (std::is_same_v<Tag, LabelTag>) { + static_assert(ViewCtorProp<P...>::has_label); + return static_cast<const ViewCtorProp<void, std::string> &>(view_ctor_prop) + .value; + } else if constexpr (std::is_same_v<Tag, PointerTag>) { + static_assert(ViewCtorProp<P...>::has_pointer); + using pointer_type = typename ViewCtorProp<P...>::pointer_type; + return static_cast<const ViewCtorProp<void, pointer_type> &>(view_ctor_prop) + .value; + } else { + static_assert(std::is_same_v<Tag, void>, "Invalid property tag!"); + return view_ctor_prop; + } + +// A workaround placed to prevent spurious "missing return statement at the +// end of non-void function" warnings from CUDA builds (issue #5470). Because +// KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK removes [[noreturn]] attribute from +// cuda_abort(), an unreachable while(true); is placed as a fallback method +#if (defined(KOKKOS_COMPILER_NVCC) && (KOKKOS_COMPILER_NVCC < 1150)) || \ + (defined(KOKKOS_COMPILER_INTEL) && (KOKKOS_COMPILER_INTEL <= 2100)) + Kokkos::abort( + "Prevents an incorrect warning: missing return statement at end of " + "non-void function"); +#ifdef KOKKOS_ENABLE_DEBUG_BOUNDS_CHECK + while (true) + ; +#endif +#endif +} +#if defined(KOKKOS_COMPILER_NVCC) && (KOKKOS_COMPILER_NVCC < 1150) +// pragma pop is getting a warning from the underlying GCC +// for unknown pragma if -pedantic is used +#ifdef __CUDA_ARCH__ +#pragma pop +#endif +#endif +#ifdef KOKKOS_IMPL_INTEL_BOGUS_MISSING_RETURN_STATEMENT_AT_END_OF_NON_VOID_FUNCTION +#pragma warning(pop) +#undef KOKKOS_IMPL_INTEL_BOGUS_MISSING_RETURN_STATEMENT_AT_END_OF_NON_VOID_FUNCTION +#endif + +template <typename Tag, typename... P> +KOKKOS_FUNCTION auto &get_property(ViewCtorProp<P...> &view_ctor_prop) { + // Avoid code duplication by deferring to the const-qualified overload and + // casting the const away from the return type + const auto &tmp = get_property<Tag>( + static_cast<const ViewCtorProp<P...> &>(view_ctor_prop)); + return const_cast<std::decay_t<decltype(tmp)> &>(tmp); +} + } /* namespace Impl */ } /* namespace Kokkos */ diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewLayoutTiled.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewLayoutTiled.hpp index 8d367cebab75bfb71cdcce5bf415fc0ae36642dc..957717f973d1218236e91ba625781f1c12c35209 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ViewLayoutTiled.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ViewLayoutTiled.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXPERIMENTAL_VIEWLAYOUTTILE_HPP #define KOKKOS_EXPERIMENTAL_VIEWLAYOUTTILE_HPP @@ -184,7 +156,7 @@ struct ViewOffset< //---------------------------------------- -#define DEBUG_OUTPUT_CHECK 0 +#define KOKKOS_IMPL_DEBUG_OUTPUT_CHECK 0 // Rank 2 template <typename I0, typename I1> @@ -201,7 +173,7 @@ struct ViewOffset< : (((i0 & MASK_0) << SHIFT_1) + (i1 & MASK_1)); // ( tile_dim[1] * li0 + li1 ) -#if DEBUG_OUTPUT_CHECK +#if KOKKOS_IMPL_DEBUG_OUTPUT_CHECK std::cout << "Am I Outer Left? " << (outer_pattern == (Kokkos::Iterate::Left)) << std::endl; std::cout << "Am I Inner Left? " @@ -235,7 +207,7 @@ struct ViewOffset< : (((i0 & MASK_0) << (SHIFT_2 + SHIFT_1)) + ((i1 & MASK_1) << (SHIFT_2)) + (i2 & MASK_2)); -#if DEBUG_OUTPUT_CHECK +#if KOKKOS_IMPL_DEBUG_OUTPUT_CHECK std::cout << "Am I Outer Left? " << (outer_pattern == (Kokkos::Iterate::Left)) << std::endl; std::cout << "Am I Inner Left? " diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp index 994dd0b2adf65d9a2440abeb5c4930b43a662d54..3ab8237cd1501d66c37a8fb8093fb53e676ead91 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ViewMapping.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXPERIMENTAL_VIEW_MAPPING_HPP #define KOKKOS_EXPERIMENTAL_VIEW_MAPPING_HPP @@ -2890,25 +2862,27 @@ struct ViewValueFunctor; template <class DeviceType, class ValueType> struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> { - using ExecSpace = typename DeviceType::execution_space; - using PolicyType = Kokkos::RangePolicy<ExecSpace, Kokkos::IndexType<int64_t>>; + using ExecSpace = typename DeviceType::execution_space; + + struct DestroyTag {}; + struct ConstructTag {}; ExecSpace space; ValueType* ptr; size_t n; - bool destroy; std::string name; bool default_exec_space; + template <class _ValueType = ValueType> KOKKOS_INLINE_FUNCTION - void operator()(const size_t i) const { - if (destroy) { - (ptr + i)->~ValueType(); - } // KOKKOS_IMPL_CUDA_CLANG_WORKAROUND this line causes ptax error - // __cxa_begin_catch in nested_view unit-test - else { - new (ptr + i) ValueType(); - } + std::enable_if_t<std::is_default_constructible<_ValueType>::value> + operator()(ConstructTag const&, const size_t i) const { + new (ptr + i) ValueType(); + } + + KOKKOS_INLINE_FUNCTION void operator()(DestroyTag const&, + const size_t i) const { + (ptr + i)->~ValueType(); } ViewValueFunctor() = default; @@ -2920,18 +2894,20 @@ struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> { : space(arg_space), ptr(arg_ptr), n(arg_n), - destroy(false), name(std::move(arg_name)), - default_exec_space(false) {} + default_exec_space(false) { + functor_instantiate_workaround(); + } ViewValueFunctor(ValueType* const arg_ptr, size_t const arg_n, std::string arg_name) : space(ExecSpace{}), ptr(arg_ptr), n(arg_n), - destroy(false), name(std::move(arg_name)), - default_exec_space(true) {} + default_exec_space(true) { + functor_instantiate_workaround(); + } template <typename Dummy = ValueType> std::enable_if_t<std::is_trivial<Dummy>::value && @@ -2966,7 +2942,7 @@ struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> { space.fence("Kokkos::Impl::ViewValueFunctor: View init/destroy fence"); } else { #endif - parallel_for_implementation(false); + parallel_for_implementation<ConstructTag>(); #ifndef KOKKOS_ARCH_A64FX } #endif @@ -2976,22 +2952,24 @@ struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> { std::enable_if_t<!(std::is_trivial<Dummy>::value && std::is_trivially_copy_assignable<ValueType>::value)> construct_dispatch() { - parallel_for_implementation(false); + parallel_for_implementation<ConstructTag>(); } - void parallel_for_implementation(bool arg) { - destroy = arg; + template <typename Tag> + void parallel_for_implementation() { if (!space.in_parallel()) { - PolicyType policy(0, n); - std::string functor_name; + using PolicyType = + Kokkos::RangePolicy<ExecSpace, Kokkos::IndexType<int64_t>, Tag>; + PolicyType policy(space, 0, n); uint64_t kpID = 0; if (Kokkos::Profiling::profileLibraryLoaded()) { - functor_name = - (destroy ? "Kokkos::View::destruction [" + functor_name + "]" - : "Kokkos::View::initialization [" + functor_name + "]"); + const std::string functor_name = + (std::is_same_v<Tag, DestroyTag> + ? "Kokkos::View::destruction [" + name + "]" + : "Kokkos::View::initialization [" + name + "]"); Kokkos::Profiling::beginParallelFor( - "Kokkos::View::initialization [" + functor_name + "]", - Kokkos::Profiling::Experimental::device_id(space), &kpID); + functor_name, Kokkos::Profiling::Experimental::device_id(space), + &kpID); } #ifdef KOKKOS_ENABLE_CUDA @@ -3003,19 +2981,33 @@ struct ViewValueFunctor<DeviceType, ValueType, false /* is_scalar */> { const Kokkos::Impl::ParallelFor<ViewValueFunctor, PolicyType> closure( *this, policy); closure.execute(); - if (default_exec_space || destroy) + if (default_exec_space || std::is_same_v<Tag, DestroyTag>) space.fence("Kokkos::Impl::ViewValueFunctor: View init/destroy fence"); if (Kokkos::Profiling::profileLibraryLoaded()) { Kokkos::Profiling::endParallelFor(kpID); } } else { - for (size_t i = 0; i < n; ++i) operator()(i); + for (size_t i = 0; i < n; ++i) operator()(Tag{}, i); } } void construct_shared_allocation() { construct_dispatch(); } - void destroy_shared_allocation() { parallel_for_implementation(true); } + void destroy_shared_allocation() { + parallel_for_implementation<DestroyTag>(); + } + + // This function is to ensure that the functor with DestroyTag is instantiated + // This is a workaround to avoid "cudaErrorInvalidDeviceFunction" error later + // when the function is queried with cudaFuncGetAttributes + void functor_instantiate_workaround() { +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ + defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) + if (false) { + parallel_for_implementation<DestroyTag>(); + } +#endif + } }; template <class DeviceType, class ValueType> @@ -3103,8 +3095,7 @@ struct ViewValueFunctor<DeviceType, ValueType, true /* is_scalar */> { void parallel_for_implementation() { if (!space.in_parallel()) { PolicyType policy(0, n); - std::string functor_name = "Kokkos::View::initialization [" + name + "]"; - uint64_t kpID = 0; + uint64_t kpID = 0; if (Kokkos::Profiling::profileLibraryLoaded()) { Kokkos::Profiling::beginParallelFor( "Kokkos::View::initialization [" + name + "]", @@ -3392,9 +3383,7 @@ class ViewMapping< KOKKOS_INLINE_FUNCTION ViewMapping( Kokkos::Impl::ViewCtorProp<P...> const& arg_prop, typename Traits::array_layout const& arg_layout) - : m_impl_handle( - ((Kokkos::Impl::ViewCtorProp<void, pointer_type> const&)arg_prop) - .value), + : m_impl_handle(Impl::get_property<Impl::PointerTag>(arg_prop)), m_impl_offset(std::integral_constant<unsigned, 0>(), arg_layout) {} /**\brief Assign data */ @@ -3417,7 +3406,9 @@ class ViewMapping< using execution_space = typename alloc_prop::execution_space; using memory_space = typename Traits::memory_space; - using value_type = typename Traits::value_type; + static_assert( + SpaceAccessibility<execution_space, memory_space>::accessible); + using value_type = typename Traits::value_type; using functor_type = ViewValueFunctor<Kokkos::Device<execution_space, memory_space>, value_type>; @@ -3436,17 +3427,11 @@ class ViewMapping< (m_impl_offset.span() * MemorySpanSize + MemorySpanMask) & ~size_t(MemorySpanMask); const std::string& alloc_name = - static_cast<Kokkos::Impl::ViewCtorProp<void, std::string> const&>( - arg_prop) - .value; + Impl::get_property<Impl::LabelTag>(arg_prop); const execution_space& exec_space = - static_cast<Kokkos::Impl::ViewCtorProp<void, execution_space> const&>( - arg_prop) - .value; + Impl::get_property<Impl::ExecutionSpaceTag>(arg_prop); const memory_space& mem_space = - static_cast<Kokkos::Impl::ViewCtorProp<void, memory_space> const&>( - arg_prop) - .value; + Impl::get_property<Impl::MemorySpaceTag>(arg_prop); // Create shared memory tracking record with allocate memory from the memory // space @@ -3458,22 +3443,25 @@ class ViewMapping< m_impl_handle = handle_type(reinterpret_cast<pointer_type>(record->data())); + functor_type functor = + execution_space_specified + ? functor_type(exec_space, (value_type*)m_impl_handle, + m_impl_offset.span(), alloc_name) + : functor_type((value_type*)m_impl_handle, m_impl_offset.span(), + alloc_name); + // Only initialize if the allocation is non-zero. // May be zero if one of the dimensions is zero. - if (alloc_size && alloc_prop::initialize) { - // Assume destruction is only required when construction is requested. - // The ViewValueFunctor has both value construction and destruction - // operators. - record->m_destroy = - execution_space_specified - ? functor_type(exec_space, (value_type*)m_impl_handle, - m_impl_offset.span(), alloc_name) - : functor_type((value_type*)m_impl_handle, m_impl_offset.span(), - alloc_name); - - // Construct values - record->m_destroy.construct_shared_allocation(); - } + if constexpr (alloc_prop::initialize) + if (alloc_size) { + // Assume destruction is only required when construction is requested. + // The ViewValueFunctor has both value construction and destruction + // operators. + record->m_destroy = std::move(functor); + + // Construct values + record->m_destroy.construct_shared_allocation(); + } return record; } diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp index cfa30f6e7b053acc6af07b95e27d5e851613e8f7..43958db3900de84a925be1307fba59de59dcc353 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ViewTracker.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_VIEW_TRACKER_HPP #define KOKKOS_VIEW_TRACKER_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_ViewUniformType.hpp b/packages/kokkos/core/src/impl/Kokkos_ViewUniformType.hpp index 13ed4df6a2f5d3aae474d45869482e98519df8df..7de2869a0d884c5f641ecfbbea345c27bb664df6 100644 --- a/packages/kokkos/core/src/impl/Kokkos_ViewUniformType.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_ViewUniformType.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_EXPERIMENTAL_VIEWUNIFORMTYPE_HPP #define KOKKOS_EXPERIMENTAL_VIEWUNIFORMTYPE_HPP diff --git a/packages/kokkos/core/src/impl/Kokkos_Volatile_Load.hpp b/packages/kokkos/core/src/impl/Kokkos_Volatile_Load.hpp index 4af26dcc91db449b58d460ef9f1e809da2bc5b9d..fa8dac4089b641ec8aeb5dbbe01bc07a659ed443 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Volatile_Load.hpp +++ b/packages/kokkos/core/src/impl/Kokkos_Volatile_Load.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> diff --git a/packages/kokkos/core/src/impl/Kokkos_hwloc.cpp b/packages/kokkos/core/src/impl/Kokkos_hwloc.cpp index a0d1bc4cb446f706671fca7c6526bacdc2533168..230322177e8adc81f442d11021557637d1dafd0c 100644 --- a/packages/kokkos/core/src/impl/Kokkos_hwloc.cpp +++ b/packages/kokkos/core/src/impl/Kokkos_hwloc.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/src/setup/Kokkos_Setup_Cuda.hpp b/packages/kokkos/core/src/setup/Kokkos_Setup_Cuda.hpp index 983a71a561ec5da83311c83f3b005fc41259e872..d774914d9f4fa908d67d343ee2d539a871269f7e 100644 --- a/packages/kokkos/core/src/setup/Kokkos_Setup_Cuda.hpp +++ b/packages/kokkos/core/src/setup/Kokkos_Setup_Cuda.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_CUDA_SETUP_HPP_ #define KOKKOS_CUDA_SETUP_HPP_ @@ -84,18 +56,12 @@ #ifdef KOKKOS_ENABLE_CUDA_LAMBDA #define KOKKOS_LAMBDA [=] __host__ __device__ -#if defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20) #define KOKKOS_CLASS_LAMBDA [ =, *this ] __host__ __device__ -#endif #else // !defined(KOKKOS_ENABLE_CUDA_LAMBDA) #undef KOKKOS_ENABLE_CXX11_DISPATCH_LAMBDA #endif // !defined(KOKKOS_ENABLE_CUDA_LAMBDA) -#if (10000 > CUDA_VERSION) -#define KOKKOS_ENABLE_PRE_CUDA_10_DEPRECATION_API -#endif - #if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700) // PTX atomics with memory order semantics are only available on volta and later #if !defined(KOKKOS_DISABLE_CUDA_ASM) @@ -115,19 +81,5 @@ #define KOKKOS_IMPL_FUNCTION __device__ __host__ #define KOKKOS_IMPL_HOST_FUNCTION __host__ #define KOKKOS_IMPL_DEVICE_FUNCTION __device__ -#if defined(KOKKOS_COMPILER_NVCC) -#define KOKKOS_INLINE_FUNCTION_DELETED inline -#else -#define KOKKOS_INLINE_FUNCTION_DELETED __device__ __host__ inline -#endif -#if (CUDA_VERSION < 10000) -#define KOKKOS_DEFAULTED_FUNCTION __host__ __device__ inline -#else -#define KOKKOS_DEFAULTED_FUNCTION inline -#endif - -#if (CUDA_VERSION >= 10000) -#define KOKKOS_CUDA_ENABLE_GRAPHS -#endif #endif /* KOKKOS_CUDA_SETUP_HPP_ */ diff --git a/packages/kokkos/core/src/setup/Kokkos_Setup_HIP.hpp b/packages/kokkos/core/src/setup/Kokkos_Setup_HIP.hpp index f1df2f87bb0a7911949442622e27cadaef466c1d..7b0186610707a1b561fdee79d100b9ba7d5d682e 100644 --- a/packages/kokkos/core/src/setup/Kokkos_Setup_HIP.hpp +++ b/packages/kokkos/core/src/setup/Kokkos_Setup_HIP.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SETUP_HIP_HPP_ #define KOKKOS_SETUP_HIP_HPP_ @@ -49,19 +21,14 @@ #define KOKKOS_IMPL_HIP_CLANG_WORKAROUND -#define HIP_ENABLE_PRINTF #include <hip/hip_runtime.h> #include <hip/hip_runtime_api.h> #define KOKKOS_LAMBDA [=] __host__ __device__ -#if defined(KOKKOS_ENABLE_CXX17) || defined(KOKKOS_ENABLE_CXX20) #define KOKKOS_CLASS_LAMBDA [ =, *this ] __host__ __device__ -#endif #define KOKKOS_IMPL_FORCEINLINE_FUNCTION __device__ __host__ __forceinline__ #define KOKKOS_IMPL_INLINE_FUNCTION __device__ __host__ inline -#define KOKKOS_DEFAULTED_FUNCTION __device__ __host__ inline -#define KOKKOS_INLINE_FUNCTION_DELETED __device__ __host__ inline #define KOKKOS_IMPL_FUNCTION __device__ __host__ #define KOKKOS_IMPL_HOST_FUNCTION __host__ #define KOKKOS_IMPL_DEVICE_FUNCTION __device__ diff --git a/packages/kokkos/core/src/setup/Kokkos_Setup_SYCL.hpp b/packages/kokkos/core/src/setup/Kokkos_Setup_SYCL.hpp index b203e9afb27b1c0d5b18b2a25c93e5d65a0d8e80..417f80f7f4df258679e03ed354ef1d51df4446f5 100644 --- a/packages/kokkos/core/src/setup/Kokkos_Setup_SYCL.hpp +++ b/packages/kokkos/core/src/setup/Kokkos_Setup_SYCL.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SETUP_SYCL_HPP_ #define KOKKOS_SETUP_SYCL_HPP_ @@ -54,7 +26,12 @@ #define SYCL_FALLBACK_ASSERT 1 #endif +// FIXME_SYCL +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else #include <CL/sycl.hpp> +#endif #ifdef __SYCL_DEVICE_ONLY__ #define KOKKOS_IMPL_DO_NOT_USE_PRINTF(format, ...) \ diff --git a/packages/kokkos/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp index cb2808698a279fbe9718d149d44af20c5a8dd0ef..a5c8ce1d3f38ea443683bb148f94cf8ca7661d04 100644 --- a/packages/kokkos/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_ExecutionSpaceTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_EXECUTIONSPACETRAIT_HPP #define KOKKOS_KOKKOS_EXECUTIONSPACETRAIT_HPP diff --git a/packages/kokkos/core/src/traits/Kokkos_GraphKernelTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_GraphKernelTrait.hpp index b16a7777cd598bf4326627346886b65cd22c45fe..64c469805bdd1fd267fcbbe6a0060f14504cc161 100644 --- a/packages/kokkos/core/src/traits/Kokkos_GraphKernelTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_GraphKernelTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_GRAPHKERNELTRAIT_HPP #define KOKKOS_KOKKOS_GRAPHKERNELTRAIT_HPP diff --git a/packages/kokkos/core/src/traits/Kokkos_IndexTypeTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_IndexTypeTrait.hpp index 57f74d521b8e181ad3a1f3f7896c92d577a16f7c..91820fbccacfdf36f5e2aea36f056a915681d6a3 100644 --- a/packages/kokkos/core/src/traits/Kokkos_IndexTypeTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_IndexTypeTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_INDEXTYPETRAIT_HPP #define KOKKOS_KOKKOS_INDEXTYPETRAIT_HPP diff --git a/packages/kokkos/core/src/traits/Kokkos_IterationPatternTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_IterationPatternTrait.hpp index 3c8ba47417252f35a31995fe4c671482c11b5756..2949d969ee01b2aefeca8ad14aebaf162ba9ae8b 100644 --- a/packages/kokkos/core/src/traits/Kokkos_IterationPatternTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_IterationPatternTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_ITERATIONPATTERNTRAIT_HPP #define KOKKOS_KOKKOS_ITERATIONPATTERNTRAIT_HPP diff --git a/packages/kokkos/core/src/traits/Kokkos_LaunchBoundsTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_LaunchBoundsTrait.hpp index c20a883ddab7298b76c709e064134e0cefc95366..24bedbcc60da50b93d71c003b8af2aa4ebbaaec8 100644 --- a/packages/kokkos/core/src/traits/Kokkos_LaunchBoundsTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_LaunchBoundsTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_LAUNCHBOUNDSTRAIT_HPP #define KOKKOS_KOKKOS_LAUNCHBOUNDSTRAIT_HPP diff --git a/packages/kokkos/core/src/traits/Kokkos_OccupancyControlTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_OccupancyControlTrait.hpp index b3328f8120cfce8018b579c3281ea3173cff24da..dadf582c3728fb0b241514b4af21ffd9b0ea1c1f 100644 --- a/packages/kokkos/core/src/traits/Kokkos_OccupancyControlTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_OccupancyControlTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_OCCUPANCYCONTROLTRAIT_HPP #define KOKKOS_KOKKOS_OCCUPANCYCONTROLTRAIT_HPP @@ -102,10 +74,9 @@ struct OccupancyControlTrait : TraitSpecificationBase<OccupancyControlTrait> { using mixin_matching_trait = OccupancyControlPolicyMixin<OccControl, AnalyzeNextTrait>; template <class T> - using trait_matches_specification = std::integral_constant< - bool, + using trait_matches_specification = std::bool_constant< std::is_same<T, Kokkos::Experimental::DesiredOccupancy>::value || - std::is_same<T, Kokkos::Experimental::MaximizeOccupancy>::value>; + std::is_same<T, Kokkos::Experimental::MaximizeOccupancy>::value>; }; // </editor-fold> end Occupancy control trait specification }}}1 diff --git a/packages/kokkos/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp b/packages/kokkos/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp index e500dd4e831abaa03479e9fb1e2fb67595107a9e..578e9e762adb7c0f2eef9fdd28f0aa0c80edb5d1 100644 --- a/packages/kokkos/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_PolicyTraitAdaptor.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <impl/Kokkos_Utilities.hpp> // type_list diff --git a/packages/kokkos/core/src/traits/Kokkos_PolicyTraitMatcher.hpp b/packages/kokkos/core/src/traits/Kokkos_PolicyTraitMatcher.hpp index 31927320bf6fe77cc133e49a80e7f741574165a8..090022ec739803338dc9b6b20026d78c22fb5f81 100644 --- a/packages/kokkos/core/src/traits/Kokkos_PolicyTraitMatcher.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_PolicyTraitMatcher.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <impl/Kokkos_Utilities.hpp> // type_list diff --git a/packages/kokkos/core/src/traits/Kokkos_ScheduleTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_ScheduleTrait.hpp index 311ab1a47d798d40f4d916f49d37b60b59f0fb0b..86130025530516d4a8a1937b60310fb443943606 100644 --- a/packages/kokkos/core/src/traits/Kokkos_ScheduleTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_ScheduleTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_SCHEDULETRAIT_HPP #define KOKKOS_KOKKOS_SCHEDULETRAIT_HPP diff --git a/packages/kokkos/core/src/traits/Kokkos_Traits_fwd.hpp b/packages/kokkos/core/src/traits/Kokkos_Traits_fwd.hpp index c6b4fe41d90f618c20b42727195d569b8cc54d9e..7d9c215be3f876ee26a8cd28d1f50601587cae38 100644 --- a/packages/kokkos/core/src/traits/Kokkos_Traits_fwd.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_Traits_fwd.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_TRAITS_FWD_HPP #define KOKKOS_KOKKOS_TRAITS_FWD_HPP diff --git a/packages/kokkos/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp index edc488a548bb1cbf920344f898e35228d9c7bea3..8f95385c851748a1e578edc54e8875672128a9ce 100644 --- a/packages/kokkos/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_WorkItemPropertyTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_WORKITEMPROPERTYTRAIT_HPP #define KOKKOS_KOKKOS_WORKITEMPROPERTYTRAIT_HPP diff --git a/packages/kokkos/core/src/traits/Kokkos_WorkTagTrait.hpp b/packages/kokkos/core/src/traits/Kokkos_WorkTagTrait.hpp index f306e43a031bdd3a55e3a150dddb87aec9e994f1..6eda78f838dc9a9ac914557e8c12be573b9528fb 100644 --- a/packages/kokkos/core/src/traits/Kokkos_WorkTagTrait.hpp +++ b/packages/kokkos/core/src/traits/Kokkos_WorkTagTrait.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_KOKKOS_WORKTAGTRAIT_HPP #define KOKKOS_KOKKOS_WORKTAGTRAIT_HPP @@ -108,15 +80,10 @@ struct WorkTagTrait : TraitSpecificationBase<WorkTagTrait> { // old code that just did a big long series of nested std::conditionals, but // we should benchmark this assumption if it becomes a problem. template <class T> - using trait_matches_specification = std::integral_constant< - bool, -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 + using trait_matches_specification = std::bool_constant< std::is_empty<T>::value && -#else - !std::is_void<T>::value && -#endif - !type_list_any<_trait_matches_spec_predicate<T>::template apply, - _exec_policy_traits_without_work_tag>::value>; + !type_list_any<_trait_matches_spec_predicate<T>::template apply, + _exec_policy_traits_without_work_tag>::value>; }; // </editor-fold> end trait specification }}}1 diff --git a/packages/kokkos/core/unit_test/CMakeLists.txt b/packages/kokkos/core/unit_test/CMakeLists.txt index 16fdb39d1a36e9dd8b7d65bbe846c28b37fcf496..8019e5f3bbfb38740cf8213bc8a19f7e09f941cf 100644 --- a/packages/kokkos/core/unit_test/CMakeLists.txt +++ b/packages/kokkos/core/unit_test/CMakeLists.txt @@ -38,7 +38,7 @@ ENDIF() SET(KOKKOS_CUDA_FEATURE_LEVEL 999) SET(KOKKOS_CUDA_NAME Cuda) SET(KOKKOS_HIP_FEATURE_LEVEL 999) -SET(KOKKOS_HIP_NAME Experimental::HIP) +SET(KOKKOS_HIP_NAME HIP) SET(KOKKOS_HPX_FEATURE_LEVEL 999) SET(KOKKOS_HPX_NAME Experimental::HPX) SET(KOKKOS_OPENMP_FEATURE_LEVEL 999) @@ -58,7 +58,7 @@ SET(KOKKOS_SYCL_FEATURE_LEVEL 999) SET(KOKKOS_SYCL_NAME Experimental::SYCL) SET(KOKKOS_THREADS_FEATURE_LEVEL 999) SET(KOKKOS_THREADS_NAME Threads) -SET(KOKKOS_OPENACC_FEATURE_LEVEL 3) +SET(KOKKOS_OPENACC_FEATURE_LEVEL 11) SET(KOKKOS_OPENACC_NAME Experimental::OpenACC) @@ -76,11 +76,18 @@ SET(COMPILE_ONLY_SOURCES TestCreateMirror.cpp TestDetectionIdiom.cpp TestInterOp.cpp - TestLegionInteroperability.cpp TestStringManipulation.cpp + TestViewTypeTraits.cpp TestTypeList.cpp + view/TestExtentsDatatypeConversion.cpp ) -# TestInterOp has a dependency on containers + +#testing if windows.h and Kokkos_Core.hpp can be included +if(WIN32) + LIST(APPEND COMPILE_ONLY_SOURCES TestWindowsInclude.cpp) +endif() + +#TestInterOp has a dependency on containers IF(KOKKOS_HAS_TRILINOS) LIST(REMOVE_ITEM COMPILE_ONLY_SOURCES TestInterOp.cpp) ENDIF() @@ -91,7 +98,7 @@ KOKKOS_ADD_EXECUTABLE( ${COMPILE_ONLY_SOURCES} ) -foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP;SYCL) +foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;OpenACC;HIP;SYCL) string(TOUPPER ${Tag} DEVICE) string(TOLOWER ${Tag} dir) @@ -159,15 +166,22 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP;SYCL) Other RangePolicy RangePolicyRequire + CommonPolicyConstructors + RangePolicyConstructors + TeamPolicyConstructors + MDRangePolicyConstructors + CommonPolicyInterface Reductions Reducers_a Reducers_b Reducers_c Reducers_d Reducers_e + ReducerCTADs Reductions_DeviceView Scan SharedAlloc + TeamMDRange ViewMapping_a ) set(file ${dir}/Test${Tag}_${Name}.cpp) @@ -181,8 +195,10 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP;SYCL) list(APPEND ${Tag}_SOURCES1B ${file}) endforeach() - SET(SOURCES2A_NAME_LIST + SET(${Tag}_SOURCES2A) + foreach(Name Abort + MDSpan TeamBasic TeamReductionScan TeamScan @@ -208,16 +224,7 @@ foreach(Tag Threads;Serial;OpenMP;Cuda;HPX;OpenMPTarget;HIP;SYCL) View_64bit WorkGraph WithoutInitializing - ) - IF(KOKKOS_HAS_TRILINOS) - LIST(REMOVE_ITEM SOURCES2A_NAME_LIST - Abort - ViewMemoryAccessViolation ) - ENDIF() - - SET(${Tag}_SOURCES2A) - foreach(Name ${SOURCES2A_NAME_LIST}) set(file ${dir}/Test${Tag}_${Name}.cpp) # Write to a temporary intermediate file and call configure_file to avoid # updating timestamps triggering unnecessary rebuilds on subsequent cmake runs. @@ -339,26 +346,44 @@ foreach(PairDeviceSpace HIP-HostPinned;HIP-Managed;Cuda-HostPinned;Cuda-UVM;SYCL endif() endforeach() + if(Kokkos_ENABLE_OPENMPTARGET) list(REMOVE_ITEM OpenMPTarget_SOURCES - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_AtomicOperations_complexfloat.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_AtomicOperations_complexdouble.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_Crs.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_LocalDeepCopy.cpp ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_Other.cpp ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_TeamReductionScan.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_TeamScan.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewAPI_e.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewCopy_a.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewCopy_b.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewMapping_subview.cpp - ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewOfClass.cpp ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_WorkGraph.cpp ) endif() +if(Kokkos_ENABLE_OPENACC) + list(REMOVE_ITEM OpenACC_SOURCES + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_complexfloat.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_complexdouble.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Crs.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_LocalDeepCopy.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Other.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamReductionScan.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamScan.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_e.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewCopy_a.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewCopy_b.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewMapping_subview.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewOfClass.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_WorkGraph.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamVectorRange.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_JoinBackwardCompatibility.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_CommonPolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_RangePolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamPolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRangePolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_CommonPolicyInterface.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamMDRange.cpp + ) +endif() + # FIXME_OPENMPTARGET - Comment non-passing tests with amdclang++ -IF(KOKKOS_ARCH_VEGA906 OR KOKKOS_ARCH_VEGA908 OR KOKKOS_ARCH_VEGA90A) +# FIXME_OPENMPTARGET - Need to check on NAVI architecture +IF(KOKKOS_ARCH_VEGA) SET(KOKKOS_AMDGPU_ARCH TRUE) ENDIF() IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKKOS_AMDGPU_ARCH) @@ -366,6 +391,13 @@ IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL Clang AND KOKK ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_Reducers_e.cpp ) ENDIF() +# FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22 +# when compiling for Intel's Xe-HP GPUs. +IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM) + LIST(REMOVE_ITEM OpenMPTarget_SOURCES + ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_TeamVectorRange.cpp + ) +ENDIF() # FIXME_OPENMPTARGET - Comment non-passing tests with the NVIDIA HPC compiler nvc++ IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) @@ -433,6 +465,96 @@ IF(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_ViewResize.cpp ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_RangePolicyRequire.cpp ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_RangePolicy.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_CommonPolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_RangePolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_TeamPolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_MDRangePolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openmptarget/TestOpenMPTarget_CommonPolicyInterface.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/default/TestDefaultDeviceType_a1.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/default/TestDefaultDeviceType_b1.cpp + ) +endif() + +# FIXME_OPENACC - Comment non-passing tests with the NVIDIA HPC compiler nvc++ +IF(KOKKOS_ENABLE_OPENACC AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) + list(REMOVE_ITEM OpenACC_SOURCES + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_int64_t_reduce.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_int64_t_reduce_dynamic.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_int64_t_reduce_dynamic_view.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_double_reduce.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_double_reduce_dynamic.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamTeamSize.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reductions_DeviceView.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamVectorRange.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_UniqueToken.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_HostSharedPtr.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_HostSharedPtrAccessOnDevice.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamScratch.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TestScan.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TestTeamScan.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TestTeamReductionScan.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Atomics.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_float.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_int.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_longint.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_longlongint.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_double.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_unsignedint.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_unsignedlongint.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicOperations_shared.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_AtomicViews.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_BlockSizeDeduction.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reductions.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reduce.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_a.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_b.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_c.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_d.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Reducers_e.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewMapping_b.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamBasic.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_Scan.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_NumericTraits.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_DeepCopyAlignment.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MathematicalFunctions.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MathematicalFunctions1.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MathematicalFunctions2.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_a.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_b.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c01.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c02.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c03.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c04.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c05.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c06.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c07.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c08.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c09.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c10.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c11.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c12.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_SubView_c13.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_a.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_b.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_c.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_d.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_e.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_f.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRange_g.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_a.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_b.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_c.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_d.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewAPI_f.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_ViewResize.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_RangePolicyRequire.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_RangePolicy.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_CommonPolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_RangePolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_TeamPolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_MDRangePolicyConstructors.cpp + ${CMAKE_CURRENT_BINARY_DIR}/openacc/TestOpenACC_CommonPolicyInterface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/default/TestDefaultDeviceType_a1.cpp ${CMAKE_CURRENT_SOURCE_DIR}/default/TestDefaultDeviceType_b1.cpp ) @@ -473,9 +595,6 @@ if (Kokkos_ENABLE_OPENMP) openmp/TestOpenMP_Task.cpp openmp/TestOpenMP_PartitionMaster.cpp ) - if (Kokkos_ENABLE_DEPRECATED_CODE_3) - list(APPEND OpenMP_EXTRA_SOURCES openmp/TestOpenMP_Task.cpp) - endif () KOKKOS_ADD_EXECUTABLE_AND_TEST( UnitTest_OpenMP SOURCES @@ -531,6 +650,15 @@ if(Kokkos_ENABLE_OPENMPTARGET) ) endif() +if(Kokkos_ENABLE_OPENACC) + KOKKOS_ADD_EXECUTABLE_AND_TEST( + UnitTest_OpenACC + SOURCES + UnitTestMainInit.cpp + ${OpenACC_SOURCES} + ) +endif() + if(Kokkos_ENABLE_CUDA) KOKKOS_ADD_EXECUTABLE_AND_TEST( UnitTest_Cuda1 @@ -555,7 +683,8 @@ if(Kokkos_ENABLE_CUDA) cuda/TestCuda_TeamScratchStreams.cpp ${Cuda_SOURCES3} cuda/TestCuda_Spaces.cpp - ) + ${Cuda_SOURCES_SHAREDSPACE} + ) KOKKOS_ADD_EXECUTABLE_AND_TEST( UnitTest_CudaTimingBased @@ -695,32 +824,43 @@ if(Kokkos_ENABLE_SYCL) ) endif() -# FIXME_OPENMPTARGET - Comment non-passing tests with the NVIDIA HPC compiler nvc++ -if (KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) - SET(DEFAULT_DEVICE_SOURCES - UnitTestMainInit.cpp - TestInitializationSettings.cpp - TestParseCmdLineArgsAndEnvVars.cpp - default/TestDefaultDeviceType.cpp - ) -else() +SET(DEFAULT_DEVICE_SOURCES + UnitTestMainInit.cpp + TestInitializationSettings.cpp + TestParseCmdLineArgsAndEnvVars.cpp + TestSharedSpace.cpp + TestSharedHostPinnedSpace.cpp + default/TestDefaultDeviceType.cpp + default/TestDefaultDeviceType_a1.cpp + default/TestDefaultDeviceType_b1.cpp + default/TestDefaultDeviceType_c1.cpp + default/TestDefaultDeviceType_a2.cpp + default/TestDefaultDeviceType_b2.cpp + default/TestDefaultDeviceType_c2.cpp + default/TestDefaultDeviceType_a3.cpp + default/TestDefaultDeviceType_b3.cpp + default/TestDefaultDeviceType_c3.cpp + default/TestDefaultDeviceType_d.cpp + default/TestDefaultDeviceTypeResize.cpp + default/TestDefaultDeviceTypeViewAPI.cpp +) +# FIXME_OPENMPTARGET and FIXME_OPENACC do not provide a MemorySpace that can be accessed from all ExecSpaces +# FIXME_SYCL clock_tic does not give the correct timings for cloc_tic +if (KOKKOS_ENABLE_OPENACC OR KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_SYCL) + LIST(REMOVE_ITEM DEFAULT_DEVICE_SOURCES TestSharedSpace.cpp) +endif() +# FIXME_OPENMPTARGET and FIXME_OPENACC do not provide a HostPinnedMemorySpace that can be accessed from all ExecSpaces +if (KOKKOS_ENABLE_OPENACC OR KOKKOS_ENABLE_OPENMPTARGET) + LIST(REMOVE_ITEM DEFAULT_DEVICE_SOURCES TestSharedHostPinnedSpace.cpp) +endif() + +# FIXME_OPENMPTARGET, FIXME_OPENACC - Comment non-passing tests with the NVIDIA HPC compiler nvc++ +if ((KOKKOS_ENABLE_OPENMPTARGET OR KOKKOS_ENABLE_OPENACC) AND KOKKOS_CXX_COMPILER_ID STREQUAL NVHPC) SET(DEFAULT_DEVICE_SOURCES UnitTestMainInit.cpp TestInitializationSettings.cpp TestParseCmdLineArgsAndEnvVars.cpp default/TestDefaultDeviceType.cpp - default/TestDefaultDeviceType_a1.cpp - default/TestDefaultDeviceType_b1.cpp - default/TestDefaultDeviceType_c1.cpp - default/TestDefaultDeviceType_a2.cpp - default/TestDefaultDeviceType_b2.cpp - default/TestDefaultDeviceType_c2.cpp - default/TestDefaultDeviceType_a3.cpp - default/TestDefaultDeviceType_b3.cpp - default/TestDefaultDeviceType_c3.cpp - default/TestDefaultDeviceType_d.cpp - default/TestDefaultDeviceTypeResize.cpp - default/TestDefaultDeviceTypeViewAPI.cpp ) endif() @@ -729,6 +869,13 @@ KOKKOS_ADD_EXECUTABLE_AND_TEST( SOURCES ${DEFAULT_DEVICE_SOURCES} ) +KOKKOS_ADD_EXECUTABLE_AND_TEST( + UnitTest_LegionInitialization + SOURCES + UnitTestMain.cpp + TestLegionInitialization.cpp +) + KOKKOS_ADD_EXECUTABLE_AND_TEST( UnitTest_PushFinalizeHook SOURCES @@ -778,23 +925,31 @@ KOKKOS_ADD_ADVANCED_TEST( UnitTest_PushFinalizeHook_terminate tools/TestCategoricalTuner.cpp ) endif() - if(NOT Kokkos_ENABLE_OPENMPTARGET) + if((NOT Kokkos_ENABLE_OPENMPTARGET) AND (NOT Kokkos_ENABLE_OPENACC)) KOKKOS_ADD_EXECUTABLE_AND_TEST( UnitTest_LogicalSpaces SOURCES tools/TestLogicalSpaces.cpp ) endif() - if(NOT (KOKKOS_CXX_COMPILER_ID STREQUAL Intel AND KOKKOS_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)) - KOKKOS_ADD_EXECUTABLE_AND_TEST( - UnitTest_KokkosP - SOURCES + SET(KOKKOSP_SOURCES UnitTestMainInit.cpp tools/TestEventCorrectness.cpp tools/TestWithoutInitializing.cpp tools/TestProfilingSection.cpp - ) + ) + + # FIXME_OPENMPTARGET This test causes internal compiler errors as of 09/01/22 + # when compiling for Intel's Xe-HP GPUs. + if(KOKKOS_ENABLE_OPENMPTARGET AND KOKKOS_CXX_COMPILER_ID STREQUAL IntelLLVM) + list(REMOVE_ITEM KOKKOSP_SOURCES tools/TestEventCorrectness.cpp) endif() + + KOKKOS_ADD_EXECUTABLE_AND_TEST( + UnitTest_KokkosP + SOURCES + ${KOKKOSP_SOURCES} + ) if(KOKKOS_ENABLE_LIBDL) KOKKOS_ADD_EXECUTABLE_AND_TEST( UnitTest_ToolIndependence @@ -968,6 +1123,29 @@ KOKKOS_ADD_EXECUTABLE_AND_TEST( ARGS "one 2 THREE" ) +# This test is not properly set up to run within Trilinos +if (NOT KOKKOS_HAS_TRILINOS) + add_executable(KokkosCore_UnitTest_DeviceAndThreads UnitTest_DeviceAndThreads.cpp) + target_link_libraries(KokkosCore_UnitTest_DeviceAndThreads Kokkos::kokkoscore) + find_package(Python3 COMPONENTS Interpreter) + if(Python3_Interpreter_FOUND AND Python3_VERSION VERSION_GREATER_EQUAL 3.7) + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20) + set(USE_SOURCE_PERMISSIONS_WHEN_SUPPORTED USE_SOURCE_PERMISSIONS) + endif() + file(GENERATE + OUTPUT $<TARGET_FILE_DIR:KokkosCore_UnitTest_DeviceAndThreads>/TestDeviceAndThreads.py + INPUT TestDeviceAndThreads.py + ${USE_SOURCE_PERMISSIONS_WHEN_SUPPORTED} + ) + if(NOT Kokkos_ENABLE_OPENMPTARGET) # FIXME_OPENMPTARGET does not select the right device + add_test( + NAME KokkosCore_UnitTest_DeviceAndThreads + COMMAND ${Python3_EXECUTABLE} -m unittest -v $<TARGET_FILE_DIR:KokkosCore_UnitTest_DeviceAndThreads>/TestDeviceAndThreads.py + ) + endif() + endif() +endif() + if (KOKKOS_ENABLE_HEADER_SELF_CONTAINMENT_TESTS AND NOT KOKKOS_HAS_TRILINOS AND NOT WIN32) add_subdirectory(headers_self_contained) endif() diff --git a/packages/kokkos/core/unit_test/IncrementalTest.cpp.in b/packages/kokkos/core/unit_test/IncrementalTest.cpp.in index e4358efe9dd8683e025b5a2be67a4e9bd83e7552..b12182e988e3cf58c73ffba69564101ac8d41b03 100644 --- a/packages/kokkos/core/unit_test/IncrementalTest.cpp.in +++ b/packages/kokkos/core/unit_test/IncrementalTest.cpp.in @@ -1,43 +1,17 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER #ifndef KOKKOS_TEST_@BACK_END_NAME@_@CURRENT_TEST_NAME@ diff --git a/packages/kokkos/core/unit_test/Makefile b/packages/kokkos/core/unit_test/Makefile index 0c3e1ee4767e1b70664de385eef8c2cd2c023243..05be2252658682cc3bc716b2f292910639cf3c5f 100644 --- a/packages/kokkos/core/unit_test/Makefile +++ b/packages/kokkos/core/unit_test/Makefile @@ -409,15 +409,6 @@ TEST_TARGETS += test-stack-trace TEST_TARGETS += test-stack-trace-terminate TEST_TARGETS += test-stack-trace-generic-term -ifneq ($(KOKKOS_INTERNAL_DISABLE_DEPRECATED_CODE), 1) -NUM_INITTESTS = 16 -INITTESTS_NUMBERS := $(shell seq 1 ${NUM_INITTESTS}) -INITTESTS_TARGETS := $(addprefix KokkosCore_UnitTest_DefaultDeviceTypeInit_,${INITTESTS_NUMBERS}) -TARGETS += ${INITTESTS_TARGETS} -INITTESTS_TEST_TARGETS := $(addprefix test-default-init-,${INITTESTS_NUMBERS}) -TEST_TARGETS += ${INITTESTS_TEST_TARGETS} -endif - KokkosCore_UnitTest_Cuda: $(OBJ_CUDA) $(KOKKOS_LINK_DEPENDS) $(LINK) $(EXTRA_PATH) $(OBJ_CUDA) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_Cuda @@ -465,10 +456,6 @@ KokkosCore_UnitTest_PushFinalizeHook: $(OBJ_DEFAULT) $(KOKKOS_LINK_DEPENDS) KokkosCore_UnitTest_PushFinalizeHook_terminate: $(OBJ_DEFAULT) $(KOKKOS_LINK_DEPENDS) $(LINK) $(EXTRA_PATH) $(OBJ_DEFAULT) $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_PushFinalizeHook_terminate - -${INITTESTS_TARGETS}: KokkosCore_UnitTest_DefaultDeviceTypeInit_%: TestDefaultDeviceTypeInit_%.o UnitTestMain.o gtest-all.o $(KOKKOS_LINK_DEPENDS) - $(LINK) $(EXTRA_PATH) TestDefaultDeviceTypeInit_$*.o UnitTestMain.o gtest-all.o $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_DefaultDeviceTypeInit_$* - KokkosCore_UnitTest_StackTraceTestExec: TestStackTrace.o TestStackTrace_f0.o TestStackTrace_f1.o TestStackTrace_f2.o TestStackTrace_f3.o TestStackTrace_f4.o $(KOKKOS_LINK_DEPENDS) gtest-all.o $(LINK) $(EXTRA_PATH) TestStackTrace.o TestStackTrace_f0.o TestStackTrace_f1.o TestStackTrace_f2.o TestStackTrace_f3.o TestStackTrace_f4.o gtest-all.o $(KOKKOS_LIBS) $(LIB) $(KOKKOS_LDFLAGS) $(LDFLAGS) -o KokkosCore_UnitTest_StackTraceTestExec @@ -521,10 +508,6 @@ test-stack-trace-terminate: KokkosCore_UnitTest_StackTraceTestExec test-stack-trace-generic-term: KokkosCore_UnitTest_StackTraceTestExec ./KokkosCore_UnitTest_StackTraceTestExec --gtest_filter=*generic_term$(STACK_TRACE_TERMINATE_FILTER) - -${INITTESTS_TEST_TARGETS}: test-default-init-%: KokkosCore_UnitTest_DefaultDeviceTypeInit_% - ./KokkosCore_UnitTest_DefaultDeviceTypeInit_$* - build_all: $(TARGETS) test: $(TEST_TARGETS) diff --git a/packages/kokkos/core/unit_test/TestAbort.hpp b/packages/kokkos/core/unit_test/TestAbort.hpp index 58da329c39930822a53ffa0f87bcf56040c71b96..63e9bdc6e23606398b5a2bc9d32c927cf8d5c950 100644 --- a/packages/kokkos/core/unit_test/TestAbort.hpp +++ b/packages/kokkos/core/unit_test/TestAbort.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -119,13 +91,6 @@ void test_abort_from_device() { } else { TestAbortCausingAbnormalProgramTerminationAndPrinting<ExecutionSpace>(); } -#elif defined(KOKKOS_IMPL_HIP_ABORT_DOES_NOT_PRINT_MESSAGE) - if (std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value) { - TestAbortCausingAbnormalProgramTerminationButIgnoringErrorMessage< - ExecutionSpace>(); - } else { - TestAbortCausingAbnormalProgramTerminationAndPrinting<ExecutionSpace>(); - } #else TestAbortCausingAbnormalProgramTerminationAndPrinting<ExecutionSpace>(); #endif diff --git a/packages/kokkos/core/unit_test/TestAggregate.hpp b/packages/kokkos/core/unit_test/TestAggregate.hpp index d21e6f46da8d253671b6fac73d4d028cc0ee9cf2..23cc5860ac906b9777cb7d8a2c9747709c817735 100644 --- a/packages/kokkos/core/unit_test/TestAggregate.hpp +++ b/packages/kokkos/core/unit_test/TestAggregate.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TEST_AGGREGATE_HPP #define TEST_AGGREGATE_HPP diff --git a/packages/kokkos/core/unit_test/TestArray.cpp b/packages/kokkos/core/unit_test/TestArray.cpp index ca93918e062718a82a9d86022055e8e501f362f1..d3bdc4f93f7b81c2c78d69a51ed4739ecd641935 100644 --- a/packages/kokkos/core/unit_test/TestArray.cpp +++ b/packages/kokkos/core/unit_test/TestArray.cpp @@ -1,69 +1,38 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Array.hpp> namespace { -#define STATIC_ASSERT(cond) static_assert(cond, "") - KOKKOS_FUNCTION constexpr bool test_array() { constexpr Kokkos::Array<int, 3> a{{1, 2}}; - STATIC_ASSERT(!a.empty()); - STATIC_ASSERT(a.size() == 3); - STATIC_ASSERT(a.max_size() == 3); + static_assert(!a.empty()); + static_assert(a.size() == 3); + static_assert(a.max_size() == 3); - STATIC_ASSERT(*a.data() == 1); - STATIC_ASSERT(a[1] == 2); + static_assert(*a.data() == 1); + static_assert(a[1] == 2); return true; } -STATIC_ASSERT(test_array()); +static_assert(test_array()); -#ifdef KOKKOS_ENABLE_CXX17 KOKKOS_FUNCTION constexpr bool test_array_structured_binding_support() { constexpr Kokkos::Array<float, 2> a{}; auto& [xr, yr] = a; @@ -78,7 +47,6 @@ KOKKOS_FUNCTION constexpr bool test_array_structured_binding_support() { return true; } -STATIC_ASSERT(test_array_structured_binding_support()); -#endif +static_assert(test_array_structured_binding_support()); } // namespace diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations.hpp index ab9b970be126b83a90c84a9f1b6ba05b2f2c78d0..b8940378bdf769dd251855087ac629c54f54c867 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_complexdouble.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_complexdouble.hpp index 612247d03fa7f823bbe7699b15d5a0bf65fe2db6..9f55aa947b3d5ce006c859965eabf172bfb529c1 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_complexdouble.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_complexdouble.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_complexfloat.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_complexfloat.hpp index e812d32074c0213c8547fed4353e0d3898b2adeb..b23e55a339ee45de4353683b8cd3e4194966a86b 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_complexfloat.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_complexfloat.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_double.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_double.hpp index 303f5b6eb9f77c3767056ac2639122d4b01b9d7a..0dea91f4165a400e9b80a7bac14684ca365b4e1d 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_double.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_double.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_float.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_float.hpp index d3d4916b4ea6d623b010834627f41ebf65161ff7..23348f20ec9fcdd7be42977080fe4b25c2a9cb4a 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_float.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_float.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_int.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_int.hpp index e5f2f334fc2b07e24ed5f77d75a64947c2117e21..31cddf20baa438fcd5330b7e5b3ffa39db951a80 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_int.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_int.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_longint.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_longint.hpp index d4fda70e80cff156aa58bc0294c66be38729f745..3171e61018f337185c7335f076b7eca8b2d576e1 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_longint.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_longint.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_longlongint.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_longlongint.hpp index b7fb0cdae5f99f6704dbdd18c2554bcb6b3e5ddf..f7bef416d6344ef2f0df6158b99b28d5331f5a85 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_longlongint.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_longlongint.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_shared.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_shared.hpp index 08f4782ce18e9b9f774aa891f9878da3be6d12ef..90b3e23c3c24148d579b9a15d6f9c7877ac7c011 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_shared.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_shared.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedint.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedint.hpp index 75b354c7a3e0e8ea2db6e9b0fc1ef9e89cf941bc..31b2693d64871c90d29a5f13fac940836cb1732b 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedint.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedint.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedlongint.hpp b/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedlongint.hpp index d7e90033c378790f7dc0aec6126840988605590a..98c2d28b20d7c3a5c207e3789eb8c9322406115a 100644 --- a/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedlongint.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicOperations_unsignedlongint.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestAtomicOperations.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomicViews.hpp b/packages/kokkos/core/unit_test/TestAtomicViews.hpp index 916dc949bcfb2140197d213fe3a52e4239f19f76..7f50b6dd717c58065eba606e2fb78fe270435e0b 100644 --- a/packages/kokkos/core/unit_test/TestAtomicViews.hpp +++ b/packages/kokkos/core/unit_test/TestAtomicViews.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestAtomics.hpp b/packages/kokkos/core/unit_test/TestAtomics.hpp index 0db2c735a78e6dc888e6f2a7388b027994317af2..e5866bb89baf229d5347c9e9903382571ac0574d 100644 --- a/packages/kokkos/core/unit_test/TestAtomics.hpp +++ b/packages/kokkos/core/unit_test/TestAtomics.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestBlockSizeDeduction.hpp b/packages/kokkos/core/unit_test/TestBlockSizeDeduction.hpp index d29e3737c6ee84eaccab66634430f0b4b058b3bc..43cee3cd5ef40763c58b89fafc25357cde4f450d 100644 --- a/packages/kokkos/core/unit_test/TestBlockSizeDeduction.hpp +++ b/packages/kokkos/core/unit_test/TestBlockSizeDeduction.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TEST_BLOCK_SIZE_DEDUCTION_HPP #define TEST_BLOCK_SIZE_DEDUCTION_HPP @@ -62,7 +34,7 @@ void test_bug_pr_3103() { using Policy = Kokkos::TeamPolicy<ExecutionSpace, Kokkos::LaunchBounds<32, 1>>; int const league_size = 1; - int const team_size = std::min(32, ExecutionSpace::concurrency()); + int const team_size = std::min(32, ExecutionSpace().concurrency()); int const vector_length = 1; Kokkos::parallel_for(Policy(league_size, team_size, vector_length), diff --git a/packages/kokkos/core/unit_test/TestCTestDevice.cpp b/packages/kokkos/core/unit_test/TestCTestDevice.cpp index 247981c5ce5ed5d486084a77ca290b170a91e1ab..5be4714f9eaf9e60a2d3d491954589097f17b9d8 100644 --- a/packages/kokkos/core/unit_test/TestCTestDevice.cpp +++ b/packages/kokkos/core/unit_test/TestCTestDevice.cpp @@ -1,12 +1,22 @@ -#include <gtest/gtest.h> - -namespace Kokkos { -namespace Impl { +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER -int get_ctest_gpu(const char *local_rank_str); +#include <gtest/gtest.h> -} // namespace Impl -} // namespace Kokkos +#include <impl/Kokkos_DeviceManagement.hpp> // get_ctest_gpu #ifdef _WIN32 int setenv(const char *name, const char *value, int overwrite) { @@ -68,60 +78,60 @@ void ctest_environment::SetUp() { TEST_F(ctest_environment, no_device_type) { unsetenv("CTEST_KOKKOS_DEVICE_TYPE"); - EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("0"), 0); + EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(0), 0); } TEST_F(ctest_environment, no_process_count) { unsetenv("CTEST_RESOURCE_GROUP_COUNT"); - EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("0"), 0); + EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(0), 0); } TEST_F(ctest_environment, invalid_rank) { EXPECT_THROW_WITH_MESSAGE( - Kokkos::Impl::get_ctest_gpu("10"), std::runtime_error, + Kokkos::Impl::get_ctest_gpu(10), std::runtime_error, "Error: local rank 10 is outside the bounds of resource groups provided " "by CTest."); } TEST_F(ctest_environment, no_type_str) { EXPECT_THROW_WITH_MESSAGE( - Kokkos::Impl::get_ctest_gpu("0"), std::runtime_error, + Kokkos::Impl::get_ctest_gpu(0), std::runtime_error, "Error: CTEST_RESOURCE_GROUP_0 is not specified. Raised by " "Kokkos::Impl::get_ctest_gpu()."); } TEST_F(ctest_environment, missing_type) { EXPECT_THROW_WITH_MESSAGE( - Kokkos::Impl::get_ctest_gpu("1"), std::runtime_error, + Kokkos::Impl::get_ctest_gpu(1), std::runtime_error, "Error: device type 'gpus' not included in CTEST_RESOURCE_GROUP_1. " "Raised by Kokkos::Impl::get_ctest_gpu()."); EXPECT_THROW_WITH_MESSAGE( - Kokkos::Impl::get_ctest_gpu("2"), std::runtime_error, + Kokkos::Impl::get_ctest_gpu(2), std::runtime_error, "Error: device type 'gpus' not included in CTEST_RESOURCE_GROUP_2. " "Raised by Kokkos::Impl::get_ctest_gpu()."); } TEST_F(ctest_environment, no_id_str) { EXPECT_THROW_WITH_MESSAGE( - Kokkos::Impl::get_ctest_gpu("3"), std::runtime_error, + Kokkos::Impl::get_ctest_gpu(3), std::runtime_error, "Error: CTEST_RESOURCE_GROUP_3_GPUS is not specified. Raised by " "Kokkos::Impl::get_ctest_gpu()."); } TEST_F(ctest_environment, invalid_id_str) { EXPECT_THROW_WITH_MESSAGE( - Kokkos::Impl::get_ctest_gpu("4"), std::runtime_error, + Kokkos::Impl::get_ctest_gpu(4), std::runtime_error, "Error: invalid value of CTEST_RESOURCE_GROUP_4_GPUS: 'id:2'. Raised by " "Kokkos::Impl::get_ctest_gpu()."); EXPECT_THROW_WITH_MESSAGE( - Kokkos::Impl::get_ctest_gpu("5"), std::runtime_error, + Kokkos::Impl::get_ctest_gpu(5), std::runtime_error, "Error: invalid value of CTEST_RESOURCE_GROUP_5_GPUS: 'slots:1,id:2'. " "Raised by Kokkos::Impl::get_ctest_gpu()."); } TEST_F(ctest_environment, good) { - EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("6"), 2); - EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("7"), 3); - EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("8"), 1); - EXPECT_EQ(Kokkos::Impl::get_ctest_gpu("9"), 4); + EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(6), 2); + EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(7), 3); + EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(8), 1); + EXPECT_EQ(Kokkos::Impl::get_ctest_gpu(9), 4); } diff --git a/packages/kokkos/core/unit_test/TestCXX11.hpp b/packages/kokkos/core/unit_test/TestCXX11.hpp index 3dbce28ad1065768d3d8e18096c74053c0653a6c..b35de9a3a04fde59a9591aee190fe6c0c960343b 100644 --- a/packages/kokkos/core/unit_test/TestCXX11.hpp +++ b/packages/kokkos/core/unit_test/TestCXX11.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestCXX11Deduction.hpp b/packages/kokkos/core/unit_test/TestCXX11Deduction.hpp index c7efab2711f283c02fad350bd5a8163ebc4b3a91..758d76996b57ae4eb339bc7d3de81b43474b1a7c 100644 --- a/packages/kokkos/core/unit_test/TestCXX11Deduction.hpp +++ b/packages/kokkos/core/unit_test/TestCXX11Deduction.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestCommonPolicyConstructors.hpp b/packages/kokkos/core/unit_test/TestCommonPolicyConstructors.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ec5d1ae0f46fad54a228f08c8caa052408259be5 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestCommonPolicyConstructors.hpp @@ -0,0 +1,113 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <Kokkos_Core.hpp> + +namespace { + +// Dummy policy for testing base class. +template <class... Args> +struct DummyPolicy : Kokkos::Impl::PolicyTraits<Args...> { + using execution_policy = DummyPolicy; +}; + +// Asserts that a policy constructor is semiregular. +// Semiregular is copyable and default initializable +// (regular requires equality comparable). +template <class Policy> +constexpr bool check_semiregular() { + static_assert(std::is_default_constructible_v<Policy>); + static_assert(std::is_copy_constructible_v<Policy>); + static_assert(std::is_move_constructible_v<Policy>); + static_assert(std::is_copy_assignable_v<Policy>); + static_assert(std::is_move_assignable_v<Policy>); + static_assert(std::is_destructible_v<Policy>); + + return true; +} + +static_assert(check_semiregular<DummyPolicy<>>()); +static_assert(check_semiregular<Kokkos::RangePolicy<>>()); +static_assert(check_semiregular<Kokkos::TeamPolicy<>>()); +static_assert(check_semiregular<Kokkos::MDRangePolicy<Kokkos::Rank<2>>>()); + +// Assert that occupancy conversion and hints work properly. +template <class Policy> +void test_prefer_desired_occupancy() { + Policy policy; + + using Kokkos::Experimental::DesiredOccupancy; + using Kokkos::Experimental::MaximizeOccupancy; + using Kokkos::Experimental::prefer; + using Kokkos::Experimental::WorkItemProperty; + + static_assert(!Policy::experimental_contains_desired_occupancy); + + // MaximizeOccupancy -> MaximizeOccupancy + auto const policy_still_no_occ = prefer(policy, MaximizeOccupancy{}); + static_assert( + !decltype(policy_still_no_occ)::experimental_contains_desired_occupancy); + + // MaximizeOccupancy -> DesiredOccupancy + auto const policy_with_occ = + prefer(policy_still_no_occ, DesiredOccupancy{33}); + static_assert( + decltype(policy_with_occ)::experimental_contains_desired_occupancy); + EXPECT_EQ(policy_with_occ.impl_get_desired_occupancy().value(), 33); + + // DesiredOccupancy -> DesiredOccupancy + auto const policy_change_occ = prefer(policy_with_occ, DesiredOccupancy{24}); + static_assert( + decltype(policy_change_occ)::experimental_contains_desired_occupancy); + EXPECT_EQ(policy_change_occ.impl_get_desired_occupancy().value(), 24); + + // DesiredOccupancy -> DesiredOccupancy w/ hint + auto policy_with_occ_and_hint = Kokkos::Experimental::require( + policy_change_occ, + Kokkos::Experimental::WorkItemProperty::HintLightWeight); + EXPECT_EQ(policy_with_occ_and_hint.impl_get_desired_occupancy().value(), 24); + + // DesiredOccupancy -> MaximizeOccupancy + auto const policy_drop_occ = + prefer(policy_with_occ_and_hint, MaximizeOccupancy{}); + static_assert( + !decltype(policy_drop_occ)::experimental_contains_desired_occupancy); +} + +TEST(TEST_CATEGORY, execution_policy_occupancy_and_hint) { + test_prefer_desired_occupancy<DummyPolicy<>>(); + test_prefer_desired_occupancy<Kokkos::RangePolicy<>>(); + test_prefer_desired_occupancy<Kokkos::TeamPolicy<>>(); + test_prefer_desired_occupancy<Kokkos::MDRangePolicy<Kokkos::Rank<2>>>(); +} + +// Check that the policy size does not increase if the user does not specify the +// occupancy (only pay for what you use). +// Disabling since EBO was not working with VS 16.11.3 and CUDA 11.4.2 +#if !(defined(_WIN32) && defined(KOKKOS_ENABLE_CUDA)) +constexpr bool test_empty_base_optimization() { + DummyPolicy<> policy; + static_assert(sizeof(decltype(policy)) == 1); + using Kokkos::Experimental::DesiredOccupancy; + using Kokkos::Experimental::prefer; + static_assert(sizeof(decltype(prefer(policy, DesiredOccupancy{33}))) == + sizeof(DesiredOccupancy)); + return true; +} +static_assert(test_empty_base_optimization()); +#endif + +} // namespace diff --git a/packages/kokkos/core/unit_test/TestCommonPolicyInterface.hpp b/packages/kokkos/core/unit_test/TestCommonPolicyInterface.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1828e99b0b308739f6f304fd7b04fcb44ee7ef96 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestCommonPolicyInterface.hpp @@ -0,0 +1,111 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <Kokkos_Core.hpp> + +namespace { + +template <typename Policy, typename ExpectedExecutionSpace, + typename ExpectedIndexType, typename ExpectedScheduleType, + typename ExpectedWorkTag> +constexpr bool compile_time_test() { + using execution_space = typename Policy::execution_space; + using index_type = typename Policy::index_type; + using schedule_type = typename Policy::schedule_type; + using work_tag = typename Policy::work_tag; + + static_assert(std::is_same_v<execution_space, ExpectedExecutionSpace>); + static_assert(std::is_same_v<index_type, ExpectedIndexType>); + static_assert(std::is_same_v<schedule_type, ExpectedScheduleType>); + static_assert(std::is_same_v<work_tag, ExpectedWorkTag>); + + return true; +} + +// Separate class type from class template args so that different +// combinations of template args can be used, while still including +// any necessary templates args (stored in "Args..."). +// Example: MDRangePolicy required an iteration pattern be included. +template <template <class...> class PolicyType, class... Args> +constexpr bool test_compile_time_parameters() { + struct SomeTag {}; + + using TestExecSpace = TEST_EXECSPACE; + using DefaultExecSpace = Kokkos::DefaultExecutionSpace; + using TestIndex = TestExecSpace::size_type; + using DefaultIndex = DefaultExecSpace::size_type; + using LongIndex = Kokkos::IndexType<long>; + using StaticSchedule = Kokkos::Schedule<Kokkos::Static>; + using DynamicSchedule = Kokkos::Schedule<Kokkos::Dynamic>; + + // clang-format off + compile_time_test<PolicyType< Args...>, DefaultExecSpace, DefaultIndex, StaticSchedule, void >(); + compile_time_test<PolicyType<TestExecSpace, Args...>, TestExecSpace, TestIndex, StaticSchedule, void >(); + compile_time_test<PolicyType<DynamicSchedule, Args...>, DefaultExecSpace, DefaultIndex, DynamicSchedule, void >(); + compile_time_test<PolicyType<TestExecSpace, DynamicSchedule, Args...>, TestExecSpace, TestIndex, DynamicSchedule, void >(); + compile_time_test<PolicyType<DynamicSchedule, LongIndex, Args...>, DefaultExecSpace, long, DynamicSchedule, void >(); + compile_time_test<PolicyType<LongIndex, DynamicSchedule, Args...>, DefaultExecSpace, long, DynamicSchedule, void >(); + compile_time_test<PolicyType<TestExecSpace, DynamicSchedule, LongIndex, Args...>, TestExecSpace, long, DynamicSchedule, void >(); + compile_time_test<PolicyType<LongIndex, TestExecSpace, DynamicSchedule, Args...>, TestExecSpace, long, DynamicSchedule, void >(); + compile_time_test<PolicyType<DynamicSchedule, LongIndex, SomeTag, Args...>, DefaultExecSpace, long, DynamicSchedule, SomeTag>(); + compile_time_test<PolicyType<SomeTag, DynamicSchedule, LongIndex, Args...>, DefaultExecSpace, long, DynamicSchedule, SomeTag>(); + compile_time_test<PolicyType<TestExecSpace, DynamicSchedule, LongIndex, SomeTag, Args...>, TestExecSpace, long, DynamicSchedule, SomeTag>(); + compile_time_test<PolicyType<DynamicSchedule, TestExecSpace, LongIndex, SomeTag, Args...>, TestExecSpace, long, DynamicSchedule, SomeTag>(); + compile_time_test<PolicyType<SomeTag, DynamicSchedule, LongIndex, TestExecSpace, Args...>, TestExecSpace, long, DynamicSchedule, SomeTag>(); + // clang-format on + + return true; +} + +static_assert(test_compile_time_parameters<Kokkos::RangePolicy>()); +static_assert(test_compile_time_parameters<Kokkos::TeamPolicy>()); +static_assert( + test_compile_time_parameters<Kokkos::MDRangePolicy, Kokkos::Rank<2>>()); + +// Asserts that worktag conversion works properly. +template <class Policy> +constexpr bool test_worktag() { + struct WorkTag1 {}; + struct WorkTag2 {}; + + // Apply WorkTag1 + using PolicyWithWorkTag1 = + Kokkos::Impl::WorkTagTrait::policy_with_trait<Policy, WorkTag1>; + // Swap for WorkTag2 + using PolicyWithWorkTag2 = + Kokkos::Impl::WorkTagTrait::policy_with_trait<PolicyWithWorkTag1, + WorkTag2>; + + static_assert(std::is_void_v<typename Policy::work_tag>); + static_assert( + std::is_same_v<typename PolicyWithWorkTag1::work_tag, WorkTag1>); + static_assert( + std::is_same_v<typename PolicyWithWorkTag2::work_tag, WorkTag2>); + + // Currently not possible to remove the work tag from a policy. + // Uncomment the line below to see the compile error. + // using PolicyRemoveWorkTag = + // Kokkos::Impl::WorkTagTrait::policy_with_trait<PolicyWithWorkTag2, void>; + // static_assert(std::is_void_v<PolicyRemoveWorkTag::work_tag>); + + return true; +} + +static_assert(test_worktag<Kokkos::RangePolicy<>>()); +static_assert(test_worktag<Kokkos::TeamPolicy<>>()); +static_assert(test_worktag<Kokkos::MDRangePolicy<Kokkos::Rank<2>>>()); + +} // namespace diff --git a/packages/kokkos/core/unit_test/TestCompileMain.cpp b/packages/kokkos/core/unit_test/TestCompileMain.cpp index 237c8ce181774d991a9dbdd8cacf1a5fb9f199f1..fe164b5ba81e800e28eeba16670a9463de53cacb 100644 --- a/packages/kokkos/core/unit_test/TestCompileMain.cpp +++ b/packages/kokkos/core/unit_test/TestCompileMain.cpp @@ -1 +1,17 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + int main() {} diff --git a/packages/kokkos/core/unit_test/TestCompilerMacros.hpp b/packages/kokkos/core/unit_test/TestCompilerMacros.hpp index 273e87ccc3f140b2648b78de49a7ab512d26cd6b..9d22c4b0a777038df4bf8662fb0c7ac582f42d58 100644 --- a/packages/kokkos/core/unit_test/TestCompilerMacros.hpp +++ b/packages/kokkos/core/unit_test/TestCompilerMacros.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> @@ -80,11 +52,6 @@ struct AddFunctor { #endif #ifdef KOKKOS_ENABLE_PRAGMA_LOOPCOUNT #pragma loop count(128) -#endif -#ifndef KOKKOS_ENABLE_DEBUG -#ifdef KOKKOS_ENABLE_PRAGMA_SIMD -#pragma simd -#endif #endif for (int j = 0; j < length; j++) { a(i, j) += b(i, j); diff --git a/packages/kokkos/core/unit_test/TestComplex.hpp b/packages/kokkos/core/unit_test/TestComplex.hpp index cd4298f8e016922dd3f98e53d79094f6a9d28020..87085f3648e58ca9e4f8d1b086b90e19d8fba797 100644 --- a/packages/kokkos/core/unit_test/TestComplex.hpp +++ b/packages/kokkos/core/unit_test/TestComplex.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> @@ -112,9 +84,9 @@ struct TestComplexConstruction { d_results(2) = c; Kokkos::complex<double> d(3.5); d_results(3) = d; - volatile Kokkos::complex<double> a_v(4.5, 5.5); + Kokkos::complex<double> a_v(4.5, 5.5); d_results(4) = a_v; - volatile Kokkos::complex<double> b_v(a); + Kokkos::complex<double> b_v(a); d_results(5) = b_v; Kokkos::complex<double> e(a_v); d_results(6) = e; @@ -425,15 +397,11 @@ TEST(TEST_CATEGORY, complex_io) { testComplexIO(); } TEST(TEST_CATEGORY, complex_trivially_copyable) { // Kokkos::complex<RealType> is trivially copyable when RealType is // trivially copyable - // Simply disable the check for IBM's XL compiler since we can't reliably - // check for a version that defines relevant functions. -#if !defined(__ibmxl__) using RealType = double; // clang claims compatibility with gcc 4.2.1 but all versions tested know // about std::is_trivially_copyable. ASSERT_TRUE(std::is_trivially_copyable<Kokkos::complex<RealType>>::value || !std::is_trivially_copyable<RealType>::value); -#endif } template <class ExecSpace> @@ -527,26 +495,24 @@ TEST(TEST_CATEGORY, complex_issue_3867) { #endif TEST(TEST_CATEGORY, complex_operations_arithmetic_types_overloads) { -#define STATIC_ASSERT(cond) static_assert(cond, "") - - STATIC_ASSERT(Kokkos::real(1) == 1.); - STATIC_ASSERT(Kokkos::real(2.f) == 2.f); - STATIC_ASSERT(Kokkos::real(3.) == 3.); - STATIC_ASSERT(Kokkos::real(4.l) == 4.l); - STATIC_ASSERT((std::is_same<decltype(Kokkos::real(1)), double>::value)); - STATIC_ASSERT((std::is_same<decltype(Kokkos::real(2.f)), float>::value)); - STATIC_ASSERT((std::is_same<decltype(Kokkos::real(3.)), double>::value)); - STATIC_ASSERT( + static_assert(Kokkos::real(1) == 1.); + static_assert(Kokkos::real(2.f) == 2.f); + static_assert(Kokkos::real(3.) == 3.); + static_assert(Kokkos::real(4.l) == 4.l); + static_assert((std::is_same<decltype(Kokkos::real(1)), double>::value)); + static_assert((std::is_same<decltype(Kokkos::real(2.f)), float>::value)); + static_assert((std::is_same<decltype(Kokkos::real(3.)), double>::value)); + static_assert( (std::is_same<decltype(Kokkos::real(4.l)), long double>::value)); - STATIC_ASSERT(Kokkos::imag(1) == 0.); - STATIC_ASSERT(Kokkos::imag(2.f) == 0.f); - STATIC_ASSERT(Kokkos::imag(3.) == 0.); - STATIC_ASSERT(Kokkos::imag(4.l) == 0.l); - STATIC_ASSERT((std::is_same<decltype(Kokkos::imag(1)), double>::value)); - STATIC_ASSERT((std::is_same<decltype(Kokkos::imag(2.f)), float>::value)); - STATIC_ASSERT((std::is_same<decltype(Kokkos::imag(3.)), double>::value)); - STATIC_ASSERT( + static_assert(Kokkos::imag(1) == 0.); + static_assert(Kokkos::imag(2.f) == 0.f); + static_assert(Kokkos::imag(3.) == 0.); + static_assert(Kokkos::imag(4.l) == 0.l); + static_assert((std::is_same<decltype(Kokkos::imag(1)), double>::value)); + static_assert((std::is_same<decltype(Kokkos::imag(2.f)), float>::value)); + static_assert((std::is_same<decltype(Kokkos::imag(3.)), double>::value)); + static_assert( (std::is_same<decltype(Kokkos::real(4.l)), long double>::value)); // FIXME in principle could be checked at compile time too @@ -554,16 +520,14 @@ TEST(TEST_CATEGORY, complex_operations_arithmetic_types_overloads) { ASSERT_EQ(Kokkos::conj(2.f), Kokkos::complex<float>(2.f)); ASSERT_EQ(Kokkos::conj(3.), Kokkos::complex<double>(3.)); ASSERT_EQ(Kokkos::conj(4.l), Kokkos::complex<long double>(4.l)); - STATIC_ASSERT(( + static_assert(( std::is_same<decltype(Kokkos::conj(1)), Kokkos::complex<double>>::value)); - STATIC_ASSERT((std::is_same<decltype(Kokkos::conj(2.f)), + static_assert((std::is_same<decltype(Kokkos::conj(2.f)), Kokkos::complex<float>>::value)); - STATIC_ASSERT((std::is_same<decltype(Kokkos::conj(3.)), + static_assert((std::is_same<decltype(Kokkos::conj(3.)), Kokkos::complex<double>>::value)); - STATIC_ASSERT((std::is_same<decltype(Kokkos::conj(4.l)), + static_assert((std::is_same<decltype(Kokkos::conj(4.l)), Kokkos::complex<long double>>::value)); - -#undef STATIC_ASSERT } } // namespace Test diff --git a/packages/kokkos/core/unit_test/TestConcepts.hpp b/packages/kokkos/core/unit_test/TestConcepts.hpp index 561302f2a0f863e5857727b821a9f07867058f53..476a8848325c0375cecaadffc773e623ac17f997 100644 --- a/packages/kokkos/core/unit_test/TestConcepts.hpp +++ b/packages/kokkos/core/unit_test/TestConcepts.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> @@ -78,10 +50,165 @@ static_assert(!Kokkos::is_space<ExecutionSpace &>{}, ""); static_assert(!Kokkos::is_space<MemorySpace &>{}, ""); static_assert(!Kokkos::is_space<DeviceType &>{}, ""); +static_assert(Kokkos::is_execution_space_v<ExecutionSpace>, ""); +static_assert(!Kokkos::is_execution_space_v<ExecutionSpace &>, ""); + static_assert( std::is_same<float, Kokkos::Impl::remove_cvref_t<float const &>>{}, ""); static_assert(std::is_same<int, Kokkos::Impl::remove_cvref_t<int &>>{}, ""); static_assert(std::is_same<int, Kokkos::Impl::remove_cvref_t<int const>>{}, ""); static_assert(std::is_same<float, Kokkos::Impl::remove_cvref_t<float>>{}, ""); +/*------------------------------------------------- + begin test for team_handle concept + + Here we also provide a complete trait that follows the full concept specified + in: + https://github.com/kokkos/kokkos/blob/61d7db55fceac3318c987a291f77b844fd94c165/core/src/Kokkos_Concepts.hpp#L160 + but this is not used as implementation for performance reasons as discussed + in: https://github.com/kokkos/kokkos/pull/5375 + ------------------------------------------------- */ + +template <typename T> +struct is_team_handle_complete_trait_check { + private: + struct TrivialFunctor { + void operator()(double &) {} + }; + using test_value_type = double; + test_value_type lvalueForMethodsNeedingIt_; + test_value_type *ptrForMethodsNeedingIt_; + // we use Sum here but any other reducer can be used + // since we just want something that meets the ReducerConcept + using reduction_to_test_t = ::Kokkos::Sum<test_value_type>; + + // nested aliases + template <class U> + using ExecutionSpaceArchetypeAlias = typename U::execution_space; + template <class U> + using ScratchMemorySpaceArchetypeAlias = typename U::scratch_memory_space; + + // "indices" methods + template <class U> + using TeamRankArchetypeExpr = decltype(std::declval<U const &>().team_rank()); + + template <class U> + using TeamSizeArchetypeExpr = decltype(std::declval<U const &>().team_size()); + + template <class U> + using LeagueRankArchetypeExpr = + decltype(std::declval<U const &>().league_rank()); + + template <class U> + using LeagueSizeArchetypeExpr = + decltype(std::declval<U const &>().league_size()); + + // scratch space + template <class U> + using TeamShmemArchetypeExpr = + decltype(std::declval<U const &>().team_shmem()); + + template <class U> + using TeamScratchArchetypeExpr = + decltype(std::declval<U const &>().team_scratch(0)); + + template <class U> + using ThreadScracthArchetypeExpr = + decltype(std::declval<U const &>().thread_scratch(0)); + + // collectives + template <class U> + using TeamBarrierArchetypeExpr = + decltype(std::declval<U const &>().team_barrier()); + + template <class U> + using TeamBroadcastArchetypeExpr = decltype( + std::declval<U const &>().team_broadcast(lvalueForMethodsNeedingIt_, 0)); + + template <class U> + using TeamBroadcastAcceptClosureArchetypeExpr = + decltype(std::declval<U const &>().team_broadcast( + TrivialFunctor{}, lvalueForMethodsNeedingIt_, 0)); + + template <class U> + using TeamReducedArchetypeExpr = + decltype(std::declval<U const &>().team_reduce( + std::declval<reduction_to_test_t>())); + + template <class U> + using TeamScanArchetypeExpr = decltype(std::declval<U const &>().team_scan( + lvalueForMethodsNeedingIt_, ptrForMethodsNeedingIt_)); + + public: + static constexpr bool value = + Kokkos::is_detected_v<ExecutionSpaceArchetypeAlias, T> && + Kokkos::is_detected_v<ScratchMemorySpaceArchetypeAlias, T> && + // + Kokkos::is_detected_exact_v<int, TeamRankArchetypeExpr, T> && + Kokkos::is_detected_exact_v<int, TeamSizeArchetypeExpr, T> && + Kokkos::is_detected_exact_v<int, LeagueRankArchetypeExpr, T> && + Kokkos::is_detected_exact_v<int, LeagueSizeArchetypeExpr, T> && + // + Kokkos::is_detected_exact_v< + Kokkos::detected_t<ScratchMemorySpaceArchetypeAlias, T> const &, + TeamShmemArchetypeExpr, T> && + Kokkos::is_detected_exact_v< + Kokkos::detected_t<ScratchMemorySpaceArchetypeAlias, T> const &, + TeamScratchArchetypeExpr, T> && + Kokkos::is_detected_exact_v< + Kokkos::detected_t<ScratchMemorySpaceArchetypeAlias, T> const &, + ThreadScracthArchetypeExpr, T> && + // + Kokkos::is_detected_exact_v<void, TeamBarrierArchetypeExpr, T> && + Kokkos::is_detected_exact_v<void, TeamBroadcastArchetypeExpr, T> && + Kokkos::is_detected_exact_v<void, TeamBroadcastAcceptClosureArchetypeExpr, + T> && + Kokkos::is_detected_exact_v<void, TeamReducedArchetypeExpr, T> && + Kokkos::is_detected_exact_v<test_value_type, TeamScanArchetypeExpr, T>; + constexpr operator bool() const noexcept { return value; } +}; + +template <class T> +inline constexpr bool is_team_handle_complete_trait_check_v = + is_team_handle_complete_trait_check<T>::value; + +// actual test begins here + +/* + FIXME_OPENMPTARGET + https://github.com/kokkos/kokkos/blob/2d6cbad7e079eb45ae69ac6a59929d9fcf10409a/core/src/OpenMPTarget/Kokkos_OpenMPTarget_Exec.hpp#L860-L864 + + FIXME_OPENACC + OpenACCTeamMember is missing the following method: + template <typename ReducerType> + KOKKOS_INLINE_FUNCTION std::enable_if_t<is_reducer<ReducerType>::value> + team_reduce(ReducerType const& reducer) const noexcept; +*/ + +#if !defined(KOKKOS_ENABLE_OPENMPTARGET) && !defined(KOKKOS_ENABLE_OPENACC) +using space_t = TEST_EXECSPACE; +using policy_t = Kokkos::TeamPolicy<space_t>; +using member_t = typename policy_t::member_type; + +// is_team_handle uses the actual core implementation +static_assert(Kokkos::is_team_handle<member_t>::value); +static_assert(Kokkos::is_team_handle_v<member_t>); +static_assert(Kokkos::is_team_handle_v<member_t const>); +static_assert(!Kokkos::is_team_handle_v<member_t &>); +static_assert(!Kokkos::is_team_handle_v<member_t const &>); +static_assert(!Kokkos::is_team_handle_v<member_t *>); +static_assert(!Kokkos::is_team_handle_v<member_t const *>); +static_assert(!Kokkos::is_team_handle_v<member_t *const>); + +// is_team_handle_complete_trait_check uses the FULL trait class above +static_assert(is_team_handle_complete_trait_check<member_t>::value); +static_assert(is_team_handle_complete_trait_check_v<member_t>); +static_assert(is_team_handle_complete_trait_check_v<member_t const>); +static_assert(!is_team_handle_complete_trait_check_v<member_t &>); +static_assert(!is_team_handle_complete_trait_check_v<member_t const &>); +static_assert(!is_team_handle_complete_trait_check_v<member_t *>); +static_assert(!is_team_handle_complete_trait_check_v<member_t const *>); +static_assert(!is_team_handle_complete_trait_check_v<member_t *const>); +#endif + } // namespace TestConcept diff --git a/packages/kokkos/core/unit_test/TestConcurrentBitset.hpp b/packages/kokkos/core/unit_test/TestConcurrentBitset.hpp index 9feac14d43c00331cc0d5bbeda63b6d85d3d834a..6d084ced86addfdcdfb6ff86917eb4fa67345e6d 100644 --- a/packages/kokkos/core/unit_test/TestConcurrentBitset.hpp +++ b/packages/kokkos/core/unit_test/TestConcurrentBitset.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TEST_CONCURRENTBITSET_HPP #define TEST_CONCURRENTBITSET_HPP diff --git a/packages/kokkos/core/unit_test/TestCreateMirror.cpp b/packages/kokkos/core/unit_test/TestCreateMirror.cpp index e8b3b6ea105950267a862a78ebcb632120e74f66..ae74c5e0da4189d66c215250cdfbe8f3341ac401 100644 --- a/packages/kokkos/core/unit_test/TestCreateMirror.cpp +++ b/packages/kokkos/core/unit_test/TestCreateMirror.cpp @@ -1,53 +1,24 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> template <typename TestView, typename MemorySpace> void check_memory_space(TestView, MemorySpace) { - static_assert( - std::is_same<typename TestView::memory_space, MemorySpace>::value, ""); + static_assert(std::is_same_v<typename TestView::memory_space, MemorySpace>); } template <class View> @@ -90,16 +61,16 @@ void test_create_mirror_properties(const View& view) { check_memory_space(create_mirror_view(view_alloc( DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror view_alloc + execution space - check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); - check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); - check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); - check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); + check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); + check_memory_space(create_mirror(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); + check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); + check_memory_space(create_mirror(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror_view view_alloc + execution space - check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); - check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); - check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); - check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); + check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}, WithoutInitializing), view), host_mirror_test_space(view)); + check_memory_space(create_mirror_view(view_alloc(DefaultHostExecutionSpace{}), view), host_mirror_test_space(view)); + check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, WithoutInitializing, DeviceMemorySpace{}), view), DeviceMemorySpace{}); + check_memory_space(create_mirror_view(view_alloc(DefaultExecutionSpace{}, DeviceMemorySpace{}), view), DeviceMemorySpace{}); // create_mirror_view_and_copy check_memory_space(create_mirror_view_and_copy(HostSpace{}, view), HostSpace{}); diff --git a/packages/kokkos/core/unit_test/TestCrs.hpp b/packages/kokkos/core/unit_test/TestCrs.hpp index 78208c911606379ff2635ddfdf940d6251973d9f..34fc4d05141ffd4f0d690d4e86abd443b0429935 100644 --- a/packages/kokkos/core/unit_test/TestCrs.hpp +++ b/packages/kokkos/core/unit_test/TestCrs.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <vector> diff --git a/packages/kokkos/core/unit_test/TestDeepCopyAlignment.hpp b/packages/kokkos/core/unit_test/TestDeepCopyAlignment.hpp index 4500bd83bba75d7ac3c4de1b4e61cb7e1f8d6111..b7e6a8778643efd00a3383847a0975352e84cdec 100644 --- a/packages/kokkos/core/unit_test/TestDeepCopyAlignment.hpp +++ b/packages/kokkos/core/unit_test/TestDeepCopyAlignment.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <Kokkos_Core.hpp> #include <cstddef> diff --git a/packages/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp b/packages/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp index d915b7e4728dacec80ebc3ae1fad87b30cf7e51a..7ae73b14d3a085870055147264b4d6147432a9af 100644 --- a/packages/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp +++ b/packages/kokkos/core/unit_test/TestDefaultDeviceTypeInit.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -69,9 +41,10 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, nargs = (do_threads ? 1 : 0) + (do_numa ? 1 : 0) + (do_device ? 1 : 0) + (do_other ? 4 : 0) + (do_tune ? 1 : 0); - char** args_kokkos = new char*[nargs]; + char** args_kokkos = new char*[nargs]; + const int max_args_size = 45; for (int i = 0; i < nargs; i++) { - args_kokkos[i] = new char[45]; + args_kokkos[i] = new char[max_args_size]; delete_these.insert(args_kokkos[i]); } @@ -112,7 +85,7 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, #endif init_args.num_threads = nthreads; - sprintf(args_kokkos[threads_idx], "--threads=%i", nthreads); + snprintf(args_kokkos[threads_idx], max_args_size, "--threads=%i", nthreads); } if (do_numa) { @@ -130,24 +103,27 @@ char** init_kokkos_args(bool do_threads, bool do_numa, bool do_device, #endif init_args.num_numa = numa; - sprintf(args_kokkos[numa_idx], "--numa=%i", numa); + snprintf(args_kokkos[numa_idx], max_args_size, "--numa=%i", numa); } if (do_device) { init_args.device_id = 0; - sprintf(args_kokkos[device_idx], "--device-id=%i", 0); + snprintf(args_kokkos[device_idx], max_args_size, "--device-id=%i", 0); } if (do_other) { - sprintf(args_kokkos[0], "--dummyarg=1"); - sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], "--dummy2arg"); - sprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], "dummy3arg"); - sprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], "dummy4arg=1"); + snprintf(args_kokkos[0], max_args_size, "--dummyarg=1"); + snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0)], max_args_size, + "--dummy2arg"); + snprintf(args_kokkos[threads_idx + (do_threads ? 1 : 0) + 1], max_args_size, + "dummy3arg"); + snprintf(args_kokkos[device_idx + (do_device ? 1 : 0)], max_args_size, + "dummy4arg=1"); } if (do_tune) { init_args.tune_internals = true; - sprintf(args_kokkos[tune_idx], "--kokkos-tune-internals"); + snprintf(args_kokkos[tune_idx], max_args_size, "--kokkos-tune-internals"); } return args_kokkos; diff --git a/packages/kokkos/core/unit_test/TestDetectionIdiom.cpp b/packages/kokkos/core/unit_test/TestDetectionIdiom.cpp index 23da339cae03246084c0e67e8781d08972fb864e..66fdecabaa285f8bd48184f61dcd8c166e49efb9 100644 --- a/packages/kokkos/core/unit_test/TestDetectionIdiom.cpp +++ b/packages/kokkos/core/unit_test/TestDetectionIdiom.cpp @@ -1,64 +1,30 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_DetectionIdiom.hpp> -#define STATIC_ASSERT(cond) static_assert(cond, ""); - void test_nonesuch() { using Kokkos::nonesuch; - STATIC_ASSERT(!std::is_constructible<nonesuch>::value); - STATIC_ASSERT(!std::is_destructible<nonesuch>::value); - STATIC_ASSERT(!std::is_copy_constructible<nonesuch>::value); - STATIC_ASSERT(!std::is_move_constructible<nonesuch>::value); -#ifdef KOKKOS_ENABLE_CXX17 - STATIC_ASSERT(!std::is_aggregate<nonesuch>::value); -#endif + static_assert(!std::is_constructible<nonesuch>::value); + static_assert(!std::is_destructible<nonesuch>::value); + static_assert(!std::is_copy_constructible<nonesuch>::value); + static_assert(!std::is_move_constructible<nonesuch>::value); + static_assert(!std::is_aggregate<nonesuch>::value); } -#undef STATIC_ASSERT - namespace Example { // Example from https://en.cppreference.com/w/cpp/experimental/is_detected template <class T> diff --git a/packages/kokkos/core/unit_test/TestDeviceAndThreads.py b/packages/kokkos/core/unit_test/TestDeviceAndThreads.py new file mode 100644 index 0000000000000000000000000000000000000000..fd70e3ff681d74e26473f93e1083807c8ad112e4 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestDeviceAndThreads.py @@ -0,0 +1,92 @@ +#@HEADER +# ************************************************************************ + +# Kokkos v. 4.0 +# Copyright (2022) National Technology & Engineering +# Solutions of Sandia, LLC (NTESS). + +# Under the terms of Contract DE-NA0003525 with NTESS, +# the U.S. Government retains certain rights in this software. + +# Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. + +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# ************************************************************************ +# @HEADER + +import unittest +import subprocess + +PREFIX = "$<TARGET_FILE_DIR:KokkosCore_UnitTest_DeviceAndThreads>" +EXECUTABLE = "$<TARGET_FILE_NAME:KokkosCore_UnitTest_DeviceAndThreads>" +COMMAND = "/".join([PREFIX, EXECUTABLE]) + + +def GetFlag(flag, *extra_args): + p = subprocess.run([COMMAND, flag, *extra_args], capture_output=True) + if p.returncode != 0: + raise Exception(p.stderr.decode("utf-8")) + return int(p.stdout) + +def GetNumThreads(max_threads): + for x in [1, 2, 3, 5, 7]: + if x >= max_threads: + break + yield x + yield max_threads + +class KokkosInitializationTestCase(unittest.TestCase): + def test_num_threads(self): + max_threads = GetFlag("max_threads") + if max_threads == 1: + self.skipTest("no host parallel backend enabled") + for num_threads in GetNumThreads(max_threads): + self.assertEqual( + num_threads, + GetFlag( + "num_threads", + "--kokkos-num-threads={}".format(num_threads))) + + def test_device_id(self): + device_count = GetFlag("device_count") + if device_count == 0: + self.skipTest("no device detected") + # by default use the first GPU available for execution + self.assertEqual(0, GetFlag("device_id")) + for device_id in range(device_count): + self.assertEqual( + device_id, + GetFlag( + "device_id", + "--kokkos-device-id={}".format(device_id))) + + def test_disable_warnings(self): + self.assertEqual(0, GetFlag("disable_warnings")) + self.assertEqual( + 0, + GetFlag( + "disable_warnings", + "--kokkos-disable-warnings=0")) + self.assertEqual( + 1, + GetFlag( + "disable_warnings", + "--kokkos-disable-warnings=1")) + + def test_tune_internals(self): + self.assertEqual(0, GetFlag("tune_internals")) + self.assertEqual( + 0, + GetFlag( + "tune_internals", + "--kokkos-tune-internals=0")) + self.assertEqual( + 1, + GetFlag( + "tune_internals", + "--kokkos-tune-internals=1")) + + +if __name__ == '__main__': + unittest.main() diff --git a/packages/kokkos/core/unit_test/TestExecSpacePartitioning.hpp b/packages/kokkos/core/unit_test/TestExecSpacePartitioning.hpp index 82228476e712a4c1cc834fccff6289945f9bb279..0b02a5e36f13119c7e2a3035d2a08dbcd8571f2e 100644 --- a/packages/kokkos/core/unit_test/TestExecSpacePartitioning.hpp +++ b/packages/kokkos/core/unit_test/TestExecSpacePartitioning.hpp @@ -1,50 +1,23 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> #include <sstream> #include <iostream> +#include <thread> #include <Kokkos_Core.hpp> @@ -64,8 +37,7 @@ void check_distinctive(Kokkos::Cuda exec1, Kokkos::Cuda exec2) { } #endif #ifdef KOKKOS_ENABLE_HIP -void check_distinctive(Kokkos::Experimental::HIP exec1, - Kokkos::Experimental::HIP exec2) { +void check_distinctive(Kokkos::HIP exec1, Kokkos::HIP exec2) { ASSERT_NE(exec1.hip_stream(), exec2.hip_stream()); } #endif @@ -76,23 +48,60 @@ void check_distinctive(Kokkos::Experimental::SYCL exec1, *exec2.impl_internal_space_instance()->m_queue); } #endif +#ifdef KOKKOS_ENABLE_OPENMP +void check_distinctive(Kokkos::OpenMP exec1, Kokkos::OpenMP exec2) { + ASSERT_NE(exec1, exec2); +} +#endif } // namespace +#ifdef KOKKOS_ENABLE_OPENMP +template <class Lambda1, class Lambda2> +void run_threaded_test(const Lambda1 l1, const Lambda2 l2) { +#pragma omp parallel num_threads(2) + { + if (omp_get_thread_num() == 0) l1(); + if (omp_get_thread_num() == 1) l2(); + } +} +// We cannot run the multithreaded test when threads or HPX is enabled because +// we cannot launch a thread from inside another thread +#elif !defined(KOKKOS_ENABLE_THREADS) && !defined(KOKKOS_ENABLE_HPX) +template <class Lambda1, class Lambda2> +void run_threaded_test(const Lambda1 l1, const Lambda2 l2) { + std::thread t1(std::move(l1)); + std::thread t2(std::move(l2)); + t1.join(); + t2.join(); +} +#else +template <class Lambda1, class Lambda2> +void run_threaded_test(const Lambda1 l1, const Lambda2 l2) { + l1(); + l2(); +} +#endif + void test_partitioning(std::vector<TEST_EXECSPACE>& instances) { check_distinctive(instances[0], instances[1]); int sum1, sum2; int N = 3910; - Kokkos::parallel_reduce( - Kokkos::RangePolicy<TEST_EXECSPACE>(instances[0], 0, N), SumFunctor(), - sum1); - Kokkos::parallel_reduce( - Kokkos::RangePolicy<TEST_EXECSPACE>(instances[1], 0, N), SumFunctor(), - sum2); + run_threaded_test( + [&]() { + Kokkos::parallel_reduce( + Kokkos::RangePolicy<TEST_EXECSPACE>(instances[0], 0, N), + SumFunctor(), sum1); + }, + [&]() { + Kokkos::parallel_reduce( + Kokkos::RangePolicy<TEST_EXECSPACE>(instances[1], 0, N), + SumFunctor(), sum2); + }); ASSERT_EQ(sum1, sum2); ASSERT_EQ(sum1, N * (N - 1) / 2); #if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ - defined(KOKKOS_ENABLE_SYCL) + defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMP) // Eliminate unused function warning // (i.e. when compiling for Serial and CUDA, during Serial compilation the // Cuda overload is unused ...) @@ -101,11 +110,14 @@ void test_partitioning(std::vector<TEST_EXECSPACE>& instances) { check_distinctive(Kokkos::Cuda(), Kokkos::Cuda()); #endif #ifdef KOKKOS_ENABLE_HIP - check_distinctive(Kokkos::Experimental::HIP(), Kokkos::Experimental::HIP()); + check_distinctive(Kokkos::HIP(), Kokkos::HIP()); #endif #ifdef KOKKOS_ENABLE_SYCL check_distinctive(Kokkos::Experimental::SYCL(), Kokkos::Experimental::SYCL()); +#endif +#ifdef KOKKOS_ENABLE_OPENMP + check_distinctive(Kokkos::OpenMP(), Kokkos::OpenMP()); #endif } #endif @@ -113,7 +125,7 @@ void test_partitioning(std::vector<TEST_EXECSPACE>& instances) { TEST(TEST_CATEGORY, partitioning_by_args) { auto instances = - Kokkos::Experimental::partition_space(TEST_EXECSPACE(), 1, 1.); + Kokkos::Experimental::partition_space(TEST_EXECSPACE(), 1, 1); ASSERT_EQ(int(instances.size()), 2); test_partitioning(instances); } diff --git a/packages/kokkos/core/unit_test/TestExecutionSpace.hpp b/packages/kokkos/core/unit_test/TestExecutionSpace.hpp index c9d2d275bfe4b1f73a990a6f9f83242cb970946c..6f0f159c1740546d5d664fef74abf1f689e8a55b 100644 --- a/packages/kokkos/core/unit_test/TestExecutionSpace.hpp +++ b/packages/kokkos/core/unit_test/TestExecutionSpace.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -54,10 +26,9 @@ struct CheckClassWithExecutionSpaceAsDataMemberIsCopyable { Kokkos::DefaultHostExecutionSpace host; KOKKOS_FUNCTION void operator()(int, int& e) const { - auto copy = *this; // not actually doing anything useful, mostly checking that // ExecutionSpace::in_parallel() is callable - if (static_cast<int>(copy.device.in_parallel()) < 0) { + if (static_cast<int>(device.in_parallel()) < 0) { ++e; } } diff --git a/packages/kokkos/core/unit_test/TestFunctorAnalysis.hpp b/packages/kokkos/core/unit_test/TestFunctorAnalysis.hpp index 5e0910b523d1361652f5ad8fc02f20a82953d220..9ebb9c066a2767d2c3593efdb7bd1daa05db5b25 100644 --- a/packages/kokkos/core/unit_test/TestFunctorAnalysis.hpp +++ b/packages/kokkos/core/unit_test/TestFunctorAnalysis.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TEST_FUNCTOR_ANALYSIS_HPP #define TEST_FUNCTOR_ANALYSIS_HPP diff --git a/packages/kokkos/core/unit_test/TestGraph.hpp b/packages/kokkos/core/unit_test/TestGraph.hpp index d012da47be08e95c012d9c02e467da7420fc42ad..9a36d08f445aa12841b3d1723729a9c518573379 100644 --- a/packages/kokkos/core/unit_test/TestGraph.hpp +++ b/packages/kokkos/core/unit_test/TestGraph.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Graph.hpp> diff --git a/packages/kokkos/core/unit_test/TestHWLOC.cpp b/packages/kokkos/core/unit_test/TestHWLOC.cpp index 428a67048451a6adbfbf77ab94bcf7a1ced910dc..d68c8ccf18815aa2f241839f2c5d4700608e33ca 100644 --- a/packages/kokkos/core/unit_test/TestHWLOC.cpp +++ b/packages/kokkos/core/unit_test/TestHWLOC.cpp @@ -1,51 +1,24 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <iostream> +#define KOKKOS_IMPL_PUBLIC_INCLUDE #include <Kokkos_hwloc.hpp> namespace Test { diff --git a/packages/kokkos/core/unit_test/TestHalfConversion.hpp b/packages/kokkos/core/unit_test/TestHalfConversion.hpp index 872e3ef8bdf40faaa677f7cb1805ebf224e5fa15..acefac2692c2e3f54ede4485bfc6fe020985aba8 100644 --- a/packages/kokkos/core/unit_test/TestHalfConversion.hpp +++ b/packages/kokkos/core/unit_test/TestHalfConversion.hpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TESTHALFCONVERSION_HPP_ #define TESTHALFCONVERSION_HPP_ diff --git a/packages/kokkos/core/unit_test/TestHalfOperators.hpp b/packages/kokkos/core/unit_test/TestHalfOperators.hpp index 977a704657c7bb6f350143e31c577738de4ff192..6a2bc359e5bf915c033db5c5ab40a98946267de3 100644 --- a/packages/kokkos/core/unit_test/TestHalfOperators.hpp +++ b/packages/kokkos/core/unit_test/TestHalfOperators.hpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TESTHALFOPERATOR_HPP_ #define TESTHALFOPERATOR_HPP_ @@ -272,6 +243,8 @@ enum OP_TESTS { N_OP_TESTS }; +// volatile-qualified parameter type 'volatile half_type' is deprecated +#if !defined(KOKKOS_ENABLE_CXX20) && !defined(KOKKOS_ENABLE_CXX23) template <class view_type, class half_type> struct Functor_TestHalfVolatileOperators { volatile half_type h_lhs, h_rhs; @@ -358,6 +331,7 @@ struct Functor_TestHalfVolatileOperators { expected_lhs(CDIV_H_H) /= d_rhs; } }; +#endif template <class view_type, class half_type> struct Functor_TestHalfOperators { @@ -961,6 +935,8 @@ void __test_half_operators(half_type h_lhs, half_type h_rhs) { epsilon); } +// volatile-qualified parameter type 'volatile half_type' is deprecated +#if !defined(KOKKOS_ENABLE_CXX20) && !defined(KOKKOS_ENABLE_CXX23) // Test partial volatile support volatile half_type _h_lhs = h_lhs; volatile half_type _h_rhs = h_rhs; @@ -984,6 +960,7 @@ void __test_half_operators(half_type h_lhs, half_type h_rhs) { epsilon); } } +#endif // is_trivially_copyable is false with the addition of explicit // copy constructors that are required for supporting reductions diff --git a/packages/kokkos/core/unit_test/TestHostSharedPtr.hpp b/packages/kokkos/core/unit_test/TestHostSharedPtr.hpp index 29bc45592b0287c5671daaac6db983905beaf5c0..5b185ee3ed154c38f92c21a8b19bd9d581da29fe 100644 --- a/packages/kokkos/core/unit_test/TestHostSharedPtr.hpp +++ b/packages/kokkos/core/unit_test/TestHostSharedPtr.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <impl/Kokkos_HostSharedPtr.hpp> diff --git a/packages/kokkos/core/unit_test/TestHostSharedPtrAccessOnDevice.hpp b/packages/kokkos/core/unit_test/TestHostSharedPtrAccessOnDevice.hpp index 9a4da5dddebc95a5e24521d6c70a9a22d6063fe6..8cf25cef847f6ae7e5b57a7d421e7ca6238d79fe 100644 --- a/packages/kokkos/core/unit_test/TestHostSharedPtrAccessOnDevice.hpp +++ b/packages/kokkos/core/unit_test/TestHostSharedPtrAccessOnDevice.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <impl/Kokkos_StringManipulation.hpp> #include <impl/Kokkos_HostSharedPtr.hpp> @@ -136,6 +108,12 @@ TEST(TEST_CATEGORY, host_shared_ptr_dereference_on_device) { static_cast<T*>(Kokkos::kokkos_malloc<MemorySpace>(sizeof(T))), [](T* p) { Kokkos::kokkos_free<MemorySpace>(p); }); +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) { + GTEST_SKIP() << "FIXME wrong result"; + } +#endif check_access_stored_pointer_and_dereference_on_device(device_ptr); } @@ -277,13 +255,11 @@ TEST(TEST_CATEGORY, host_shared_ptr_tracking) { Kokkos::Experimental::SYCLSharedUSMSpace>(); #endif #ifdef KOKKOS_ENABLE_HIP - if (std::is_same<TEST_EXECSPACE, Kokkos::Experimental::HIP>::value) { - host_shared_ptr_test_reference_counting< - Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIPHostPinnedSpace>(); - host_shared_ptr_test_reference_counting< - Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIPManagedSpace>(); + if (std::is_same<TEST_EXECSPACE, Kokkos::HIP>::value) { + host_shared_ptr_test_reference_counting<Kokkos::HIPHostPinnedSpace, + Kokkos::HIPHostPinnedSpace>(); + host_shared_ptr_test_reference_counting<Kokkos::HIPManagedSpace, + Kokkos::HIPManagedSpace>(); } #endif } diff --git a/packages/kokkos/core/unit_test/TestInit.hpp b/packages/kokkos/core/unit_test/TestInit.hpp index 20536b0d35f44a14bc392c4302072c59cf710772..7be9ef5f12a3ef0329c8204b11a4a6e6dbd5a2cf 100644 --- a/packages/kokkos/core/unit_test/TestInit.hpp +++ b/packages/kokkos/core/unit_test/TestInit.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> #include <sstream> @@ -70,4 +42,3 @@ TEST(TEST_CATEGORY, dispatch) { test_dispatch<TEST_EXECSPACE>(); } } // namespace Test #include <TestCompilerMacros.hpp> -#include <TestPolicyConstruction.hpp> diff --git a/packages/kokkos/core/unit_test/TestInitializationSettings.cpp b/packages/kokkos/core/unit_test/TestInitializationSettings.cpp index a5b11c5a30d049df4fb590b0838f10fabb9e8ae5..f5be0e47aab47f0e050c799e5a47867da65e2de4 100644 --- a/packages/kokkos/core/unit_test/TestInitializationSettings.cpp +++ b/packages/kokkos/core/unit_test/TestInitializationSettings.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -91,15 +63,13 @@ TEST(defaultdevicetype, initialization_settings) { EXPECT_FALSE(settings.has_tools_args()); } -#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, "") // FIXME C++17 - constexpr bool test_initialization_settings_getter() { #define CHECK_INITIALIZATION_SETTINGS_GETTER_RETURN_TYPE(NAME, TYPE) \ - STATIC_ASSERT(std::is_same< \ + static_assert(std::is_same< \ decltype(std::declval<Kokkos::InitializationSettings const&>() \ .has_##NAME()), \ bool>::value); \ - STATIC_ASSERT(std::is_same< \ + static_assert(std::is_same< \ decltype(std::declval<Kokkos::InitializationSettings const&>() \ .get_##NAME()), \ TYPE>::value); @@ -116,9 +86,9 @@ constexpr bool test_initialization_settings_getter() { return true; } -STATIC_ASSERT(test_initialization_settings_getter()); +static_assert(test_initialization_settings_getter()); -STATIC_ASSERT( +static_assert( std::is_default_constructible<Kokkos::InitializationSettings>::value); } // namespace diff --git a/packages/kokkos/core/unit_test/TestInterOp.cpp b/packages/kokkos/core/unit_test/TestInterOp.cpp index 50238a93a5a8ea9b1125e42cb0d60ab8dc762e16..b183b13403aab33b7a3341a5d1cff09b2e7f4b02 100644 --- a/packages/kokkos/core/unit_test/TestInterOp.cpp +++ b/packages/kokkos/core/unit_test/TestInterOp.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_DynRankView.hpp> diff --git a/packages/kokkos/core/unit_test/TestIrregularLayout.hpp b/packages/kokkos/core/unit_test/TestIrregularLayout.hpp index af4fd22452fa0427c3d0536e0a45168503b00677..c04d2cca3ee65ea16da20af5afc9296f55492f29 100644 --- a/packages/kokkos/core/unit_test/TestIrregularLayout.hpp +++ b/packages/kokkos/core/unit_test/TestIrregularLayout.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp b/packages/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp index ab5ccd0039583a3e3d626f7b7bd789e783b3b66e..60da9e0713f0da4df94aa81e3a1778ba99ae28db 100644 --- a/packages/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp +++ b/packages/kokkos/core/unit_test/TestJoinBackwardCompatibility.hpp @@ -1,57 +1,32 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> +#ifndef KOKKOS_ENABLE_OPENACC // FIXME_OPENACC - temporarily disabled due to + // unimplemented reduction features namespace { enum MyErrorCode { no_error = 0b000, error_operator_plus_equal = 0b001, error_operator_plus_equal_volatile = 0b010, - error_join_volatile = 0b100 + error_join_volatile = 0b100, + expected_join_volatile = 0b1000 }; @@ -114,7 +89,7 @@ struct ReducerWithJoinThatTakesVolatileQualifiedArgs { using value_type = MyJoinBackCompatValueType; KOKKOS_FUNCTION void join(MyJoinBackCompatValueType volatile &x, MyJoinBackCompatValueType const volatile &y) const { - x.err = x.err | y.err; + x.err = x.err | y.err | expected_join_volatile; } KOKKOS_FUNCTION void operator()(int, MyJoinBackCompatValueType &) const {} KOKKOS_FUNCTION ReducerWithJoinThatTakesVolatileQualifiedArgs() {} @@ -124,12 +99,6 @@ void test_join_backward_compatibility() { MyJoinBackCompatValueType result; Kokkos::RangePolicy<> policy(0, 1); -#if defined KOKKOS_ENABLE_DEPRECATED_CODE_3 - Kokkos::parallel_reduce( - policy, ReducerWithJoinThatTakesVolatileQualifiedArgs{}, result); - ASSERT_EQ(result.err, no_error); -#endif - Kokkos::parallel_reduce( policy, ReducerWithJoinThatTakesBothVolatileAndNonVolatileQualifiedArgs{}, result); @@ -145,10 +114,28 @@ void test_join_backward_compatibility() { static_cast<MyJoinBackCompatValueType const volatile &>(result); ASSERT_EQ(result.err, error_operator_plus_equal | error_operator_plus_equal_volatile); + + MyJoinBackCompatValueType result2; + volatile MyJoinBackCompatValueType vol_result; + ReducerWithJoinThatTakesVolatileQualifiedArgs my_red; + my_red.join(vol_result, result2); + ASSERT_EQ(vol_result.err, expected_join_volatile); + +#if defined(KOKKOS_ENABLE_DEPRECATED_CODE_3) + MyJoinBackCompatValueType result3; + Kokkos::parallel_reduce( + policy, ReducerWithJoinThatTakesVolatileQualifiedArgs{}, result3); + ASSERT_EQ(result3.err, expected_join_volatile); +#endif } TEST(TEST_CATEGORY, join_backward_compatibility) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + GTEST_SKIP() << "FIXME wrong result"; +#endif test_join_backward_compatibility(); } } // namespace +#endif diff --git a/packages/kokkos/core/unit_test/TestLegionInitialization.cpp b/packages/kokkos/core/unit_test/TestLegionInitialization.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3967d302590ba3035c5943d54be46097e578f26 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestLegionInitialization.cpp @@ -0,0 +1,65 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <Kokkos_Core.hpp> +#include <gtest/gtest.h> + +namespace { + +struct ReductionFunctor { + Kokkos::View<int*> d; + + KOKKOS_FUNCTION void operator()(int i, int& sum) const { sum += d(i); } +}; + +// The purpose of this test is to mimic Legion's use case of initializing and +// finalizing individual backends +TEST(initialization, legion_initialization) { + Kokkos::InitializationSettings kokkos_init_settings; + + Kokkos::Impl::pre_initialize(kokkos_init_settings); + + // We need to have a host execution space initialized first. + Kokkos::DefaultHostExecutionSpace::impl_initialize(kokkos_init_settings); + + if (!std::is_same_v<Kokkos::DefaultExecutionSpace, + Kokkos::DefaultHostExecutionSpace>) + Kokkos::DefaultExecutionSpace::impl_initialize(kokkos_init_settings); + + Kokkos::Impl::post_initialize(kokkos_init_settings); + + EXPECT_TRUE(Kokkos::is_initialized()); + + { + Kokkos::View<int*> d("d", 1000); + Kokkos::deep_copy(d, 1); + int result; + Kokkos::parallel_reduce("TestRed", d.extent(0), ReductionFunctor{d}, + result); + EXPECT_EQ(result, d.extent_int(0)); + } + + Kokkos::Impl::pre_finalize(); + if (!std::is_same_v<Kokkos::DefaultExecutionSpace, + Kokkos::DefaultHostExecutionSpace>) + Kokkos::DefaultExecutionSpace::impl_finalize(); + Kokkos::DefaultHostExecutionSpace::impl_finalize(); + Kokkos::Impl::post_finalize(); + + EXPECT_FALSE(Kokkos::is_initialized()); + EXPECT_TRUE(Kokkos::is_finalized()); +} +} // namespace diff --git a/packages/kokkos/core/unit_test/TestLegionInteroperability.cpp b/packages/kokkos/core/unit_test/TestLegionInteroperability.cpp deleted file mode 100644 index 1838558451d52dbb3d0bc26d46cb50621d00343c..0000000000000000000000000000000000000000 --- a/packages/kokkos/core/unit_test/TestLegionInteroperability.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* -//@HEADER -// ************************************************************************ -// -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ -//@HEADER -*/ - -#include <Kokkos_Core.hpp> - -#if defined(KOKKOS_COMPILER_INTEL) && (KOKKOS_COMPILER_INTEL < 1800) - -namespace { - -// error: expression must have a constant value -// std::enable_if_t<!has_deprecated_cuda_impl_initialize_v<T>> -constexpr bool -test_compiler_upgrade_needed_for_detection_idiom_and_variable_template() { - return true; -} -static_assert( - test_compiler_upgrade_needed_for_detection_idiom_and_variable_template(), - "Intel C++ compiler is awesome"); - -} // namespace - -#else - -// The purpose of this compile-only test is twofold: -// 1. mimic Legion's use of Kokkos implementation details for initializing the -// exectution environment -// 2. demonstrate how to leverage SFINAE to support Kokkos version through the -// ExecutionSpace::impl_initialize breaking change before release 3.7 -namespace { -#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, "") // FIXME C++17 - -#ifdef KOKKOS_ENABLE_CUDA -template <class T> -using deprecated_cuda_impl_initialize_t = - decltype(T::impl_initialize(typename T::SelectDevice(0), 1)); - -template <class T> -constexpr bool has_deprecated_cuda_impl_initialize_v = - Kokkos::is_detected<deprecated_cuda_impl_initialize_t, T>::value; - -template <class T> -std::enable_if_t<has_deprecated_cuda_impl_initialize_v<T> > -legion_initialize_kokkos_cuda() { - int cuda_device_id = 0; - int num_instances = 1; - T::impl_initialize(typename T::SelectDevice(cuda_device_id), num_instances); -} - -template <class T> -std::enable_if_t<!has_deprecated_cuda_impl_initialize_v<T> > -legion_initialize_kokkos_cuda() { - int cuda_device_id = 0; - auto const settings = - Kokkos::InitializationSettings().set_device_id(cuda_device_id); - T::impl_initialize(settings); -} - -STATIC_ASSERT(std::is_void< - decltype(legion_initialize_kokkos_cuda<Kokkos::Cuda>())>::value); -#endif - -#ifdef KOKKOS_ENABLE_OPENMP -template <class T> -using deprecated_openmp_impl_initialize_t = decltype(T::impl_initialize(0)); - -template <class T> -constexpr bool has_deprecated_openmp_impl_initialize_v = - Kokkos::is_detected<deprecated_openmp_impl_initialize_t, T>::value; - -template <class T> -std::enable_if_t<has_deprecated_openmp_impl_initialize_v<T> > -legion_initialize_kokkos_openmp() { - int thread_count = -1; - T::impl_initialize(thread_count); -} - -template <class T> -std::enable_if_t<!has_deprecated_openmp_impl_initialize_v<T> > -legion_initialize_kokkos_openmp() { - int thread_count = -1; - auto const settings = - Kokkos::InitializationSettings().set_num_threads(thread_count); - T::impl_initialize(settings); -} - -STATIC_ASSERT(std::is_void<decltype( - legion_initialize_kokkos_openmp<Kokkos::OpenMP>())>::value); - -#endif - -#ifdef KOKKOS_ENABLE_SERIAL -template <class T> -using deprecated_serial_impl_initialize_t = decltype(T::impl_initialize()); - -template <class T> -constexpr bool has_deprecated_serial_impl_initialize_v = - Kokkos::is_detected<deprecated_serial_impl_initialize_t, T>::value; - -template <class T> -std::enable_if_t<has_deprecated_serial_impl_initialize_v<T> > -legion_initialize_kokkos_serial() { - T::impl_initialize(); -} - -template <class T> -std::enable_if_t<!has_deprecated_serial_impl_initialize_v<T> > -legion_initialize_kokkos_serial() { - Kokkos::InitializationSettings settings; - T::impl_initialize(settings); -} - -STATIC_ASSERT(std::is_void<decltype( - legion_initialize_kokkos_serial<Kokkos::Serial>())>::value); -#endif - -} // namespace - -#endif diff --git a/packages/kokkos/core/unit_test/TestLocalDeepCopy.hpp b/packages/kokkos/core/unit_test/TestLocalDeepCopy.hpp index cdb14fec54291c745ad266f37a9dd846f0921d7a..60cb02b7f0577c1a5325210d8f15ed8945568e9a 100644 --- a/packages/kokkos/core/unit_test/TestLocalDeepCopy.hpp +++ b/packages/kokkos/core/unit_test/TestLocalDeepCopy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestMDRange.hpp b/packages/kokkos/core/unit_test/TestMDRange.hpp index e0a880a7a1435bc6879fc67c7e7b53876e81bb74..3e80e7a01bf0331bbaadbdb963fa5bea97ca7779 100644 --- a/packages/kokkos/core/unit_test/TestMDRange.hpp +++ b/packages/kokkos/core/unit_test/TestMDRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> @@ -109,12 +81,6 @@ struct TestMDRange_ReduceArray_2D { parallel_for(range_init, functor); // Init the view to 3's double sums[array_size]; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - double *sums_ptr = sums; - parallel_reduce(range, functor, sums_ptr); - ASSERT_EQ(sums[0], 6 * N0 * N1); - ASSERT_EQ(sums[1], 3 * N0 * N1); -#endif Kokkos::fence("Fence before accessing result on the host"); parallel_reduce(range, functor, sums); diff --git a/packages/kokkos/core/unit_test/TestMDRangePolicyConstructors.hpp b/packages/kokkos/core/unit_test/TestMDRangePolicyConstructors.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9eeaba9fd44609cebc129900d81ffcc67ede34c1 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestMDRangePolicyConstructors.hpp @@ -0,0 +1,100 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <gtest/gtest.h> + +#include <Kokkos_Core.hpp> + +namespace { + +template <class IndexType> +void construct_mdrange_policy_variable_type() { + (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{ + Kokkos::Array<IndexType, 2>{}, Kokkos::Array<IndexType, 2>{}}; + + (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{ + {{IndexType(0), IndexType(0)}}, {{IndexType(2), IndexType(2)}}}; + + (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{ + {IndexType(0), IndexType(0)}, {IndexType(2), IndexType(2)}}; +} + +TEST(TEST_CATEGORY, md_range_policy_construction_from_arrays) { + { + // Check that construction from Kokkos::Array of the specified index type + // works. + using IndexType = unsigned long long; + Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, + Kokkos::IndexType<IndexType>> + p1(Kokkos::Array<IndexType, 2>{{0, 1}}, + Kokkos::Array<IndexType, 2>{{2, 3}}); + Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, + Kokkos::IndexType<IndexType>> + p2(Kokkos::Array<IndexType, 2>{{0, 1}}, + Kokkos::Array<IndexType, 2>{{2, 3}}); + Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, + Kokkos::IndexType<IndexType>> + p3(Kokkos::Array<IndexType, 2>{{0, 1}}, + Kokkos::Array<IndexType, 2>{{2, 3}}, + Kokkos::Array<IndexType, 1>{{4}}); + } + { + // Check that construction from double-braced initializer list + // works. + using index_type = unsigned long long; + Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p1({{0, 1}}, + {{2, 3}}); + Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, + Kokkos::IndexType<index_type>> + p2({{0, 1}}, {{2, 3}}); + } + { + // Check that construction from Kokkos::Array of long compiles for backwards + // compability. This was broken in + // https://github.com/kokkos/kokkos/pull/3527/commits/88ea8eec6567c84739d77bdd25fdbc647fae28bb#r512323639 + Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p1( + Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}}); + Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p2( + Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}}); + Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p3( + Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}}, + Kokkos::Array<long, 1>{{4}}); + } + + // Check that construction from various index types works. + construct_mdrange_policy_variable_type<char>(); + construct_mdrange_policy_variable_type<int>(); + construct_mdrange_policy_variable_type<unsigned long>(); + construct_mdrange_policy_variable_type<std::int64_t>(); +} + +#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC +#ifndef KOKKOS_ENABLE_OPENMPTARGET // FIXME_OPENMPTARGET +TEST(TEST_CATEGORY_DEATH, policy_bounds_unsafe_narrowing_conversions) { + using Policy = Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, + Kokkos::IndexType<unsigned>>; + + ::testing::FLAGS_gtest_death_test_style = "threadsafe"; + ASSERT_DEATH( + { + (void)Policy({-1, 0}, {2, 3}); + }, + "unsafe narrowing conversion"); +} +#endif +#endif + +} // namespace diff --git a/packages/kokkos/core/unit_test/TestMDRange_a.hpp b/packages/kokkos/core/unit_test/TestMDRange_a.hpp index 0f2abd6d65e921bf07b512984b17ac3d5f5fe67c..e88ebb6ddca4dc1142131711ef94b21426789f76 100644 --- a/packages/kokkos/core/unit_test/TestMDRange_a.hpp +++ b/packages/kokkos/core/unit_test/TestMDRange_a.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestMDRange.hpp> diff --git a/packages/kokkos/core/unit_test/TestMDRange_b.hpp b/packages/kokkos/core/unit_test/TestMDRange_b.hpp index 85410d5c27fa6ba60c5d8034efa0d30bb1f6db7a..fea6283811612985ac582ee2cc4bf49e3c365283 100644 --- a/packages/kokkos/core/unit_test/TestMDRange_b.hpp +++ b/packages/kokkos/core/unit_test/TestMDRange_b.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestMDRange.hpp> diff --git a/packages/kokkos/core/unit_test/TestMDRange_c.hpp b/packages/kokkos/core/unit_test/TestMDRange_c.hpp index 9f597ec54b5777fe1df4f7e831c20e9eb1eab38d..1c796bffe8d53b51c5315d4eee6f356351a6b9ce 100644 --- a/packages/kokkos/core/unit_test/TestMDRange_c.hpp +++ b/packages/kokkos/core/unit_test/TestMDRange_c.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestMDRange.hpp> diff --git a/packages/kokkos/core/unit_test/TestMDRange_d.hpp b/packages/kokkos/core/unit_test/TestMDRange_d.hpp index 5ca57ccf483710bdfb7907bcd4e10d03d13ecc39..39a5927f2ec5e8a080151b7fcfceacb93d7e0ac1 100644 --- a/packages/kokkos/core/unit_test/TestMDRange_d.hpp +++ b/packages/kokkos/core/unit_test/TestMDRange_d.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestMDRange.hpp> diff --git a/packages/kokkos/core/unit_test/TestMDRange_e.hpp b/packages/kokkos/core/unit_test/TestMDRange_e.hpp index b9754e63d56bacb497fec4f932eb348c38f6c79f..ed08ca44fa77a8aef440e7f76787ee37c8056e85 100644 --- a/packages/kokkos/core/unit_test/TestMDRange_e.hpp +++ b/packages/kokkos/core/unit_test/TestMDRange_e.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestMDRange.hpp> diff --git a/packages/kokkos/core/unit_test/TestMDRange_f.hpp b/packages/kokkos/core/unit_test/TestMDRange_f.hpp index 2cef1324d7c75059dfa50417d940bd7bf40a9763..6e0695111e77deb2f088cee3fa870053b6c326e0 100644 --- a/packages/kokkos/core/unit_test/TestMDRange_f.hpp +++ b/packages/kokkos/core/unit_test/TestMDRange_f.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestMDRange.hpp> diff --git a/packages/kokkos/core/unit_test/TestMDRange_g.hpp b/packages/kokkos/core/unit_test/TestMDRange_g.hpp index c097b2961d4c6f8bf7561d043e359ab635b8a0d2..aaa9a91acce7c13f4fb85ff90c0114f2702e3af8 100644 --- a/packages/kokkos/core/unit_test/TestMDRange_g.hpp +++ b/packages/kokkos/core/unit_test/TestMDRange_g.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ //#include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestMDSpan.hpp b/packages/kokkos/core/unit_test/TestMDSpan.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6359bd447d3a53c682870dbb156fbcec006f335e --- /dev/null +++ b/packages/kokkos/core/unit_test/TestMDSpan.hpp @@ -0,0 +1,65 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_UNITTEST_MDSPAN_HPP +#define KOKKOS_UNITTEST_MDSPAN_HPP + +#include <Kokkos_Core.hpp> +#include <gtest/gtest.h> + +#ifdef KOKKOS_ENABLE_IMPL_MDSPAN + +namespace { +void test_mdspan_minimal_functional() { + int N = 100; + Kokkos::View<int*, TEST_EXECSPACE> a("A", N); + Kokkos::parallel_for( + "FillSequence", Kokkos::RangePolicy<TEST_EXECSPACE>(0, N), + KOKKOS_LAMBDA(int i) { a(i) = i; }); + + mdspan_ns::mdspan<int, mdspan_ns::dextents<int, 1>> a_mds(a.data(), N); + int errors; + Kokkos::parallel_reduce( + "CheckMinimalMDSpan", Kokkos::RangePolicy<TEST_EXECSPACE>(0, N), + KOKKOS_LAMBDA(int i, int& err) { + mdspan_ns::mdspan<int, mdspan_ns::dextents<int, 1>> b_mds(a.data(), N); +#ifdef KOKKOS_ENABLE_CXX23 + if (a_mds[i] != i) err++; + if (b_mds[i] != i) err++; +#else + if (a_mds(i) != i) err++; + if (b_mds(i) != i) err++; +#endif + }, + errors); + ASSERT_EQ(errors, 0); +} +} // namespace +#endif + +namespace { + +TEST(TEST_CATEGORY, mdspan_minimal_functional) { +#ifndef KOKKOS_ENABLE_IMPL_MDSPAN + GTEST_SKIP() << "mdspan not enabled"; +#else + test_mdspan_minimal_functional(); +#endif +} + +} // namespace + +#endif diff --git a/packages/kokkos/core/unit_test/TestMathematicalConstants.hpp b/packages/kokkos/core/unit_test/TestMathematicalConstants.hpp index 2043d727074eb81c8962748061f93bab27cd9d7e..f52bfeaff7d97f35f6892d3e96a624a698707763 100644 --- a/packages/kokkos/core/unit_test/TestMathematicalConstants.hpp +++ b/packages/kokkos/core/unit_test/TestMathematicalConstants.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> @@ -53,33 +25,11 @@ KOKKOS_FUNCTION T *take_address_of(T &arg) { template <class T> KOKKOS_FUNCTION void take_by_value(T) {} -#if defined(KOKKOS_ENABLE_CXX17) -#define DEFINE_MATH_CONSTANT_TRAIT(TRAIT) \ - template <class T> \ - struct TRAIT { \ - static constexpr T value = Kokkos::Experimental::TRAIT##_v<T>; \ +#define DEFINE_MATH_CONSTANT_TRAIT(TRAIT) \ + template <class T> \ + struct TRAIT { \ + static constexpr T value = Kokkos::numbers::TRAIT##_v<T>; \ } -#else -#define DEFINE_MATH_CONSTANT_TRAIT(TRAIT) \ - template <class> \ - struct TRAIT; \ - template <> \ - struct TRAIT<float> { \ - static constexpr float value = Kokkos::Experimental::TRAIT##_v<float>; \ - }; \ - template <> \ - struct TRAIT<double> { \ - static constexpr double value = Kokkos::Experimental::TRAIT##_v<double>; \ - }; \ - template <> \ - struct TRAIT<long double> { \ - static constexpr long double value = \ - Kokkos::Experimental::TRAIT##_v<long double>; \ - }; \ - constexpr float TRAIT<float>::value; \ - constexpr double TRAIT<double>::value; \ - constexpr long double TRAIT<long double>::value -#endif DEFINE_MATH_CONSTANT_TRAIT(e); DEFINE_MATH_CONSTANT_TRAIT(log2e); @@ -112,7 +62,8 @@ struct TestMathematicalConstants { KOKKOS_FUNCTION void operator()(Trait, int, int &) const { use_on_device(); } KOKKOS_FUNCTION void use_on_device() const { -#if defined(KOKKOS_COMPILER_NVCC) || defined(KOKKOS_ENABLE_OPENMPTARGET) +#if defined(KOKKOS_COMPILER_NVCC) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \ + defined(KOKKOS_ENABLE_OPENACC) take_by_value(Trait::value); #else (void)take_address_of(Trait::value); @@ -120,8 +71,9 @@ struct TestMathematicalConstants { } }; -#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ - defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) +#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP) || \ + defined(KOKKOS_ENABLE_SYCL) || defined(KOKKOS_ENABLE_OPENMPTARGET) || \ + defined(KOKKOS_ENABLE_OPENACC) #define TEST_MATH_CONSTANT(TRAIT) \ TEST(TEST_CATEGORY, mathematical_constants_##TRAIT) { \ TestMathematicalConstants<TEST_EXECSPACE, TRAIT<float>>(); \ diff --git a/packages/kokkos/core/unit_test/TestMathematicalFunctions.hpp b/packages/kokkos/core/unit_test/TestMathematicalFunctions.hpp index 7294f8e62e2ccf5c9fcd6106f424f00e2e221862..b198006cbb4bd2cb53ff7c373f039f64204d9a52 100644 --- a/packages/kokkos/core/unit_test/TestMathematicalFunctions.hpp +++ b/packages/kokkos/core/unit_test/TestMathematicalFunctions.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -224,6 +196,9 @@ template <> struct math_binary_function_return_type<unsigned long long, l template <class T, class U> using math_binary_function_return_type_t = typename math_binary_function_return_type<T, U>::type; // clang-format on +template <class T, class U, class V> +using math_ternary_function_return_type_t = math_binary_function_return_type_t< + T, math_binary_function_return_type_t<U, V>>; struct FloatingPointComparison { private: @@ -292,29 +267,29 @@ struct FloatingPointComparison { template <class> struct math_function_name; -#define DEFINE_UNARY_FUNCTION_EVAL(FUNC, ULP_FACTOR) \ - struct MathUnaryFunction_##FUNC { \ - template <typename T> \ - static KOKKOS_FUNCTION auto eval(T x) { \ - static_assert(std::is_same<decltype(Kokkos::FUNC((T)0)), \ - math_unary_function_return_type_t<T>>::value, \ - ""); \ - return Kokkos::FUNC(x); \ - } \ - template <typename T> \ - static auto eval_std(T x) { \ - static_assert(std::is_same<decltype(std::FUNC((T)0)), \ - math_unary_function_return_type_t<T>>::value, \ - ""); \ - return std::FUNC(x); \ - } \ - static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; } \ - }; \ - using kk_##FUNC = MathUnaryFunction_##FUNC; \ - template <> \ - struct math_function_name<MathUnaryFunction_##FUNC> { \ - static constexpr char name[] = #FUNC; \ - }; \ +#define DEFINE_UNARY_FUNCTION_EVAL(FUNC, ULP_FACTOR) \ + struct MathUnaryFunction_##FUNC { \ + template <typename T> \ + static KOKKOS_FUNCTION auto eval(T x) { \ + static_assert( \ + std::is_same<decltype(Kokkos::FUNC((T)0)), \ + math_unary_function_return_type_t<T>>::value); \ + return Kokkos::FUNC(x); \ + } \ + template <typename T> \ + static auto eval_std(T x) { \ + static_assert( \ + std::is_same<decltype(std::FUNC((T)0)), \ + math_unary_function_return_type_t<T>>::value); \ + return std::FUNC(x); \ + } \ + static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; } \ + }; \ + using kk_##FUNC = MathUnaryFunction_##FUNC; \ + template <> \ + struct math_function_name<MathUnaryFunction_##FUNC> { \ + static constexpr char name[] = #FUNC; \ + }; \ constexpr char math_function_name<MathUnaryFunction_##FUNC>::name[] #ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1 @@ -380,31 +355,29 @@ DEFINE_UNARY_FUNCTION_EVAL(logb, 2); #undef DEFINE_UNARY_FUNCTION_EVAL -#define DEFINE_BINARY_FUNCTION_EVAL(FUNC, ULP_FACTOR) \ - struct MathBinaryFunction_##FUNC { \ - template <typename T, typename U> \ - static KOKKOS_FUNCTION auto eval(T x, U y) { \ - static_assert( \ - std::is_same<decltype(Kokkos::FUNC((T)0, (U)0)), \ - math_binary_function_return_type_t<T, U>>::value, \ - ""); \ - return Kokkos::FUNC(x, y); \ - } \ - template <typename T, typename U> \ - static auto eval_std(T x, U y) { \ - static_assert( \ - std::is_same<decltype(std::FUNC((T)0, (U)0)), \ - math_binary_function_return_type_t<T, U>>::value, \ - ""); \ - return std::FUNC(x, y); \ - } \ - static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; } \ - }; \ - using kk_##FUNC = MathBinaryFunction_##FUNC; \ - template <> \ - struct math_function_name<MathBinaryFunction_##FUNC> { \ - static constexpr char name[] = #FUNC; \ - }; \ +#define DEFINE_BINARY_FUNCTION_EVAL(FUNC, ULP_FACTOR) \ + struct MathBinaryFunction_##FUNC { \ + template <typename T, typename U> \ + static KOKKOS_FUNCTION auto eval(T x, U y) { \ + static_assert( \ + std::is_same<decltype(Kokkos::FUNC((T)0, (U)0)), \ + math_binary_function_return_type_t<T, U>>::value); \ + return Kokkos::FUNC(x, y); \ + } \ + template <typename T, typename U> \ + static auto eval_std(T x, U y) { \ + static_assert( \ + std::is_same<decltype(std::FUNC((T)0, (U)0)), \ + math_binary_function_return_type_t<T, U>>::value); \ + return std::FUNC(x, y); \ + } \ + static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; } \ + }; \ + using kk_##FUNC = MathBinaryFunction_##FUNC; \ + template <> \ + struct math_function_name<MathBinaryFunction_##FUNC> { \ + static constexpr char name[] = #FUNC; \ + }; \ constexpr char math_function_name<MathBinaryFunction_##FUNC>::name[] #ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1 @@ -418,6 +391,38 @@ DEFINE_BINARY_FUNCTION_EVAL(copysign, 1); #undef DEFINE_BINARY_FUNCTION_EVAL +#define DEFINE_TERNARY_FUNCTION_EVAL(FUNC, ULP_FACTOR) \ + struct MathTernaryFunction_##FUNC { \ + template <typename T, typename U, typename V> \ + static KOKKOS_FUNCTION auto eval(T x, U y, V z) { \ + static_assert( \ + std::is_same<decltype(Kokkos::FUNC((T)0, (U)0, (V)0)), \ + math_ternary_function_return_type_t<T, U, V>>::value); \ + return Kokkos::FUNC(x, y, z); \ + } \ + template <typename T, typename U, typename V> \ + static auto eval_std(T x, U y, V z) { \ + static_assert( \ + std::is_same<decltype(std::FUNC((T)0, (U)0, (V)0)), \ + math_ternary_function_return_type_t<T, U, V>>::value); \ + return std::FUNC(x, y, z); \ + } \ + static KOKKOS_FUNCTION double ulp_factor() { return ULP_FACTOR; } \ + }; \ + using kk3_##FUNC = MathTernaryFunction_##FUNC; \ + template <> \ + struct math_function_name<MathTernaryFunction_##FUNC> { \ + static constexpr char name[] = #FUNC; \ + }; \ + constexpr char math_function_name<MathTernaryFunction_##FUNC>::name[] + +#ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1 +DEFINE_TERNARY_FUNCTION_EVAL(hypot, 2); +DEFINE_TERNARY_FUNCTION_EVAL(fma, 2); +#endif + +#undef DEFINE_TERNARY_FUNCTION_EVAL + // clang-format off template <class> struct type_helper; @@ -509,6 +514,49 @@ void do_test_math_binary_function(Arg1 arg1, Arg2 arg2) { (TestMathBinaryFunction<Space, Func, Arg1, Arg2>(arg1, arg2), 0)...}; } +template <class Space, class Func, class Arg1, class Arg2, class Arg3, + class Ret = math_ternary_function_return_type_t<Arg1, Arg2, Arg3>> +struct TestMathTernaryFunction : FloatingPointComparison { + Arg1 val1_; + Arg2 val2_; + Arg3 val3_; + Ret res_; + TestMathTernaryFunction(Arg1 val1, Arg2 val2, Arg3 val3) + : val1_(val1), + val2_(val2), + val3_(val3), + res_(Func::eval_std(val1, val2, val3)) { + run(); + } + void run() { + int errors = 0; + Kokkos::parallel_reduce(Kokkos::RangePolicy<Space>(0, 1), *this, errors); + ASSERT_EQ(errors, 0) << "Failed check no error for " + << math_function_name<Func>::name << "(" + << type_helper<Arg1>::name() << ", " + << type_helper<Arg1>::name() << ", " + << type_helper<Arg3>::name() << ")"; + } + KOKKOS_FUNCTION void operator()(int, int& e) const { + bool ar = + compare(Func::eval(val1_, val2_, val3_), res_, Func::ulp_factor()); + if (!ar) { + ++e; + KOKKOS_IMPL_DO_NOT_USE_PRINTF( + "value at %f, %f, %f which is %f was expected to be %f\n", + (double)val1_, (double)val2_, (double)val3_, + (double)Func::eval(val1_, val2_, val3_), (double)res_); + } + } +}; + +template <class Space, class... Func, class Arg1, class Arg2, class Arg3> +void do_test_math_ternary_function(Arg1 arg1, Arg2 arg2, Arg3 arg3) { + (void)std::initializer_list<int>{ + (TestMathTernaryFunction<Space, Func, Arg1, Arg2, Arg3>(arg1, arg2, arg3), + 0)...}; +} + #ifndef KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1 TEST(TEST_CATEGORY, mathematical_functions_trigonometric_functions) { @@ -631,6 +679,24 @@ TEST(TEST_CATEGORY, mathematical_functions_power_functions) { #if !(defined(KOKKOS_ARCH_POWER8) || defined(KOKKOS_ARCH_POWER9)) do_test_math_binary_function<TEST_EXECSPACE, kk_hypot>(2.l, 3.l); #endif +#endif + + do_test_math_ternary_function<TEST_EXECSPACE, kk3_hypot>(2.f, 3.f, 4.f); + do_test_math_ternary_function<TEST_EXECSPACE, kk3_hypot>(2., 3., 4.); + do_test_math_ternary_function<TEST_EXECSPACE, kk3_hypot>(2, 3.f, 4.); +#ifdef MATHEMATICAL_FUNCTIONS_HAVE_LONG_DOUBLE_OVERLOADS +#if !(defined(KOKKOS_ARCH_POWER8) || defined(KOKKOS_ARCH_POWER9)) + do_test_math_ternary_function<TEST_EXECSPACE, kk3_hypot>(2.l, 3.l, 4.l); +#endif +#endif +} + +TEST(TEST_CATEGORY, mathematical_functions_fma) { + do_test_math_ternary_function<TEST_EXECSPACE, kk3_fma>(2.f, 3.f, 4.f); + do_test_math_ternary_function<TEST_EXECSPACE, kk3_fma>(2., 3., 4.); + do_test_math_ternary_function<TEST_EXECSPACE, kk3_fma>(2, 3.f, 4.); +#ifdef MATHEMATICAL_FUNCTIONS_HAVE_LONG_DOUBLE_OVERLOADS + do_test_math_ternary_function<TEST_EXECSPACE, kk3_fma>(2.l, 3.l, 4.l); #endif } @@ -1047,8 +1113,10 @@ struct TestIsNaN { } if (isnan(3.) #ifndef KOKKOS_IMPL_WORKAROUND_INTEL_LLVM_DEFAULT_FLOATING_POINT_MODEL +#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC || !isnan(quiet_NaN<double>::value) || !isnan(signaling_NaN<double>::value) +#endif #endif ) { ++e; diff --git a/packages/kokkos/core/unit_test/TestMathematicalFunctions1.hpp b/packages/kokkos/core/unit_test/TestMathematicalFunctions1.hpp index 0fd56a5ac91c2a5ed01fccf5e6534a0afa814e58..d902a04422d5b1c19d401476de6d3e6faada1fca 100644 --- a/packages/kokkos/core/unit_test/TestMathematicalFunctions1.hpp +++ b/packages/kokkos/core/unit_test/TestMathematicalFunctions1.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #define KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_2 #include "TestMathematicalFunctions.hpp" diff --git a/packages/kokkos/core/unit_test/TestMathematicalFunctions2.hpp b/packages/kokkos/core/unit_test/TestMathematicalFunctions2.hpp index 74e7443b1306c1ee4a26ba9e4890cf8a26c195e8..58572ebe6fe1dc73cbce9aabb6f1263cf5d4a6b9 100644 --- a/packages/kokkos/core/unit_test/TestMathematicalFunctions2.hpp +++ b/packages/kokkos/core/unit_test/TestMathematicalFunctions2.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #define KOKKOS_MATHEMATICAL_FUNCTIONS_SKIP_1 #include "TestMathematicalFunctions.hpp" diff --git a/packages/kokkos/core/unit_test/TestMathematicalSpecialFunctions.hpp b/packages/kokkos/core/unit_test/TestMathematicalSpecialFunctions.hpp index 26f237a71d7c1667062f27c93e1b58fd83d3e44b..7ae202770583a45a82925c50f1a43232b104274b 100644 --- a/packages/kokkos/core/unit_test/TestMathematicalSpecialFunctions.hpp +++ b/packages/kokkos/core/unit_test/TestMathematicalSpecialFunctions.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <fstream> #include <gtest/gtest.h> #include "Kokkos_Core.hpp" @@ -489,7 +505,13 @@ struct TestComplexBesselJ0Y0Function { Kokkos::deep_copy(d_z, h_z); // Call Bessel functions - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this); +#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4) + using Property = + Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t; +#else + using Property = Kokkos::Experimental::WorkItemProperty::None_t; +#endif + Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this); Kokkos::fence(); Kokkos::deep_copy(h_cbj0, d_cbj0); @@ -618,8 +640,8 @@ struct TestComplexBesselJ0Y0Function { Kokkos::deep_copy(d_z_large, h_z_large); - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, TestLargeArgTag>(0, 1), - *this); + Kokkos::parallel_for( + Kokkos::RangePolicy<ExecSpace, Property, TestLargeArgTag>(0, 1), *this); Kokkos::fence(); Kokkos::deep_copy(h_cbj0_large, d_cbj0_large); @@ -779,7 +801,13 @@ struct TestComplexBesselJ1Y1Function { Kokkos::deep_copy(d_z, h_z); // Call Bessel functions - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this); +#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4) + using Property = + Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t; +#else + using Property = Kokkos::Experimental::WorkItemProperty::None_t; +#endif + Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this); Kokkos::fence(); Kokkos::deep_copy(h_cbj1, d_cbj1); @@ -908,8 +936,8 @@ struct TestComplexBesselJ1Y1Function { Kokkos::deep_copy(d_z_large, h_z_large); - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, TestLargeArgTag>(0, 1), - *this); + Kokkos::parallel_for( + Kokkos::RangePolicy<ExecSpace, Property, TestLargeArgTag>(0, 1), *this); Kokkos::fence(); Kokkos::deep_copy(h_cbj1_large, d_cbj1_large); @@ -1067,7 +1095,13 @@ struct TestComplexBesselI0K0Function { Kokkos::deep_copy(d_z, h_z); // Call Bessel functions - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this); +#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4) + using Property = + Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t; +#else + using Property = Kokkos::Experimental::WorkItemProperty::None_t; +#endif + Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this); Kokkos::fence(); Kokkos::deep_copy(h_cbi0, d_cbi0); @@ -1189,8 +1223,8 @@ struct TestComplexBesselI0K0Function { Kokkos::deep_copy(d_z_large, h_z_large); - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, TestLargeArgTag>(0, 1), - *this); + Kokkos::parallel_for( + Kokkos::RangePolicy<ExecSpace, Property, TestLargeArgTag>(0, 1), *this); Kokkos::fence(); Kokkos::deep_copy(h_cbi0_large, d_cbi0_large); @@ -1302,7 +1336,13 @@ struct TestComplexBesselI1K1Function { Kokkos::deep_copy(d_z, h_z); // Call Bessel functions - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this); +#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4) + using Property = + Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t; +#else + using Property = Kokkos::Experimental::WorkItemProperty::None_t; +#endif + Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this); Kokkos::fence(); Kokkos::deep_copy(h_cbi1, d_cbi1); @@ -1424,8 +1464,8 @@ struct TestComplexBesselI1K1Function { Kokkos::deep_copy(d_z_large, h_z_large); - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, TestLargeArgTag>(0, 1), - *this); + Kokkos::parallel_for( + Kokkos::RangePolicy<ExecSpace, Property, TestLargeArgTag>(0, 1), *this); Kokkos::fence(); Kokkos::deep_copy(h_cbi1_large, d_cbi1_large); @@ -1533,7 +1573,13 @@ struct TestComplexBesselH1Function { Kokkos::deep_copy(d_z, h_z); // Call Hankel functions - Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace>(0, N), *this); +#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 4) + using Property = + Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t; +#else + using Property = Kokkos::Experimental::WorkItemProperty::None_t; +#endif + Kokkos::parallel_for(Kokkos::RangePolicy<ExecSpace, Property>(0, N), *this); Kokkos::fence(); Kokkos::deep_copy(h_ch10, d_ch10); diff --git a/packages/kokkos/core/unit_test/TestMemoryPool.hpp b/packages/kokkos/core/unit_test/TestMemoryPool.hpp index 75deae13a108aa40833836eef30502560ed07933..f0bf1182924c9e2ac57fea092d3f1c5b7d4eac18 100644 --- a/packages/kokkos/core/unit_test/TestMemoryPool.hpp +++ b/packages/kokkos/core/unit_test/TestMemoryPool.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_UNITTEST_MEMPOOL_HPP #define KOKKOS_UNITTEST_MEMPOOL_HPP diff --git a/packages/kokkos/core/unit_test/TestMinMaxClamp.hpp b/packages/kokkos/core/unit_test/TestMinMaxClamp.hpp index 42f83f348ef41eeec96d2bccb6e8e9e22a068b4b..7ed2c6d3bacececde0c538163dc45abf473ad40c 100644 --- a/packages/kokkos/core/unit_test/TestMinMaxClamp.hpp +++ b/packages/kokkos/core/unit_test/TestMinMaxClamp.hpp @@ -1,53 +1,22 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> -// FIXME C++17 -#define STATIC_ASSERT(cond) static_assert(cond, ""); - namespace Test { template <class T> struct Greater { @@ -80,15 +49,15 @@ TEST(TEST_CATEGORY, max) { b = 1; EXPECT_EQ(Kokkos::max(a, b), 3); - STATIC_ASSERT(Kokkos::max(1, 2) == 2); - STATIC_ASSERT(Kokkos::max(1, 2, ::Test::Greater<int>{}) == 1); + static_assert(Kokkos::max(1, 2) == 2); + static_assert(Kokkos::max(1, 2, ::Test::Greater<int>{}) == 1); EXPECT_EQ(Kokkos::max({3.f, -1.f, 0.f}), 3.f); - STATIC_ASSERT(Kokkos::max({3, -1, 0}) == 3); - STATIC_ASSERT(Kokkos::max({3, -1, 0}, ::Test::Greater<int>{}) == -1); + static_assert(Kokkos::max({3, -1, 0}) == 3); + static_assert(Kokkos::max({3, -1, 0}, ::Test::Greater<int>{}) == -1); - STATIC_ASSERT(Kokkos::max({ + static_assert(Kokkos::max({ ::Test::PairIntCompareFirst{255, 0}, ::Test::PairIntCompareFirst{255, 1}, ::Test::PairIntCompareFirst{0, 2}, @@ -141,15 +110,15 @@ TEST(TEST_CATEGORY, min) { b = 2; EXPECT_EQ(Kokkos::min(a, b), 2); - STATIC_ASSERT(Kokkos::min(3.f, 2.f) == 2.f); - STATIC_ASSERT(Kokkos::min(3.f, 2.f, ::Test::Greater<int>{}) == 3.f); + static_assert(Kokkos::min(3.f, 2.f) == 2.f); + static_assert(Kokkos::min(3.f, 2.f, ::Test::Greater<int>{}) == 3.f); EXPECT_EQ(Kokkos::min({3.f, -1.f, 0.f}), -1.f); - STATIC_ASSERT(Kokkos::min({3, -1, 0}) == -1); - STATIC_ASSERT(Kokkos::min({3, -1, 0}, ::Test::Greater<int>{}) == 3); + static_assert(Kokkos::min({3, -1, 0}) == -1); + static_assert(Kokkos::min({3, -1, 0}, ::Test::Greater<int>{}) == 3); - STATIC_ASSERT(Kokkos::min({ + static_assert(Kokkos::min({ ::Test::PairIntCompareFirst{255, 0}, ::Test::PairIntCompareFirst{255, 1}, ::Test::PairIntCompareFirst{0, 2}, @@ -207,21 +176,21 @@ TEST(TEST_CATEGORY, minmax) { #ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC nvhpc can't deal with device side // constexpr constructors so I removed the - // constexpr in pair, which makes STATIC_ASSERT + // constexpr in pair, which makes static_assert // here fail - STATIC_ASSERT((Kokkos::pair<float, float>(Kokkos::minmax(3.f, 2.f)) == + static_assert((Kokkos::pair<float, float>(Kokkos::minmax(3.f, 2.f)) == Kokkos::make_pair(2.f, 3.f))); - STATIC_ASSERT( + static_assert( (Kokkos::pair<float, float>(Kokkos::minmax( 3.f, 2.f, ::Test::Greater<int>{})) == Kokkos::make_pair(3.f, 2.f))); EXPECT_EQ(Kokkos::minmax({3.f, -1.f, 0.f}), Kokkos::make_pair(-1.f, 3.f)); - STATIC_ASSERT(Kokkos::minmax({3, -1, 0}) == Kokkos::make_pair(-1, 3)); - STATIC_ASSERT(Kokkos::minmax({3, -1, 0}, ::Test::Greater<int>{}) == + static_assert(Kokkos::minmax({3, -1, 0}) == Kokkos::make_pair(-1, 3)); + static_assert(Kokkos::minmax({3, -1, 0}, ::Test::Greater<int>{}) == Kokkos::make_pair(3, -1)); - STATIC_ASSERT(Kokkos::minmax({ + static_assert(Kokkos::minmax({ ::Test::PairIntCompareFirst{255, 0}, ::Test::PairIntCompareFirst{255, 1}, ::Test::PairIntCompareFirst{0, 2}, @@ -230,7 +199,7 @@ TEST(TEST_CATEGORY, minmax) { ::Test::PairIntCompareFirst{0, 5}, }) .first.second == 2); // leftmost - STATIC_ASSERT(Kokkos::minmax({ + static_assert(Kokkos::minmax({ ::Test::PairIntCompareFirst{255, 0}, ::Test::PairIntCompareFirst{255, 1}, ::Test::PairIntCompareFirst{0, 2}, diff --git a/packages/kokkos/core/unit_test/TestNonTrivialScalarTypes.hpp b/packages/kokkos/core/unit_test/TestNonTrivialScalarTypes.hpp index 02064d2fc3debc09aa0fcbfed16e6366fc9cd14f..eaf7a4125cc3ca23f4b26b60a6a602a7d0cf7a89 100644 --- a/packages/kokkos/core/unit_test/TestNonTrivialScalarTypes.hpp +++ b/packages/kokkos/core/unit_test/TestNonTrivialScalarTypes.hpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TESTNONTRIVIALSCALARTYPES_HPP_ #define TESTNONTRIVIALSCALARTYPES_HPP_ diff --git a/packages/kokkos/core/unit_test/TestNumericTraits.hpp b/packages/kokkos/core/unit_test/TestNumericTraits.hpp index 0f34ff436f0fe21b0e38e2055fde34e7a5e60b0b..9146297cd8a2f0438649820ce512b9573f4b16df 100644 --- a/packages/kokkos/core/unit_test/TestNumericTraits.hpp +++ b/packages/kokkos/core/unit_test/TestNumericTraits.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -81,7 +53,6 @@ struct FiniteMax { template <class T> using trait = Kokkos::Experimental::finite struct RoundError { template <class T> using trait = Kokkos::Experimental::round_error<T>; }; struct NormMin { template <class T> using trait = Kokkos::Experimental::norm_min<T>; }; struct DenormMin { template <class T> using trait = Kokkos::Experimental::denorm_min<T>; }; -struct ReciprocalOverflowThreshold { template <class T> using trait = Kokkos::Experimental::reciprocal_overflow_threshold<T>; }; struct Digits { template <class T> using trait = Kokkos::Experimental::digits<T>; }; struct Digits10 { template <class T> using trait = Kokkos::Experimental::digits10<T>; }; struct MaxDigits10 { template <class T> using trait = Kokkos::Experimental::max_digits10<T>; }; @@ -152,18 +123,6 @@ struct TestNumericTraits { use_on_device(); } - KOKKOS_FUNCTION void operator()(ReciprocalOverflowThreshold, int, - int& e) const { - using Kokkos::Experimental::reciprocal_overflow_threshold; - auto const inv = 1 / reciprocal_overflow_threshold<T>::value; - if (inv + inv == inv && inv != 0) { - KOKKOS_IMPL_DO_NOT_USE_PRINTF( - "inverse of reciprocal overflow threshold is inf\n"); - ++e; - } - use_on_device(); - } - // clang-format off KOKKOS_FUNCTION void operator()(FiniteMax, int, int&) const { use_on_device(); } KOKKOS_FUNCTION void operator()(RoundError, int, int&) const { use_on_device(); } @@ -239,9 +198,8 @@ struct TestNumericTraits< TEST(TEST_CATEGORY, numeric_traits_infinity) { TestNumericTraits<TEST_EXECSPACE, float, Infinity>(); TestNumericTraits<TEST_EXECSPACE, double, Infinity>(); - // fails with XL 16.1.1 see issue #4100 // FIXME_NVHPC long double not supported -#if !defined(KOKKOS_COMPILER_IBM) && !defined(KOKKOS_COMPILER_NVHPC) +#if !defined(KOKKOS_COMPILER_NVHPC) TestNumericTraits<TEST_EXECSPACE, long double, Infinity>(); #endif } @@ -249,9 +207,8 @@ TEST(TEST_CATEGORY, numeric_traits_infinity) { TEST(TEST_CATEGORY, numeric_traits_epsilon) { TestNumericTraits<TEST_EXECSPACE, float, Epsilon>(); TestNumericTraits<TEST_EXECSPACE, double, Epsilon>(); - // fails with XL 16.1.1 see issue #4100 // FIXME_NVHPC long double not supported -#if !defined(KOKKOS_COMPILER_IBM) && !defined(KOKKOS_COMPILER_NVHPC) +#if !defined(KOKKOS_COMPILER_NVHPC) TestNumericTraits<TEST_EXECSPACE, long double, Epsilon>(); #endif } @@ -286,16 +243,6 @@ TEST(TEST_CATEGORY, numeric_traits_denorm_min) { #endif } -TEST(TEST_CATEGORY, numeric_traits_reciprocal_overflow_threshold) { - TestNumericTraits<TEST_EXECSPACE, float, ReciprocalOverflowThreshold>(); - TestNumericTraits<TEST_EXECSPACE, double, ReciprocalOverflowThreshold>(); -#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC: - // nvc++-Fatal-/home/projects/x86-64/nvidia/hpc_sdk/Linux_x86_64/22.3/compilers/bin/tools/cpp2 - // TERMINATED by signal 11 - TestNumericTraits<TEST_EXECSPACE, long double, ReciprocalOverflowThreshold>(); -#endif -} - TEST(TEST_CATEGORY, numeric_traits_finite_min_max) { TestNumericTraits<TEST_EXECSPACE, char, FiniteMin>(); TestNumericTraits<TEST_EXECSPACE, char, FiniteMax>(); @@ -528,17 +475,13 @@ CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, infinity); CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, infinity); CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(float, epsilon); CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, epsilon); -#ifndef KOKKOS_COMPILER_IBM // fails with XL 16.1.1 CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, epsilon); -#endif CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(float, round_error); CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, round_error); CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, round_error); CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(float, denorm_min); CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, denorm_min); CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, denorm_min); -// NOTE reciprocal_overflow_threshold purposefully omitted since it does not -// exist in std::numeric_limits // clang-format off static_assert(Kokkos::Experimental::norm_min<float >::value == std::numeric_limits< float>::min(), ""); static_assert(Kokkos::Experimental::norm_min<double >::value == std::numeric_limits< double>::min(), ""); @@ -703,8 +646,6 @@ CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_INTEGRAL(finite_max); CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(epsilon); CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(round_error); CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(norm_min); -CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT( - reciprocal_overflow_threshold); CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_FLOATING_POINT(digits); CHECK_INSTANTIATED_ON_CV_QUALIFIED_TYPES_INTEGRAL(digits); diff --git a/packages/kokkos/core/unit_test/TestOther.hpp b/packages/kokkos/core/unit_test/TestOther.hpp index 5596f373bf2d45636c6d03562886c50bf22fb435..5d118ce9b0225f3a35ee4d3877247bffed1e9a75 100644 --- a/packages/kokkos/core/unit_test/TestOther.hpp +++ b/packages/kokkos/core/unit_test/TestOther.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_OTHER_HPP #define KOKKOS_TEST_OTHER_HPP diff --git a/packages/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp b/packages/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp index 11684f8a80abc9d6f6010f2f3d6b40287d513cdc..176ce9b5fed40ebe925cd65b0fc1cb3ecdce738f 100644 --- a/packages/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp +++ b/packages/kokkos/core/unit_test/TestParseCmdLineArgsAndEnvVars.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestPolicyConstruction.hpp b/packages/kokkos/core/unit_test/TestPolicyConstruction.hpp deleted file mode 100644 index b25acb455518493761029f1f1c3453a7e180171c..0000000000000000000000000000000000000000 --- a/packages/kokkos/core/unit_test/TestPolicyConstruction.hpp +++ /dev/null @@ -1,922 +0,0 @@ -/* -//@HEADER -// ************************************************************************ -// -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). -// -// Under the terms of Contract DE-NA0003525 with NTESS, -// the U.S. Government retains certain rights in this software. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ -//@HEADER -*/ - -#include <gtest/gtest.h> - -#include <Kokkos_Core.hpp> -#include <sstream> -#include <iostream> -#include <type_traits> - -namespace Test { -struct SomeTag {}; - -template <class ExecutionSpace> -class TestRangePolicyConstruction { - public: - TestRangePolicyConstruction() { - test_compile_time_parameters(); - test_runtime_parameters(); - } - - private: - void test_compile_time_parameters() { - { - using policy_t = Kokkos::RangePolicy<>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, - typename execution_space::size_type>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Static>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::RangePolicy<ExecutionSpace>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, - typename execution_space::size_type>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Static>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::RangePolicy<ExecutionSpace, - Kokkos::Schedule<Kokkos::Dynamic>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, - typename execution_space::size_type>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = - Kokkos::RangePolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = - Kokkos::RangePolicy<Kokkos::IndexType<long>, ExecutionSpace, - Kokkos::Schedule<Kokkos::Dynamic>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = - Kokkos::RangePolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, SomeTag>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = - Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>, ExecutionSpace, - Kokkos::IndexType<long>, SomeTag>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = - Kokkos::RangePolicy<SomeTag, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, ExecutionSpace>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, - typename execution_space::size_type>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::RangePolicy<Kokkos::IndexType<long>, - Kokkos::Schedule<Kokkos::Dynamic>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, SomeTag>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = Kokkos::RangePolicy<Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, SomeTag>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = - Kokkos::RangePolicy<SomeTag, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - } - void test_runtime_parameters() { - using policy_t = Kokkos::RangePolicy<>; - using index_t = policy_t::index_type; - index_t work_begin = 5; - index_t work_end = 15; - index_t chunk_size = 10; - { - policy_t p(work_begin, work_end); - ASSERT_EQ(p.begin(), work_begin); - ASSERT_EQ(p.end(), work_end); - } - { - policy_t p(Kokkos::DefaultExecutionSpace(), work_begin, work_end); - ASSERT_EQ(p.begin(), work_begin); - ASSERT_EQ(p.end(), work_end); - } - { - policy_t p(work_begin, work_end, Kokkos::ChunkSize(chunk_size)); - ASSERT_EQ(p.begin(), work_begin); - ASSERT_EQ(p.end(), work_end); - ASSERT_EQ(p.chunk_size(), chunk_size); - } - { - policy_t p(Kokkos::DefaultExecutionSpace(), work_begin, work_end, - Kokkos::ChunkSize(chunk_size)); - ASSERT_EQ(p.begin(), work_begin); - ASSERT_EQ(p.end(), work_end); - ASSERT_EQ(p.chunk_size(), chunk_size); - } - { - policy_t p; - ASSERT_EQ(p.begin(), index_t(0)); - ASSERT_EQ(p.end(), index_t(0)); - p = policy_t(work_begin, work_end, Kokkos::ChunkSize(chunk_size)); - ASSERT_EQ(p.begin(), work_begin); - ASSERT_EQ(p.end(), work_end); - ASSERT_EQ(p.chunk_size(), chunk_size); - } - } -}; - -template <class ExecutionSpace> -class TestTeamPolicyConstruction { - public: - TestTeamPolicyConstruction() { - test_compile_time_parameters(); - test_run_time_parameters(); - } - - private: - void test_compile_time_parameters() { - { - using policy_t = Kokkos::TeamPolicy<>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, - typename execution_space::size_type>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Static>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::TeamPolicy<ExecutionSpace>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, - typename execution_space::size_type>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Static>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = - Kokkos::TeamPolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, - typename execution_space::size_type>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = - Kokkos::TeamPolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = - Kokkos::TeamPolicy<Kokkos::IndexType<long>, ExecutionSpace, - Kokkos::Schedule<Kokkos::Dynamic>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = - Kokkos::TeamPolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, SomeTag>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = - Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>, ExecutionSpace, - Kokkos::IndexType<long>, SomeTag>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = - Kokkos::TeamPolicy<SomeTag, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, ExecutionSpace>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE((std::is_same<execution_space, ExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, - typename execution_space::size_type>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::TeamPolicy<Kokkos::IndexType<long>, - Kokkos::Schedule<Kokkos::Dynamic>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_void<work_tag>::value)); - } - - { - using policy_t = Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, SomeTag>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, SomeTag>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - - { - using policy_t = - Kokkos::TeamPolicy<SomeTag, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>>; - using execution_space = typename policy_t::execution_space; - using index_type = typename policy_t::index_type; - using schedule_type = typename policy_t::schedule_type; - using work_tag = typename policy_t::work_tag; - - ASSERT_TRUE(( - std::is_same<execution_space, Kokkos::DefaultExecutionSpace>::value)); - ASSERT_TRUE((std::is_same<index_type, long>::value)); - ASSERT_TRUE((std::is_same<schedule_type, - Kokkos::Schedule<Kokkos::Dynamic>>::value)); - ASSERT_TRUE((std::is_same<work_tag, SomeTag>::value)); - } - } - - template <class policy_t> - void test_run_time_parameters_type() { - int league_size = 131; - int team_size = 4 < policy_t::execution_space::concurrency() - ? 4 - : policy_t::execution_space::concurrency(); -#ifdef KOKKOS_ENABLE_HPX - team_size = 1; -#endif -#ifdef KOKKOS_ENABLE_OPENMPTARGET - if (std::is_same<typename policy_t::execution_space, - Kokkos::Experimental::OpenMPTarget>::value) - team_size = 32; -#endif - int chunk_size = 4; - int per_team_scratch = 1024; - int per_thread_scratch = 16; - int scratch_size = per_team_scratch + per_thread_scratch * team_size; - - policy_t p1(league_size, team_size); - ASSERT_EQ(p1.league_size(), league_size); - ASSERT_EQ(p1.team_size(), team_size); - ASSERT_GT(p1.chunk_size(), 0); - ASSERT_EQ(size_t(p1.scratch_size(0)), 0u); - - policy_t p2 = p1.set_chunk_size(chunk_size); - ASSERT_EQ(p1.league_size(), league_size); - ASSERT_EQ(p1.team_size(), team_size); - ASSERT_EQ(p1.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p1.scratch_size(0)), 0u); - - ASSERT_EQ(p2.league_size(), league_size); - ASSERT_EQ(p2.team_size(), team_size); - ASSERT_EQ(p2.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p2.scratch_size(0)), 0u); - - policy_t p3 = p2.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch)); - ASSERT_EQ(p2.league_size(), league_size); - ASSERT_EQ(p2.team_size(), team_size); - ASSERT_EQ(p2.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p2.scratch_size(0)), size_t(per_team_scratch)); - ASSERT_EQ(p3.league_size(), league_size); - ASSERT_EQ(p3.team_size(), team_size); - ASSERT_EQ(p3.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p3.scratch_size(0)), size_t(per_team_scratch)); - - policy_t p4 = p2.set_scratch_size(0, Kokkos::PerThread(per_thread_scratch)); - ASSERT_EQ(p2.league_size(), league_size); - ASSERT_EQ(p2.team_size(), team_size); - ASSERT_EQ(p2.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p2.scratch_size(0)), size_t(scratch_size)); - ASSERT_EQ(p4.league_size(), league_size); - ASSERT_EQ(p4.team_size(), team_size); - ASSERT_EQ(p4.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p4.scratch_size(0)), size_t(scratch_size)); - - policy_t p5 = p2.set_scratch_size(0, Kokkos::PerThread(per_thread_scratch), - Kokkos::PerTeam(per_team_scratch)); - ASSERT_EQ(p2.league_size(), league_size); - ASSERT_EQ(p2.team_size(), team_size); - ASSERT_EQ(p2.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p2.scratch_size(0)), size_t(scratch_size)); - ASSERT_EQ(p5.league_size(), league_size); - ASSERT_EQ(p5.team_size(), team_size); - ASSERT_EQ(p5.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p5.scratch_size(0)), size_t(scratch_size)); - - policy_t p6 = p2.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch), - Kokkos::PerThread(per_thread_scratch)); - ASSERT_EQ(p2.league_size(), league_size); - ASSERT_EQ(p2.team_size(), team_size); - ASSERT_EQ(p2.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p2.scratch_size(0)), size_t(scratch_size)); - ASSERT_EQ(p6.league_size(), league_size); - ASSERT_EQ(p6.team_size(), team_size); - ASSERT_EQ(p6.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p6.scratch_size(0)), size_t(scratch_size)); - - policy_t p7 = p3.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch), - Kokkos::PerThread(per_thread_scratch)); - ASSERT_EQ(p3.league_size(), league_size); - ASSERT_EQ(p3.team_size(), team_size); - ASSERT_EQ(p3.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p3.scratch_size(0)), size_t(scratch_size)); - ASSERT_EQ(p7.league_size(), league_size); - ASSERT_EQ(p7.team_size(), team_size); - ASSERT_EQ(p7.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p7.scratch_size(0)), size_t(scratch_size)); - - policy_t p8; // default constructed - ASSERT_EQ(p8.league_size(), 0); - ASSERT_EQ(size_t(p8.scratch_size(0)), 0u); - p8 = p3; // call assignment operator - ASSERT_EQ(p3.league_size(), league_size); - ASSERT_EQ(p3.team_size(), team_size); - ASSERT_EQ(p3.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p3.scratch_size(0)), size_t(scratch_size)); - ASSERT_EQ(p8.league_size(), league_size); - ASSERT_EQ(p8.team_size(), team_size); - ASSERT_EQ(p8.chunk_size(), chunk_size); - ASSERT_EQ(size_t(p8.scratch_size(0)), size_t(scratch_size)); - } - - void test_run_time_parameters() { - test_run_time_parameters_type<Kokkos::TeamPolicy<ExecutionSpace>>(); - test_run_time_parameters_type< - Kokkos::TeamPolicy<ExecutionSpace, Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>>>(); - test_run_time_parameters_type< - Kokkos::TeamPolicy<Kokkos::IndexType<long>, ExecutionSpace, - Kokkos::Schedule<Kokkos::Dynamic>>>(); - test_run_time_parameters_type< - Kokkos::TeamPolicy<Kokkos::Schedule<Kokkos::Dynamic>, - Kokkos::IndexType<long>, ExecutionSpace, SomeTag>>(); - } -}; - -// semiregular is copyable and default initializable -// (regular requires equality comparable) -template <class Policy> -void check_semiregular() { - static_assert(std::is_default_constructible<Policy>::value, ""); - static_assert(std::is_copy_constructible<Policy>::value, ""); - static_assert(std::is_move_constructible<Policy>::value, ""); - static_assert(std::is_copy_assignable<Policy>::value, ""); - static_assert(std::is_move_assignable<Policy>::value, ""); - static_assert(std::is_destructible<Policy>::value, ""); -} - -TEST(TEST_CATEGORY, policy_construction) { - check_semiregular<Kokkos::RangePolicy<TEST_EXECSPACE>>(); - check_semiregular<Kokkos::TeamPolicy<TEST_EXECSPACE>>(); - check_semiregular<Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>>(); - - TestRangePolicyConstruction<TEST_EXECSPACE>(); - TestTeamPolicyConstruction<TEST_EXECSPACE>(); -} - -template <template <class...> class Policy, class... Args> -void check_converting_constructor_add_work_tag(Policy<Args...> const& policy) { - // Not the greatest but at least checking it compiles - struct WorkTag {}; - Policy<Args..., WorkTag> policy_with_tag = policy; - (void)policy_with_tag; -} - -TEST(TEST_CATEGORY, policy_converting_constructor_from_other_policy) { - check_converting_constructor_add_work_tag( - Kokkos::RangePolicy<TEST_EXECSPACE>{}); - check_converting_constructor_add_work_tag( - Kokkos::TeamPolicy<TEST_EXECSPACE>{}); - check_converting_constructor_add_work_tag( - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{}); -} - -#ifndef KOKKOS_COMPILER_NVHPC // FIXME_NVHPC -#ifndef KOKKOS_ENABLE_OPENMPTARGET // FIXME_OPENMPTARGET -TEST(TEST_CATEGORY_DEATH, policy_bounds_unsafe_narrowing_conversions) { - using Policy = Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, - Kokkos::IndexType<unsigned>>; - - ::testing::FLAGS_gtest_death_test_style = "threadsafe"; - ASSERT_DEATH( - { - (void)Policy({-1, 0}, {2, 3}); - }, - "unsafe narrowing conversion"); -} -#endif -#endif - -template <class Policy> -void test_prefer_desired_occupancy(Policy const& policy) { - static_assert(!Policy::experimental_contains_desired_occupancy, ""); - - // MaximizeOccupancy -> MaximizeOccupancy - auto const policy_still_no_occ = Kokkos::Experimental::prefer( - policy, Kokkos::Experimental::MaximizeOccupancy{}); - static_assert( - !decltype(policy_still_no_occ)::experimental_contains_desired_occupancy, - ""); - - // MaximizeOccupancy -> DesiredOccupancy - auto const policy_with_occ = Kokkos::Experimental::prefer( - policy, Kokkos::Experimental::DesiredOccupancy{33}); - static_assert( - decltype(policy_with_occ)::experimental_contains_desired_occupancy, ""); - EXPECT_EQ(policy_with_occ.impl_get_desired_occupancy().value(), 33); - - // DesiredOccupancy -> DesiredOccupancy - auto const policy_change_occ = Kokkos::Experimental::prefer( - policy_with_occ, Kokkos::Experimental::DesiredOccupancy{24}); - static_assert( - decltype(policy_change_occ)::experimental_contains_desired_occupancy, ""); - EXPECT_EQ(policy_change_occ.impl_get_desired_occupancy().value(), 24); - - // DesiredOccupancy -> MaximizeOccupancy - auto const policy_drop_occ = Kokkos::Experimental::prefer( - policy_with_occ, Kokkos::Experimental::MaximizeOccupancy{}); - static_assert( - !decltype(policy_drop_occ)::experimental_contains_desired_occupancy, ""); -} - -template <class... Args> -struct DummyPolicy : Kokkos::Impl::PolicyTraits<Args...> { - using execution_policy = DummyPolicy; - - using base_t = Kokkos::Impl::PolicyTraits<Args...>; - using base_t::base_t; -}; - -TEST(TEST_CATEGORY, desired_occupancy_prefer) { - test_prefer_desired_occupancy(DummyPolicy<TEST_EXECSPACE>{}); - test_prefer_desired_occupancy(Kokkos::RangePolicy<TEST_EXECSPACE>{}); - test_prefer_desired_occupancy( - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{}); - test_prefer_desired_occupancy(Kokkos::TeamPolicy<TEST_EXECSPACE>{}); -} - -// For a more informative static assertion: -template <size_t> -struct static_assert_dummy_policy_must_be_size_one; -template <> -struct static_assert_dummy_policy_must_be_size_one<1> {}; -template <size_t, size_t> -struct static_assert_dummy_policy_must_be_size_of_desired_occupancy; -template <> -struct static_assert_dummy_policy_must_be_size_of_desired_occupancy< - sizeof(Kokkos::Experimental::DesiredOccupancy), - sizeof(Kokkos::Experimental::DesiredOccupancy)> {}; - -// EBO failure with VS 16.11.3 and CUDA 11.4.2 -#if !(defined(_WIN32) && defined(KOKKOS_ENABLE_CUDA)) -TEST(TEST_CATEGORY, desired_occupancy_empty_base_optimization) { - DummyPolicy<TEST_EXECSPACE> const policy{}; - static_assert(sizeof(decltype(policy)) == 1, ""); - static_assert_dummy_policy_must_be_size_one<sizeof(decltype(policy))> - _assert1{}; - (void)&_assert1; // avoid unused variable warning - - using Kokkos::Experimental::DesiredOccupancy; - auto policy_with_occ = - Kokkos::Experimental::prefer(policy, DesiredOccupancy{50}); - static_assert(sizeof(decltype(policy_with_occ)) == sizeof(DesiredOccupancy), - ""); - static_assert_dummy_policy_must_be_size_of_desired_occupancy< - sizeof(decltype(policy_with_occ)), sizeof(DesiredOccupancy)> - _assert2{}; - (void)&_assert2; // avoid unused variable warning -} -#endif - -template <typename Policy> -void test_desired_occupancy_converting_constructors(Policy const& policy) { - auto policy_with_occ = Kokkos::Experimental::prefer( - policy, Kokkos::Experimental::DesiredOccupancy{50}); - EXPECT_EQ(policy_with_occ.impl_get_desired_occupancy().value(), 50); - - auto policy_with_hint = Kokkos::Experimental::require( - policy_with_occ, Kokkos::Experimental::WorkItemProperty::HintLightWeight); - EXPECT_EQ(policy_with_hint.impl_get_desired_occupancy().value(), 50); -} - -TEST(TEST_CATEGORY, desired_occupancy_converting_constructors) { - test_desired_occupancy_converting_constructors( - Kokkos::RangePolicy<TEST_EXECSPACE>{}); - test_desired_occupancy_converting_constructors( - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{}); - test_desired_occupancy_converting_constructors( - Kokkos::TeamPolicy<TEST_EXECSPACE>{}); -} - -template <class T> -void more_md_range_policy_construction_test() { - (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{ - Kokkos::Array<T, 2>{}, Kokkos::Array<T, 2>{}}; - - (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{{{T(0), T(0)}}, - {{T(2), T(2)}}}; - - (void)Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>>{{T(0), T(0)}, - {T(2), T(2)}}; -} - -TEST(TEST_CATEGORY, md_range_policy_construction_from_arrays) { - { - // Check that construction from Kokkos::Array of long compiles for backwards - // compability. This was broken in - // https://github.com/kokkos/kokkos/pull/3527/commits/88ea8eec6567c84739d77bdd25fdbc647fae28bb#r512323639 - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p1( - Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}}); - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p2( - Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}}); - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p3( - Kokkos::Array<long, 2>{{0, 1}}, Kokkos::Array<long, 2>{{2, 3}}, - Kokkos::Array<long, 1>{{4}}); - } - { - // Check that construction from Kokkos::Array of the specified index type - // works. - using index_type = unsigned long long; - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, - Kokkos::IndexType<index_type>> - p1(Kokkos::Array<index_type, 2>{{0, 1}}, - Kokkos::Array<index_type, 2>{{2, 3}}); - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, - Kokkos::IndexType<index_type>> - p2(Kokkos::Array<index_type, 2>{{0, 1}}, - Kokkos::Array<index_type, 2>{{2, 3}}); - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, - Kokkos::IndexType<index_type>> - p3(Kokkos::Array<index_type, 2>{{0, 1}}, - Kokkos::Array<index_type, 2>{{2, 3}}, - Kokkos::Array<index_type, 1>{{4}}); - } - { - // Check that construction from double-braced initliazer list - // works. - using index_type = unsigned long long; - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>> p1({{0, 1}}, - {{2, 3}}); - Kokkos::MDRangePolicy<TEST_EXECSPACE, Kokkos::Rank<2>, - Kokkos::IndexType<index_type>> - p2({{0, 1}}, {{2, 3}}); - } - - more_md_range_policy_construction_test<char>(); - more_md_range_policy_construction_test<int>(); - more_md_range_policy_construction_test<unsigned long>(); - more_md_range_policy_construction_test<std::int64_t>(); -} - -template <class WorkTag, class Policy> -constexpr auto set_worktag(Policy const& policy) { - static_assert(Kokkos::is_execution_policy<Policy>::value, ""); - using PolicyWithWorkTag = - Kokkos::Impl::WorkTagTrait::policy_with_trait<Policy, WorkTag>; - return PolicyWithWorkTag{policy}; -} - -TEST(TEST_CATEGORY, policy_set_worktag) { - struct SomeWorkTag {}; - struct OtherWorkTag {}; - - Kokkos::RangePolicy<> p1; - static_assert(std::is_void<decltype(p1)::work_tag>::value, ""); - - auto p2 = set_worktag<SomeWorkTag>(p1); - static_assert(std::is_same<decltype(p2)::work_tag, SomeWorkTag>::value, ""); - - auto p3 = set_worktag<OtherWorkTag>(p2); - static_assert(std::is_same<decltype(p3)::work_tag, OtherWorkTag>::value, ""); - - // NOTE this does not currently compile - // auto p4 = set_worktag<void>(p3); - // static_assert(std::is_void<decltype(p4)::work_tag>::value, ""); -} -} // namespace Test diff --git a/packages/kokkos/core/unit_test/TestQuadPrecisionMath.hpp b/packages/kokkos/core/unit_test/TestQuadPrecisionMath.hpp index 3be6b70ecf0cc165b73d4f1a947e8d276f0222c2..3801acd4a2a315e27dfbe9e51f87009d73589d50 100644 --- a/packages/kokkos/core/unit_test/TestQuadPrecisionMath.hpp +++ b/packages/kokkos/core/unit_test/TestQuadPrecisionMath.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Macros.hpp> #ifdef KOKKOS_ENABLE_LIBQUADMATH @@ -108,33 +80,31 @@ TEST(TEST_CATEGORY, quad_precision_common_math_functions) { }); } -#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, "") // FIXME C++17 - constexpr bool test_quad_precision_promotion_traits() { - STATIC_ASSERT( + static_assert( std::is_same<__float128, decltype(Kokkos::pow(__float128(1), 2))>::value); - STATIC_ASSERT(std::is_same<__float128, + static_assert(std::is_same<__float128, decltype(Kokkos::hypot(3, __float128(4)))>::value); return true; } -STATIC_ASSERT(test_quad_precision_promotion_traits()); +static_assert(test_quad_precision_promotion_traits()); constexpr bool test_quad_precision_math_constants() { // compare to mathematical constants defined in libquadmath when available // clang-format off - STATIC_ASSERT(Kokkos::Experimental::e_v <__float128> == M_Eq); - STATIC_ASSERT(Kokkos::Experimental::log2e_v <__float128> == M_LOG2Eq); - STATIC_ASSERT(Kokkos::Experimental::log10e_v<__float128> == M_LOG10Eq); - STATIC_ASSERT(Kokkos::Experimental::pi_v <__float128> == M_PIq); + static_assert(Kokkos::numbers::e_v <__float128> == M_Eq); + static_assert(Kokkos::numbers::log2e_v <__float128> == M_LOG2Eq); + static_assert(Kokkos::numbers::log10e_v<__float128> == M_LOG10Eq); + static_assert(Kokkos::numbers::pi_v <__float128> == M_PIq); #if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 930) - STATIC_ASSERT(Kokkos::Experimental::inv_pi_v<__float128> == M_1_PIq); + static_assert(Kokkos::::inv_pi_v<__float128> == M_1_PIq); #endif // inv_sqrtpi_v - STATIC_ASSERT(Kokkos::Experimental::ln2_v <__float128> == M_LN2q); - STATIC_ASSERT(Kokkos::Experimental::ln10_v <__float128> == M_LN10q); + static_assert(Kokkos::numbers::ln2_v <__float128> == M_LN2q); + static_assert(Kokkos::numbers::ln10_v <__float128> == M_LN10q); #if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 930) - STATIC_ASSERT(Kokkos::Experimental::sqrt2_v <__float128> == M_SQRT2q); + static_assert(Kokkos::numbers::sqrt2_v <__float128> == M_SQRT2q); #endif // sqrt3_v // inv_sqrt3_v @@ -144,7 +114,7 @@ constexpr bool test_quad_precision_math_constants() { return true; } -STATIC_ASSERT(test_quad_precision_math_constants()); +static_assert(test_quad_precision_math_constants()); } // namespace diff --git a/packages/kokkos/core/unit_test/TestRange.hpp b/packages/kokkos/core/unit_test/TestRange.hpp index d6b5d8fecc86173d3fa438cbca5b8242b48ddb36..0c465bdc1cfee80f2904a7083f1fcab67e138d7e 100644 --- a/packages/kokkos/core/unit_test/TestRange.hpp +++ b/packages/kokkos/core/unit_test/TestRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> @@ -285,10 +257,11 @@ struct TestRange { auto const N_no_implicit_capture = N; using policy_t = Kokkos::RangePolicy<ExecSpace, Kokkos::Schedule<Kokkos::Dynamic> >; + int const concurrency = ExecSpace().concurrency(); { Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> > - count("Count", ExecSpace::concurrency()); + count("Count", concurrency); Kokkos::View<int *, ExecSpace> a("A", N); Kokkos::parallel_for( @@ -309,17 +282,16 @@ struct TestRange { error); ASSERT_EQ(error, 0); - if ((ExecSpace::concurrency() > (int)1) && - (N > static_cast<int>(4 * ExecSpace::concurrency()))) { + if ((concurrency > 1) && (N > 4 * concurrency)) { size_t min = N; size_t max = 0; - for (int t = 0; t < ExecSpace::concurrency(); t++) { + for (int t = 0; t < concurrency; t++) { if (count(t) < min) min = count(t); if (count(t) > max) max = count(t); } ASSERT_LT(min, max); - // if ( ExecSpace::concurrency() > 2 ) { + // if ( concurrency > 2 ) { // ASSERT_LT( 2 * min, max ); //} } @@ -327,7 +299,7 @@ struct TestRange { { Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> > - count("Count", ExecSpace::concurrency()); + count("Count", concurrency); Kokkos::View<int *, ExecSpace> a("A", N); value_type sum = 0; @@ -353,17 +325,16 @@ struct TestRange { error); ASSERT_EQ(error, 0); - if ((ExecSpace::concurrency() > (int)1) && - (N > static_cast<int>(4 * ExecSpace::concurrency()))) { + if ((concurrency > 1) && (N > 4 * concurrency)) { size_t min = N; size_t max = 0; - for (int t = 0; t < ExecSpace::concurrency(); t++) { + for (int t = 0; t < concurrency; t++) { if (count(t) < min) min = count(t); if (count(t) > max) max = count(t); } ASSERT_LT(min, max); - // if ( ExecSpace::concurrency() > 2 ) { + // if ( concurrency > 2 ) { // ASSERT_LT( 2 * min, max ); //} } diff --git a/packages/kokkos/core/unit_test/TestRangePolicy.hpp b/packages/kokkos/core/unit_test/TestRangePolicy.hpp index 3f40e24d1c8c912a5fb600aa3569f5a27515565b..c612d367430a2144cc0876e0d36e4c017e15122a 100644 --- a/packages/kokkos/core/unit_test/TestRangePolicy.hpp +++ b/packages/kokkos/core/unit_test/TestRangePolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_RANGEPOLICY_HPP #define KOKKOS_TEST_RANGEPOLICY_HPP diff --git a/packages/kokkos/core/unit_test/TestRangePolicyConstructors.hpp b/packages/kokkos/core/unit_test/TestRangePolicyConstructors.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0a7e59ed980c4b47ba965c02c07d2c378453689e --- /dev/null +++ b/packages/kokkos/core/unit_test/TestRangePolicyConstructors.hpp @@ -0,0 +1,73 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <gtest/gtest.h> + +#include <Kokkos_Core.hpp> + +namespace { + +TEST(TEST_CATEGORY, range_policy_runtime_parameters) { + using Policy = Kokkos::RangePolicy<>; + using Index = Policy::index_type; + Index work_begin = 5; + Index work_end = 15; + Index chunk_size = 10; + { + Policy p(work_begin, work_end); + ASSERT_EQ(p.begin(), work_begin); + ASSERT_EQ(p.end(), work_end); + } + { + Policy p(Kokkos::DefaultExecutionSpace(), work_begin, work_end); + ASSERT_EQ(p.begin(), work_begin); + ASSERT_EQ(p.end(), work_end); + } + { + Policy p(work_begin, work_end, Kokkos::ChunkSize(chunk_size)); + ASSERT_EQ(p.begin(), work_begin); + ASSERT_EQ(p.end(), work_end); + ASSERT_EQ(p.chunk_size(), chunk_size); + } + { + Policy p(Kokkos::DefaultExecutionSpace(), work_begin, work_end, + Kokkos::ChunkSize(chunk_size)); + ASSERT_EQ(p.begin(), work_begin); + ASSERT_EQ(p.end(), work_end); + ASSERT_EQ(p.chunk_size(), chunk_size); + } + { + Policy p; // default-constructed + ASSERT_EQ(p.begin(), Index(0)); + ASSERT_EQ(p.end(), Index(0)); + ASSERT_EQ(p.chunk_size(), Index(0)); + + // copy-assigned + p = Policy(work_begin, work_end, Kokkos::ChunkSize(chunk_size)); + ASSERT_EQ(p.begin(), work_begin); + ASSERT_EQ(p.end(), work_end); + ASSERT_EQ(p.chunk_size(), chunk_size); + } + { + Policy p1(work_begin, work_end, Kokkos::ChunkSize(chunk_size)); + Policy p2(p1); // copy-constructed + ASSERT_EQ(p1.begin(), p2.begin()); + ASSERT_EQ(p1.end(), p2.end()); + ASSERT_EQ(p1.chunk_size(), p2.chunk_size()); + } +} + +} // namespace diff --git a/packages/kokkos/core/unit_test/TestRangePolicyRequire.hpp b/packages/kokkos/core/unit_test/TestRangePolicyRequire.hpp index 508b7192cb29aa87d3d28930d0babe0be1024432..749f8b97d2b59e53c486d220c013f7ed2537adea 100644 --- a/packages/kokkos/core/unit_test/TestRangePolicyRequire.hpp +++ b/packages/kokkos/core/unit_test/TestRangePolicyRequire.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> @@ -277,10 +249,11 @@ struct TestRangeRequire { auto const N_no_implicit_capture = N; using policy_t = Kokkos::RangePolicy<ExecSpace, Kokkos::Schedule<Kokkos::Dynamic> >; + int const concurrency = ExecSpace().concurrency(); { Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> > - count("Count", ExecSpace::concurrency()); + count("Count", concurrency); Kokkos::View<int *, ExecSpace> a("A", N); Kokkos::parallel_for( @@ -301,17 +274,16 @@ struct TestRangeRequire { error); ASSERT_EQ(error, 0); - if ((ExecSpace::concurrency() > (int)1) && - (N > static_cast<int>(4 * ExecSpace::concurrency()))) { + if ((concurrency > 1) && (N > 4 * concurrency)) { size_t min = N; size_t max = 0; - for (int t = 0; t < ExecSpace::concurrency(); t++) { + for (int t = 0; t < concurrency; t++) { if (count(t) < min) min = count(t); if (count(t) > max) max = count(t); } ASSERT_LT(min, max); - // if ( ExecSpace::concurrency() > 2 ) { + // if ( concurrency > 2 ) { // ASSERT_LT( 2 * min, max ); //} } @@ -319,7 +291,7 @@ struct TestRangeRequire { { Kokkos::View<size_t *, ExecSpace, Kokkos::MemoryTraits<Kokkos::Atomic> > - count("Count", ExecSpace::concurrency()); + count("Count", concurrency); Kokkos::View<int *, ExecSpace> a("A", N); int sum = 0; @@ -345,17 +317,16 @@ struct TestRangeRequire { error); ASSERT_EQ(error, 0); - if ((ExecSpace::concurrency() > (int)1) && - (N > static_cast<int>(4 * ExecSpace::concurrency()))) { + if ((concurrency > 1) && (N > 4 * concurrency)) { size_t min = N; size_t max = 0; - for (int t = 0; t < ExecSpace::concurrency(); t++) { + for (int t = 0; t < concurrency; t++) { if (count(t) < min) min = count(t); if (count(t) > max) max = count(t); } ASSERT_LT(min, max); - // if ( ExecSpace::concurrency() > 2 ) { + // if ( concurrency > 2 ) { // ASSERT_LT( 2 * min, max ); //} } diff --git a/packages/kokkos/core/unit_test/TestRealloc.hpp b/packages/kokkos/core/unit_test/TestRealloc.hpp index 3de42070e7d14b87e63f4dbea891c1cdd3f15693..2c9dc5ee47322d375caab016b733216f88fb240b 100644 --- a/packages/kokkos/core/unit_test/TestRealloc.hpp +++ b/packages/kokkos/core/unit_test/TestRealloc.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TESTREALLOC_HPP_ #define TESTREALLOC_HPP_ diff --git a/packages/kokkos/core/unit_test/TestReduce.hpp b/packages/kokkos/core/unit_test/TestReduce.hpp index c136b409b1ed6d82e4f1a67856348328176562e1..4cf30f6fbed47fb05a4f4fed5b83eff542ba04d7 100644 --- a/packages/kokkos/core/unit_test/TestReduce.hpp +++ b/packages/kokkos/core/unit_test/TestReduce.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <sstream> #include <iostream> @@ -518,22 +490,6 @@ class TestReduceDynamicView { // Test result to host pointer: std::string str("TestKernelReduce"); -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 - if (count % 2 == 0) { - Kokkos::parallel_reduce(nw, functor_type(nw, count), - host_result.data()); - } else { - Kokkos::parallel_reduce(str, nw, functor_type(nw, count), - host_result.data()); - } - - for (unsigned j = 0; j < count; ++j) { - const uint64_t correct = 0 == j % 3 ? nw : nsum; - ASSERT_EQ(host_result(j), (ScalarType)correct); - host_result(j) = 0; - } -#endif - if (count % 2 == 0) { Kokkos::parallel_reduce(nw, functor_type(nw, count), host_result); } else { diff --git a/packages/kokkos/core/unit_test/TestReduceCombinatorical.hpp b/packages/kokkos/core/unit_test/TestReduceCombinatorical.hpp index 2217b9b8a3f46fc28c19d9cc1479e716a9e32903..c6b6249bdf1b869917054d61460d292f5732f04c 100644 --- a/packages/kokkos/core/unit_test/TestReduceCombinatorical.hpp +++ b/packages/kokkos/core/unit_test/TestReduceCombinatorical.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <sstream> #include <iostream> @@ -415,11 +387,11 @@ struct TestReduceCombinatoricalInstantiation { #ifndef KOKKOS_ENABLE_OPENMPTARGET CallParallelReduce(args..., Test::ReduceCombinatorical::AddPlus<double>(value)); - if ((Kokkos::DefaultExecutionSpace::concurrency() > 1) && - (ExecSpace::concurrency() > 1) && (expected_result > 0)) { + if ((Kokkos::DefaultExecutionSpace().concurrency() > 1) && + (ExecSpace().concurrency() > 1) && (expected_result > 0)) { ASSERT_LT(expected_result, value); - } else if (((Kokkos::DefaultExecutionSpace::concurrency() > 1) || - (ExecSpace::concurrency() > 1)) && + } else if (((Kokkos::DefaultExecutionSpace().concurrency() > 1) || + (ExecSpace().concurrency() > 1)) && (expected_result > 0)) { ASSERT_LE(expected_result, value); } else { @@ -429,11 +401,11 @@ struct TestReduceCombinatoricalInstantiation { value = 99; Test::ReduceCombinatorical::AddPlus<double> add(value); CallParallelReduce(args..., add); - if ((Kokkos::DefaultExecutionSpace::concurrency() > 1) && - (ExecSpace::concurrency() > 1) && (expected_result > 0)) { + if ((Kokkos::DefaultExecutionSpace().concurrency() > 1) && + (ExecSpace().concurrency() > 1) && (expected_result > 0)) { ASSERT_LT(expected_result, value); - } else if (((Kokkos::DefaultExecutionSpace::concurrency() > 1) || - (ExecSpace::concurrency() > 1)) && + } else if (((Kokkos::DefaultExecutionSpace().concurrency() > 1) || + (ExecSpace().concurrency() > 1)) && (expected_result > 0)) { ASSERT_LE(expected_result, value); } else { diff --git a/packages/kokkos/core/unit_test/TestReducerCTADs.hpp b/packages/kokkos/core/unit_test/TestReducerCTADs.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3b90c2a7e09ae02c36313a3c8034584f0168a20f --- /dev/null +++ b/packages/kokkos/core/unit_test/TestReducerCTADs.hpp @@ -0,0 +1,421 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <Kokkos_Core.hpp> + +namespace { + +struct TestReducerCTADS { + using execspace = TEST_EXECSPACE; + using scalar_type = double; + using index_type = int; + using memspace = execspace::memory_space; + + struct CustomComparator { + bool operator()(scalar_type, scalar_type) const; + }; + static CustomComparator comparator; + + struct TestSum { + static Kokkos::View<scalar_type, memspace> view; + static Kokkos::View<scalar_type, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::Sum<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Sum(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Sum(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::Sum(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::Sum(unmanaged))>); + }; + + struct TestProd { + static Kokkos::View<scalar_type, memspace> view; + static Kokkos::View<scalar_type, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::Prod<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Prod(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Prod(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::Prod(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::Prod(unmanaged))>); + }; + + struct TestMin { + static Kokkos::View<scalar_type, memspace> view; + static Kokkos::View<scalar_type, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::Min<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Min(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Min(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::Min(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::Min(unmanaged))>); + }; + + struct TestMax { + static Kokkos::View<scalar_type, memspace> view; + static Kokkos::View<scalar_type, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::Max<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Max(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::Max(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::Max(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::Max(unmanaged))>); + }; + + struct TestLAnd { + static Kokkos::View<scalar_type, memspace> view; + static Kokkos::View<scalar_type, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::LAnd<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LAnd(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LAnd(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::LAnd(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::LAnd(unmanaged))>); + }; + + struct TestLOr { + static Kokkos::View<scalar_type, memspace> view; + static Kokkos::View<scalar_type, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::LOr<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LOr(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LOr(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::LOr(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::LOr(unmanaged))>); + }; + + struct TestBAnd { + static Kokkos::View<scalar_type, memspace> view; + static Kokkos::View<scalar_type, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::BAnd<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::BAnd(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::BAnd(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::BAnd(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::BAnd(unmanaged))>); + }; + + struct TestBOr { + static Kokkos::View<scalar_type, memspace> view; + static Kokkos::View<scalar_type, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::BOr<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::BOr(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::BOr(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::BOr(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::BOr(unmanaged))>); + }; + + struct TestMinLoc { + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace> + view; + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MinLoc<scalar_type, index_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MinLoc(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MinLoc(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinLoc(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinLoc(unmanaged))>); + }; + + struct TestMaxLoc { + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace> + view; + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MaxLoc<scalar_type, index_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MaxLoc(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MaxLoc(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MaxLoc(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MaxLoc(unmanaged))>); + }; + + struct TestMinMax { + static Kokkos::View<Kokkos::MinMaxScalar<scalar_type>, memspace> view; + static Kokkos::View<Kokkos::MinMaxScalar<scalar_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MinMax<scalar_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MinMax(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::MinMax(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinMax(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinMax(unmanaged))>); + }; + + struct TestMinMaxLoc { + static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>, + memspace> + view; + static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>, + memspace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MinMaxLoc<scalar_type, index_type, memspace> rt; + + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinMaxLoc(view))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinMaxLoc(rt))>); + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MinMaxLoc(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinMaxLoc(unmanaged))>); + }; + + struct TestMaxFirstLoc { + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace> + view; + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MaxFirstLoc<scalar_type, index_type, memspace> rt; + + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MaxFirstLoc(view))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MaxFirstLoc(rt))>); + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MaxFirstLoc(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MaxFirstLoc(unmanaged))>); + }; + + struct TestMaxFirstLocCustomComparator { + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace> + view; + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MaxFirstLocCustomComparator<scalar_type, index_type, + CustomComparator, memspace> + rt; + + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MaxFirstLocCustomComparator( + view, comparator))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::MaxFirstLocCustomComparator(rt))>); + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MaxFirstLocCustomComparator( + std::move(rt)))>); + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MaxFirstLocCustomComparator( + unmanaged, comparator))>); + }; + + struct TestMinFirstLoc { + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace> + view; + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MinFirstLoc<scalar_type, index_type, memspace> rt; + + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinFirstLoc(view))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinFirstLoc(rt))>); + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MinFirstLoc(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinFirstLoc(unmanaged))>); + }; + + struct TestMinFirstLocCustomComparator { + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace> + view; + static Kokkos::View<Kokkos::ValLocScalar<scalar_type, index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MinFirstLocCustomComparator<scalar_type, index_type, + CustomComparator, memspace> + rt; + + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MinFirstLocCustomComparator( + view, comparator))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::MinFirstLocCustomComparator(rt))>); + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MinFirstLocCustomComparator( + std::move(rt)))>); + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MinFirstLocCustomComparator( + unmanaged, comparator))>); + }; + + struct TestMinMaxFirstLastLoc { + static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>, + memspace> + view; + static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>, + memspace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MinMaxFirstLastLoc<scalar_type, index_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::MinMaxFirstLastLoc(view))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::MinMaxFirstLastLoc(rt))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::MinMaxFirstLastLoc(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::MinMaxFirstLastLoc(unmanaged))>); + }; + + struct TestMinMaxFirstLastLocCustomComparator { + static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>, + memspace> + view; + static Kokkos::View<Kokkos::MinMaxLocScalar<scalar_type, index_type>, + memspace, Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::MinMaxFirstLastLocCustomComparator< + scalar_type, index_type, CustomComparator, memspace> + rt; + + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::MinMaxFirstLastLocCustomComparator( + view, comparator))>); + static_assert(std::is_same_v< + decltype(rt), + decltype(Kokkos::MinMaxFirstLastLocCustomComparator(rt))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::MinMaxFirstLastLocCustomComparator( + std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::MinMaxFirstLastLocCustomComparator( + unmanaged, comparator))>); + }; + + struct TestFirstLoc { + static Kokkos::View<Kokkos::FirstLocScalar<index_type>, memspace> view; + static Kokkos::View<Kokkos::FirstLocScalar<index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::FirstLoc<index_type, memspace> rt; + + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::FirstLoc(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::FirstLoc(rt))>); + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::FirstLoc(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::FirstLoc(unmanaged))>); + }; + + struct TestLastLoc { + static Kokkos::View<Kokkos::LastLocScalar<index_type>, memspace> view; + static Kokkos::View<Kokkos::LastLocScalar<index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::LastLoc<index_type, memspace> rt; + + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::LastLoc(view))>); + static_assert(std::is_same_v<decltype(rt), decltype(Kokkos::LastLoc(rt))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::LastLoc(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::LastLoc(unmanaged))>); + }; + + struct TestStdIsPartitioned { + static Kokkos::View<Kokkos::StdIsPartScalar<index_type>, memspace> view; + static Kokkos::View<Kokkos::StdIsPartScalar<index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::StdIsPartitioned<index_type, memspace> rt; + + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::StdIsPartitioned(view))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::StdIsPartitioned(rt))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::StdIsPartitioned(std::move(rt)))>); + static_assert(std::is_same_v< + decltype(rt), decltype(Kokkos::StdIsPartitioned(unmanaged))>); + }; + + struct TestStdPartitionPoint { + static Kokkos::View<Kokkos::StdPartPointScalar<index_type>, memspace> view; + static Kokkos::View<Kokkos::StdPartPointScalar<index_type>, memspace, + Kokkos::MemoryTraits<Kokkos::Unmanaged>> + unmanaged; + static Kokkos::StdPartitionPoint<index_type, memspace> rt; + + static_assert(std::is_same_v<decltype(rt), + decltype(Kokkos::StdPartitionPoint(view))>); + static_assert( + std::is_same_v<decltype(rt), decltype(Kokkos::StdPartitionPoint(rt))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::StdPartitionPoint(std::move(rt)))>); + static_assert( + std::is_same_v<decltype(rt), + decltype(Kokkos::StdPartitionPoint(unmanaged))>); + }; +}; + +} // namespace diff --git a/packages/kokkos/core/unit_test/TestReducers.hpp b/packages/kokkos/core/unit_test/TestReducers.hpp index 10e0f3e9544fc2344b3b9c8387cd34ed1d5a70d3..633b203afe73138b8e7b5857b8e3430b34bbc534 100644 --- a/packages/kokkos/core/unit_test/TestReducers.hpp +++ b/packages/kokkos/core/unit_test/TestReducers.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <sstream> #include <iostream> diff --git a/packages/kokkos/core/unit_test/TestReducers_a.hpp b/packages/kokkos/core/unit_test/TestReducers_a.hpp index 4efc4f645064c7e01f501101ff9b42ca8e686309..7d6345d69caf5c26d260a0fbbd0e6c2bc7d3909f 100644 --- a/packages/kokkos/core/unit_test/TestReducers_a.hpp +++ b/packages/kokkos/core/unit_test/TestReducers_a.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestReducers.hpp> diff --git a/packages/kokkos/core/unit_test/TestReducers_b.hpp b/packages/kokkos/core/unit_test/TestReducers_b.hpp index 57aa0f3b7661659acd04ccdb8fe171954e258eb9..a55870776e4f731a45dc94d9350c3707f2ce9bbe 100644 --- a/packages/kokkos/core/unit_test/TestReducers_b.hpp +++ b/packages/kokkos/core/unit_test/TestReducers_b.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestReducers.hpp> diff --git a/packages/kokkos/core/unit_test/TestReducers_c.hpp b/packages/kokkos/core/unit_test/TestReducers_c.hpp index d1353b1f647e43c698adf994240be1086a9a5da3..9797fb3ef5886f1e8a559f640d92da5af4545e82 100644 --- a/packages/kokkos/core/unit_test/TestReducers_c.hpp +++ b/packages/kokkos/core/unit_test/TestReducers_c.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestReducers.hpp> diff --git a/packages/kokkos/core/unit_test/TestReducers_d.hpp b/packages/kokkos/core/unit_test/TestReducers_d.hpp index a84a6e20f0456c367a6f49a335db0f71a7a9e6bb..19eaa6d70002e60b5eec78c57f0759c469f9494a 100644 --- a/packages/kokkos/core/unit_test/TestReducers_d.hpp +++ b/packages/kokkos/core/unit_test/TestReducers_d.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestReducers.hpp> @@ -87,11 +59,11 @@ TEST(TEST_CATEGORY, reducers_bhalf_t) { TestReducers<ThisTestType, TEST_EXECSPACE>::test_sum(50); TestReducers<ThisTestType, TEST_EXECSPACE>::test_sum(51); + TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(1); + TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(2); + TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(3); + TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(4); TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(5); - TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(10); - TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(15); - TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(20); - TestReducers<ThisTestType, TEST_EXECSPACE>::test_prod(25); } TEST(TEST_CATEGORY, reducers_int8_t) { diff --git a/packages/kokkos/core/unit_test/TestReducers_e.hpp b/packages/kokkos/core/unit_test/TestReducers_e.hpp index e8a01e350f7cf6ae8531bb2d3a2570c85222e969..6b94aaaab50ab6e39aa92c3939ce644201279961 100644 --- a/packages/kokkos/core/unit_test/TestReducers_e.hpp +++ b/packages/kokkos/core/unit_test/TestReducers_e.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestReducers.hpp> diff --git a/packages/kokkos/core/unit_test/TestReductions.hpp b/packages/kokkos/core/unit_test/TestReductions.hpp index 1fa8a2e92e68f7c3bf34e6cc4cc96b29b73071f3..a4c277cb0bfbec4e6b579d459de57188e22ab1b2 100644 --- a/packages/kokkos/core/unit_test/TestReductions.hpp +++ b/packages/kokkos/core/unit_test/TestReductions.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_REDUCTIONS_HPP #define KOKKOS_TEST_REDUCTIONS_HPP diff --git a/packages/kokkos/core/unit_test/TestReductions_DeviceView.hpp b/packages/kokkos/core/unit_test/TestReductions_DeviceView.hpp index c1d6c5cec10596fd1b355f6588e4987cd1a96ca7..f9f9f251495f240afd87e3ea4587684568b77e2a 100644 --- a/packages/kokkos/core/unit_test/TestReductions_DeviceView.hpp +++ b/packages/kokkos/core/unit_test/TestReductions_DeviceView.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <Kokkos_Core.hpp> namespace Test { diff --git a/packages/kokkos/core/unit_test/TestResize.hpp b/packages/kokkos/core/unit_test/TestResize.hpp index cd1fde4a9da716b39723a5755209f5d831215927..13d7e16d5890ca170683f98471c2b8af41b6f7a4 100644 --- a/packages/kokkos/core/unit_test/TestResize.hpp +++ b/packages/kokkos/core/unit_test/TestResize.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TESTRESIZE_HPP_ #define TESTRESIZE_HPP_ diff --git a/packages/kokkos/core/unit_test/TestScan.hpp b/packages/kokkos/core/unit_test/TestScan.hpp index 356ffde9565aaf40035e033748056cbb3028f678..8c6a02f31fe3b5ff0dae001a50391993259cdaab 100644 --- a/packages/kokkos/core/unit_test/TestScan.hpp +++ b/packages/kokkos/core/unit_test/TestScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> @@ -100,15 +72,51 @@ struct TestScan { Kokkos::deep_copy(errors_a, 0); errors = errors_a; - Kokkos::parallel_scan(N, *this); + { + Kokkos::parallel_scan(N, *this); + check_error(); + } + + { + Kokkos::deep_copy(errors_a, 0); + value_type total = 0; + Kokkos::parallel_scan(N, *this, total); + + // We can't return a value in a constructor so use a lambda as wrapper to + // ignore it. + [&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total)); }(); + check_error(); + } - value_type total = 0; - Kokkos::parallel_scan(N, *this, total); + { + Kokkos::deep_copy(errors_a, 0); + Kokkos::View<value_type, Kokkos::HostSpace> total_view("total"); + Kokkos::parallel_scan(N, *this, total_view); + Kokkos::fence(); - // We can't return a value in a constructor so use a lambda as wrapper to - // ignore it. - [&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total)); }(); - check_error(); + // We can't return a value in a constructor so use a lambda as wrapper to + // ignore it. + [&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total_view())); }(); + check_error(); + } + + { + Kokkos::deep_copy(errors_a, 0); + Kokkos::View<value_type, typename Device::memory_space> total_view( + "total"); + typename Device::execution_space exec; + Kokkos::parallel_scan( + Kokkos::RangePolicy<typename Device::execution_space>(exec, 0, N), + *this, total_view); + value_type total; + Kokkos::deep_copy(exec, total, total_view); + exec.fence(); + + // We can't return a value in a constructor so use a lambda as wrapper to + // ignore it. + [&] { ASSERT_EQ(size_t((N + 1) * N / 2), size_t(total)); }(); + check_error(); + } } TestScan(const size_t Start, const size_t N) { diff --git a/packages/kokkos/core/unit_test/TestSharedAlloc.hpp b/packages/kokkos/core/unit_test/TestSharedAlloc.hpp index f66b35dc9f9de2a8b3eabc0338683f3875dbd2b1..c7b0f380231e571a5c3f6aae864c91a43ace8977 100644 --- a/packages/kokkos/core/unit_test/TestSharedAlloc.hpp +++ b/packages/kokkos/core/unit_test/TestSharedAlloc.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -91,7 +63,7 @@ void test_shared_alloc() { // Since always executed on host space, leave [=] Kokkos::parallel_for(range, [=](int i) { char name[64]; - sprintf(name, "test_%.2d", i); + snprintf(name, 64, "test_%.2d", i); r[i] = RecordMemS::allocate(s, name, size * (i + 1)); h[i] = Header::get_header(r[i]->data()); @@ -135,7 +107,7 @@ void test_shared_alloc() { Kokkos::parallel_for(range, [=](size_t i) { char name[64]; - sprintf(name, "test_%.2d", int(i)); + snprintf(name, 64, "test_%.2d", int(i)); RecordFull* rec = RecordFull::allocate(s, name, size * (i + 1)); @@ -241,11 +213,13 @@ TEST(TEST_CATEGORY, impl_shared_alloc) { #elif (TEST_CATEGORY_NUMBER == 5) // cuda test_shared_alloc<Kokkos::CudaSpace, Kokkos::DefaultHostExecutionSpace>(); #elif (TEST_CATEGORY_NUMBER == 6) // hip - test_shared_alloc<Kokkos::Experimental::HIPSpace, - Kokkos::DefaultHostExecutionSpace>(); + test_shared_alloc<Kokkos::HIPSpace, Kokkos::DefaultHostExecutionSpace>(); #elif (TEST_CATEGORY_NUMBER == 7) // sycl test_shared_alloc<Kokkos::Experimental::SYCLDeviceUSMSpace, Kokkos::DefaultHostExecutionSpace>(); +#elif (TEST_CATEGORY_NUMBER == 8) // openacc + test_shared_alloc<Kokkos::Experimental::OpenACCSpace, + Kokkos::DefaultHostExecutionSpace>(); #endif #else test_shared_alloc<TEST_EXECSPACE, Kokkos::DefaultHostExecutionSpace>(); diff --git a/packages/kokkos/core/unit_test/TestSharedHostPinnedSpace.cpp b/packages/kokkos/core/unit_test/TestSharedHostPinnedSpace.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4d59fb1a442ebad8e407257e8350dc6f93f2e251 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestSharedHostPinnedSpace.cpp @@ -0,0 +1,105 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER +#include <gtest/gtest.h> +#include <Kokkos_Core.hpp> + +namespace { + +template <typename ViewType> +struct Increment { + ViewType view_; + + template <typename ExecutionSpace> + explicit Increment(ExecutionSpace, ViewType view) : view_(view) { + Kokkos::parallel_for( + "increment", + Kokkos::RangePolicy<ExecutionSpace, Kokkos::IndexType<size_t>>{ + 0, view_.size()}, + *this); + } + + KOKKOS_FUNCTION + void operator()(const size_t idx) const { ++view_(idx); } +}; + +template <typename ViewType> +struct CheckResult { + ViewType view_; + int targetVal_; + unsigned numErrors = 0; + + template <typename ExecutionSpace> + CheckResult(ExecutionSpace, ViewType view, int targetVal) + : view_(view), targetVal_(targetVal) { + Kokkos::parallel_reduce( + "check", + Kokkos::RangePolicy<ExecutionSpace, Kokkos::IndexType<size_t>>{ + 0, view_.size()}, + *this, Kokkos::Sum<unsigned>(numErrors)); + } + + KOKKOS_FUNCTION + void operator()(const size_t idx, unsigned& errors) const { + if (view_(idx) != targetVal_) ++errors; + } +}; + +TEST(defaultdevicetype, shared_host_pinned_space) { + ASSERT_TRUE(Kokkos::has_shared_host_pinned_space); + + if constexpr (std::is_same_v<Kokkos::DefaultExecutionSpace, + Kokkos::DefaultHostExecutionSpace>) + GTEST_SKIP() << "Skipping as host and device are the same space"; + + const unsigned int numDeviceHostCycles = 3; + size_t numInts = 1024; + + using DeviceExecutionSpace = Kokkos::DefaultExecutionSpace; + using HostExecutionSpace = Kokkos::DefaultHostExecutionSpace; + + // ALLOCATION + Kokkos::View<int*, Kokkos::SharedHostPinnedSpace> sharedData("sharedData", + numInts); + // MAIN LOOP + unsigned incrementCount = 0; + + for (unsigned i = 0; i < numDeviceHostCycles; ++i) { + // INCREMENT DEVICE + Increment incrementOnDevice(DeviceExecutionSpace{}, sharedData); + ++incrementCount; + Kokkos::fence(); + // CHECK RESULTS HOST + ASSERT_EQ( + CheckResult(HostExecutionSpace{}, sharedData, incrementCount).numErrors, + 0u) + << "Changes to SharedHostPinnedSpace made on device not visible to " + "host. Iteration " + << i << " of " << numDeviceHostCycles; + + // INCREMENT HOST + Increment incrementOnHost(HostExecutionSpace{}, sharedData); + ++incrementCount; + Kokkos::fence(); + // CHECK RESULTS Device + ASSERT_EQ(CheckResult(DeviceExecutionSpace{}, sharedData, incrementCount) + .numErrors, + 0u) + << "Changes to SharedHostPinnedSpace made on host not visible to " + "device. Iteration " + << i << " of " << numDeviceHostCycles; + } +} +} // namespace diff --git a/packages/kokkos/core/unit_test/TestSharedSpace.cpp b/packages/kokkos/core/unit_test/TestSharedSpace.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8112c956db42ffb95cf791e722136333dedb15a4 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestSharedSpace.cpp @@ -0,0 +1,218 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER +#include <gtest/gtest.h> +#include <Kokkos_Core.hpp> + +#if defined(_WIN32) +#include <windows.h> +unsigned getBytesPerPage() { + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwPageSize; +} + +#else // unix/posix system +#include <unistd.h> +unsigned getBytesPerPage() { return sysconf(_SC_PAGESIZE); } +#endif + +#include <algorithm> +#include <numeric> +#include <iostream> + +namespace { +void printTimings(std::ostream& out, std::vector<uint64_t> const& tr, + uint64_t threshold = (std::numeric_limits<uint64_t>::max)()) { + out << "TimingResult contains " << tr.size() << " results:\n"; + for (auto it = tr.begin(); it != tr.end(); ++it) { + out << "Duration of loop " << it - tr.begin() << " is " << *it + << " clock cycles. "; + if ((*it) > threshold) out << "Migration assumed."; + + out << "\n"; + } +} + +template <typename T> +T computeMean(std::vector<T> const& results) { + return std::accumulate(results.begin(), results.end(), T{}) / results.size(); +} + +template <typename ViewType> +class IncrementFunctor { + private: + using index_type = decltype(std::declval<ViewType>().size()); + ViewType view_; + + public: + IncrementFunctor() = delete; + + explicit IncrementFunctor(ViewType view) : view_(view) {} + + KOKKOS_INLINE_FUNCTION + void operator()(const index_type idx, uint64_t& clockTics) const { + uint64_t start = Kokkos::Impl::clock_tic(); + ++view_(idx); + clockTics += Kokkos::Impl::clock_tic() - start; + } +}; + +// TIMING CAPTURED KERNEL +// PREMISE: This kernel should always be memory bound, as we are measuring +// memory access times. The compute load of an increment is small enough on +// current hardware but this could be different for new hardware. As we count +// the clocks in the kernel, the core frequency of the device has to be fast +// enough to guarante that the kernel stays memory bound. +template <typename ExecSpace, typename ViewType> +std::vector<uint64_t> incrementInLoop(ViewType& view, + unsigned int numRepetitions) { + using index_type = decltype(view.size()); + std::vector<uint64_t> results; + + Kokkos::fence(); + for (unsigned i = 0; i < numRepetitions; ++i) { + uint64_t sum_clockTics; + IncrementFunctor<ViewType> func(view); + Kokkos::parallel_reduce( + "increment", + Kokkos::RangePolicy<ExecSpace, Kokkos::IndexType<index_type>>{ + 0, view.size()}, + func, sum_clockTics); + Kokkos::fence(); + results.push_back(sum_clockTics / view.size()); + } + return results; +} + +TEST(defaultdevicetype, shared_space) { + ASSERT_TRUE(Kokkos::has_shared_space); + + if constexpr (std::is_same_v<Kokkos::DefaultExecutionSpace, + Kokkos::DefaultHostExecutionSpace>) + GTEST_SKIP() << "Skipping as host and device are the same space"; + +#if defined(KOKKOS_ARCH_VEGA906) || defined(KOKKOS_ARCH_VEGA908) || \ + defined(KOKKOS_ARCH_NAVI) + GTEST_SKIP() + << "skipping because specified arch does not support page migration"; +#endif +#if defined(KOKKOS_ENABLE_SYCL) && !defined(KOKKOS_ARCH_INTEL_GPU) + GTEST_SKIP() + << "skipping because clock_tic is only defined for sycl+intel gpu"; +#endif + + const unsigned int numRepetitions = 10; + const unsigned int numDeviceHostCycles = 3; + double threshold = 1.5; + unsigned int numPages = 100; + size_t numBytes = numPages * getBytesPerPage(); + + using DeviceExecutionSpace = Kokkos::DefaultExecutionSpace; + using HostExecutionSpace = Kokkos::DefaultHostExecutionSpace; + + // ALLOCATION + Kokkos::View<int*, Kokkos::SharedSpace> sharedData("sharedData", + numBytes / sizeof(int)); + Kokkos::View<int*, DeviceExecutionSpace::memory_space> deviceData( + "deviceData", numBytes / sizeof(int)); + Kokkos::View<int*, HostExecutionSpace::memory_space> hostData( + "hostData", numBytes / sizeof(int)); + Kokkos::fence(); + + // GET DEFAULT EXECSPACE LOCAL TIMINGS + auto deviceLocalTimings = + incrementInLoop<DeviceExecutionSpace>(deviceData, numRepetitions); + + // GET DEFAULT HOSTEXECSPACE LOCAL TIMINGS + auto hostLocalTimings = + incrementInLoop<HostExecutionSpace>(hostData, numRepetitions); + + // GET PAGE MIGRATING TIMINGS DATA + std::vector<decltype(deviceLocalTimings)> deviceSharedTimings{}; + std::vector<decltype(hostLocalTimings)> hostSharedTimings{}; + for (unsigned i = 0; i < numDeviceHostCycles; ++i) { + // GET RESULTS DEVICE + deviceSharedTimings.push_back( + incrementInLoop<DeviceExecutionSpace>(sharedData, numRepetitions)); + + // GET RESULTS HOST + hostSharedTimings.push_back( + incrementInLoop<HostExecutionSpace>(sharedData, numRepetitions)); + } + + // COMPUTE STATISTICS OF HOST AND DEVICE LOCAL KERNELS + auto deviceLocalMean = computeMean(deviceLocalTimings); + auto hostLocalMean = computeMean(hostLocalTimings); + + // ASSESS RESULTS + bool fastAsLocalOnRepeatedAccess = true; + + for (unsigned cycle = 0; cycle < numDeviceHostCycles; ++cycle) { + std::for_each(std::next(deviceSharedTimings[cycle].begin()), + deviceSharedTimings[cycle].end(), [&](const uint64_t timing) { + (timing < threshold * deviceLocalMean) + ? fastAsLocalOnRepeatedAccess &= true + : fastAsLocalOnRepeatedAccess &= false; + }); + + std::for_each(std::next(hostSharedTimings[cycle].begin()), + hostSharedTimings[cycle].end(), [&](const uint64_t timing) { + (timing < threshold * hostLocalMean) + ? fastAsLocalOnRepeatedAccess &= true + : fastAsLocalOnRepeatedAccess &= false; + }); + } + + // CHECK IF PASSED + bool passed = (fastAsLocalOnRepeatedAccess); + + // PRINT IF NOT PASSED + if (!passed) { + std::cout << "Page size as reported by os: " << getBytesPerPage() + << " bytes \n"; + std::cout << "Allocating " << numPages + << " pages of memory in SharedSpace.\n"; + + std::cout << "Behavior found: \n"; + std::cout << "SharedSpace is as fast as local space on repeated access: " + << fastAsLocalOnRepeatedAccess << ", we expect true \n\n"; + + std::cout + << "Please look at the following timings. The first access in a " + "different ExecutionSpace is not evaluated for the test. As we " + "expect the memory to migrate during the first access it might have " + "a higher cycle count than subsequent accesses, depending on your " + "hardware. If the cycles are more than " + << threshold + << " times the cycles for pure local memory access, we assume a page " + "migration happened.\n\n"; + + std::cout << "################SHARED SPACE####################\n"; + for (unsigned cycle = 0; cycle < numDeviceHostCycles; ++cycle) { + std::cout << "DeviceExecutionSpace timings of run " << cycle << ":\n"; + printTimings(std::cout, deviceSharedTimings[cycle], + threshold * deviceLocalMean); + std::cout << "HostExecutionSpace timings of run " << cycle << ":\n"; + printTimings(std::cout, hostSharedTimings[cycle], + threshold * hostLocalMean); + } + std::cout << "################LOCAL SPACE####################\n"; + printTimings(std::cout, deviceLocalTimings); + printTimings(std::cout, hostLocalTimings); + } + ASSERT_TRUE(passed); +} +} // namespace diff --git a/packages/kokkos/core/unit_test/TestStackTrace.cpp b/packages/kokkos/core/unit_test/TestStackTrace.cpp index 76ab7e3ebe56292125214b07fb09ea20a4abd0c4..fe06ae58d0a4a54fd813bab8cad60f22ec23e923 100644 --- a/packages/kokkos/core/unit_test/TestStackTrace.cpp +++ b/packages/kokkos/core/unit_test/TestStackTrace.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/TestStackTrace.hpp b/packages/kokkos/core/unit_test/TestStackTrace.hpp index d34d0f92e959277e7f6a66c0718ce381cd794e61..f5a0b95a02d33082a38846d3eb684c739593da8b 100644 --- a/packages/kokkos/core/unit_test/TestStackTrace.hpp +++ b/packages/kokkos/core/unit_test/TestStackTrace.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include <gtest/gtest.h> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f0.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f0.cpp index 1514600f7d1f300cfaa076790e3f3e4dbfe52e0d..123713d5ec5dee9a68872843f2f8b34a55e2048c 100644 --- a/packages/kokkos/core/unit_test/TestStackTrace_f0.cpp +++ b/packages/kokkos/core/unit_test/TestStackTrace_f0.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f1.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f1.cpp index b10c574c9bd0d7f8a82ff2fa3ead8b5204cf179f..158a7adef4f0179694585f62da7c4c90e99c8430 100644 --- a/packages/kokkos/core/unit_test/TestStackTrace_f1.cpp +++ b/packages/kokkos/core/unit_test/TestStackTrace_f1.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f2.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f2.cpp index 23c1895e6946b2ef45caf7ed8d5a30e808089290..6cc4af411bcc9137448f6d1d58367873f017d10c 100644 --- a/packages/kokkos/core/unit_test/TestStackTrace_f2.cpp +++ b/packages/kokkos/core/unit_test/TestStackTrace_f2.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f3.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f3.cpp index ac004243f11e52c21d15bd04a6f246148e2962d2..830556324ffe06ae3b9d73f4490a3679bfc09351 100644 --- a/packages/kokkos/core/unit_test/TestStackTrace_f3.cpp +++ b/packages/kokkos/core/unit_test/TestStackTrace_f3.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/TestStackTrace_f4.cpp b/packages/kokkos/core/unit_test/TestStackTrace_f4.cpp index afae98a2a8fe70f1d0d9fa49709646bb70b9ce18..d5e1f38e78bbef52098cef7a0456816963e2a322 100644 --- a/packages/kokkos/core/unit_test/TestStackTrace_f4.cpp +++ b/packages/kokkos/core/unit_test/TestStackTrace_f4.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/TestStringManipulation.cpp b/packages/kokkos/core/unit_test/TestStringManipulation.cpp index 92b2afa475f1a5274cd3bbf80e4834542f7c7dd7..4b929edb940557f5a2369a0b09a8c2c95b95fb7f 100644 --- a/packages/kokkos/core/unit_test/TestStringManipulation.cpp +++ b/packages/kokkos/core/unit_test/TestStringManipulation.cpp @@ -1,63 +1,33 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <impl/Kokkos_StringManipulation.hpp> #include <climits> namespace { -#define STATIC_ASSERT(cond) static_assert(cond, "") - KOKKOS_FUNCTION constexpr bool test_strlen() { using Kokkos::Impl::strlen; constexpr char str[] = "How many characters does this string contain?"; - STATIC_ASSERT(strlen(str) == 45); // without null character - STATIC_ASSERT(sizeof str == 46); // with null character - STATIC_ASSERT(strlen("") == 0); + static_assert(strlen(str) == 45); // without null character + static_assert(sizeof str == 46); // with null character + static_assert(strlen("") == 0); return true; } -STATIC_ASSERT(test_strlen()); +static_assert(test_strlen()); KOKKOS_FUNCTION constexpr bool test_strcmp() { using Kokkos::Impl::strcmp; @@ -65,44 +35,38 @@ KOKKOS_FUNCTION constexpr bool test_strcmp() { constexpr char cat2[] = "Snagglepuss"; constexpr char cat3[] = "Hobbes"; constexpr char cat4[] = "Garfield"; - STATIC_ASSERT(strcmp(cat1, cat1) == 0); + static_assert(strcmp(cat1, cat1) == 0); #if (!defined(KOKKOS_COMPILER_NVCC) || \ ((__CUDACC_VER_MAJOR__ >= 11) && (__CUDACC_VER_MINOR__ >= 3))) && \ (!defined(__INTEL_COMPILER_BUILD_DATE) || \ (__INTEL_COMPILER_BUILD_DATE >= 20210228)) - STATIC_ASSERT(strcmp(cat1, cat2) < 0); - STATIC_ASSERT(strcmp(cat1, cat3) < 0); + static_assert(strcmp(cat1, cat2) < 0); + static_assert(strcmp(cat1, cat3) < 0); #endif - STATIC_ASSERT(strcmp(cat1, cat4) > 0); - STATIC_ASSERT(strcmp(cat2, cat2) == 0); - STATIC_ASSERT(strcmp(cat2, cat3) > 0); - STATIC_ASSERT(strcmp(cat2, cat4) > 0); - STATIC_ASSERT(strcmp(cat3, cat3) == 0); - STATIC_ASSERT(strcmp(cat3, cat4) > 0); - STATIC_ASSERT(strcmp(cat4, cat4) == 0); + static_assert(strcmp(cat1, cat4) > 0); + static_assert(strcmp(cat2, cat2) == 0); + static_assert(strcmp(cat2, cat3) > 0); + static_assert(strcmp(cat2, cat4) > 0); + static_assert(strcmp(cat3, cat3) == 0); + static_assert(strcmp(cat3, cat4) > 0); + static_assert(strcmp(cat4, cat4) == 0); return true; } -STATIC_ASSERT(test_strcmp()); +static_assert(test_strcmp()); KOKKOS_FUNCTION constexpr bool test_strncmp() { using Kokkos::Impl::strncmp; constexpr char greet1[] = "Hello, world!"; constexpr char greet2[] = "Hello, everybody!"; constexpr char greet3[] = "Hello, somebody!"; - STATIC_ASSERT(strncmp(greet1, greet2, 13) > 0); - STATIC_ASSERT(strncmp(greet2, greet1, 13) < 0); - STATIC_ASSERT(strncmp(greet2, greet1, 7) == 0); -#if defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU < 610) - (void)greet3; -#elif defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU < 710) - STATIC_ASSERT(strncmp(&greet2[12], &greet3[11], 5) == 0); -#else - STATIC_ASSERT(strncmp(greet2 + 12, greet3 + 11, 5) == 0); -#endif - STATIC_ASSERT(strncmp(greet1, greet2, 0) == 0); + static_assert(strncmp(greet1, greet2, 13) > 0); + static_assert(strncmp(greet2, greet1, 13) < 0); + static_assert(strncmp(greet2, greet1, 7) == 0); + static_assert(strncmp(greet2 + 12, greet3 + 11, 5) == 0); + static_assert(strncmp(greet1, greet2, 0) == 0); return true; } -STATIC_ASSERT(test_strncmp()); +static_assert(test_strncmp()); KOKKOS_FUNCTION constexpr bool strcpy_helper(const char* dest, const char* src, const char* ref) { @@ -115,10 +79,10 @@ KOKKOS_FUNCTION constexpr bool strcpy_helper(const char* dest, const char* src, } KOKKOS_FUNCTION constexpr bool test_strcpy() { - STATIC_ASSERT(strcpy_helper("abcdef", "hi", "hi\0\0\0f")); + static_assert(strcpy_helper("abcdef", "hi", "hi\0\0\0f")); return true; } -STATIC_ASSERT(test_strcpy()); +static_assert(test_strcpy()); KOKKOS_FUNCTION constexpr bool strncpy_helper(const char* dest, const char* src, std::size_t count, @@ -133,11 +97,11 @@ KOKKOS_FUNCTION constexpr bool strncpy_helper(const char* dest, const char* src, } KOKKOS_FUNCTION constexpr bool test_strncpy() { - STATIC_ASSERT(strncpy_helper("abcdef", "hi", 5, "hi\0\0\0f")); - STATIC_ASSERT(strncpy_helper("abcdef", "hi", 0, "abcdef")); + static_assert(strncpy_helper("abcdef", "hi", 5, "hi\0\0\0f")); + static_assert(strncpy_helper("abcdef", "hi", 0, "abcdef")); return true; } -STATIC_ASSERT(test_strncpy()); +static_assert(test_strncpy()); KOKKOS_FUNCTION constexpr bool strcat_helper(const char* dest, const char* src, const char* ref) { @@ -150,12 +114,12 @@ KOKKOS_FUNCTION constexpr bool strcat_helper(const char* dest, const char* src, } KOKKOS_FUNCTION constexpr bool test_strcat() { - STATIC_ASSERT(strcat_helper("Hello ", "World!", "Hello World!")); - STATIC_ASSERT(strcat_helper("Hello World!", " Goodbye World!", + static_assert(strcat_helper("Hello ", "World!", "Hello World!")); + static_assert(strcat_helper("Hello World!", " Goodbye World!", "Hello World! Goodbye World!")); return true; } -STATIC_ASSERT(test_strcat()); +static_assert(test_strcat()); KOKKOS_FUNCTION constexpr bool strncat_helper(const char* dest, const char* src, std::size_t count, @@ -170,15 +134,14 @@ KOKKOS_FUNCTION constexpr bool strncat_helper(const char* dest, const char* src, } KOKKOS_FUNCTION constexpr bool test_strncat() { - STATIC_ASSERT( + static_assert( strncat_helper("Hello World!", " Goodbye World!", 3, "Hello World! Go")); - STATIC_ASSERT( + static_assert( strncat_helper("Hello World!", " Goodbye World!", 0, "Hello World!")); return true; } -STATIC_ASSERT(test_strncat()); +static_assert(test_strncat()); -#if !defined(KOKKOS_COMPILER_GNU) && (KOKKOS_COMPILER_GNU >= 540) template <class Integral> KOKKOS_FUNCTION constexpr bool to_chars_helper(Integral val, char const* ref) { using Kokkos::Impl::strcmp; @@ -192,26 +155,25 @@ KOKKOS_FUNCTION constexpr bool to_chars_helper(Integral val, char const* ref) { } KOKKOS_FUNCTION constexpr bool test_to_chars() { - STATIC_ASSERT(to_chars_helper(0, "0")); - STATIC_ASSERT(to_chars_helper(123, "123")); - STATIC_ASSERT(to_chars_helper(-456, "-456")); - STATIC_ASSERT(to_chars_helper(INT_MAX, "2147483647")); - STATIC_ASSERT(to_chars_helper(INT_MIN, "-2147483648")); + static_assert(to_chars_helper(0, "0")); + static_assert(to_chars_helper(123, "123")); + static_assert(to_chars_helper(-456, "-456")); + static_assert(to_chars_helper(INT_MAX, "2147483647")); + static_assert(to_chars_helper(INT_MIN, "-2147483648")); - STATIC_ASSERT(to_chars_helper(0u, "0")); - STATIC_ASSERT(to_chars_helper(78u, "78")); - STATIC_ASSERT(to_chars_helper(UINT_MAX, "4294967295")); + static_assert(to_chars_helper(0u, "0")); + static_assert(to_chars_helper(78u, "78")); + static_assert(to_chars_helper(UINT_MAX, "4294967295")); - STATIC_ASSERT(to_chars_helper(0ll, "0")); - STATIC_ASSERT(to_chars_helper(LLONG_MAX, "9223372036854775807")); - STATIC_ASSERT(to_chars_helper(LLONG_MIN, "-9223372036854775808")); + static_assert(to_chars_helper(0ll, "0")); + static_assert(to_chars_helper(LLONG_MAX, "9223372036854775807")); + static_assert(to_chars_helper(LLONG_MIN, "-9223372036854775808")); - STATIC_ASSERT(to_chars_helper(0ull, "0")); - STATIC_ASSERT(to_chars_helper(ULLONG_MAX, "18446744073709551615")); + static_assert(to_chars_helper(0ull, "0")); + static_assert(to_chars_helper(ULLONG_MAX, "18446744073709551615")); return true; } -STATIC_ASSERT(test_to_chars()); -#endif +static_assert(test_to_chars()); } // namespace diff --git a/packages/kokkos/core/unit_test/TestSubView_a.hpp b/packages/kokkos/core/unit_test/TestSubView_a.hpp index ecfc96f82497d2e487b506da40d4b23cbd2f8978..6ce680200c963d4c22827d9865ceedfee2811e18 100644 --- a/packages/kokkos/core/unit_test/TestSubView_a.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_a.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_A_HPP #define KOKKOS_TEST_SUBVIEW_A_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_b.hpp b/packages/kokkos/core/unit_test/TestSubView_b.hpp index d83b7c832766660ff2fdba44b9a9b4a8a8fcdc1b..814faed010aaf2d8477ce8de297bf4f771d65e66 100644 --- a/packages/kokkos/core/unit_test/TestSubView_b.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_b.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_B_HPP #define KOKKOS_TEST_SUBVIEW_B_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c01.hpp b/packages/kokkos/core/unit_test/TestSubView_c01.hpp index 03e19768d2331a784b5cf62cb86cd12da3cfd47a..7f9588fdb4ffa1f58d1d9d675efc0b3ee7a167b1 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c01.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c01.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C01_HPP #define KOKKOS_TEST_SUBVIEW_C01_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c02.hpp b/packages/kokkos/core/unit_test/TestSubView_c02.hpp index 9fba8dbfd81101b439ac0ccd66747d0b1f12653e..5587a53b640d54556d4819ec01aaa3f96277ea1f 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c02.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c02.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C02_HPP #define KOKKOS_TEST_SUBVIEW_C02_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c03.hpp b/packages/kokkos/core/unit_test/TestSubView_c03.hpp index 04391b8920b85b8947e7b013c1b9d7d68a793dc7..53452960a20df037913ef6cd660a2acdf85455ad 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c03.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c03.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C03_HPP #define KOKKOS_TEST_SUBVIEW_C03_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c04.hpp b/packages/kokkos/core/unit_test/TestSubView_c04.hpp index 64d5d4b406db3acb156aa10faad3ed9aa59ba056..c2c1669e82b1477b19b723959b87a418982070cf 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c04.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c04.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C04_HPP #define KOKKOS_TEST_SUBVIEW_C04_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c05.hpp b/packages/kokkos/core/unit_test/TestSubView_c05.hpp index ffc07800d13aebcae50fbc3d323fbfdc2eedd6f8..c861ab18f352e03ee7a18675eb7cc5186be0f193 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c05.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c05.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C05_HPP #define KOKKOS_TEST_SUBVIEW_C05_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c06.hpp b/packages/kokkos/core/unit_test/TestSubView_c06.hpp index f7f066f102f550b47a2b2ffbf885b5947094b896..50693663ac375ef1ba37879c2b0af143a3b7bdf9 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c06.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c06.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C06_HPP #define KOKKOS_TEST_SUBVIEW_C06_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c07.hpp b/packages/kokkos/core/unit_test/TestSubView_c07.hpp index 87b5022826e5b05c6fbfd9ed03c9a0ee202fcb41..2dd02e552e237c81b76850f57b62e04774ab33a3 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c07.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c07.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C07_HPP #define KOKKOS_TEST_SUBVIEW_C07_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c08.hpp b/packages/kokkos/core/unit_test/TestSubView_c08.hpp index d18d4c1b7d0778a58ce2a795bfa47c598d2829d4..1d360669bfb34e3ee8183b97ab6ff77b02806f90 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c08.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c08.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C08_HPP #define KOKKOS_TEST_SUBVIEW_C08_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c09.hpp b/packages/kokkos/core/unit_test/TestSubView_c09.hpp index 8f7ece4d298691541f2bc232597309dd72942667..fc18786f10aad16b6ba6f181965e03841c1a5513 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c09.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c09.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C09_HPP #define KOKKOS_TEST_SUBVIEW_C09_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c10.hpp b/packages/kokkos/core/unit_test/TestSubView_c10.hpp index 0a0358b56f959aeb6bd45a595ede5a981f6644bb..036d41e0a79f9066055dd3cd8206b6b4519a5a3b 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c10.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c10.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C10_HPP #define KOKKOS_TEST_SUBVIEW_C10_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c11.hpp b/packages/kokkos/core/unit_test/TestSubView_c11.hpp index bb0b34a646daf69dfdca5edee6cb3cc773dd68f2..592b384dec70a50bb9a5a63ec40bc34e2bcd645d 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c11.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c11.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C11_HPP #define KOKKOS_TEST_SUBVIEW_C11_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c12.hpp b/packages/kokkos/core/unit_test/TestSubView_c12.hpp index b3af606771caf81c820126677de68067128e296d..be469114dba3535885500b9043a14dc59ab2a01b 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c12.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c12.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C12_HPP #define KOKKOS_TEST_SUBVIEW_C12_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c13.hpp b/packages/kokkos/core/unit_test/TestSubView_c13.hpp index 05c4767368c5b9813a140f76cd20b2044273c3a8..c3efe87a4d10dde7f66aa5e687bb5ae599f964ae 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c13.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c13.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C13_HPP #define KOKKOS_TEST_SUBVIEW_C13_HPP diff --git a/packages/kokkos/core/unit_test/TestSubView_c14.hpp b/packages/kokkos/core/unit_test/TestSubView_c14.hpp index e6510c83a603481a9b8de0367894ec98407faba3..6055fc5050aa0f368d6c594c431200aa0b181dea 100644 --- a/packages/kokkos/core/unit_test/TestSubView_c14.hpp +++ b/packages/kokkos/core/unit_test/TestSubView_c14.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SUBVIEW_C14_HPP #define KOKKOS_TEST_SUBVIEW_C14_HPP diff --git a/packages/kokkos/core/unit_test/TestTaskScheduler.hpp b/packages/kokkos/core/unit_test/TestTaskScheduler.hpp index 62fd68b6cb70c3c387fee6d1f8175ef212cfdb79..5a0394f6c180ea6b3176bf6e6fa15ca66b768b30 100644 --- a/packages/kokkos/core/unit_test/TestTaskScheduler.hpp +++ b/packages/kokkos/core/unit_test/TestTaskScheduler.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_UNITTEST_TASKSCHEDULER_HPP #define KOKKOS_UNITTEST_TASKSCHEDULER_HPP diff --git a/packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp b/packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp index c5d05382f8f26cd6c55d02a53ae4f3c16c45bf50..14b442ee8fc1ac82878ecf7f2e4bc5c1bd87e0fa 100644 --- a/packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp +++ b/packages/kokkos/core/unit_test/TestTaskScheduler_single.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ namespace Test { diff --git a/packages/kokkos/core/unit_test/TestTeam.hpp b/packages/kokkos/core/unit_test/TestTeam.hpp index 3f05b2ef66a04783a94f854259253cb984411819..0f86f9f3697b77187f173fb5b5564b2ab2d0ab49 100644 --- a/packages/kokkos/core/unit_test/TestTeam.hpp +++ b/packages/kokkos/core/unit_test/TestTeam.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> #include <sstream> @@ -655,8 +627,9 @@ struct TestLambdaSharedTeam { Kokkos::TeamPolicy<ScheduleType, ExecSpace> team_exec(8192 / team_size, team_size); - team_exec = team_exec.set_scratch_size( - 0, Kokkos::PerTeam(SHARED_COUNT * 2 * sizeof(int))); + + int scratch_size = shared_int_array_type::shmem_size(SHARED_COUNT) * 2; + team_exec = team_exec.set_scratch_size(0, Kokkos::PerTeam(scratch_size)); typename Functor::value_type error_count = 0; @@ -1025,8 +998,8 @@ struct ClassNoShmemSizeFunction { #else int team_size = 8; #endif - if (team_size > ExecSpace::concurrency()) - team_size = ExecSpace::concurrency(); + int const concurrency = ExecSpace().concurrency(); + if (team_size > concurrency) team_size = concurrency; { Kokkos::TeamPolicy<TagFor, ExecSpace, ScheduleType> policy(10, team_size, 16); @@ -1098,8 +1071,9 @@ struct ClassWithShmemSizeFunction { Kokkos::MemoryTraits<Kokkos::Unmanaged>>::shmem_size(1600); int team_size = 8; - if (team_size > ExecSpace::concurrency()) - team_size = ExecSpace::concurrency(); + + int const concurrency = ExecSpace().concurrency(); + if (team_size > concurrency) team_size = concurrency; { Kokkos::TeamPolicy<TagFor, ExecSpace, ScheduleType> policy(10, team_size, @@ -1173,8 +1147,8 @@ void test_team_mulit_level_scratch_test_lambda() { #else int team_size = 8; #endif - if (team_size > ExecSpace::concurrency()) - team_size = ExecSpace::concurrency(); + int const concurrency = ExecSpace().concurrency(); + if (team_size > concurrency) team_size = concurrency; Kokkos::TeamPolicy<ExecSpace, ScheduleType> policy(10, team_size, 16); @@ -1551,15 +1525,18 @@ struct TestScratchAlignment { double x, y, z; }; TestScratchAlignment() { - test(true); - test(false); + test_view(true); + test_view(false); + test_minimal(); + test_raw(); } using ScratchView = Kokkos::View<TestScalar *, typename ExecSpace::scratch_memory_space>; using ScratchViewInt = Kokkos::View<int *, typename ExecSpace::scratch_memory_space>; - void test(bool allocate_small) { + void test_view(bool allocate_small) { int shmem_size = ScratchView::shmem_size(11); + // FIXME_OPENMPTARGET temporary restriction for team size to be at least 32 #ifdef KOKKOS_ENABLE_OPENMPTARGET int team_size = std::is_same<ExecSpace, Kokkos::Experimental::OpenMPTarget>::value ? 32 @@ -1580,12 +1557,106 @@ struct TestScratchAlignment { }); Kokkos::fence(); } + + // test really small size of scratch space, produced error before + void test_minimal() { + using member_type = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + // FIXME_OPENMPTARGET temporary restriction for team size to be at least 32 +#ifdef KOKKOS_ENABLE_OPENMPTARGET + int team_size = + std::is_same<ExecSpace, Kokkos::Experimental::OpenMPTarget>::value ? 32 + : 1; +#else + int team_size = 1; +#endif + Kokkos::TeamPolicy<ExecSpace> policy(1, team_size); + size_t scratch_size = sizeof(int); + Kokkos::View<int, ExecSpace> flag("Flag"); + + Kokkos::parallel_for( + policy.set_scratch_size(0, Kokkos::PerTeam(scratch_size)), + KOKKOS_LAMBDA(const member_type &team) { + int *scratch_ptr = (int *)team.team_shmem().get_shmem(scratch_size); + if (scratch_ptr == nullptr) flag() = 1; + }); + Kokkos::fence(); + int minimal_scratch_allocation_failed = 0; + Kokkos::deep_copy(minimal_scratch_allocation_failed, flag); + ASSERT_TRUE(minimal_scratch_allocation_failed == 0); + } + + // test alignment of successive allocations + void test_raw() { + using member_type = typename Kokkos::TeamPolicy<ExecSpace>::member_type; +#ifdef KOKKOS_ENABLE_OPENMPTARGET + int team_size = + std::is_same<ExecSpace, Kokkos::Experimental::OpenMPTarget>::value ? 32 + : 1; +#else + int team_size = 1; +#endif + Kokkos::TeamPolicy<ExecSpace> policy(1, team_size); + Kokkos::View<int, ExecSpace> flag("Flag"); + + Kokkos::parallel_for( + policy.set_scratch_size(0, Kokkos::PerTeam(1024)), + KOKKOS_LAMBDA(const member_type &team) { + // first get some unaligned allocations, should give back + // exactly the requested number of bytes + auto scratch_ptr1 = + reinterpret_cast<intptr_t>(team.team_shmem().get_shmem(24)); + auto scratch_ptr2 = + reinterpret_cast<intptr_t>(team.team_shmem().get_shmem(32)); + auto scratch_ptr3 = + reinterpret_cast<intptr_t>(team.team_shmem().get_shmem(12)); + + if (((scratch_ptr2 - scratch_ptr1) != 24) || + ((scratch_ptr3 - scratch_ptr2) != 32)) + flag() = 1; + + // Now request aligned memory such that the allocation after + // for scratch_ptr2 would be unaligned if it doesn't pad + // correct. + // Depending on whether scratch_ptr3 is 4 or 8 byte aligned + // we need to request different amount of memory. + if ((scratch_ptr3 + 12) % 8 == 4) + scratch_ptr1 = reinterpret_cast<intptr_t>( + team.team_shmem().get_shmem_aligned(24, 4)); + else { + scratch_ptr1 = reinterpret_cast<intptr_t>( + team.team_shmem().get_shmem_aligned(12, 4)); + } + scratch_ptr2 = reinterpret_cast<intptr_t>( + team.team_shmem().get_shmem_aligned(32, 8)); + scratch_ptr3 = reinterpret_cast<intptr_t>( + team.team_shmem().get_shmem_aligned(8, 4)); + + // note the difference between scratch_ptr2 and scratch_ptr1 + // is 4 bytes larger than what we requested in either of the + // two cases. + if (((scratch_ptr2 - scratch_ptr1) != 28) && + ((scratch_ptr2 - scratch_ptr1) != 16)) + flag() = 1; + // check that there wasn't unnneccessary padding happening + // i.e. scratch_ptr2 was allocated with a 32 byte request + // and since scratch_ptr3 is then already aligned it difference + // should match that + if ((scratch_ptr3 - scratch_ptr2) != 32) flag() = 1; + // check actually alignment of ptrs is as requested + if (((scratch_ptr1 % 4) != 0) || ((scratch_ptr2 % 8) != 0) || + ((scratch_ptr3 % 4) != 0)) + flag() = 1; + }); + Kokkos::fence(); + int raw_get_shmem_alignment_failed = 0; + Kokkos::deep_copy(raw_get_shmem_alignment_failed, flag); + ASSERT_TRUE(raw_get_shmem_alignment_failed == 0); + } }; } // namespace namespace { - template <class ExecSpace> struct TestTeamPolicyHandleByValue { using scalar = double; @@ -1626,7 +1697,7 @@ struct TestRepeatedTeamReduce { const { // non-divisible by power of two to make triggering problems easier constexpr int nlev = 129; - constexpr auto pi = Kokkos::Experimental::pi_v<double>; + constexpr auto pi = Kokkos::numbers::pi; double b = 0.; for (int ri = 0; ri < 10; ++ri) { // The contributions here must be sufficiently complex, simply adding ones diff --git a/packages/kokkos/core/unit_test/TestTeamBasic.hpp b/packages/kokkos/core/unit_test/TestTeamBasic.hpp index be1848d70daa138bd38209dfe05c0b67a59a8d4e..5ee8629656fc06c17e95d3ab4936285bc15f4ba2 100644 --- a/packages/kokkos/core/unit_test/TestTeamBasic.hpp +++ b/packages/kokkos/core/unit_test/TestTeamBasic.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_TEAM_BASIC_HPP #define KOKKOS_TEST_TEAM_BASIC_HPP @@ -114,6 +86,84 @@ TEST(TEST_CATEGORY, team_reduce_large) { } } +/*! \brief Test passing an aggregate to Kokkos::single in a parallel_for with + team policy +*/ +template <typename ExecutionSpace> +struct TestTeamForAggregate { + using range_policy_t = Kokkos::RangePolicy<ExecutionSpace>; + using team_policy_t = Kokkos::TeamPolicy<ExecutionSpace>; + using member_t = typename team_policy_t::member_type; + using memory_space = typename ExecutionSpace::memory_space; + using results_type = Kokkos::View<double*, memory_space>; + + static constexpr double INIT_VALUE = -1.0; + static constexpr double EXPECT_VALUE = 1.0; + + struct Agg { + double d; + }; + results_type results_; + + TestTeamForAggregate(const size_t size) : results_("results", size) {} + TestTeamForAggregate() : TestTeamForAggregate(0) {} + + KOKKOS_INLINE_FUNCTION + void operator()(const member_t& t) const { + Agg lagg; + lagg.d = INIT_VALUE; + Kokkos::single( + Kokkos::PerTeam(t), [&](Agg& myAgg) { myAgg.d = EXPECT_VALUE; }, lagg); + size_t i = t.league_rank() * t.team_size() + t.team_rank(); + if (i < results_.size()) { + results_(i) = lagg.d; + } + } + + KOKKOS_INLINE_FUNCTION + void operator()(const int i, int& lNumErrs) const { + if (EXPECT_VALUE != results_(i)) { + ++lNumErrs; + } + } + + static void run() { + int minTeamSize = 1; + /* OpenMPTarget hard-codes 32 as the minimum size + FIXME OPENMPTARGET + */ +#ifdef KOKKOS_ENABLE_OPENMPTARGET + if constexpr (std::is_same<ExecutionSpace, + Kokkos::Experimental::OpenMPTarget>::value) { + minTeamSize = 32; + } +#endif + + int maxTeamSize; + { + TestTeamForAggregate test; + maxTeamSize = team_policy_t(1, minTeamSize) + .team_size_max(test, Kokkos::ParallelForTag()); + } + + for (int teamSize = minTeamSize; teamSize <= maxTeamSize; teamSize *= 2) { + for (int problemSize : {1, 100, 10'000, 1'000'000}) { + const int leagueSize = (problemSize + teamSize - 1) / teamSize; + TestTeamForAggregate test(problemSize); + Kokkos::parallel_for(team_policy_t(leagueSize, teamSize), test); + int numErrs = 0; + Kokkos::parallel_reduce(range_policy_t(0, problemSize), test, numErrs); + EXPECT_EQ(numErrs, 0) + << " teamSize=" << teamSize << " problemSize=" << problemSize; + } + } + } +}; + +TEST(TEST_CATEGORY, team_parallel_single) { + TestTeamForAggregate<TEST_EXECSPACE>::run(); +} + template <typename ExecutionSpace> struct LargeTeamScratchFunctor { using team_member = typename Kokkos::TeamPolicy<ExecutionSpace>::member_type; @@ -294,7 +344,7 @@ TEST(TEST_CATEGORY, team_broadcast_float) { #endif // FIXME_HIP #ifdef KOKKOS_ENABLE_HIP - if (!std::is_same<TEST_EXECSPACE, Kokkos::Experimental::HIP>::value) + if (!std::is_same<TEST_EXECSPACE, Kokkos::HIP>::value) #endif { TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, @@ -328,7 +378,7 @@ TEST(TEST_CATEGORY, team_broadcast_double) { #endif // FIXME_HIP #ifdef KOKKOS_ENABLE_HIP - if (!std::is_same<TEST_EXECSPACE, Kokkos::Experimental::HIP>::value) + if (!std::is_same<TEST_EXECSPACE, Kokkos::HIP>::value) #endif { TestTeamBroadcast<TEST_EXECSPACE, Kokkos::Schedule<Kokkos::Static>, diff --git a/packages/kokkos/core/unit_test/TestTeamMDRange.hpp b/packages/kokkos/core/unit_test/TestTeamMDRange.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8ac7e8338c749a62913ed87cd7682c35ebcccdc2 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestTeamMDRange.hpp @@ -0,0 +1,1969 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <Kokkos_Core.hpp> + +namespace Test { + +namespace TeamMDRange { + +struct FillFlattenedIndex { + explicit FillFlattenedIndex(int n0, int n1, int n2, int n3 = 1, int n4 = 1, + int n5 = 1, int n6 = 1, int n7 = 1) + : initValue{n0, n1, n2, n3, n4, n5, n6, n7} {} + + KOKKOS_INLINE_FUNCTION + int operator()(int n0, int n1, int n2, int n3 = 0, int n4 = 0, int n5 = 0, + int n6 = 0, int n7 = 0) const { + return ((((((n7 * initValue[7] + n6) * initValue[6] + n5) * initValue[5] + + n4) * + initValue[4] + + n3) * + initValue[3] + + n2) * + initValue[2] + + n1) * + initValue[1] + + n0; + } + + int initValue[8]; +}; + +struct TestTeamMDParallelFor { + using DataType = int64_t; + using DimsType = int[8]; + + template <typename HostViewType, typename FillFunctor> + static void check_result_3D(HostViewType h_view, + FillFunctor const& fillFunctor) { + for (size_t i = 0; i < h_view.extent(0); ++i) { + for (size_t j = 0; j < h_view.extent(1); ++j) { + for (size_t k = 0; k < h_view.extent(2); ++k) { + EXPECT_EQ(h_view(i, j, k), fillFunctor(i, j, k)); + } + } + } + } + + template <typename HostViewType, typename FillFunctor> + static void check_result_4D(HostViewType h_view, FillFunctor& fillFunctor) { + for (size_t i = 0; i < h_view.extent(0); ++i) { + for (size_t j = 0; j < h_view.extent(1); ++j) { + for (size_t k = 0; k < h_view.extent(2); ++k) { + for (size_t l = 0; l < h_view.extent(3); ++l) { + EXPECT_EQ(h_view(i, j, k, l), fillFunctor(i, j, k, l)); + } + } + } + } + } + + template <typename HostViewType, typename FillFunctor> + static void check_result_5D(HostViewType h_view, FillFunctor& fillFunctor) { + for (size_t i = 0; i < h_view.extent(0); ++i) { + for (size_t j = 0; j < h_view.extent(1); ++j) { + for (size_t k = 0; k < h_view.extent(2); ++k) { + for (size_t l = 0; l < h_view.extent(3); ++l) { + for (size_t m = 0; m < h_view.extent(4); ++m) { + EXPECT_EQ(h_view(i, j, k, l, m), fillFunctor(i, j, k, l, m)); + } + } + } + } + } + } + + template <typename HostViewType, typename FillFunctor> + static void check_result_6D(HostViewType h_view, FillFunctor& fillFunctor) { + for (size_t i = 0; i < h_view.extent(0); ++i) { + for (size_t j = 0; j < h_view.extent(1); ++j) { + for (size_t k = 0; k < h_view.extent(2); ++k) { + for (size_t l = 0; l < h_view.extent(3); ++l) { + for (size_t m = 0; m < h_view.extent(4); ++m) { + for (size_t n = 0; n < h_view.extent(5); ++n) { + EXPECT_EQ(h_view(i, j, k, l, m, n), + fillFunctor(i, j, k, l, m, n)); + } + } + } + } + } + } + } + + template <typename HostViewType, typename FillFunctor> + static void check_result_7D(HostViewType h_view, FillFunctor& fillFunctor) { + for (size_t i = 0; i < h_view.extent(0); ++i) { + for (size_t j = 0; j < h_view.extent(1); ++j) { + for (size_t k = 0; k < h_view.extent(2); ++k) { + for (size_t l = 0; l < h_view.extent(3); ++l) { + for (size_t m = 0; m < h_view.extent(4); ++m) { + for (size_t n = 0; n < h_view.extent(5); ++n) { + for (size_t o = 0; o < h_view.extent(6); ++o) { + EXPECT_EQ(h_view(i, j, k, l, m, n, o), + fillFunctor(i, j, k, l, m, n, o)); + } + } + } + } + } + } + } + } + + template <typename HostViewType, typename FillFunctor> + static void check_result_8D(HostViewType h_view, FillFunctor& fillFunctor) { + for (size_t i = 0; i < h_view.extent(0); ++i) { + for (size_t j = 0; j < h_view.extent(1); ++j) { + for (size_t k = 0; k < h_view.extent(2); ++k) { + for (size_t l = 0; l < h_view.extent(3); ++l) { + for (size_t m = 0; m < h_view.extent(4); ++m) { + for (size_t n = 0; n < h_view.extent(5); ++n) { + for (size_t o = 0; o < h_view.extent(6); ++o) { + for (size_t p = 0; p < h_view.extent(7); ++p) { + EXPECT_EQ(h_view(i, j, k, l, m, n, o, p), + fillFunctor(i, j, k, l, m, n, o, p)); + } + } + } + } + } + } + } + } + } +}; + +// If KOKKOS_ENABLE_CUDA_LAMBDA is off, extended lambdas used in parallel_for +// and parallel_reduce in these tests will not compile correctly +#if !defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_CUDA_LAMBDA) + +template <typename ExecSpace> +struct TestTeamThreadMDRangeParallelFor : public TestTeamMDParallelFor { + using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_3D_TeamThreadMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType***, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + + ViewType v("v", leagueSize, n0, n1); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamThreadMDRange<Kokkos::Rank<2, Direction>, TeamType>( + team, n0, n1); + + Kokkos::parallel_for(teamRange, [=](int i, int j) { + v(leagueRank, i, j) += fillFlattenedIndex(leagueRank, i, j); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_3D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_4D_TeamThreadMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType****, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + + ViewType v("v", leagueSize, n0, n1, n2); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamThreadMDRange<Kokkos::Rank<3, Direction>, TeamType>( + team, n0, n1, n2); + + Kokkos::parallel_for(teamRange, [=](int i, int j, int k) { + v(leagueRank, i, j, k) += fillFlattenedIndex(leagueRank, i, j, k); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_4D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_5D_TeamThreadMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*****, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + + ViewType v("v", leagueSize, n0, n1, n2, n3); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamThreadMDRange<Kokkos::Rank<4, Direction>, TeamType>( + team, n0, n1, n2, n3); + + Kokkos::parallel_for(teamRange, [=](int i, int j, int k, int l) { + v(leagueRank, i, j, k, l) += + fillFlattenedIndex(leagueRank, i, j, k, l); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_5D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_6D_TeamThreadMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType******, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamThreadMDRange<Kokkos::Rank<5, Direction>, TeamType>( + team, n0, n1, n2, n3, n4); + + Kokkos::parallel_for( + teamRange, [=](int i, int j, int k, int l, int m) { + v(leagueRank, i, j, k, l, m) += + fillFlattenedIndex(leagueRank, i, j, k, l, m); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_6D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_7D_TeamThreadMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*******, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamThreadMDRange<Kokkos::Rank<6, Direction>, TeamType>( + team, n0, n1, n2, n3, n4, n5); + + Kokkos::parallel_for( + teamRange, [=](int i, int j, int k, int l, int m, int n) { + v(leagueRank, i, j, k, l, m, n) += + fillFlattenedIndex(leagueRank, i, j, k, l, m, n); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_7D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_8D_TeamThreadMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType********, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + int n6 = dims[7]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5, + n6); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamThreadMDRange<Kokkos::Rank<7, Direction>, TeamType>( + team, n0, n1, n2, n3, n4, n5, n6); + + Kokkos::parallel_for( + teamRange, [=](int i, int j, int k, int l, int m, int n, int o) { + v(leagueRank, i, j, k, l, m, n, o) += + fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_8D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_single_direction_test(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType***, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int n0 = dims[0]; + int n1 = dims[1]; + int n2 = dims[2]; + + ViewType v("v", n0, n1, n2); + FillFlattenedIndex fillFlattenedIndex(n0, n1, n2); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(1, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + auto teamRange = + Kokkos::TeamThreadMDRange<Kokkos::Rank<3, Direction>, TeamType>( + team, n0, n1, n2); + + Kokkos::parallel_for(teamRange, [=](int i, int j, int k) { + v(i, j, k) += fillFlattenedIndex(i, j, k); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_3D(h_view, fillFlattenedIndex); + } +}; + +template <typename ExecSpace> +struct TestThreadVectorMDRangeParallelFor : public TestTeamMDParallelFor { + using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_4D_ThreadVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType****, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + + ViewType v("v", leagueSize, n0, n1, n2); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto teamRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<2, Direction>, TeamType>( + team, n1, n2); + + Kokkos::parallel_for(teamThreadRange, [=](int i) { + Kokkos::parallel_for(teamRange, [=](int j, int k) { + v(leagueRank, i, j, k) += fillFlattenedIndex(leagueRank, i, j, k); + }); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_4D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_5D_ThreadVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*****, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + + ViewType v("v", leagueSize, n0, n1, n2, n3); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto teamRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<3, Direction>, TeamType>( + team, n1, n2, n3); + + Kokkos::parallel_for(teamThreadRange, [=](int i) { + Kokkos::parallel_for(teamRange, [=](int j, int k, int l) { + v(leagueRank, i, j, k, l) += + fillFlattenedIndex(leagueRank, i, j, k, l); + }); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_5D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_6D_ThreadVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType******, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto teamRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>( + team, n1, n2, n3, n4); + + Kokkos::parallel_for(teamThreadRange, [=](int i) { + Kokkos::parallel_for(teamRange, [=](int j, int k, int l, int m) { + v(leagueRank, i, j, k, l, m) += + fillFlattenedIndex(leagueRank, i, j, k, l, m); + }); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_6D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_7D_ThreadVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*******, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto teamRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<5, Direction>, TeamType>( + team, n1, n2, n3, n4, n5); + + Kokkos::parallel_for(teamThreadRange, [=](int i) { + Kokkos::parallel_for( + teamRange, [=](int j, int k, int l, int m, int n) { + v(leagueRank, i, j, k, l, m, n) += + fillFlattenedIndex(leagueRank, i, j, k, l, m, n); + }); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_7D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_8D_ThreadVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType********, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + int n6 = dims[7]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5, + n6); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto teamRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<6, Direction>, TeamType>( + team, n1, n2, n3, n4, n5, n6); + + Kokkos::parallel_for(teamThreadRange, [=](int i) { + Kokkos::parallel_for( + teamRange, [=](int j, int k, int l, int m, int n, int o) { + v(leagueRank, i, j, k, l, m, n, o) += + fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o); + }); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_8D(h_view, fillFlattenedIndex); + } +}; + +template <typename ExecSpace> +struct TestTeamVectorMDRangeParallelFor : public TestTeamMDParallelFor { + using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_3D_TeamVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType***, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + + ViewType v("v", leagueSize, n0, n1); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<2, Direction>, TeamType>( + team, n0, n1); + + Kokkos::parallel_for(teamRange, [=](int i, int j) { + v(leagueRank, i, j) += fillFlattenedIndex(leagueRank, i, j); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_3D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_4D_TeamVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType****, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + + ViewType v("v", leagueSize, n0, n1, n2); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<3, Direction>, TeamType>( + team, n0, n1, n2); + + Kokkos::parallel_for(teamRange, [=](int i, int j, int k) { + v(leagueRank, i, j, k) += fillFlattenedIndex(leagueRank, i, j, k); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_4D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_5D_TeamVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*****, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + + ViewType v("v", leagueSize, n0, n1, n2, n3); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>( + team, n0, n1, n2, n3); + + Kokkos::parallel_for(teamRange, [=](int i, int j, int k, int l) { + v(leagueRank, i, j, k, l) += + fillFlattenedIndex(leagueRank, i, j, k, l); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_5D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_6D_TeamVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType******, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<5, Direction>, TeamType>( + team, n0, n1, n2, n3, n4); + + Kokkos::parallel_for( + teamRange, [=](int i, int j, int k, int l, int m) { + v(leagueRank, i, j, k, l, m) += + fillFlattenedIndex(leagueRank, i, j, k, l, m); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_6D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_7D_TeamVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*******, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<6, Direction>, TeamType>( + team, n0, n1, n2, n3, n4, n5); + + Kokkos::parallel_for( + teamRange, [=](int i, int j, int k, int l, int m, int n) { + v(leagueRank, i, j, k, l, m, n) += + fillFlattenedIndex(leagueRank, i, j, k, l, m, n); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_7D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_for_8D_TeamVectorMDRange(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType********, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + int n6 = dims[7]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5, + n6); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + int leagueRank = team.league_rank(); + + auto teamRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<7, Direction>, TeamType>( + team, n0, n1, n2, n3, n4, n5, n6); + + Kokkos::parallel_for( + teamRange, [=](int i, int j, int k, int l, int m, int n, int o) { + v(leagueRank, i, j, k, l, m, n, o) += + fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_8D(h_view, fillFlattenedIndex); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_double_direction_test(DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType****, ExecSpace>; + using HostViewType = typename ViewType::HostMirror; + + int n0 = dims[0]; + int n1 = dims[1]; + int n2 = dims[2]; + int n3 = dims[3]; + + ViewType v("v", n0, n1, n2, n3); + FillFlattenedIndex fillFlattenedIndex(n0, n1, n2, n3); + + Kokkos::parallel_for( + Kokkos::TeamPolicy<ExecSpace>(1, Kokkos::AUTO), + KOKKOS_LAMBDA(const TeamType& team) { + auto teamRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>( + team, n0, n1, n2, n3); + + Kokkos::parallel_for(teamRange, [=](int i, int j, int k, int l) { + v(i, j, k, l) += fillFlattenedIndex(i, j, k, l); + }); + }); + + HostViewType h_view = Kokkos::create_mirror_view_and_copy( + typename HostViewType::traits::memory_space(), v); + + check_result_4D(h_view, fillFlattenedIndex); + } +}; + +struct TestTeamMDParallelReduce { + using DataType = int64_t; + using DimsType = int[8]; + + template <typename F> + constexpr static DataType get_expected_partial_sum(DimsType const& dims, + size_t maxRank, F const& f, + DimsType& indices, + size_t rank) { + if (rank == maxRank) { + return f(indices[0], indices[1], indices[2], indices[3], indices[4], + indices[5], indices[6], indices[7]); + } + + auto& index = indices[rank]; + DataType accValue = 0; + for (index = 0; index < dims[rank]; ++index) { + accValue += get_expected_partial_sum(dims, maxRank, f, indices, rank + 1); + } + + return accValue; + } + + template <typename F> + static DataType get_expected_sum(DimsType const& dims, size_t maxRank, + F const& f) { + DimsType indices = {}; + return get_expected_partial_sum(dims, maxRank, f, indices, 0); + } +}; + +template <typename ExecSpace> +struct TestTeamThreadMDRangeParallelReduce : public TestTeamMDParallelReduce { + using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_3D_TeamThreadMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType***, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + + ViewType v("v", leagueSize, n0, n1); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<3>>({0, 0, 0}, + {leagueSize, n0, n1}), + KOKKOS_LAMBDA(const int i, const int j, const int k) { + v(i, j, k) = fillFlattenedIndex(i, j, k); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamThreadMDRange<Kokkos::Rank<2, Direction>, TeamType>( + team, n0, n1), + [=](const int& i, const int& j, DataType& threadSum) { + threadSum += v(leagueRank, i, j); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 3, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_4D_TeamThreadMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType****, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + + ViewType v("v", leagueSize, n0, n1, n2); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>>( + {0, 0, 0, 0}, {leagueSize, n0, n1, n2}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l) { + v(i, j, k, l) = fillFlattenedIndex(i, j, k, l); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamThreadMDRange<Kokkos::Rank<3, Direction>, TeamType>( + team, n0, n1, n2), + [=](const int& i, const int& j, const int& k, + DataType& threadSum) { threadSum += v(leagueRank, i, j, k); }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 4, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_5D_TeamThreadMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*****, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + + ViewType v("v", leagueSize, n0, n1, n2, n3); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>>( + {0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l, + const int m) { + v(i, j, k, l, m) = fillFlattenedIndex(i, j, k, l, m); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamThreadMDRange<Kokkos::Rank<4, Direction>, TeamType>( + team, n0, n1, n2, n3), + [=](const int& i, const int& j, const int& k, const int& l, + DataType& threadSum) { + threadSum += v(leagueRank, i, j, k, l); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 5, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_6D_TeamThreadMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType******, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l, + const int m, const int n) { + v(i, j, k, l, m, n) = fillFlattenedIndex(i, j, k, l, m, n); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamThreadMDRange<Kokkos::Rank<5, Direction>, TeamType>( + team, n0, n1, n2, n3, n4), + [=](const int& i, const int& j, const int& k, const int& l, + const int& m, DataType& threadSum) { + threadSum += v(leagueRank, i, j, k, l, m); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 6, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + // MDRangePolicy only allows up to rank of 6. Because of this, expectedSum + // array had to be constructed from a nested parallel_for loop. + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_7D_TeamThreadMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*******, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5); + auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}); + + Kokkos::parallel_for( + mdRangePolicy, + KOKKOS_LAMBDA(const int leagueRank, const int i, const int j, + const int k, const int l, const int m) { + for (int n = 0; n < n5; ++n) { + v(leagueRank, i, j, k, l, m, n) = + fillFlattenedIndex(leagueRank, i, j, k, l, m, n); + } + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamThreadMDRange<Kokkos::Rank<6, Direction>, TeamType>( + team, n0, n1, n2, n3, n4, n5), + [=](const int& i, const int& j, const int& k, const int& l, + const int& m, const int& n, DataType& threadSum) { + threadSum += v(leagueRank, i, j, k, l, m, n); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 7, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_8D_TeamThreadMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType********, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + int n6 = dims[7]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5, + n6); + auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}); + + Kokkos::parallel_for( + mdRangePolicy, + KOKKOS_LAMBDA(const int leagueRank, const int i, const int j, + const int k, const int l, const int m) { + for (int n = 0; n < n5; ++n) { + for (int o = 0; o < n6; ++o) { + v(leagueRank, i, j, k, l, m, n, o) = + fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o); + } + } + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamThreadMDRange<Kokkos::Rank<7, Direction>, TeamType>( + team, n0, n1, n2, n3, n4, n5, n6), + [=](const int& i, const int& j, const int& k, const int& l, + const int& m, const int& n, const int& o, + DataType& threadSum) { + threadSum += v(leagueRank, i, j, k, l, m, n, o); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 8, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } +}; + +template <typename ExecSpace> +struct TestThreadVectorMDRangeParallelReduce : public TestTeamMDParallelReduce { + using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_4D_ThreadVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType****, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + + ViewType v("v", leagueSize, n0, n1, n2); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>>( + {0, 0, 0, 0}, {leagueSize, n0, n1, n2}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l) { + v(i, j, k, l) = fillFlattenedIndex(i, j, k, l); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto threadVectorRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<2, Direction>, TeamType>( + team, n1, n2); + + Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) { + DataType threadSum = 0; + Kokkos::parallel_reduce( + threadVectorRange, + [=](const int& j, const int& k, DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k); + }, + threadSum); + + teamSum += threadSum; + }); + + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 4, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_5D_ThreadVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*****, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + + ViewType v("v", leagueSize, n0, n1, n2, n3); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>>( + {0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l, + const int m) { + v(i, j, k, l, m) = fillFlattenedIndex(i, j, k, l, m); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto threadVectorRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<3, Direction>, TeamType>( + team, n1, n2, n3); + + Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) { + DataType threadSum = 0; + Kokkos::parallel_reduce( + threadVectorRange, + [=](const int& j, const int& k, const int& l, + DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k, l); + }, + threadSum); + + teamSum += threadSum; + }); + + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 5, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_6D_ThreadVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType******, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l, + const int m, const int n) { + v(i, j, k, l, m, n) = fillFlattenedIndex(i, j, k, l, m, n); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto threadVectorRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>( + team, n1, n2, n3, n4); + + Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) { + DataType threadSum = 0; + Kokkos::parallel_reduce( + threadVectorRange, + [=](const int& j, const int& k, const int& l, const int& m, + DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k, l, m); + }, + threadSum); + + teamSum += threadSum; + }); + + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 6, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_7D_ThreadVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*******, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5); + auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}); + + Kokkos::parallel_for( + mdRangePolicy, + KOKKOS_LAMBDA(const int leagueRank, const int i, const int j, + const int k, const int l, const int m) { + for (int n = 0; n < n5; ++n) { + v(leagueRank, i, j, k, l, m, n) = + fillFlattenedIndex(leagueRank, i, j, k, l, m, n); + } + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto threadVectorRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<5, Direction>, TeamType>( + team, n1, n2, n3, n4, n5); + + Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) { + DataType threadSum = 0; + Kokkos::parallel_reduce( + threadVectorRange, + [=](const int& j, const int& k, const int& l, const int& m, + const int& n, DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k, l, m, n); + }, + threadSum); + + teamSum += threadSum; + }); + + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 7, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_8D_ThreadVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType********, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + int n6 = dims[7]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5, + n6); + auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}); + + Kokkos::parallel_for( + mdRangePolicy, + KOKKOS_LAMBDA(const int leagueRank, const int i, const int j, + const int k, const int l, const int m) { + for (int n = 0; n < n5; ++n) { + for (int o = 0; o < n6; ++o) { + v(leagueRank, i, j, k, l, m, n, o) = + fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o); + } + } + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamThreadRange = Kokkos::TeamThreadRange(team, n0); + auto threadVectorRange = + Kokkos::ThreadVectorMDRange<Kokkos::Rank<6, Direction>, TeamType>( + team, n1, n2, n3, n4, n5, n6); + + Kokkos::parallel_for(teamThreadRange, [=, &teamSum](const int& i) { + DataType threadSum = 0; + Kokkos::parallel_reduce( + threadVectorRange, + [=](const int& j, const int& k, const int& l, const int& m, + const int& n, const int& o, DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k, l, m, n, o); + }, + threadSum); + + teamSum += threadSum; + }); + + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 8, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } +}; + +template <typename ExecSpace> +struct TestTeamVectorMDRangeParallelReduce : public TestTeamMDParallelReduce { + using TeamType = typename Kokkos::TeamPolicy<ExecSpace>::member_type; + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_4D_TeamVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType****, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + + ViewType v("v", leagueSize, n0, n1, n2); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<4>>( + {0, 0, 0, 0}, {leagueSize, n0, n1, n2}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l) { + v(i, j, k, l) = fillFlattenedIndex(i, j, k, l); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamVectorRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<3, Direction>, TeamType>( + team, n0, n1, n2); + + Kokkos::parallel_reduce( + teamVectorRange, + [=](const int& i, const int& j, const int& k, + DataType& vectorSum) { vectorSum += v(leagueRank, i, j, k); }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 4, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_5D_TeamVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*****, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + + ViewType v("v", leagueSize, n0, n1, n2, n3); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<5>>( + {0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l, + const int m) { + v(i, j, k, l, m) = fillFlattenedIndex(i, j, k, l, m); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamVectorRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<4, Direction>, TeamType>( + team, n0, n1, n2, n3); + + Kokkos::parallel_reduce( + teamVectorRange, + [=](const int& i, const int& j, const int& k, const int& l, + DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k, l); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 5, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_6D_TeamVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType******, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4); + + Kokkos::parallel_for( + Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}), + KOKKOS_LAMBDA(const int i, const int j, const int k, const int l, + const int m, const int n) { + v(i, j, k, l, m, n) = fillFlattenedIndex(i, j, k, l, m, n); + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamVectorRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<5, Direction>, TeamType>( + team, n0, n1, n2, n3, n4); + + Kokkos::parallel_reduce( + teamVectorRange, + [=](const int& i, const int& j, const int& k, const int& l, + const int& m, DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k, l, m); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 6, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_7D_TeamVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType*******, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5); + auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}); + + Kokkos::parallel_for( + mdRangePolicy, + KOKKOS_LAMBDA(const int leagueRank, const int i, const int j, + const int k, const int l, const int m) { + for (int n = 0; n < n5; ++n) { + v(leagueRank, i, j, k, l, m, n) = + fillFlattenedIndex(leagueRank, i, j, k, l, m, n); + } + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamVectorRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<6, Direction>, TeamType>( + team, n0, n1, n2, n3, n4, n5); + + Kokkos::parallel_reduce( + teamVectorRange, + [=](const int& i, const int& j, const int& k, const int& l, + const int& m, const int& n, DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k, l, m, n); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 7, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } + + template <Kokkos::Iterate Direction = Kokkos::Iterate::Default> + static void test_parallel_reduce_for_8D_TeamVectorMDRange( + DimsType const& dims) { + using ViewType = typename Kokkos::View<DataType********, ExecSpace>; + + int leagueSize = dims[0]; + int n0 = dims[1]; + int n1 = dims[2]; + int n2 = dims[3]; + int n3 = dims[4]; + int n4 = dims[5]; + int n5 = dims[6]; + int n6 = dims[7]; + + ViewType v("v", leagueSize, n0, n1, n2, n3, n4, n5, n6); + FillFlattenedIndex fillFlattenedIndex(leagueSize, n0, n1, n2, n3, n4, n5, + n6); + auto mdRangePolicy = Kokkos::MDRangePolicy<ExecSpace, Kokkos::Rank<6>>( + {0, 0, 0, 0, 0, 0}, {leagueSize, n0, n1, n2, n3, n4}); + + Kokkos::parallel_for( + mdRangePolicy, + KOKKOS_LAMBDA(const int leagueRank, const int i, const int j, + const int k, const int l, const int m) { + for (int n = 0; n < n5; ++n) { + for (int o = 0; o < n6; ++o) { + v(leagueRank, i, j, k, l, m, n, o) = + fillFlattenedIndex(leagueRank, i, j, k, l, m, n, o); + } + } + }); + + DataType finalSum = 0; + + Kokkos::parallel_reduce( + Kokkos::TeamPolicy<ExecSpace>(leagueSize, Kokkos::AUTO), + KOKKOS_LAMBDA(TeamType const& team, DataType& leagueSum) { + auto leagueRank = team.league_rank(); + DataType teamSum = 0; + + auto teamVectorRange = + Kokkos::TeamVectorMDRange<Kokkos::Rank<7, Direction>, TeamType>( + team, n0, n1, n2, n3, n4, n5, n6); + + Kokkos::parallel_reduce( + teamVectorRange, + [=](const int& i, const int& j, const int& k, const int& l, + const int& m, const int& n, const int& o, + DataType& vectorSum) { + vectorSum += v(leagueRank, i, j, k, l, m, n, o); + }, + teamSum); + leagueSum += teamSum; + }, + finalSum); + + DataType expectedSum = get_expected_sum(dims, 8, fillFlattenedIndex); + + EXPECT_EQ(finalSum, expectedSum); + } +}; +/*--------------------------------------------------------------------------*/ + +constexpr auto Left = Kokkos::Iterate::Left; +constexpr auto Right = Kokkos::Iterate::Right; + +// Using prime numbers makes debugging easier +// small dimensions were needed for larger dimensions to reduce test run time +int dims[] = {3, 5, 7, 11, 13, 17, 19, 23}; +int smallDims[] = {2, 3, 2, 3, 5, 2, 3, 5}; + +TEST(TEST_CATEGORY, TeamThreadMDRangeParallelFor) { + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_3D_TeamThreadMDRange<Left>(dims); + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_3D_TeamThreadMDRange<Right>(dims); + + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_4D_TeamThreadMDRange<Left>(dims); + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_4D_TeamThreadMDRange<Right>(dims); + + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_5D_TeamThreadMDRange<Left>(dims); + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_5D_TeamThreadMDRange<Right>(dims); + + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_6D_TeamThreadMDRange<Left>(dims); + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_6D_TeamThreadMDRange<Right>(dims); + + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_7D_TeamThreadMDRange<Left>(smallDims); + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_7D_TeamThreadMDRange<Right>(smallDims); + + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_8D_TeamThreadMDRange<Left>(smallDims); + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_8D_TeamThreadMDRange<Right>(smallDims); + + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_single_direction_test<Left>(dims); + TestTeamThreadMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_single_direction_test<Right>(dims); +} + +TEST(TEST_CATEGORY, ThreadVectorMDRangeParallelFor) { + TestThreadVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_4D_ThreadVectorMDRange<Left>(dims); + TestThreadVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_4D_ThreadVectorMDRange<Right>(dims); + + TestThreadVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_5D_ThreadVectorMDRange<Left>(dims); + TestThreadVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_5D_ThreadVectorMDRange<Right>(dims); + + TestThreadVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_6D_ThreadVectorMDRange<Left>(dims); + TestThreadVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_6D_ThreadVectorMDRange<Right>(dims); + + TestThreadVectorMDRangeParallelFor<TEST_EXECSPACE>:: + test_parallel_for_7D_ThreadVectorMDRange<Left>(smallDims); + TestThreadVectorMDRangeParallelFor<TEST_EXECSPACE>:: + test_parallel_for_7D_ThreadVectorMDRange<Right>(smallDims); + + TestThreadVectorMDRangeParallelFor<TEST_EXECSPACE>:: + test_parallel_for_8D_ThreadVectorMDRange<Left>(smallDims); + TestThreadVectorMDRangeParallelFor<TEST_EXECSPACE>:: + test_parallel_for_8D_ThreadVectorMDRange<Right>(smallDims); +} + +TEST(TEST_CATEGORY, TeamVectorMDRangeParallelFor) { + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_3D_TeamVectorMDRange<Left>(dims); + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_3D_TeamVectorMDRange<Right>(dims); + + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_4D_TeamVectorMDRange<Left>(dims); + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_4D_TeamVectorMDRange<Right>(dims); + + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_5D_TeamVectorMDRange<Left>(dims); + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_5D_TeamVectorMDRange<Right>(dims); + + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_6D_TeamVectorMDRange<Left>(dims); + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_6D_TeamVectorMDRange<Right>(dims); + + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_7D_TeamVectorMDRange<Left>(smallDims); + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_7D_TeamVectorMDRange<Right>(smallDims); + + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_8D_TeamVectorMDRange<Left>(smallDims); + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_for_8D_TeamVectorMDRange<Right>(smallDims); + + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_double_direction_test<Left>(dims); + TestTeamVectorMDRangeParallelFor< + TEST_EXECSPACE>::test_parallel_double_direction_test<Right>(dims); +} + +TEST(TEST_CATEGORY, TeamThreadMDRangeParallelReduce) { + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_3D_TeamThreadMDRange<Left>(dims); + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_3D_TeamThreadMDRange<Right>(dims); + + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_4D_TeamThreadMDRange<Left>(dims); + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_4D_TeamThreadMDRange<Right>(dims); + + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_5D_TeamThreadMDRange<Left>(dims); + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_5D_TeamThreadMDRange<Right>(dims); + + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_6D_TeamThreadMDRange<Left>(dims); + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_6D_TeamThreadMDRange<Right>(dims); + + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_7D_TeamThreadMDRange<Left>(smallDims); + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_7D_TeamThreadMDRange<Right>(smallDims); + + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_8D_TeamThreadMDRange<Left>(smallDims); + TestTeamThreadMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_8D_TeamThreadMDRange<Right>(smallDims); +} + +TEST(TEST_CATEGORY, ThreadVectorMDRangeParallelReduce) { +// FIXME_SYCL sycl::group_barrier doesn't work correctly for non-Intel GPUs +#if defined(KOKKOS_ENABLE_SYCL) && !defined(KOKKOS_ARCH_INTEL_GPU) + if (std::is_same_v<TEST_EXECSPACE, Kokkos::Experimental::SYCL>) + GTEST_SKIP() << "skipping because of bug in group_barrier implementation"; +#endif + + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_4D_ThreadVectorMDRange<Left>(dims); + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_4D_ThreadVectorMDRange<Right>(dims); + + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_5D_ThreadVectorMDRange<Left>(dims); + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_5D_ThreadVectorMDRange<Right>(dims); + + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_6D_ThreadVectorMDRange<Left>(dims); + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_6D_ThreadVectorMDRange<Right>(dims); + + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_7D_ThreadVectorMDRange<Left>(smallDims); + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_7D_ThreadVectorMDRange<Right>(smallDims); + + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_8D_ThreadVectorMDRange<Left>(smallDims); + TestThreadVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_8D_ThreadVectorMDRange<Right>(smallDims); +} + +TEST(TEST_CATEGORY, TeamVectorMDRangeParallelReduce) { +// FIXME_SYCL sycl::group_barrier doesn't work correctly for non-Intel GPUs +#if defined(KOKKOS_ENABLE_SYCL) && !defined(KOKKOS_ARCH_INTEL_GPU) + if (std::is_same_v<TEST_EXECSPACE, Kokkos::Experimental::SYCL>) + GTEST_SKIP() << "skipping because of bug in group_barrier implementation"; +#endif + + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_4D_TeamVectorMDRange<Left>(dims); + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_4D_TeamVectorMDRange<Right>(dims); + + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_5D_TeamVectorMDRange<Left>(dims); + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_5D_TeamVectorMDRange<Right>(dims); + + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_6D_TeamVectorMDRange<Left>(dims); + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_6D_TeamVectorMDRange<Right>(dims); + + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_7D_TeamVectorMDRange<Left>(smallDims); + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_7D_TeamVectorMDRange<Right>(smallDims); + + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_8D_TeamVectorMDRange<Left>(smallDims); + TestTeamVectorMDRangeParallelReduce<TEST_EXECSPACE>:: + test_parallel_reduce_for_8D_TeamVectorMDRange<Right>(smallDims); +} + +#endif + +} // namespace TeamMDRange +} // namespace Test diff --git a/packages/kokkos/core/unit_test/TestTeamPolicyConstructors.hpp b/packages/kokkos/core/unit_test/TestTeamPolicyConstructors.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5b0bfdb1755c3cbae1062ed84b902d4d3743452f --- /dev/null +++ b/packages/kokkos/core/unit_test/TestTeamPolicyConstructors.hpp @@ -0,0 +1,141 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <gtest/gtest.h> + +#include <Kokkos_Core.hpp> + +namespace { + +template <typename Policy> +void test_run_time_parameters() { + int league_size = 131; + + using ExecutionSpace = typename Policy::execution_space; + int team_size = + 4 < ExecutionSpace().concurrency() ? 4 : ExecutionSpace().concurrency(); +#ifdef KOKKOS_ENABLE_HPX + team_size = 1; +#endif +#ifdef KOKKOS_ENABLE_OPENMPTARGET + if (std::is_same<ExecutionSpace, Kokkos::Experimental::OpenMPTarget>::value) + team_size = 32; +#endif + int chunk_size = 4; + int per_team_scratch = 1024; + int per_thread_scratch = 16; + int scratch_size = per_team_scratch + per_thread_scratch * team_size; + + Policy p1(league_size, team_size); + ASSERT_EQ(p1.league_size(), league_size); + ASSERT_EQ(p1.team_size(), team_size); + ASSERT_GT(p1.chunk_size(), 0); + ASSERT_EQ(p1.scratch_size(0), 0u); + + Policy p2 = p1.set_chunk_size(chunk_size); + ASSERT_EQ(p1.league_size(), league_size); + ASSERT_EQ(p1.team_size(), team_size); + ASSERT_EQ(p1.chunk_size(), chunk_size); + ASSERT_EQ(p1.scratch_size(0), 0u); + + ASSERT_EQ(p2.league_size(), league_size); + ASSERT_EQ(p2.team_size(), team_size); + ASSERT_EQ(p2.chunk_size(), chunk_size); + ASSERT_EQ(p2.scratch_size(0), 0u); + + Policy p3 = p2.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch)); + ASSERT_EQ(p2.league_size(), league_size); + ASSERT_EQ(p2.team_size(), team_size); + ASSERT_EQ(p2.chunk_size(), chunk_size); + ASSERT_EQ(p2.scratch_size(0), size_t(per_team_scratch)); + ASSERT_EQ(p3.league_size(), league_size); + ASSERT_EQ(p3.team_size(), team_size); + ASSERT_EQ(p3.chunk_size(), chunk_size); + ASSERT_EQ(p3.scratch_size(0), size_t(per_team_scratch)); + + Policy p4 = p2.set_scratch_size(0, Kokkos::PerThread(per_thread_scratch)); + ASSERT_EQ(p2.league_size(), league_size); + ASSERT_EQ(p2.team_size(), team_size); + ASSERT_EQ(p2.chunk_size(), chunk_size); + ASSERT_EQ(p2.scratch_size(0), size_t(scratch_size)); + ASSERT_EQ(p4.league_size(), league_size); + ASSERT_EQ(p4.team_size(), team_size); + ASSERT_EQ(p4.chunk_size(), chunk_size); + ASSERT_EQ(p4.scratch_size(0), size_t(scratch_size)); + + Policy p5 = p2.set_scratch_size(0, Kokkos::PerThread(per_thread_scratch), + Kokkos::PerTeam(per_team_scratch)); + ASSERT_EQ(p2.league_size(), league_size); + ASSERT_EQ(p2.team_size(), team_size); + ASSERT_EQ(p2.chunk_size(), chunk_size); + ASSERT_EQ(p2.scratch_size(0), size_t(scratch_size)); + ASSERT_EQ(p5.league_size(), league_size); + ASSERT_EQ(p5.team_size(), team_size); + ASSERT_EQ(p5.chunk_size(), chunk_size); + ASSERT_EQ(p5.scratch_size(0), size_t(scratch_size)); + + Policy p6 = p2.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch), + Kokkos::PerThread(per_thread_scratch)); + ASSERT_EQ(p2.league_size(), league_size); + ASSERT_EQ(p2.team_size(), team_size); + ASSERT_EQ(p2.chunk_size(), chunk_size); + ASSERT_EQ(p2.scratch_size(0), size_t(scratch_size)); + ASSERT_EQ(p6.league_size(), league_size); + ASSERT_EQ(p6.team_size(), team_size); + ASSERT_EQ(p6.chunk_size(), chunk_size); + ASSERT_EQ(p6.scratch_size(0), size_t(scratch_size)); + + Policy p7 = p3.set_scratch_size(0, Kokkos::PerTeam(per_team_scratch), + Kokkos::PerThread(per_thread_scratch)); + ASSERT_EQ(p3.league_size(), league_size); + ASSERT_EQ(p3.team_size(), team_size); + ASSERT_EQ(p3.chunk_size(), chunk_size); + ASSERT_EQ(p3.scratch_size(0), size_t(scratch_size)); + ASSERT_EQ(p7.league_size(), league_size); + ASSERT_EQ(p7.team_size(), team_size); + ASSERT_EQ(p7.chunk_size(), chunk_size); + ASSERT_EQ(p7.scratch_size(0), size_t(scratch_size)); + + Policy p8; // default constructed + ASSERT_EQ(p8.league_size(), 0); + ASSERT_EQ(p8.scratch_size(0), 0u); + p8 = p3; // call assignment operator + ASSERT_EQ(p3.league_size(), league_size); + ASSERT_EQ(p3.team_size(), team_size); + ASSERT_EQ(p3.chunk_size(), chunk_size); + ASSERT_EQ(p3.scratch_size(0), size_t(scratch_size)); + ASSERT_EQ(p8.league_size(), league_size); + ASSERT_EQ(p8.team_size(), team_size); + ASSERT_EQ(p8.chunk_size(), chunk_size); + ASSERT_EQ(p8.scratch_size(0), size_t(scratch_size)); +} + +TEST(TEST_CATEGORY, team_policy_runtime_parameters) { + struct SomeTag {}; + + using TestExecSpace = TEST_EXECSPACE; + using DynamicSchedule = Kokkos::Schedule<Kokkos::Dynamic>; + using LongIndex = Kokkos::IndexType<long>; + + // clang-format off + test_run_time_parameters<Kokkos::TeamPolicy<TestExecSpace >>(); + test_run_time_parameters<Kokkos::TeamPolicy<TestExecSpace, DynamicSchedule, LongIndex >>(); + test_run_time_parameters<Kokkos::TeamPolicy<LongIndex, TestExecSpace, DynamicSchedule >>(); + test_run_time_parameters<Kokkos::TeamPolicy<DynamicSchedule, LongIndex, TestExecSpace, SomeTag>>(); + // clang-format on +} + +} // namespace diff --git a/packages/kokkos/core/unit_test/TestTeamReductionScan.hpp b/packages/kokkos/core/unit_test/TestTeamReductionScan.hpp index 4d4f3b1f4d34eeae219b9436922162f7279ac8ca..f8f56ad0d85128941dd96fbaa6ef16e6b39f2924 100644 --- a/packages/kokkos/core/unit_test/TestTeamReductionScan.hpp +++ b/packages/kokkos/core/unit_test/TestTeamReductionScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_TEAM_REDUCTION_SCAN_HPP #define KOKKOS_TEST_TEAM_REDUCTION_SCAN_HPP diff --git a/packages/kokkos/core/unit_test/TestTeamScan.hpp b/packages/kokkos/core/unit_test/TestTeamScan.hpp index b93285b21e2b09dcc22dd718b35626a20fb5b8ec..cec36236d848be12644d4c1ccd60d415986c74e1 100644 --- a/packages/kokkos/core/unit_test/TestTeamScan.hpp +++ b/packages/kokkos/core/unit_test/TestTeamScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <impl/Kokkos_Stacktrace.hpp> diff --git a/packages/kokkos/core/unit_test/TestTeamScratch.hpp b/packages/kokkos/core/unit_test/TestTeamScratch.hpp index bab937273ddee06bb55b17b4fefc567c98bac30b..3fdf81e04408d4a551f6222d229e7753e8965ae8 100644 --- a/packages/kokkos/core/unit_test/TestTeamScratch.hpp +++ b/packages/kokkos/core/unit_test/TestTeamScratch.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_TEAM_SCRATCH_HPP #define KOKKOS_TEST_TEAM_SCRATCH_HPP diff --git a/packages/kokkos/core/unit_test/TestTeamTeamSize.hpp b/packages/kokkos/core/unit_test/TestTeamTeamSize.hpp index 5e637616c9a0240fc7350d903e6add0783a4a033..7a6a4dd581929be1a44e655d1084794ac324c83e 100644 --- a/packages/kokkos/core/unit_test/TestTeamTeamSize.hpp +++ b/packages/kokkos/core/unit_test/TestTeamTeamSize.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> #include <sstream> diff --git a/packages/kokkos/core/unit_test/TestTeamVector.hpp b/packages/kokkos/core/unit_test/TestTeamVector.hpp index 8c302f9307c7b4f6eaa5b10e8cf935c89da36293..15410bb63fa115e3e008a9e8641e481996c482d0 100644 --- a/packages/kokkos/core/unit_test/TestTeamVector.hpp +++ b/packages/kokkos/core/unit_test/TestTeamVector.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> @@ -729,8 +701,8 @@ bool Test(int test) { #else int team_size = 33; #endif - if (team_size > int(ExecutionSpace::concurrency())) - team_size = int(ExecutionSpace::concurrency()); + int const concurrency = ExecutionSpace().concurrency(); + if (team_size > concurrency) team_size = concurrency; passed = passed && test_scalar<int, ExecutionSpace>(317, team_size, test); passed = passed && test_scalar<long long int, ExecutionSpace>(317, team_size, test); @@ -770,8 +742,9 @@ class TestTripleNestedReduce { void run_test(const size_type &nrows, const size_type &ncols, size_type team_size, const size_type &vector_length) { - if (team_size > size_type(DeviceType::execution_space::concurrency())) - team_size = size_type(DeviceType::execution_space::concurrency()); + auto const concurrency = + static_cast<size_type>(execution_space().concurrency()); + if (team_size > concurrency) team_size = concurrency; #ifdef KOKKOS_ENABLE_HPX team_size = 1; @@ -978,7 +951,7 @@ struct checkScan { } } for (int i = 0; i < host_outputs.extent_int(0); ++i) - ASSERT_EQ(host_outputs(i), expected(i)); + ASSERT_EQ(host_outputs(i), expected(i)) << "differ at index " << i; } }; } // namespace VectorScanReducer @@ -987,7 +960,10 @@ struct checkScan { TEST(TEST_CATEGORY, team_vector) { ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(0))); ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(1))); +#if !(defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC)) // FIXME_NVHPC ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(2))); +#endif ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(3))); ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(4))); ASSERT_TRUE((TestTeamVector::Test<TEST_EXECSPACE>(5))); @@ -1034,6 +1010,13 @@ TEST(TEST_CATEGORY, parallel_scan_with_reducers) { constexpr int n = 1000000; constexpr int n_vector_range = 100; +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) { + GTEST_SKIP() << "All but max inclusive scan differ at index 101"; + } +#endif + checkScan<TEST_EXECSPACE, ScanType::Exclusive, n, n_vector_range, Kokkos::Prod<T, TEST_EXECSPACE>>() .run(); diff --git a/packages/kokkos/core/unit_test/TestTeamVectorRange.hpp b/packages/kokkos/core/unit_test/TestTeamVectorRange.hpp index 44ffc7f3be4700948e66d385d9099215a1381953..bc7eb76932caed3938f578eadca62e52668ca2a0 100644 --- a/packages/kokkos/core/unit_test/TestTeamVectorRange.hpp +++ b/packages/kokkos/core/unit_test/TestTeamVectorRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> @@ -443,8 +415,8 @@ bool Test(int test) { #else int team_size = 33; #endif - if (team_size > int(ExecutionSpace::concurrency())) - team_size = int(ExecutionSpace::concurrency()); + int const concurrency = ExecutionSpace().concurrency(); + if (team_size > concurrency) team_size = concurrency; passed = passed && test_scalar<int, ExecutionSpace>(317, team_size, test); passed = passed && test_scalar<long long int, ExecutionSpace>(317, team_size, test); @@ -466,6 +438,12 @@ namespace Test { TEST(TEST_CATEGORY, team_teamvector_range) { ASSERT_TRUE((TestTeamVectorRange::Test<TEST_EXECSPACE>(0))); +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + if constexpr (std::is_same_v<TEST_EXECSPACE, Kokkos::Cuda>) { + GTEST_SKIP() << "Disabling 2/3rd of the test for now"; + } +#endif ASSERT_TRUE((TestTeamVectorRange::Test<TEST_EXECSPACE>(1))); // FIXME_OPENMPTARGET - Use of kokkos reducers currently results in runtime // memory errors. diff --git a/packages/kokkos/core/unit_test/TestTypeList.cpp b/packages/kokkos/core/unit_test/TestTypeList.cpp index e450d11562819c756334daeea91f3f448df624db..7057b8c3f70f1a01cb2ae4e0c0d1d804ee9864a2 100644 --- a/packages/kokkos/core/unit_test/TestTypeList.cpp +++ b/packages/kokkos/core/unit_test/TestTypeList.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <impl/Kokkos_Utilities.hpp> diff --git a/packages/kokkos/core/unit_test/TestUniqueToken.hpp b/packages/kokkos/core/unit_test/TestUniqueToken.hpp index 224a97fef00330a8812590231295574501d1887a..55ea6eba61e4936b25b13b94c406bd30bcc5fdb7 100644 --- a/packages/kokkos/core/unit_test/TestUniqueToken.hpp +++ b/packages/kokkos/core/unit_test/TestUniqueToken.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -221,7 +193,7 @@ class TestAcquireTeamUniqueToken { } TestAcquireTeamUniqueToken(int team_size) - : tokens(execution_space::concurrency() / team_size, execution_space()), + : tokens(execution_space().concurrency() / team_size, execution_space()), verify("TestAcquireTeamUniqueTokenVerify", tokens.size()), counts("TestAcquireTeamUniqueTokenCounts", tokens.size()), errors("TestAcquireTeamUniqueTokenErrors", 1) {} diff --git a/packages/kokkos/core/unit_test/TestUtilities.hpp b/packages/kokkos/core/unit_test/TestUtilities.hpp index cbe9b77af1bd8c2ca06a8b622221d5f4a0052956..8de5f5e0d16bee1532b557fffe042b3d33f00e87 100644 --- a/packages/kokkos/core/unit_test/TestUtilities.hpp +++ b/packages/kokkos/core/unit_test/TestUtilities.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -69,22 +41,4 @@ void test_is_specialization_of() { ""); } -template <std::size_t... Idxs, class... Args> -std::size_t do_comma_emulation_test(std::integer_sequence<std::size_t, Idxs...>, - Args... args) { - // Count the bugs, since ASSERT_EQ is a statement and not an expression - std::size_t bugs = 0; - // Ensure in-order evaluation - std::size_t i = 0; - KOKKOS_IMPL_FOLD_COMMA_OPERATOR(bugs += std::size_t(Idxs != i++) /*, ...*/); - // Ensure expansion of multiple packs works - KOKKOS_IMPL_FOLD_COMMA_OPERATOR(bugs += std::size_t(Idxs != args) /*, ...*/); - return bugs; -} - -TEST(utilities, comma_operator_emulation) { - ASSERT_EQ(0u, do_comma_emulation_test(std::make_index_sequence<5>{}, 0, 1, 2, - 3, 4)); -} - } // namespace Test diff --git a/packages/kokkos/core/unit_test/TestViewAPI.hpp b/packages/kokkos/core/unit_test/TestViewAPI.hpp index 320eb6f2ea9bed603fa22547e511f8cf5655cc08..767f6e5e49c2355d097d2f997c2856fdd3fc1319 100644 --- a/packages/kokkos/core/unit_test/TestViewAPI.hpp +++ b/packages/kokkos/core/unit_test/TestViewAPI.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestViewAPI_a.hpp b/packages/kokkos/core/unit_test/TestViewAPI_a.hpp index 048ba51c17001a0a65027922c7132eb239d5b8ea..994ab9c1cf609645e18b3c81053e4c17b3945495 100644 --- a/packages/kokkos/core/unit_test/TestViewAPI_a.hpp +++ b/packages/kokkos/core/unit_test/TestViewAPI_a.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestViewAPI.hpp> diff --git a/packages/kokkos/core/unit_test/TestViewAPI_b.hpp b/packages/kokkos/core/unit_test/TestViewAPI_b.hpp index 5cd9446a1cd52ed0a57d3d9c27389d82f21c0e19..e66ed70ef49b63e659e038759ba7e4a2c77e86d5 100644 --- a/packages/kokkos/core/unit_test/TestViewAPI_b.hpp +++ b/packages/kokkos/core/unit_test/TestViewAPI_b.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestViewAPI.hpp> diff --git a/packages/kokkos/core/unit_test/TestViewAPI_c.hpp b/packages/kokkos/core/unit_test/TestViewAPI_c.hpp index a70792dc623b63bb8aa1a84fec93ca413ffa94a1..5efbd95bc94e4d287452ec4fb6651ea077d94fd8 100644 --- a/packages/kokkos/core/unit_test/TestViewAPI_c.hpp +++ b/packages/kokkos/core/unit_test/TestViewAPI_c.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestViewAPI.hpp> diff --git a/packages/kokkos/core/unit_test/TestViewAPI_d.hpp b/packages/kokkos/core/unit_test/TestViewAPI_d.hpp index ecb65804b7900d773e0018f4763a0a3d60aa566b..08d21f54499fcd77b4ba02b6c4a098e855b4d8f7 100644 --- a/packages/kokkos/core/unit_test/TestViewAPI_d.hpp +++ b/packages/kokkos/core/unit_test/TestViewAPI_d.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestViewAPI.hpp> @@ -55,6 +27,9 @@ TEST(TEST_CATEGORY, view_api_d) { } TEST(TEST_CATEGORY, view_allocation_error) { +#if ((HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 3)) + GTEST_SKIP() << "ROCm 5.3 segfaults when trying to allocate too much memory"; +#endif TestViewAPI<double, TEST_EXECSPACE>::run_test_error(); } diff --git a/packages/kokkos/core/unit_test/TestViewAPI_e.hpp b/packages/kokkos/core/unit_test/TestViewAPI_e.hpp index 2dfde085733a8077616cb56a024c5e7084f4d928..df66396ab845f212edd507ec926afc2195b193b4 100644 --- a/packages/kokkos/core/unit_test/TestViewAPI_e.hpp +++ b/packages/kokkos/core/unit_test/TestViewAPI_e.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -58,10 +30,9 @@ TEST(TEST_CATEGORY, view_remap) { std::conditional<std::is_same<TEST_EXECSPACE, Kokkos::Cuda>::value, \ Kokkos::CudaHostPinnedSpace, TEST_EXECSPACE>::type #elif defined(KOKKOS_ENABLE_HIP) -#define EXECSPACE \ - std::conditional< \ - std::is_same<TEST_EXECSPACE, Kokkos::Experimental::HIP>::value, \ - Kokkos::Experimental::HIPHostPinnedSpace, TEST_EXECSPACE>::type +#define EXECSPACE \ + std::conditional<std::is_same<TEST_EXECSPACE, Kokkos::HIP>::value, \ + Kokkos::HIPHostPinnedSpace, TEST_EXECSPACE>::type #elif defined(KOKKOS_ENABLE_SYCL) #define EXECSPACE \ std::conditional< \ diff --git a/packages/kokkos/core/unit_test/TestViewCopy_a.hpp b/packages/kokkos/core/unit_test/TestViewCopy_a.hpp index ced0aa3828cffabfc196fd9dac146718c0f005d3..3bfc93aadacf721e5c6c77ffd54208eb3113acaf 100644 --- a/packages/kokkos/core/unit_test/TestViewCopy_a.hpp +++ b/packages/kokkos/core/unit_test/TestViewCopy_a.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> @@ -223,6 +195,7 @@ TEST(TEST_CATEGORY, view_copy_tests) { Kokkos::deep_copy(dev, b, h_b); ASSERT_TRUE(run_check(b, 4)); } + // Non contiguous copies { Kokkos::deep_copy(dev, s_a, 5); diff --git a/packages/kokkos/core/unit_test/TestViewCopy_b.hpp b/packages/kokkos/core/unit_test/TestViewCopy_b.hpp index 79647caa90a11ed93f13e32aa49226b12ebd8707..4b155c4c7fc4dcb9b83dc90fcfe1ef4b28dd14b1 100644 --- a/packages/kokkos/core/unit_test/TestViewCopy_b.hpp +++ b/packages/kokkos/core/unit_test/TestViewCopy_b.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> diff --git a/packages/kokkos/core/unit_test/TestViewCtorDimMatch.hpp b/packages/kokkos/core/unit_test/TestViewCtorDimMatch.hpp index e1eb88dba11fee8d03476c0272fac585b7d79135..ff62eaecccf13ef456e588982cb3ce9a7359a738 100644 --- a/packages/kokkos/core/unit_test/TestViewCtorDimMatch.hpp +++ b/packages/kokkos/core/unit_test/TestViewCtorDimMatch.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestViewCtorPropEmbeddedDim.hpp b/packages/kokkos/core/unit_test/TestViewCtorPropEmbeddedDim.hpp index d6b3c33ebe1872c6c740d13e46c46ac7256ad59c..1ab28208f310a2034ad395a5f7b16be0fee67c6c 100644 --- a/packages/kokkos/core/unit_test/TestViewCtorPropEmbeddedDim.hpp +++ b/packages/kokkos/core/unit_test/TestViewCtorPropEmbeddedDim.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> diff --git a/packages/kokkos/core/unit_test/TestViewHooks.hpp b/packages/kokkos/core/unit_test/TestViewHooks.hpp index ac679bedbdf6f06f1d2431242c9c3a6e4e3bf5dc..da9ea42e5fb224b2793b2bddc0c9aaca2decc360 100644 --- a/packages/kokkos/core/unit_test/TestViewHooks.hpp +++ b/packages/kokkos/core/unit_test/TestViewHooks.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TESTVIEWHOOKS_HPP_ #define TESTVIEWHOOKS_HPP_ diff --git a/packages/kokkos/core/unit_test/TestViewIsAssignable.hpp b/packages/kokkos/core/unit_test/TestViewIsAssignable.hpp index 3ac392d3e98860fe536a07fbff43cc7d5fc1aecd..0221569b226938434533eb5dd21e54dfa81bbd56 100644 --- a/packages/kokkos/core/unit_test/TestViewIsAssignable.hpp +++ b/packages/kokkos/core/unit_test/TestViewIsAssignable.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <Kokkos_Core.hpp> namespace Test { @@ -128,7 +144,6 @@ TEST(TEST_CATEGORY, view_is_assignable) { // reference type and const-qualified types using SomeViewType = View<int*, left, d_exec>; -#if defined(KOKKOS_ENABLE_CXX17) static_assert(is_always_assignable_v<SomeViewType, SomeViewType>); static_assert(is_always_assignable_v<SomeViewType, SomeViewType&>); static_assert(is_always_assignable_v<SomeViewType, SomeViewType const>); @@ -137,19 +152,5 @@ TEST(TEST_CATEGORY, view_is_assignable) { static_assert(is_always_assignable_v<SomeViewType&, SomeViewType&>); static_assert(is_always_assignable_v<SomeViewType&, SomeViewType const>); static_assert(is_always_assignable_v<SomeViewType&, SomeViewType const&>); -#else - static_assert(is_always_assignable<SomeViewType, SomeViewType>::value, ""); - static_assert(is_always_assignable<SomeViewType, SomeViewType&>::value, ""); - static_assert(is_always_assignable<SomeViewType, SomeViewType const>::value, - ""); - static_assert(is_always_assignable<SomeViewType, SomeViewType const&>::value, - ""); - static_assert(is_always_assignable<SomeViewType&, SomeViewType>::value, ""); - static_assert(is_always_assignable<SomeViewType&, SomeViewType&>::value, ""); - static_assert(is_always_assignable<SomeViewType&, SomeViewType const>::value, - ""); - static_assert(is_always_assignable<SomeViewType&, SomeViewType const&>::value, - ""); -#endif } } // namespace Test diff --git a/packages/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp b/packages/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp index a8d28933af44b5c784bbf21d45648467354dce54..865f87efae36dca5949d47801462f31ee3a144dc 100644 --- a/packages/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp +++ b/packages/kokkos/core/unit_test/TestViewLayoutStrideAssignment.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestViewLayoutTiled.hpp b/packages/kokkos/core/unit_test/TestViewLayoutTiled.hpp index b0fabddbfc7424a7852e452a73ccaee428ab8646..67308212ee0feb391a1d1bfb0244bc6c6f9d301f 100644 --- a/packages/kokkos/core/unit_test/TestViewLayoutTiled.hpp +++ b/packages/kokkos/core/unit_test/TestViewLayoutTiled.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE #define KOKKOS_IMPL_PUBLIC_INCLUDE diff --git a/packages/kokkos/core/unit_test/TestViewMapping_a.hpp b/packages/kokkos/core/unit_test/TestViewMapping_a.hpp index 5a54a93619a819bf2a460a4f377f23867df371bf..9df044ec7a4b7fd70097fcdf6e6029b1fc371dd5 100644 --- a/packages/kokkos/core/unit_test/TestViewMapping_a.hpp +++ b/packages/kokkos/core/unit_test/TestViewMapping_a.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestViewMapping_b.hpp b/packages/kokkos/core/unit_test/TestViewMapping_b.hpp index b6f83e2f26649123fd68320346030b056a5e6bf5..9ac4e7da8453eea1363a3ea5bfd94c7b79d80717 100644 --- a/packages/kokkos/core/unit_test/TestViewMapping_b.hpp +++ b/packages/kokkos/core/unit_test/TestViewMapping_b.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestViewMapping_subview.hpp b/packages/kokkos/core/unit_test/TestViewMapping_subview.hpp index 0dd6a8d52134bb05b1cb392eee07f1bdf506ba6d..069ad09da98f8088a35bd2a5f1103c8ad9778da9 100644 --- a/packages/kokkos/core/unit_test/TestViewMapping_subview.hpp +++ b/packages/kokkos/core/unit_test/TestViewMapping_subview.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp b/packages/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp index aeab9dbcb9f61739755c38c50de136de3f66a119..cdd90426eb4ce2c9ae9ddc83be3e9776902e47e2 100644 --- a/packages/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp +++ b/packages/kokkos/core/unit_test/TestViewMemoryAccessViolation.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> @@ -198,11 +170,6 @@ TEST(TEST_CATEGORY_DEATH, view_memory_access_violations_from_device) { GTEST_SKIP() << "skipping since no memory access violation would occur"; } -#if defined(KOKKOS_IMPL_HIP_ABORT_DOES_NOT_PRINT_MESSAGE) - if (std::is_same<ExecutionSpace, Kokkos::Experimental::HIP>::value) { - GTEST_SKIP() << "skipping because not yet supported with HIP toolchain"; - } -#endif #if defined(KOKKOS_ENABLE_SYCL) && defined(NDEBUG) // FIXME_SYCL if (std::is_same<ExecutionSpace, Kokkos::Experimental::SYCL>::value) { GTEST_SKIP() << "skipping SYCL device-side abort does not work when NDEBUG " diff --git a/packages/kokkos/core/unit_test/TestViewOfClass.hpp b/packages/kokkos/core/unit_test/TestViewOfClass.hpp index e9128debf7d3ba9c8edf841e3565ce528691ba54..e1edd3d7dc094a060bc8c68816d0c501c8cddce3 100644 --- a/packages/kokkos/core/unit_test/TestViewOfClass.hpp +++ b/packages/kokkos/core/unit_test/TestViewOfClass.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestViewResize.hpp b/packages/kokkos/core/unit_test/TestViewResize.hpp index 36214c2c6580f2aacab2f694c03b8acf07316f50..d056c960ecdc30851b79e84e03ed3314674130d6 100644 --- a/packages/kokkos/core/unit_test/TestViewResize.hpp +++ b/packages/kokkos/core/unit_test/TestViewResize.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TESTVIEWRESIZE_HPP_ #define TESTVIEWRESIZE_HPP_ diff --git a/packages/kokkos/core/unit_test/TestViewSpaceAssign.hpp b/packages/kokkos/core/unit_test/TestViewSpaceAssign.hpp index b7c50d63621e09e97880d7f1ab8fc67288c60eaa..f49edf9260b65efbed7719baaaa1a2161b685c20 100644 --- a/packages/kokkos/core/unit_test/TestViewSpaceAssign.hpp +++ b/packages/kokkos/core/unit_test/TestViewSpaceAssign.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/TestViewSubview.hpp b/packages/kokkos/core/unit_test/TestViewSubview.hpp index 3114d41be3c586bf96f8fffa8f94454bddc66391..eb0050a6827900385723b6f6b220f275b5510653 100644 --- a/packages/kokkos/core/unit_test/TestViewSubview.hpp +++ b/packages/kokkos/core/unit_test/TestViewSubview.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef TESTVIEWSUBVIEW_HPP_ #define TESTVIEWSUBVIEW_HPP_ #include <gtest/gtest.h> @@ -164,8 +136,9 @@ struct fill_2D { template <class Layout, class Space> void test_auto_1d() { - using mv_type = Kokkos::View<double**, Layout, Space>; - using size_type = typename mv_type::size_type; + using mv_type = Kokkos::View<double**, Layout, Space>; + using execution_space = typename Space::execution_space; + using size_type = typename mv_type::size_type; const double ZERO = 0.0; const double ONE = 1.0; @@ -178,7 +151,14 @@ void test_auto_1d() { typename mv_type::HostMirror X_h = Kokkos::create_mirror_view(X); fill_2D<mv_type, Space> f1(X, ONE); - Kokkos::parallel_for(X.extent(0), f1); +#if (HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 3) + using Property = + Kokkos::Experimental::WorkItemProperty::ImplForceGlobalLaunch_t; +#else + using Property = Kokkos::Experimental::WorkItemProperty::None_t; +#endif + Kokkos::parallel_for( + Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f1); Kokkos::fence(); Kokkos::deep_copy(X_h, X); for (size_type j = 0; j < numCols; ++j) { @@ -188,7 +168,8 @@ void test_auto_1d() { } fill_2D<mv_type, Space> f2(X, 0.0); - Kokkos::parallel_for(X.extent(0), f2); + Kokkos::parallel_for( + Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f2); Kokkos::fence(); Kokkos::deep_copy(X_h, X); for (size_type j = 0; j < numCols; ++j) { @@ -198,7 +179,8 @@ void test_auto_1d() { } fill_2D<mv_type, Space> f3(X, TWO); - Kokkos::parallel_for(X.extent(0), f3); + Kokkos::parallel_for( + Kokkos::RangePolicy<execution_space, Property>(0, X.extent(0)), f3); Kokkos::fence(); Kokkos::deep_copy(X_h, X); for (size_type j = 0; j < numCols; ++j) { @@ -211,7 +193,8 @@ void test_auto_1d() { auto X_j = Kokkos::subview(X, Kokkos::ALL, j); fill_1D<decltype(X_j), Space> f4(X_j, ZERO); - Kokkos::parallel_for(X_j.extent(0), f4); + Kokkos::parallel_for( + Kokkos::RangePolicy<execution_space, Property>(0, X_j.extent(0)), f4); Kokkos::fence(); Kokkos::deep_copy(X_h, X); for (size_type i = 0; i < numRows; ++i) { @@ -221,7 +204,9 @@ void test_auto_1d() { for (size_type jj = 0; jj < numCols; ++jj) { auto X_jj = Kokkos::subview(X, Kokkos::ALL, jj); fill_1D<decltype(X_jj), Space> f5(X_jj, ONE); - Kokkos::parallel_for(X_jj.extent(0), f5); + Kokkos::parallel_for( + Kokkos::RangePolicy<execution_space, Property>(0, X_jj.extent(0)), + f5); Kokkos::fence(); Kokkos::deep_copy(X_h, X); for (size_type i = 0; i < numRows; ++i) { diff --git a/packages/kokkos/core/unit_test/TestViewTypeTraits.cpp b/packages/kokkos/core/unit_test/TestViewTypeTraits.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8f4e0e579eea1ca9ccf561ae23e5112d5a2c1c6a --- /dev/null +++ b/packages/kokkos/core/unit_test/TestViewTypeTraits.cpp @@ -0,0 +1,50 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <Kokkos_Core.hpp> + +#include <type_traits> + +namespace { + +constexpr bool test_view_rank() { + // clang-format off + static_assert(Kokkos::View<int >::rank == 0); + static_assert(Kokkos::View<int[1] >::rank == 1); + static_assert(Kokkos::View<int * >::rank == 1); + static_assert(Kokkos::View<int[1][2] >::rank == 2); + static_assert(Kokkos::View<int * [1] >::rank == 2); + static_assert(Kokkos::View<int * * >::rank == 2); + static_assert(Kokkos::View<int[1][2][3]>::rank == 3); + static_assert(Kokkos::View<int * [1][2]>::rank == 3); + static_assert(Kokkos::View<int * * [1]>::rank == 3); + static_assert(Kokkos::View<int * * * >::rank == 3); + // clang-format on + return true; +} +static_assert(test_view_rank()); + +constexpr bool test_is_view_type_trait() { + struct NotView {}; + static_assert(Kokkos::is_view<Kokkos::View<int>>::value); + static_assert(Kokkos::is_view_v<Kokkos::View<int>>); + static_assert(!Kokkos::is_view_v<NotView>); + static_assert(!Kokkos::is_view<NotView>::value); + return true; +} +static_assert(test_is_view_type_trait()); + +} // namespace diff --git a/packages/kokkos/core/unit_test/TestView_64bit.hpp b/packages/kokkos/core/unit_test/TestView_64bit.hpp index 174a07ac1d5b6ca6e9ddc145617ea86bf51de314..f30fe2d13275fd03497ae1a055285b35a60452f0 100644 --- a/packages/kokkos/core/unit_test/TestView_64bit.hpp +++ b/packages/kokkos/core/unit_test/TestView_64bit.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestWindowsInclude.cpp b/packages/kokkos/core/unit_test/TestWindowsInclude.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1db8068a3e992b29b6f421513b86d5edde295f13 --- /dev/null +++ b/packages/kokkos/core/unit_test/TestWindowsInclude.cpp @@ -0,0 +1,21 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +// as we use min and max as names in our headers and these are defined as macros +// in windows.h, we added a pragma push to disable them at the beginning of +// Kokkos_Core and pop them back into existence at the end. +#include <windows.h> +#include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/TestWithoutInitializing.hpp b/packages/kokkos/core/unit_test/TestWithoutInitializing.hpp index 2bf93ab3f67d75911bb0aa7218cf1ed9f1cdeed9..0509cc62b9641f56bd83a7691503a56f092f4eb1 100644 --- a/packages/kokkos/core/unit_test/TestWithoutInitializing.hpp +++ b/packages/kokkos/core/unit_test/TestWithoutInitializing.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> @@ -242,6 +214,12 @@ TEST(TEST_CATEGORY, deep_copy_zero_memset) { GTEST_SKIP() << "skipping since the OpenMPTarget backend doesn't implement " "ZeroMemset"; #endif +// FIXME_OPENACC: The OpenACC backend doesn't implement ZeroMemset +#ifdef KOKKOS_ENABLE_OPENACC + if (std::is_same<TEST_EXECSPACE, Kokkos::Experimental::OpenACC>::value) + GTEST_SKIP() << "skipping since the OpenACC backend doesn't implement " + "ZeroMemset"; +#endif using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableKernels()); @@ -361,3 +339,13 @@ TEST(TEST_CATEGORY, view_allocation_exec_space_int) { ASSERT_TRUE(success); listen_tool_events(Config::DisableAll()); } + +struct NotDefaultConstructible { + NotDefaultConstructible() = delete; +}; + +TEST(TEST_CATEGORY, view_not_default_constructible) { + using Space = TEST_EXECSPACE; + Kokkos::View<NotDefaultConstructible, Space> my_view(Kokkos::view_alloc( + "not_default_constructible", Kokkos::WithoutInitializing)); +} diff --git a/packages/kokkos/core/unit_test/TestWorkGraph.hpp b/packages/kokkos/core/unit_test/TestWorkGraph.hpp index 472af3a0444a3d78a9361640399967535d15d704..9e0b8b7f25ca698f0a16bf82807bfaab434f6b46 100644 --- a/packages/kokkos/core/unit_test/TestWorkGraph.hpp +++ b/packages/kokkos/core/unit_test/TestWorkGraph.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <vector> #include <iostream> @@ -159,12 +131,7 @@ struct TestWorkGraph { } // anonymous namespace TEST(TEST_CATEGORY, workgraph_fib) { - // FIXME_HIP The test is very slow with HIP and it causes the CI to timeout -#ifdef KOKKOS_ENABLE_HIP - int limit = 7; -#else int limit = 27; -#endif for (int i = 0; i < limit; ++i) { TestWorkGraph<TEST_EXECSPACE> f(i); f.test_for(); diff --git a/packages/kokkos/core/unit_test/Test_InterOp_Streams.hpp b/packages/kokkos/core/unit_test/Test_InterOp_Streams.hpp index 6af731b9fa3e037598123add65071c1efa341187..4d3d63954f6b0bf73ea9a6d7abd1c7ae9479b2c4 100644 --- a/packages/kokkos/core/unit_test/Test_InterOp_Streams.hpp +++ b/packages/kokkos/core/unit_test/Test_InterOp_Streams.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/UnitTestMain.cpp b/packages/kokkos/core/unit_test/UnitTestMain.cpp index a70409105f0b43a9fe07c102b626dce7cf803410..da37ff823b16e7b443db34676dcd256f3eddb0e6 100644 --- a/packages/kokkos/core/unit_test/UnitTestMain.cpp +++ b/packages/kokkos/core/unit_test/UnitTestMain.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <cstdlib> diff --git a/packages/kokkos/core/unit_test/UnitTestMainInit.cpp b/packages/kokkos/core/unit_test/UnitTestMainInit.cpp index 140ba418fdac4eda95ed362a9b5bf64e50676cc2..0bf647012ac64a64fde6218e4f49aad0b47e2f89 100644 --- a/packages/kokkos/core/unit_test/UnitTestMainInit.cpp +++ b/packages/kokkos/core/unit_test/UnitTestMainInit.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <cstdlib> diff --git a/packages/kokkos/core/unit_test/UnitTest_CMakePassCmdLineArgs.cpp b/packages/kokkos/core/unit_test/UnitTest_CMakePassCmdLineArgs.cpp index 7525f8d2b4b939702b9b361b107b12e57826cb65..3a552bc31e32fef3f5eeb15cc7559d3df744ebb2 100644 --- a/packages/kokkos/core/unit_test/UnitTest_CMakePassCmdLineArgs.cpp +++ b/packages/kokkos/core/unit_test/UnitTest_CMakePassCmdLineArgs.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <string> struct Up {}; diff --git a/packages/kokkos/core/unit_test/UnitTest_DeviceAndThreads.cpp b/packages/kokkos/core/unit_test/UnitTest_DeviceAndThreads.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2b3c90ef2aed7825dd3200f7a6635861616ec06f --- /dev/null +++ b/packages/kokkos/core/unit_test/UnitTest_DeviceAndThreads.cpp @@ -0,0 +1,110 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <Kokkos_Core.hpp> +#include <iostream> +#include <string> +#include <thread> + +int get_device_count() { +#if defined(KOKKOS_ENABLE_CUDA) + int count; + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetDeviceCount(&count)); + return count; +#elif defined(KOKKOS_ENABLE_HIP) + int count; + KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDevice(&count)); + return count; +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) + return omp_get_num_devices(); +#elif defined(KOKKOS_ENABLE_OPENACC) + return acc_get_num_devices(acc_get_device_type()); +#else + return 0; +#endif +} + +int get_device_id() { +#if defined(KOKKOS_ENABLE_CUDA) + int device; + KOKKOS_IMPL_CUDA_SAFE_CALL(cudaGetDevice(&device)); + return device; +#elif defined(KOKKOS_ENABLE_HIP) + int device_id; + KOKKOS_IMPL_HIP_SAFE_CALL(hipGetDevice(&device_id)); + return device_id; +#elif defined(KOKKOS_ENABLE_OPENMPTARGET) + return omp_get_device_num(); +#elif defined(KOKKOS_ENABLE_OPENACC) + return acc_get_device_num(acc_get_device_type()); +#else + return -1; +#endif +} + +int get_max_threads() { +#if defined(KOKKOS_ENABLE_OPENMP) + return omp_get_max_threads(); +#elif defined(KOKKOS_ENABLE_THREADS) + return std::thread::hardware_concurrency(); +#else + return 1; +#endif +} + +int get_num_threads() { + return Kokkos::DefaultHostExecutionSpace().concurrency(); +} + +int get_disable_warnings() { return !Kokkos::show_warnings(); } + +int get_tune_internals() { return Kokkos::tune_internals(); } + +int print_flag(std::string const& flag) { + std::vector<std::string> valid_flags; +#define KOKKOS_TEST_PRINT_FLAG(NAME) \ + if (flag == #NAME) { \ + std::cout << get_##NAME() << '\n'; \ + return EXIT_SUCCESS; \ + } \ + valid_flags.push_back(#NAME) + + KOKKOS_TEST_PRINT_FLAG(num_threads); + KOKKOS_TEST_PRINT_FLAG(max_threads); + KOKKOS_TEST_PRINT_FLAG(device_id); + KOKKOS_TEST_PRINT_FLAG(device_count); + KOKKOS_TEST_PRINT_FLAG(disable_warnings); + KOKKOS_TEST_PRINT_FLAG(tune_internals); + +#undef KOKKOS_TEST_PRINT_FLAG + + std::cerr << "Invalid flag name " << flag << ". Valid names are "; + for (int i = 0; i < (int)valid_flags.size() - 1; ++i) { + std::cerr << valid_flags[i] << ", "; + } + std::cerr << "and " << valid_flags.back() << ".\n"; + return EXIT_FAILURE; +} + +int main(int argc, char* argv[]) { + Kokkos::ScopeGuard guard(argc, argv); + if (argc != 2) { + std::cerr << "Usage: <executable> NAME_OF_FLAG\n"; + return EXIT_FAILURE; + } + int exit_code = print_flag(argv[1]); + return exit_code; +} diff --git a/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook.cpp b/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook.cpp index 1b99691e6d13dc23c0cc94f653cd6b91c069c82d..3a30de4d7a42b23336f9c8ff0cd6dc6efe56a4f2 100644 --- a/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook.cpp +++ b/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdlib> #include <exception> diff --git a/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook_terminate.cpp b/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook_terminate.cpp index 442310542be36bf40c495336d287d37812c9b83c..e58f17beef80f604621bcf57755488aa922f58c3 100644 --- a/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook_terminate.cpp +++ b/packages/kokkos/core/unit_test/UnitTest_PushFinalizeHook_terminate.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdlib> #include <iostream> diff --git a/packages/kokkos/core/unit_test/category_files/TestCudaHostPinned_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestCudaHostPinned_Category.hpp index 3f8ec6bacf209f9fe3fc0739170b359dfb986f36..28704de29ea619f333c9def78443a9ab45bd28dc 100644 --- a/packages/kokkos/core/unit_test/category_files/TestCudaHostPinned_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestCudaHostPinned_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_CUDAHOSTPINNED_HPP #define KOKKOS_TEST_CUDAHOSTPINNED_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestCudaUVM_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestCudaUVM_Category.hpp index ff53e5a719a7274e8d38b93259286e14bc44d27a..7197065b6542f255054ce119ec6d70c6244544db 100644 --- a/packages/kokkos/core/unit_test/category_files/TestCudaUVM_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestCudaUVM_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_CUDAUVM_HPP #define KOKKOS_TEST_CUDAUVM_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestCuda_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestCuda_Category.hpp index 22666dc82fab611ee08aa7555e9b56ae0b2f148a..191d0a11afa9b187b1b64680e8ac29f9b83578a5 100644 --- a/packages/kokkos/core/unit_test/category_files/TestCuda_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestCuda_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_CUDA_HPP #define KOKKOS_TEST_CUDA_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestDefaultDeviceType_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestDefaultDeviceType_Category.hpp index 57a0e0ee006460a59c71d5fbccfbd87c2c754653..5d8fb496f0e8995606751409e7917593d6da3264 100644 --- a/packages/kokkos/core/unit_test/category_files/TestDefaultDeviceType_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestDefaultDeviceType_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_DEFAULTDEVICETYPE_HPP #define KOKKOS_TEST_DEFAULTDEVICETYPE_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestHIPHostPinned_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestHIPHostPinned_Category.hpp index dace3924a32e43427b23ffccabd80d16df731685..c00a717ee1ec26ae398b0301ac29cfb9a2a4d5f7 100644 --- a/packages/kokkos/core/unit_test/category_files/TestHIPHostPinned_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestHIPHostPinned_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_HIPHOSTPINNED_HPP #define KOKKOS_TEST_HIPHOSTPINNED_HPP @@ -49,6 +21,6 @@ #define TEST_CATEGORY hip_hostpinned #define TEST_CATEGORY_DEATH hip_hostpinned_DeathTest -#define TEST_EXECSPACE Kokkos::Experimental::HIPHostPinnedSpace +#define TEST_EXECSPACE Kokkos::HIPHostPinnedSpace #endif diff --git a/packages/kokkos/core/unit_test/category_files/TestHIPManaged_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestHIPManaged_Category.hpp index 1ff88a4841b2ef032c38775a23a33f3c64c918f2..9cf14ef0ef6054084056b35664551a92816929df 100644 --- a/packages/kokkos/core/unit_test/category_files/TestHIPManaged_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestHIPManaged_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_HIPUNIFIED_HPP #define KOKKOS_TEST_HIPUNIFIED_HPP @@ -49,6 +21,6 @@ #define TEST_CATEGORY hip_managed #define TEST_CATEGORY_DEATH hip_managed_DeathTest -#define TEST_EXECSPACE Kokkos::Experimental::HIPManagedSpace +#define TEST_EXECSPACE Kokkos::HIPManagedSpace #endif diff --git a/packages/kokkos/core/unit_test/category_files/TestHIP_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestHIP_Category.hpp index a0a34f5c954d58e24e2a85867a94d04e4eee7ca6..adaed3281ab4a7d64ce73d349e682e2d3a15b75b 100644 --- a/packages/kokkos/core/unit_test/category_files/TestHIP_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestHIP_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_HIP_HPP #define KOKKOS_TEST_HIP_HPP @@ -50,6 +22,6 @@ #define TEST_CATEGORY hip #define TEST_CATEGORY_NUMBER 6 #define TEST_CATEGORY_DEATH hip_DeathTest -#define TEST_EXECSPACE Kokkos::Experimental::HIP +#define TEST_EXECSPACE Kokkos::HIP #endif diff --git a/packages/kokkos/core/unit_test/category_files/TestHPX_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestHPX_Category.hpp index 401794c43177a4304817318bb6ed88ce1ff1dd88..d3a7cdbea530ff655770a6fd96b7f0bffae0ed0b 100644 --- a/packages/kokkos/core/unit_test/category_files/TestHPX_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestHPX_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_HPX_HPP #define KOKKOS_TEST_HPX_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestOpenACC_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestOpenACC_Category.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0c4e4b7e11953be5be1eefce5d453e08c605ce55 --- /dev/null +++ b/packages/kokkos/core/unit_test/category_files/TestOpenACC_Category.hpp @@ -0,0 +1,27 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_TEST_OACC_HPP +#define KOKKOS_TEST_OACC_HPP + +#include <gtest/gtest.h> + +#define TEST_CATEGORY openacc +#define TEST_CATEGORY_NUMBER 8 +#define TEST_CATEGORY_DEATH openacc_DeathTest +#define TEST_EXECSPACE Kokkos::Experimental::OpenACC + +#endif diff --git a/packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp index 4d3d14e245099e11986d7fdcb83e5cb4289c5d23..235b34ffab78d214301d35cbf2452dff9da0e377 100644 --- a/packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestOpenMPTarget_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_OMPTARGET_HPP #define KOKKOS_TEST_OMPTARGET_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestOpenMP_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestOpenMP_Category.hpp index 98b8b9f515d128ca3fb9fd239f7d3b5ab5131e0b..22924ad1974948b24f8e6349c7ef650d076279f2 100644 --- a/packages/kokkos/core/unit_test/category_files/TestOpenMP_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestOpenMP_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_OMP_HPP #define KOKKOS_TEST_OMP_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestSYCLHostUSM_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestSYCLHostUSM_Category.hpp index 4c1996bfaa73eea936d8f3a6e15340ebd5408fb8..465b066c32c98c242c52bbd0a4d18c4c40430184 100644 --- a/packages/kokkos/core/unit_test/category_files/TestSYCLHostUSM_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestSYCLHostUSM_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SYCL_HOST_USM_SPACE_HPP #define KOKKOS_TEST_SYCL_HOST_USM_SPACE_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestSYCLSharedUSM_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestSYCLSharedUSM_Category.hpp index 4421559180c4e83348419bea0172e25a79660766..e377f73eec28ca35ff873930bd3c9555f1a539f4 100644 --- a/packages/kokkos/core/unit_test/category_files/TestSYCLSharedUSM_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestSYCLSharedUSM_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SYCL_SHARED_USM_SPACE_HPP #define KOKKOS_TEST_SYCL_SHARED_USM_SPACE_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestSYCL_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestSYCL_Category.hpp index efa84ad39f0ad5f12e96c2eb5a908fb505ba5bd5..8e1b18c9acd9b69509f1793f9563699ddcd43052 100644 --- a/packages/kokkos/core/unit_test/category_files/TestSYCL_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestSYCL_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SYCL_HPP #define KOKKOS_TEST_SYCL_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestSerial_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestSerial_Category.hpp index b2e0f96f446bd9c67c57f4dd0c7429f133f67bf8..0baf2b9265f5705cfa83c1ada65eeb131a90c0c3 100644 --- a/packages/kokkos/core/unit_test/category_files/TestSerial_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestSerial_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_SERIAL_HPP #define KOKKOS_TEST_SERIAL_HPP diff --git a/packages/kokkos/core/unit_test/category_files/TestThreads_Category.hpp b/packages/kokkos/core/unit_test/category_files/TestThreads_Category.hpp index b7ca7c826b090649e9e49cc26b3a1bf8b9b45894..13b0b653f21ec3061ffe0084fe9f52b10f6c98f6 100644 --- a/packages/kokkos/core/unit_test/category_files/TestThreads_Category.hpp +++ b/packages/kokkos/core/unit_test/category_files/TestThreads_Category.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_THREADS_HPP #define KOKKOS_TEST_THREADS_HPP diff --git a/packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt b/packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt index 759d59a07dd9e9268fb7d818b4dc50f564845805..551588f642da0c9c271ff0eff99e6e6c10bb159d 100644 --- a/packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt +++ b/packages/kokkos/core/unit_test/configuration/test-code/CMakeLists.txt @@ -19,8 +19,8 @@ # The CMake variables CMAKE_CXX_STANDARD and CMAKE_CXX_EXTENSIONS are # respected. We recommend that you set CMAKE_CXX_EXTENSIONS to OFF. # Otherwise, CMake defaults to using extensions for the C++ standard, and the -# GNU extensions (-std=gnu++14) will be used for compilers that support it -# instead of standard C++14 (-std=c++14). +# GNU extensions (-std=gnu++17) will be used for compilers that support it +# instead of standard C++17 (-std=c++17). # # A bunch of build options are added as variables (all starting with KOKKOS_) # to the build. Check them out using ccmake or the CMake GUI. diff --git a/packages/kokkos/core/unit_test/configuration/test-code/main.cpp b/packages/kokkos/core/unit_test/configuration/test-code/main.cpp index 0d2f6de3a9f6cc70bf9d6ebb83d46780405a2b89..69af1d7ae9d3142bc3af477004183fd623560bac 100644 --- a/packages/kokkos/core/unit_test/configuration/test-code/main.cpp +++ b/packages/kokkos/core/unit_test/configuration/test-code/main.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <Kokkos_Core.hpp> int main(int argc, char* argv[]) { diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_DebugPinUVMSpace.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_DebugPinUVMSpace.cpp index 5b6fccdbd0a500cbb0d45574879a797c866d1b55..5814b36509f8eac2dcbe009caf4284de63b568f3 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_DebugPinUVMSpace.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_DebugPinUVMSpace.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestCuda_Category.hpp> diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_DebugSerialExecution.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_DebugSerialExecution.cpp index f1d3dfc5245d971b6b90ca3ef11731e34b538f67..15d197bb86198343663b9113cfa267fef28e4061 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_DebugSerialExecution.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_DebugSerialExecution.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestCuda_Category.hpp> diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_Graph.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_Graph.cpp index 77b1e58a1586482b029f89298c7273cfccc95a7d..272036396905722ab04982c7526d229da40a79a0 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_Graph.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_Graph.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestCuda_Category.hpp> #include <TestGraph.hpp> diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp index 31fd63f08437520614c54714fd611d1bd87db9e3..0ed0e19b5e51961b5e6b8e21f46739c3b017d857 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Init.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestCuda_Category.hpp> @@ -59,9 +31,11 @@ __global__ void offset(int* p) { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // Cuda. TEST(cuda, raw_cuda_interop) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + int* p; KOKKOS_IMPL_CUDA_SAFE_CALL(cudaMalloc(&p, sizeof(int) * 100)); - Kokkos::initialize(); Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v(p, 100); Kokkos::deep_copy(v, 5); diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp index f11f657e004d7955dc1cdcff8518ad4b58e443d6..b48a08a9a34617763236f4ab5f05bf8b07022120 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_InterOp_Streams.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestCuda_Category.hpp> #include <Test_InterOp_Streams.hpp> @@ -48,9 +20,11 @@ namespace Test { // Test Interoperability with Cuda Streams TEST(cuda, raw_cuda_streams) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + cudaStream_t stream; cudaStreamCreate(&stream); - Kokkos::initialize(); int* p; cudaMalloc(&p, sizeof(int) * 100); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_ReducerViewSizeLimit.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_ReducerViewSizeLimit.cpp index b8ae97f5861b9d0552d1014b58a5041bd9e20c4c..fea91a39b8486b4f76875eda3564f0226177ab7e 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_ReducerViewSizeLimit.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_ReducerViewSizeLimit.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestCuda_Category.hpp> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_Spaces.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_Spaces.cpp index 2fa61d43120d338bac3c475fc7cf35e9aeb06776..407aa60a0a645172120ac644fbd47caacbe7d8ca 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_Spaces.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_Spaces.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestCuda_Category.hpp> @@ -260,20 +232,18 @@ TEST(cuda, space_access) { } TEST(cuda, uvm) { - if (Kokkos::CudaUVMSpace::available()) { - int *uvm_ptr = static_cast<int *>( - Kokkos::kokkos_malloc<Kokkos::CudaUVMSpace>("uvm_ptr", sizeof(int))); + int *uvm_ptr = static_cast<int *>( + Kokkos::kokkos_malloc<Kokkos::CudaUVMSpace>("uvm_ptr", sizeof(int))); - *uvm_ptr = 42; + *uvm_ptr = 42; - Kokkos::Cuda().fence(); - test_cuda_spaces_int_value<<<1, 1>>>(uvm_ptr); - Kokkos::Cuda().fence(); + Kokkos::fence(); + test_cuda_spaces_int_value<<<1, 1>>>(uvm_ptr); + Kokkos::fence(); - EXPECT_EQ(*uvm_ptr, int(2 * 42)); + EXPECT_EQ(*uvm_ptr, int(2 * 42)); - Kokkos::kokkos_free<Kokkos::CudaUVMSpace>(uvm_ptr); - } + Kokkos::kokkos_free<Kokkos::CudaUVMSpace>(uvm_ptr); } template <class MemSpace, class ExecSpace> @@ -368,8 +338,83 @@ struct TestViewCudaTexture { }; TEST(cuda, impl_view_texture) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC + GTEST_SKIP() + << "Getting error_count of 1000 meaning all assertions are failing"; +#endif TestViewCudaTexture<Kokkos::CudaSpace>::run(); TestViewCudaTexture<Kokkos::CudaUVMSpace>::run(); } +// couldn't create a random-access subview of a view of const T in Kokkos::Cuda +namespace issue_5594 { + +template <typename View> +struct InitFunctor { + InitFunctor(const View &view) : view_(view) {} + KOKKOS_INLINE_FUNCTION + void operator()(int i) const { view_(i) = i; } + View view_; +}; + +template <typename V1, typename V2> +struct Issue5594Functor { + Issue5594Functor(const V1 &v1) : v1_(v1) {} + KOKKOS_INLINE_FUNCTION + void operator()(int i, int &lerr) const { + V2 v2(&v1_(0), + v1_.size()); // failure here -- create subview in execution space + lerr += v1_(i) != v2(i); // check that subview is correct + } + V1 v1_; +}; + +template <typename View> +View create_view() { + using execution_space = typename View::execution_space; + View view("", 10); + InitFunctor iota(view); + Kokkos::parallel_for("test_view_subview_const_randomaccess", + Kokkos::RangePolicy<execution_space>(0, view.extent(0)), + iota); + return view; +} + +// creating a RandomAccess subview of a view of const T in Kokkos::Cuda +template <typename Exec, typename Mem> +void test_view_subview_const_randomaccess() { + using view_t = Kokkos::View<int *, Mem>; + using view_const_t = Kokkos::View<const int *, Mem>; + using u_view_const_t = Kokkos::View< + const int *, Mem, + Kokkos::MemoryTraits<Kokkos::Unmanaged | Kokkos::RandomAccess>>; + + // create non-const view with known values + view_t nonConst = create_view<view_t>(); + // get a const version of the values + view_const_t view(nonConst); + + // create a subview in the execution space and check that it worked + Issue5594Functor<view_const_t, u_view_const_t> checker(view); + int errCount; + Kokkos::parallel_reduce("test_view_subview_const_randomaccess", + Kokkos::RangePolicy<Exec>(0, view.extent(0)), checker, + errCount); + EXPECT_TRUE(0 == errCount); +} +} // namespace issue_5594 + +TEST(cuda, view_subview_const_randomaccess) { +#if defined(KOKKOS_ENABLE_CUDA) && \ + defined(KOKKOS_COMPILER_NVHPC) // FIXME_NVHPC (similar failure to + // TestViewCudaTexture?) + GTEST_SKIP() << "RandomAccess view not working on NVHPC?"; +#endif + issue_5594::test_view_subview_const_randomaccess<Kokkos::Cuda, + Kokkos::CudaSpace>(); + issue_5594::test_view_subview_const_randomaccess<Kokkos::Cuda, + Kokkos::CudaUVMSpace>(); +} + } // namespace Test diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp index 42fa615bc6f65f0661ceaad12c3613781a133a52..ac38923cb5b40fee3b0fc9752c0a8ea9468909d1 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_Task.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestCuda_Category.hpp> #include <TestTaskScheduler.hpp> diff --git a/packages/kokkos/core/unit_test/cuda/TestCuda_TeamScratchStreams.cpp b/packages/kokkos/core/unit_test/cuda/TestCuda_TeamScratchStreams.cpp index eb9077aaf423b2bf9bdfa919d4d45cd18805d069..9ad338fc998013e0a9ea7da1e62720f7f9dd176a 100644 --- a/packages/kokkos/core/unit_test/cuda/TestCuda_TeamScratchStreams.cpp +++ b/packages/kokkos/core/unit_test/cuda/TestCuda_TeamScratchStreams.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestCuda_Category.hpp> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceDevelop.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceDevelop.cpp index b312f42b24369a725a44bdd1de1a2771e794959f..d85973ec155d59e43a29e101edfb4ef6cd8c46e2 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceDevelop.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceDevelop.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType.cpp index 6d6ff0a67bc151421556fca487f30677a5119c33..4a70d9e79beb8b96fedb97471e66d9512027323f 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_1.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_1.cpp index 0f53cf8de7908d3e4dc046cc5c9624fe90e3cb76..348b9feeab04b1bf12637c0fa8e0995550c1efca 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_1.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_1.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_01 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_10.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_10.cpp index c4691edd9b70428844462dd27627bc29618556c8..a77a55ea65303e8a34f8bb17d4e8923e749382fb 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_10.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_10.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_10 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_11.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_11.cpp index 6d999e6cca50f8765f2216c72625b00942d24cab..1b6a140920c85865cf458f408a2c42ee2496dbff 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_11.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_11.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_11 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_12.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_12.cpp index 8b60a704af57c32af9cbf479e8b8475ffc69d543..316bc85526f4cd947d55b1dd594b95ee8756d036 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_12.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_12.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_12 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_13.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_13.cpp index 22af90b95225798b8fe4c5456df8fe5d43aa67d8..6344960a1cfe9229557f694c24c2a1f7fe5d531d 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_13.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_13.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_13 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_14.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_14.cpp index cbe7aa34c7b48d892528b1e2139b03cd3e979470..4515174b82b136b65cca1bfce7f7b0bb90a9a6ef 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_14.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_14.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_14 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_15.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_15.cpp index 8aefe0b77a277edcf8ef1ca52e7b0e520ebdf638..7ead50f0944e0e5a78fc1172ed4dd746974c34d2 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_15.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_15.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_15 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_16.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_16.cpp index 0023c903be9762a71077fa56c9ebf7852679051a..e12b9b3894aeb29da67ff78535c4207a93b83b98 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_16.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_16.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_16 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_17.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_17.cpp index e2c6eed8309cd664e51c1776c3421bb1d40124df..959d0ab7503e15465fd06e0cf0beab510eecb58e 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_17.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_17.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_17 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_18.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_18.cpp index 282634bc184786aa68537de9817a1bdc5f46b04a..07d841519dcf33e9d84e0d8bbcabfcb495056db4 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_18.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_18.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_18 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_2.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_2.cpp index da3c5d381c0d97481874661f245fd3202039dea8..042a515b16acbc5c6656be06a8b92f6b669720e4 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_2.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_2.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_02 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_3.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_3.cpp index ab55bf93aa91360fdce82248d8c282fc6aa6d32e..dba401e5bcf9fc2be70195f1bd19c40cfb4c04b4 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_3.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_3.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_03 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_4.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_4.cpp index 02b637d6cdc16953e84dce595675738b9b0e2ab4..a44c58bdb55adb261e39af050df443493bc0fb23 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_4.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_4.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_04 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_5.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_5.cpp index 0d6dbc52233d0b15618cd5c805cbab60ade6c034..cac0841dd8324de21722df8f3861acd1cb2a6303 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_5.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_5.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_05 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_6.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_6.cpp index 148153944da29f710c8bd5829a50b1b3723bb44b..bafe3b3fd2af39bd626ec29fbdfdde40cc776bc3 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_6.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_6.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_06 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_7.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_7.cpp index d7366577e9e64e078d08cac819c28da3cd26115b..3a4dd9d2533daa2019795085c0cc886927840051 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_7.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_7.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_07 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_8.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_8.cpp index 72404d4328335b901cd5e65b1ecfc6c375dcf714..4e92aae565a3be70762c68c7e41c6b0dc9251fda 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_8.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_8.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_08 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_9.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_9.cpp index 7e327677199a906ed0f48636e384d7a61af0c2e2..44b8f3428d920fb99f08b56d556040615e34c2a7 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_9.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeInit_9.cpp @@ -1,2 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_DEFAULTDEVICETYPE_INIT_TEST_09 #include <TestDefaultDeviceTypeInit.hpp> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeResize.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeResize.cpp index 7f53034557dca1c06bcbc6588ff7fdce6ddbb4c4..354520137638910dd11b5ca4271a812cbc9384a0 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeResize.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeResize.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include "TestResize.hpp" diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeViewAPI.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeViewAPI.cpp index c0d6a8afe878c44791d3133352fdde343cb02810..96fffa0dc7ee22350bed9fa7250a32134f26decb 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeViewAPI.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceTypeViewAPI.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a1.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a1.cpp index 9b57de712183a7ff1fd72533f578c25947901f39..08268178686d3cfcbd55c415bfdc450ff03b71e4 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a1.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a1.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a2.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a2.cpp index 314891433693df21689fedb2827dc8d614896383..9826bc777034ace50499d2c414051ada62f9a50d 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a2.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a2.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a3.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a3.cpp index f9e36e298a227281683ceae0bf5bfe9179a6b8d5..ffca3961fc66fe30b255c932fab0582a140c35e2 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a3.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_a3.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b1.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b1.cpp index 1a34bef874f75ecf4a75a99166f7abc66ec1804c..944fe95083743118d19ddf738862ffb3b9c86fed 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b1.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b1.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b2.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b2.cpp index 8bd7628243ab0e3c073d797cc2817ec2a4ba1185..979d0e56f604eb740595f5822364b56301149e65 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b2.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b2.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b3.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b3.cpp index bc1d763437d1f4d23ae688fe94c16fcd7f9367f9..3a43735982b1f37a84ea8be45ddc8e7d3e6b8645 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b3.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_b3.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c1.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c1.cpp index ba4cca46fbb9d0883691a40ee53b8a11c739b4c5..8e9fefb347d3c71deb3790df36daca6681f91bff 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c1.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c1.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c2.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c2.cpp index 0459f98dddb20e7cae811502e4ebf5518b011c6b..3004376804b330d315c9d4e9f28361d86d999971 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c2.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c2.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c3.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c3.cpp index 801dee83bbe16b6b25398b27068e5d8a3b3d29e2..044e76173735dfbc237c55bd8f40f514f77cd5de 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c3.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_c3.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_d.cpp b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_d.cpp index c74090fff93c8b9a529fad2e5d156d4cad55b954..2bb378d294c4e3285692e1211a8d1328a438a93e 100644 --- a/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_d.cpp +++ b/packages/kokkos/core/unit_test/default/TestDefaultDeviceType_d.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/headers_self_contained/tstHeader.cpp b/packages/kokkos/core/unit_test/headers_self_contained/tstHeader.cpp index 9f249045be9d85001f92abb5906383d570097460..5a558854c61714bc990058f821ca52101b9e3e62 100644 --- a/packages/kokkos/core/unit_test/headers_self_contained/tstHeader.cpp +++ b/packages/kokkos/core/unit_test/headers_self_contained/tstHeader.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #define KOKKOS_HEADER_TEST_STRINGIZE_IMPL(x) #x #define KOKKOS_HEADER_TEST_STRINGIZE(x) KOKKOS_HEADER_TEST_STRINGIZE_IMPL(x) diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_AsyncLauncher.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_AsyncLauncher.cpp index 854f916ba3dad7777f453694ea708a0754872d3d..8142893748398dad07e943e7819055579c97ea56 100644 --- a/packages/kokkos/core/unit_test/hip/TestHIP_AsyncLauncher.cpp +++ b/packages/kokkos/core/unit_test/hip/TestHIP_AsyncLauncher.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHIP_Category.hpp> @@ -69,10 +41,9 @@ TEST(hip, async_launcher) { KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&flag, sizeof(size_t))); KOKKOS_IMPL_HIP_SAFE_CALL(hipMemset(flag, 0, sizeof(size_t))); // launch # of cycles * 1000 kernels w/ distinct values - auto space = Kokkos::Experimental::HIP(); - auto instance = space.impl_internal_space_instance(); - size_t max_cycles = instance->m_maxDriverCycles; - size_t nkernels = max_cycles * 1000; + auto space = Kokkos::HIP(); + auto instance = space.impl_internal_space_instance(); + size_t nkernels = 1000; for (size_t i = 0; i < nkernels; ++i) { TestAsyncLauncher(flag, i).run(); } diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_BlocksizeDeduction.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_BlocksizeDeduction.cpp index f382e5b568b85cdac1f4943c72aa02be73472d7a..07df31a5e890d96a7d3312c254b9936fcf3a07e4 100644 --- a/packages/kokkos/core/unit_test/hip/TestHIP_BlocksizeDeduction.cpp +++ b/packages/kokkos/core/unit_test/hip/TestHIP_BlocksizeDeduction.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHIP_Category.hpp> @@ -85,14 +57,14 @@ TEST(hip, preferred_blocksize_deduction) { { using DriverType = Kokkos::Impl::ParallelFor<TestNone, policy>; - ASSERT_TRUE(Kokkos::Experimental::Impl::HIPParallelLaunch< - DriverType>::get_scratch_size() == 0); + ASSERT_TRUE( + Kokkos::Impl::HIPParallelLaunch<DriverType>::get_scratch_size() == 0); } { using DriverType = Kokkos::Impl::ParallelFor<TestSpiller, policy>; - ASSERT_TRUE(Kokkos::Experimental::Impl::HIPParallelLaunch< - DriverType>::get_scratch_size() > 0); + ASSERT_TRUE( + Kokkos::Impl::HIPParallelLaunch<DriverType>::get_scratch_size() > 0); } } diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp index af20e753d4c99ea9941d4bbd19aa61b7894d1f3a..6fab53e021a933517718fe7d39467c6cb9b073d5 100644 --- a/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp +++ b/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Init.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHIP_Category.hpp> @@ -59,9 +31,11 @@ __global__ void offset(int* p) { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // HIP. TEST(hip, raw_hip_interop) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + int* p; KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100)); - Kokkos::initialize(); Kokkos::View<int*, Kokkos::MemoryTraits<Kokkos::Unmanaged>> v(p, 100); Kokkos::deep_copy(v, 5); diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp index 95d102d4d1c2628ca4964d7598235bb531683912..29108059619978cfc6818b139c66e8c18f5be0be 100644 --- a/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp +++ b/packages/kokkos/core/unit_test/hip/TestHIP_InterOp_Streams.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestHIP_Category.hpp> #include <Test_InterOp_Streams.hpp> @@ -50,9 +22,11 @@ namespace Test { // The difference with the CUDA tests are: raw HIP vs raw CUDA and no launch // bound in HIP due to an error when computing the block size. TEST(hip, raw_hip_streams) { + // Make sure that we use the same device for all allocations + Kokkos::initialize(); + hipStream_t stream; KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream)); - Kokkos::initialize(); int* p; KOKKOS_IMPL_HIP_SAFE_CALL(hipMalloc(&p, sizeof(int) * 100)); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp index 24f48c6599876e9ee68949d65325e75d79590dcd..8c72e9f297241ceab6bc3b1e168235a714319f85 100644 --- a/packages/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp +++ b/packages/kokkos/core/unit_test/hip/TestHIP_Memory_Requirements.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHIP_Category.hpp> @@ -77,10 +48,8 @@ TEST(hip, memory_requirements) { // we want all user-facing memory in hip to be coarse grained. As of // today(07.01.22) the documentation is not reliable/correct, we test the // memory on the device and host - KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPSpace, int, 10); - KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPHostPinnedSpace, - int, 10); - KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::Experimental::HIPManagedSpace, - int, 10); + KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::HIPSpace, int, 10); + KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::HIPHostPinnedSpace, int, 10); + KOKKOS_TEST_MEMORY_COARSEGRAINEDNESS(Kokkos::HIPManagedSpace, int, 10); } } // namespace diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_ScanUnit.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_ScanUnit.cpp index b44bc46fb7abc3cee5be16ec2a3fd3ce910aafa1..0b46d9742ac720dfddd5c2490da00e1886e66b06 100644 --- a/packages/kokkos/core/unit_test/hip/TestHIP_ScanUnit.cpp +++ b/packages/kokkos/core/unit_test/hip/TestHIP_ScanUnit.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHIP_Category.hpp> @@ -62,8 +33,7 @@ __global__ void start_intra_block_scan() DummyFunctor f; typename Kokkos::Impl::FunctorAnalysis< Kokkos::Impl::FunctorPatternInterface::SCAN, - Kokkos::RangePolicy<Kokkos::Experimental::HIP>, DummyFunctor>::Reducer - reducer(&f); + Kokkos::RangePolicy<Kokkos::HIP>, DummyFunctor>::Reducer reducer(&f); Kokkos::Impl::hip_intra_block_reduce_scan<true>(reducer, values); __syncthreads(); @@ -82,9 +52,8 @@ void test_intra_block_scan() { } TEST(TEST_CATEGORY, scan_unit) { - if (std::is_same< - TEST_EXECSPACE, - typename Kokkos::Experimental::HIPSpace::execution_space>::value) { + if (std::is_same<TEST_EXECSPACE, + typename Kokkos::HIPSpace::execution_space>::value) { test_intra_block_scan<1>(); test_intra_block_scan<2>(); test_intra_block_scan<4>(); diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_Spaces.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_Spaces.cpp index c9b370ea7b4466e02b5b6e13da8515ac56fe45c4..14fd4e28837cd6ed690bf006ada187ebe74447cb 100644 --- a/packages/kokkos/core/unit_test/hip/TestHIP_Spaces.cpp +++ b/packages/kokkos/core/unit_test/hip/TestHIP_Spaces.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHIP_Category.hpp> @@ -60,216 +32,193 @@ TEST(hip, space_access) { Kokkos::HostSpace>::assignable, ""); - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::HostSpace, - Kokkos::Experimental::HIPHostPinnedSpace>::assignable, - ""); - static_assert( - !Kokkos::Impl::MemorySpaceAccess< - Kokkos::HostSpace, Kokkos::Experimental::HIPSpace>::assignable, + Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace, + Kokkos::HIPHostPinnedSpace>::assignable, ""); - static_assert( - !Kokkos::Impl::MemorySpaceAccess< - Kokkos::HostSpace, Kokkos::Experimental::HIPSpace>::accessible, - ""); + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace, + Kokkos::HIPSpace>::assignable, + ""); + + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace, + Kokkos::HIPSpace>::accessible, + ""); static_assert( - !Kokkos::Impl::MemorySpaceAccess< - Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::assignable, + !Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace, + Kokkos::HIPManagedSpace>::assignable, ""); static_assert( - Kokkos::Impl::MemorySpaceAccess< - Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::accessible, + Kokkos::Impl::MemorySpaceAccess<Kokkos::HostSpace, + Kokkos::HIPManagedSpace>::accessible, ""); //-------------------------------------- - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIPSpace>::assignable, + static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace, + Kokkos::HIPSpace>::assignable, ""); - static_assert(!Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIPHostPinnedSpace>::assignable, - ""); + static_assert( + !Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace, + Kokkos::HIPHostPinnedSpace>::assignable, + ""); - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIPHostPinnedSpace>::accessible, - ""); + static_assert( + Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace, + Kokkos::HIPHostPinnedSpace>::accessible, + ""); - static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPSpace, + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace, Kokkos::HostSpace>::assignable, ""); - static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPSpace, + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace, Kokkos::HostSpace>::accessible, ""); - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIPManagedSpace>::assignable, - ""); - - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIPManagedSpace>::accessible, - ""); - - //-------------------------------------- - - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIPHostPinnedSpace>::assignable, - ""); + static_assert( + Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace, + Kokkos::HIPManagedSpace>::assignable, + ""); static_assert( - !Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::HostSpace>::assignable, + Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPSpace, + Kokkos::HIPManagedSpace>::accessible, ""); + //-------------------------------------- + static_assert( - Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::HostSpace>::accessible, + Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace, + Kokkos::HIPHostPinnedSpace>::assignable, ""); - static_assert(!Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIPSpace>::assignable, + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace, + Kokkos::HostSpace>::assignable, ""); - static_assert(!Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIPSpace>::accessible, + static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace, + Kokkos::HostSpace>::accessible, ""); - static_assert(!Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIPManagedSpace>::assignable, + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace, + Kokkos::HIPSpace>::assignable, ""); - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIPManagedSpace>::accessible, + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace, + Kokkos::HIPSpace>::accessible, ""); - //-------------------------------------- - - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIPManagedSpace>::assignable, - ""); + static_assert( + !Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace, + Kokkos::HIPManagedSpace>::assignable, + ""); static_assert( - !Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace, - Kokkos::HostSpace>::assignable, + Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPHostPinnedSpace, + Kokkos::HIPManagedSpace>::accessible, ""); + //-------------------------------------- + static_assert( - !Kokkos::Impl::MemorySpaceAccess<Kokkos::Experimental::HIPManagedSpace, - Kokkos::HostSpace>::accessible, + Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace, + Kokkos::HIPManagedSpace>::assignable, ""); - static_assert(!Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIPSpace>::assignable, + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace, + Kokkos::HostSpace>::assignable, ""); - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIPSpace>::accessible, + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace, + Kokkos::HostSpace>::accessible, ""); - static_assert(!Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIPHostPinnedSpace>::assignable, + static_assert(!Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace, + Kokkos::HIPSpace>::assignable, ""); - static_assert(Kokkos::Impl::MemorySpaceAccess< - Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIPHostPinnedSpace>::accessible, + static_assert(Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace, + Kokkos::HIPSpace>::accessible, ""); + static_assert( + !Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace, + Kokkos::HIPHostPinnedSpace>::assignable, + ""); + + static_assert( + Kokkos::Impl::MemorySpaceAccess<Kokkos::HIPManagedSpace, + Kokkos::HIPHostPinnedSpace>::accessible, + ""); + //-------------------------------------- - static_assert(!Kokkos::SpaceAccessibility<Kokkos::Experimental::HIP, - Kokkos::HostSpace>::accessible, - ""); + static_assert( + !Kokkos::SpaceAccessibility<Kokkos::HIP, Kokkos::HostSpace>::accessible, + ""); static_assert( - Kokkos::SpaceAccessibility<Kokkos::Experimental::HIP, - Kokkos::Experimental::HIPSpace>::accessible, + Kokkos::SpaceAccessibility<Kokkos::HIP, Kokkos::HIPSpace>::accessible, ""); - static_assert(Kokkos::SpaceAccessibility< - Kokkos::Experimental::HIP, - Kokkos::Experimental::HIPHostPinnedSpace>::accessible, + static_assert( + Kokkos::SpaceAccessibility<Kokkos::HIP, + Kokkos::HIPHostPinnedSpace>::accessible, + ""); + + static_assert(Kokkos::SpaceAccessibility<Kokkos::HIP, + Kokkos::HIPManagedSpace>::accessible, ""); - static_assert(Kokkos::SpaceAccessibility< - Kokkos::Experimental::HIP, - Kokkos::Experimental::HIPManagedSpace>::accessible, + static_assert(!Kokkos::SpaceAccessibility<Kokkos::HostSpace, + Kokkos::HIPSpace>::accessible, ""); static_assert( - !Kokkos::SpaceAccessibility<Kokkos::HostSpace, - Kokkos::Experimental::HIPSpace>::accessible, + Kokkos::SpaceAccessibility<Kokkos::HostSpace, + Kokkos::HIPHostPinnedSpace>::accessible, ""); - static_assert(Kokkos::SpaceAccessibility< - Kokkos::HostSpace, - Kokkos::Experimental::HIPHostPinnedSpace>::accessible, + static_assert(Kokkos::SpaceAccessibility<Kokkos::HostSpace, + Kokkos::HIPManagedSpace>::accessible, ""); - static_assert( - Kokkos::SpaceAccessibility< - Kokkos::HostSpace, Kokkos::Experimental::HIPManagedSpace>::accessible, - ""); + static_assert(std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPSpace>::Space, + Kokkos::HostSpace>::value, + ""); static_assert( - std::is_same< - Kokkos::Impl::HostMirror<Kokkos::Experimental::HIPSpace>::Space, - Kokkos::HostSpace>::value, + std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPHostPinnedSpace>::Space, + Kokkos::HIPHostPinnedSpace>::value, ""); static_assert( - std::is_same<Kokkos::Impl::HostMirror< - Kokkos::Experimental::HIPHostPinnedSpace>::Space, - Kokkos::Experimental::HIPHostPinnedSpace>::value, + std::is_same<Kokkos::Impl::HostMirror<Kokkos::HIPManagedSpace>::Space, + Kokkos::Device<Kokkos::HostSpace::execution_space, + Kokkos::HIPManagedSpace>>::value, ""); static_assert( - std::is_same< - Kokkos::Impl::HostMirror< - Kokkos::Experimental::HIPManagedSpace>::Space, - Kokkos::Device<Kokkos::HostSpace::execution_space, - Kokkos::Experimental::HIPManagedSpace>>::value, + Kokkos::SpaceAccessibility<Kokkos::Impl::HostMirror<Kokkos::HIP>::Space, + Kokkos::HostSpace>::accessible, ""); static_assert(Kokkos::SpaceAccessibility< - Kokkos::Impl::HostMirror<Kokkos::Experimental::HIP>::Space, + Kokkos::Impl::HostMirror<Kokkos::HIPSpace>::Space, Kokkos::HostSpace>::accessible, ""); - static_assert( - Kokkos::SpaceAccessibility< - Kokkos::Impl::HostMirror<Kokkos::Experimental::HIPSpace>::Space, - Kokkos::HostSpace>::accessible, - ""); - static_assert(Kokkos::SpaceAccessibility< - Kokkos::Impl::HostMirror< - Kokkos::Experimental::HIPHostPinnedSpace>::Space, + Kokkos::Impl::HostMirror<Kokkos::HIPHostPinnedSpace>::Space, Kokkos::HostSpace>::accessible, ""); static_assert(Kokkos::SpaceAccessibility< - Kokkos::Impl::HostMirror< - Kokkos::Experimental::HIPManagedSpace>::Space, + Kokkos::Impl::HostMirror<Kokkos::HIPManagedSpace>::Space, Kokkos::HostSpace>::accessible, ""); } @@ -311,18 +260,15 @@ struct TestViewHIPAccessible { }; TEST(hip, impl_view_accessible) { - TestViewHIPAccessible<Kokkos::Experimental::HIPSpace, - Kokkos::Experimental::HIP>::run(); + TestViewHIPAccessible<Kokkos::HIPSpace, Kokkos::HIP>::run(); - TestViewHIPAccessible<Kokkos::Experimental::HIPHostPinnedSpace, - Kokkos::Experimental::HIP>::run(); - TestViewHIPAccessible<Kokkos::Experimental::HIPHostPinnedSpace, + TestViewHIPAccessible<Kokkos::HIPHostPinnedSpace, Kokkos::HIP>::run(); + TestViewHIPAccessible<Kokkos::HIPHostPinnedSpace, Kokkos::HostSpace::execution_space>::run(); - TestViewHIPAccessible<Kokkos::Experimental::HIPManagedSpace, + TestViewHIPAccessible<Kokkos::HIPManagedSpace, Kokkos::HostSpace::execution_space>::run(); - TestViewHIPAccessible<Kokkos::Experimental::HIPManagedSpace, - Kokkos::Experimental::HIP>::run(); + TestViewHIPAccessible<Kokkos::HIPManagedSpace, Kokkos::HIP>::run(); } } // namespace Test diff --git a/packages/kokkos/core/unit_test/hip/TestHIP_TeamScratchStreams.cpp b/packages/kokkos/core/unit_test/hip/TestHIP_TeamScratchStreams.cpp index 86b2fab3c7e3fc0b53b309646add9f4817b804f2..c1c5fba427496efb213d4fa5dc2e4cf3f361c268 100644 --- a/packages/kokkos/core/unit_test/hip/TestHIP_TeamScratchStreams.cpp +++ b/packages/kokkos/core/unit_test/hip/TestHIP_TeamScratchStreams.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestHIP_Category.hpp> #include <Kokkos_Core.hpp> @@ -50,17 +22,14 @@ namespace Test { namespace Impl { struct HIPStreamScratchTestFunctor { - using team_t = Kokkos::TeamPolicy<Kokkos::Experimental::HIP>::member_type; - using scratch_t = - Kokkos::View<int64_t*, Kokkos::Experimental::HIP::scratch_memory_space>; + using team_t = Kokkos::TeamPolicy<Kokkos::HIP>::member_type; + using scratch_t = Kokkos::View<int64_t*, Kokkos::HIP::scratch_memory_space>; - Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace, - Kokkos::MemoryTraits<Kokkos::Atomic>> + Kokkos::View<int64_t, Kokkos::HIPSpace, Kokkos::MemoryTraits<Kokkos::Atomic>> counter; int N, M; - HIPStreamScratchTestFunctor( - Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace> counter_, int N_, - int M_) + HIPStreamScratchTestFunctor(Kokkos::View<int64_t, Kokkos::HIPSpace> counter_, + int N_, int M_) : counter(counter_), N(N_), M(M_) {} KOKKOS_FUNCTION @@ -81,13 +50,11 @@ struct HIPStreamScratchTestFunctor { }; void hip_stream_scratch_test_one( - int N, int T, int M_base, - Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace> counter, - Kokkos::Experimental::HIP hip, int tid) { + int N, int T, int M_base, Kokkos::View<int64_t, Kokkos::HIPSpace> counter, + Kokkos::HIP hip, int tid) { int M = M_base + tid * 5; - Kokkos::TeamPolicy<Kokkos::Experimental::HIP> p(hip, T, 64); - using scratch_t = - Kokkos::View<int64_t*, Kokkos::Experimental::HIP::scratch_memory_space>; + Kokkos::TeamPolicy<Kokkos::HIP> p(hip, T, 64); + using scratch_t = Kokkos::View<int64_t*, Kokkos::HIP::scratch_memory_space>; int bytes = scratch_t::shmem_size(M); @@ -97,15 +64,14 @@ void hip_stream_scratch_test_one( } } -void hip_stream_scratch_test( - int N, int T, int M_base, - Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace> counter) { +void hip_stream_scratch_test(int N, int T, int M_base, + Kokkos::View<int64_t, Kokkos::HIPSpace> counter) { int K = 4; hipStream_t stream[4]; - Kokkos::Experimental::HIP hip[4]; + Kokkos::HIP hip[4]; for (int i = 0; i < K; i++) { KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamCreate(&stream[i])); - hip[i] = Kokkos::Experimental::HIP(stream[i]); + hip[i] = Kokkos::HIP(stream[i]); } // Test that growing scratch size in subsequent calls doesn't crash things #if defined(KOKKOS_ENABLE_OPENMP) @@ -130,7 +96,7 @@ void hip_stream_scratch_test( Kokkos::fence(); for (int i = 0; i < K; i++) { - hip[i] = Kokkos::Experimental::HIP(); + hip[i] = Kokkos::HIP(); KOKKOS_IMPL_HIP_SAFE_CALL(hipStreamDestroy(stream[i])); } } @@ -141,7 +107,7 @@ TEST(hip, team_scratch_1_streams) { int T = 10; int M_base = 150; - Kokkos::View<int64_t, Kokkos::Experimental::HIPSpace> counter("C"); + Kokkos::View<int64_t, Kokkos::HIPSpace> counter("C"); Impl::hip_stream_scratch_test(N, T, M_base, counter); diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstances.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstances.cpp index 421e3c50bf675354e2081ee889c4e05ecfef524b..8f349cf8045bb38b8fce7562e693b63ecbca077b 100644 --- a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstances.cpp +++ b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstances.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHPX_Category.hpp> diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesDelayedExecution.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesDelayedExecution.cpp index 872bf2fd5031d51930a066268c6dff3483b7f986..177d87c1c86e468360589b23da85d32c648576fd 100644 --- a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesDelayedExecution.cpp +++ b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesDelayedExecution.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHPX_Category.hpp> diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesInstanceIds.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesInstanceIds.cpp index 899cd09d4f4d766101105e19765fc264245ea153..6441666e64f35df133a9dccfa4aec1638c285d42 100644 --- a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesInstanceIds.cpp +++ b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesInstanceIds.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHPX_Category.hpp> diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesRefCounting.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesRefCounting.cpp index a69bea572f7bccc5108087f11fa6dbfca5afd4c9..2e9ca081bc03b8c581ea71a4ea3e439e0ce3293a 100644 --- a/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesRefCounting.cpp +++ b/packages/kokkos/core/unit_test/hpx/TestHPX_IndependentInstancesRefCounting.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHPX_Category.hpp> diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_InterOp.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_InterOp.cpp index e89f7acacc3a5b0c4dff58137dff4c067eeae02e..c52a1328dd8f4ed39b9e653f16edceeea608b635 100644 --- a/packages/kokkos/core/unit_test/hpx/TestHPX_InterOp.cpp +++ b/packages/kokkos/core/unit_test/hpx/TestHPX_InterOp.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestHPX_Category.hpp> diff --git a/packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp b/packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp index 57d0ac803bcd86b5499dd6c29348d88138088c15..e8e5b935c492cf99beea48693bfe819ad34493ed 100644 --- a/packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp +++ b/packages/kokkos/core/unit_test/hpx/TestHPX_Task.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestHPX_Category.hpp> #include <TestTaskScheduler.hpp> diff --git a/packages/kokkos/core/unit_test/incremental/README.md b/packages/kokkos/core/unit_test/incremental/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a67247c7d87510891cff579fd92c57a694221037 --- /dev/null +++ b/packages/kokkos/core/unit_test/incremental/README.md @@ -0,0 +1,3 @@ +# Incremental testing for test-driven development + +This sequence of tests aims to provide a clear implementation path for developing new backends. The idea being, if one can get these tests to pass in sequence, failures in the broader test suite of the parent directory should become more informative about more obscure errors. \ No newline at end of file diff --git a/packages/kokkos/core/unit_test/incremental/Test01_execspace.hpp b/packages/kokkos/core/unit_test/incremental/Test01_execspace.hpp index c14a90d749709d05ab7c87b6de032cc30f55cf5f..25c7138ed3c14ae594e56ec40952f8aee5be018c 100644 --- a/packages/kokkos/core/unit_test/incremental/Test01_execspace.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test01_execspace.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// @Kokkos_Feature_Level_Required:1 diff --git a/packages/kokkos/core/unit_test/incremental/Test02_atomic_host.hpp b/packages/kokkos/core/unit_test/incremental/Test02_atomic_host.hpp index d40cb4dbe7f77627429f9880ce4981b38f414c9d..3ea674d48365724c1feca7c335094dd5fc609b02 100644 --- a/packages/kokkos/core/unit_test/incremental/Test02_atomic_host.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test02_atomic_host.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// @Kokkos_Feature_Level_Required:2 // Unit test for atomic exchange, atomic add and atomic sub. diff --git a/packages/kokkos/core/unit_test/incremental/Test03a_MemorySpace_malloc.hpp b/packages/kokkos/core/unit_test/incremental/Test03a_MemorySpace_malloc.hpp index da808be21918892b423854db0e162706d9b0672b..9ee671214cbb691c9ecf675a775cc6754efc01a9 100644 --- a/packages/kokkos/core/unit_test/incremental/Test03a_MemorySpace_malloc.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test03a_MemorySpace_malloc.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/incremental/Test03b_MemorySpace_free.hpp b/packages/kokkos/core/unit_test/incremental/Test03b_MemorySpace_free.hpp index f7ee76ec9de45e23b6d7fbd2849ef51ac21443da..f552892b00d37c524eefbfcfc2dac73ab762cf4a 100644 --- a/packages/kokkos/core/unit_test/incremental/Test03b_MemorySpace_free.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test03b_MemorySpace_free.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// @Kokkos_Feature_Level_Required:3 // Unit test for Kokkos free. diff --git a/packages/kokkos/core/unit_test/incremental/Test04_ParallelFor_RangePolicy.hpp b/packages/kokkos/core/unit_test/incremental/Test04_ParallelFor_RangePolicy.hpp index ee9cdc3174d6b2f804d937b41f4956d8421b7975..75cf601e782b031481ee42a51a631065fdf2b33f 100644 --- a/packages/kokkos/core/unit_test/incremental/Test04_ParallelFor_RangePolicy.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test04_ParallelFor_RangePolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/incremental/Test05_ParallelReduce_RangePolicy.hpp b/packages/kokkos/core/unit_test/incremental/Test05_ParallelReduce_RangePolicy.hpp index 0cc9d6c5d8961730d59365508eb9716bb8a16ba8..4235c73c8e69bd1f7b454a6fd75925b920a2c54f 100644 --- a/packages/kokkos/core/unit_test/incremental/Test05_ParallelReduce_RangePolicy.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test05_ParallelReduce_RangePolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/incremental/Test06_ParallelFor_MDRangePolicy.hpp b/packages/kokkos/core/unit_test/incremental/Test06_ParallelFor_MDRangePolicy.hpp index 2fed01dd66a2d42f1ade6f86b0e98dc34d43f682..4616086648707b21b49b91df5bcc61226d65ae83 100644 --- a/packages/kokkos/core/unit_test/incremental/Test06_ParallelFor_MDRangePolicy.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test06_ParallelFor_MDRangePolicy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/incremental/Test08_deep_copy.hpp b/packages/kokkos/core/unit_test/incremental/Test08_deep_copy.hpp index 6e8fc07b8de50e61e1139ad0b7ba6e2752e81229..cea182aadfa38545b99ae7f6b06c100867702fe5 100644 --- a/packages/kokkos/core/unit_test/incremental/Test08_deep_copy.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test08_deep_copy.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/incremental/Test10_HierarchicalBasics.hpp b/packages/kokkos/core/unit_test/incremental/Test10_HierarchicalBasics.hpp index 720197c3545001e3fe2bc56c9b51692f86cac6e4..1f3370b6ebd422609ae35841e404e13a693562e5 100644 --- a/packages/kokkos/core/unit_test/incremental/Test10_HierarchicalBasics.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test10_HierarchicalBasics.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:10 // Unit test for hierarchical parallelism @@ -58,7 +30,8 @@ struct HierarchicalBasics { using team_t = typename policy_t::member_type; void run(const int nP, int nT) { - if (nT > ExecSpace::concurrency()) nT = ExecSpace::concurrency(); + int const concurrency = ExecSpace().concurrency(); + if (nT > concurrency) nT = concurrency; policy_t pol(nP, nT); diff --git a/packages/kokkos/core/unit_test/incremental/Test11a_ParallelFor_TeamThreadRange.hpp b/packages/kokkos/core/unit_test/incremental/Test11a_ParallelFor_TeamThreadRange.hpp index fef4d9c6906454568d963f7f9053fc12c39160e8..ec15e245e7ad596db7433e87e06517a68eb770a3 100644 --- a/packages/kokkos/core/unit_test/incremental/Test11a_ParallelFor_TeamThreadRange.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test11a_ParallelFor_TeamThreadRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:11 // Unit test for hierarchical parallelism diff --git a/packages/kokkos/core/unit_test/incremental/Test11b_ParallelFor_TeamVectorRange.hpp b/packages/kokkos/core/unit_test/incremental/Test11b_ParallelFor_TeamVectorRange.hpp index a81b474a64f9db4a2dee93ab0a83dc7c067de766..07b3dd2da1b32ebd4b0e3090afc6b87d209d8cd0 100644 --- a/packages/kokkos/core/unit_test/incremental/Test11b_ParallelFor_TeamVectorRange.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test11b_ParallelFor_TeamVectorRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:11 // Unit test for hierarchical parallelism diff --git a/packages/kokkos/core/unit_test/incremental/Test11c_ParallelFor_ThreadVectorRange.hpp b/packages/kokkos/core/unit_test/incremental/Test11c_ParallelFor_ThreadVectorRange.hpp index 814ab5fda660fd53c3bbe4e71d252c7e63ec9c73..caa7087df41b51c3f6c18c218965f2862425caca 100644 --- a/packages/kokkos/core/unit_test/incremental/Test11c_ParallelFor_ThreadVectorRange.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test11c_ParallelFor_ThreadVectorRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:11 // Unit test for hierarchical parallelism diff --git a/packages/kokkos/core/unit_test/incremental/Test12a_ThreadScratch.hpp b/packages/kokkos/core/unit_test/incremental/Test12a_ThreadScratch.hpp index ab1cd90d4bfa2e5f5800b8dd13f23a999d2a8fa0..a4cd4fc56f509c3a08e7042f2142613dd0ea251e 100644 --- a/packages/kokkos/core/unit_test/incremental/Test12a_ThreadScratch.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test12a_ThreadScratch.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:12 // Unit test for hierarchical parallelism diff --git a/packages/kokkos/core/unit_test/incremental/Test12b_TeamScratch.hpp b/packages/kokkos/core/unit_test/incremental/Test12b_TeamScratch.hpp index d81822d0da9cfd67b25c8394886509407ecbfeb0..9b27e35dfe9b51dfe5e025d50c88299788de20d6 100644 --- a/packages/kokkos/core/unit_test/incremental/Test12b_TeamScratch.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test12b_TeamScratch.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:12 // Unit test for hierarchical parallelism diff --git a/packages/kokkos/core/unit_test/incremental/Test13a_ParallelRed_TeamThreadRange.hpp b/packages/kokkos/core/unit_test/incremental/Test13a_ParallelRed_TeamThreadRange.hpp index e32b0ed0fc92684072cf004b64240093e1b981fd..876393bfb341d1d7f127d8230e51e77180fafb42 100644 --- a/packages/kokkos/core/unit_test/incremental/Test13a_ParallelRed_TeamThreadRange.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test13a_ParallelRed_TeamThreadRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:13 // Unit test for hierarchical parallelism diff --git a/packages/kokkos/core/unit_test/incremental/Test13b_ParallelRed_TeamVectorRange.hpp b/packages/kokkos/core/unit_test/incremental/Test13b_ParallelRed_TeamVectorRange.hpp index 0d37703e2b73d5ca22e73f2bfbd2f553e1fe0225..748e01a38cce32babef8bd814717ff1ef84915e5 100644 --- a/packages/kokkos/core/unit_test/incremental/Test13b_ParallelRed_TeamVectorRange.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test13b_ParallelRed_TeamVectorRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:13 // Unit test for hierarchical parallelism diff --git a/packages/kokkos/core/unit_test/incremental/Test13c_ParallelRed_ThreadVectorRange.hpp b/packages/kokkos/core/unit_test/incremental/Test13c_ParallelRed_ThreadVectorRange.hpp index 26f9d000914393a8af86d9ba1bc4bb5658a7244e..32a37013cf62805ade0ee88afdc244bf47d84d15 100644 --- a/packages/kokkos/core/unit_test/incremental/Test13c_ParallelRed_ThreadVectorRange.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test13c_ParallelRed_ThreadVectorRange.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // @Kokkos_Feature_Level_Required:13 // Unit test for hierarchical parallelism diff --git a/packages/kokkos/core/unit_test/incremental/Test14_MDRangeReduce.hpp b/packages/kokkos/core/unit_test/incremental/Test14_MDRangeReduce.hpp index 649cf6c3830143ad0e7c530e84d57c3484a5e9f9..a1f307c0c82de68b5debf7bd0c2ae4a51c342fd2 100644 --- a/packages/kokkos/core/unit_test/incremental/Test14_MDRangeReduce.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test14_MDRangeReduce.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /// @Kokkos_Feature_Level_Required:14 // Incremental test for MDRange reduction . diff --git a/packages/kokkos/core/unit_test/incremental/Test16_ParallelScan.hpp b/packages/kokkos/core/unit_test/incremental/Test16_ParallelScan.hpp index e1f5e3767cbc2d45f52ab41dd7220ba68eb4090b..78f791914a93c10bcb62e3c911385224b969fba8 100644 --- a/packages/kokkos/core/unit_test/incremental/Test16_ParallelScan.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test16_ParallelScan.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <gtest/gtest.h> diff --git a/packages/kokkos/core/unit_test/incremental/Test17_CompleteAtomic.hpp b/packages/kokkos/core/unit_test/incremental/Test17_CompleteAtomic.hpp index 6ba5adc618717647b655c6f9654e291cbbf9cb56..e2953aa91931402a5e70782aa4c6e8634a883349 100644 --- a/packages/kokkos/core/unit_test/incremental/Test17_CompleteAtomic.hpp +++ b/packages/kokkos/core/unit_test/incremental/Test17_CompleteAtomic.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <array> diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP.hpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP.hpp index 1039f13fec00e5c39149511ebfcd8c28edc24aa0..3a974d517cea0fed3e2e28d6fe80fe9842c6a999 100644 --- a/packages/kokkos/core/unit_test/openmp/TestOpenMP.hpp +++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_OPENMP_HPP #define KOKKOS_TEST_OPENMP_HPP diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP_Graph.cpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP_Graph.cpp index e5ba9e8738275b4163a787518678c6615f91f0f7..22c8ab1bf8fdc8ea888d95ac174776da39a70017 100644 --- a/packages/kokkos/core/unit_test/openmp/TestOpenMP_Graph.cpp +++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP_Graph.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestOpenMP_Category.hpp> #include <TestGraph.hpp> diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP_InterOp.cpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP_InterOp.cpp index 5f8fd2236680dc79edbd5dd62e031a9ab54c5ffb..9cd7bf8fca8abfe1f2ea9c8b158ed868374c1b37 100644 --- a/packages/kokkos/core/unit_test/openmp/TestOpenMP_InterOp.cpp +++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP_InterOp.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestOpenMP_Category.hpp> @@ -71,7 +43,7 @@ TEST(openmp, raw_openmp_interop) { count++; } - concurrency = Kokkos::OpenMP::concurrency(); + concurrency = Kokkos::OpenMP().concurrency(); ASSERT_EQ(count, concurrency); Kokkos::finalize(); diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP_PartitionMaster.cpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP_PartitionMaster.cpp index 2978c98b50d4b0950364da8c1481e2450ef401ab..6983fabb2acb226b50e1baad6cdd71e70f19555a 100644 --- a/packages/kokkos/core/unit_test/openmp/TestOpenMP_PartitionMaster.cpp +++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP_PartitionMaster.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestOpenMP_Category.hpp> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp b/packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp index 2ddc6a58419040f912ebbd0f9d4f60ae113b9368..e8974d477fac86004e0adbe64fef6a9a4556da14 100644 --- a/packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp +++ b/packages/kokkos/core/unit_test/openmp/TestOpenMP_Task.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestOpenMP_Category.hpp> #include <TestTaskScheduler.hpp> diff --git a/packages/kokkos/core/unit_test/openmptarget/TestOpenMPTarget.hpp b/packages/kokkos/core/unit_test/openmptarget/TestOpenMPTarget.hpp index 3d8c722be4dbc46f7cc6039500b977fe6b68809b..6ae45620f256043787c148fd647664fc684f991e 100644 --- a/packages/kokkos/core/unit_test/openmptarget/TestOpenMPTarget.hpp +++ b/packages/kokkos/core/unit_test/openmptarget/TestOpenMPTarget.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_TEST_OPENMPTARGET_HPP #define KOKKOS_TEST_OPENMPTARGET_HPP diff --git a/packages/kokkos/core/unit_test/serial/TestSerial_Graph.cpp b/packages/kokkos/core/unit_test/serial/TestSerial_Graph.cpp index b2dba1c265cab5cfa4b982bf43f920ec666fcaa5..bff64d83e276e874e6b9d7e33031fc1ce46f5619 100644 --- a/packages/kokkos/core/unit_test/serial/TestSerial_Graph.cpp +++ b/packages/kokkos/core/unit_test/serial/TestSerial_Graph.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestSerial_Category.hpp> #include <TestGraph.hpp> diff --git a/packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp b/packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp index c08efbf447b6fe055f7f01e619b2a0b02de0cdf8..60e9d13ce6550960391c11c91343dacfe58119d1 100644 --- a/packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp +++ b/packages/kokkos/core/unit_test/serial/TestSerial_Task.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestSerial_Category.hpp> #include <TestTaskScheduler.hpp> diff --git a/packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp b/packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp index c1f7398c166bcf738111b1674a83a919293faf6d..8bee512213cd50189f7732a169a4fe5f754a8c8e 100644 --- a/packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp +++ b/packages/kokkos/core/unit_test/standalone/UnitTestMainInit.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <cstdlib> @@ -68,6 +40,9 @@ #ifdef KOKKOS_ENABLE_OPENMPTARGET #include <TestOpenMPTarget_Category.hpp> #endif +#ifdef KOKKOS_ENABLE_OPENACC +#include <TestOpenACC_Category.hpp> +#endif #ifndef TEST_EXECSPACE #ifdef KOKKOS_ENABLE_SERIAL #include <TestSerial_Category.hpp> diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp index e45d990745e1ba3cc6c8d7e5e66c434745619872..25c5c9a50ceed9031b600a992737d5e47b22aed8 100644 --- a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp +++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestSYCL_Category.hpp> @@ -52,8 +24,8 @@ namespace Test { // Test whether allocations survive Kokkos initialize/finalize if done via Raw // SYCL. TEST(sycl, raw_sycl_interop) { + // Make sure all queues use the same context Kokkos::initialize(); - Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp index 114d2a4aa2bd13c1932baf3e812c0373029a5821..336a5d59c32fc0d3043102a50e2a51569633d1d2 100644 --- a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp +++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Init_Context.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestSYCL_Category.hpp> @@ -51,6 +23,7 @@ namespace Test { // Test whether external allocations can be accessed by the default queue. TEST(sycl, raw_sycl_interop_context_1) { + // Make sure all queues use the same context Kokkos::Experimental::SYCL default_space; sycl::context default_context = default_space.sycl_queue().get_context(); diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp index 8ffada1dab1d255c3fec8486fe51cef06fb935a5..13810d861ca0b4cb45844e9e602a53de243148bc 100644 --- a/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp +++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_InterOp_Streams.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestSYCL_Category.hpp> #include <Test_InterOp_Streams.hpp> @@ -48,9 +20,13 @@ namespace Test { // Test Interoperability with SYCL Streams TEST(sycl, raw_sycl_queues) { - sycl::default_selector device_selector; - sycl::queue queue(device_selector); + // Make sure all queues use the same context Kokkos::initialize(); + Kokkos::Experimental::SYCL default_space; + sycl::context default_context = default_space.sycl_queue().get_context(); + + sycl::default_selector device_selector; + sycl::queue queue(default_context, device_selector); int* p = sycl::malloc_device<int>(100, queue); using MemorySpace = typename TEST_EXECSPACE::memory_space; diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_Spaces.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_Spaces.cpp index 91fdaac6e097fb9b127816301ca2e5c514a4f374..914f8432488db3f82ffed012237b0473263de96b 100644 --- a/packages/kokkos/core/unit_test/sycl/TestSYCL_Spaces.cpp +++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_Spaces.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <TestSYCL_Category.hpp> diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_Task.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_Task.cpp index 95a7b68088c1238672b2257d285d7329d52cbec7..3c599b95a6f3362c1d8c33de69315ef8cfd3df44 100644 --- a/packages/kokkos/core/unit_test/sycl/TestSYCL_Task.cpp +++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_Task.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestSYCL_Category.hpp> #include <TestTaskScheduler.hpp> diff --git a/packages/kokkos/core/unit_test/sycl/TestSYCL_TeamScratchStreams.cpp b/packages/kokkos/core/unit_test/sycl/TestSYCL_TeamScratchStreams.cpp index 420522caf5036a087b69c928b63ec4100aca0325..11207a5480f0345a24911cf4d8f967e715889508 100644 --- a/packages/kokkos/core/unit_test/sycl/TestSYCL_TeamScratchStreams.cpp +++ b/packages/kokkos/core/unit_test/sycl/TestSYCL_TeamScratchStreams.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestSYCL_Category.hpp> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/core/unit_test/tools/TestAllCalls.cpp b/packages/kokkos/core/unit_test/tools/TestAllCalls.cpp index 7ee8d68e30dd1de252866ff83c4aed8e07bd2ab5..4dbff82834618555ebb51670f3acff4b3381ef81 100644 --- a/packages/kokkos/core/unit_test/tools/TestAllCalls.cpp +++ b/packages/kokkos/core/unit_test/tools/TestAllCalls.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // This file calls most of the basic Kokkos primitives. When combined with a // testing library this tests that our shared-library loading based profiling diff --git a/packages/kokkos/core/unit_test/tools/TestBuiltinTuners.cpp b/packages/kokkos/core/unit_test/tools/TestBuiltinTuners.cpp index fbcc6541db745b1b29f29760be2ecec7006f7100..bf6aeeda77e7862af6afaa8cb29851d265dd306e 100644 --- a/packages/kokkos/core/unit_test/tools/TestBuiltinTuners.cpp +++ b/packages/kokkos/core/unit_test/tools/TestBuiltinTuners.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <impl/Kokkos_Tools_Generic.hpp> using ExecSpace = Kokkos::DefaultHostExecutionSpace; diff --git a/packages/kokkos/core/unit_test/tools/TestCategoricalTuner.cpp b/packages/kokkos/core/unit_test/tools/TestCategoricalTuner.cpp index 2177556d392f002ad17499ad08fe93268a3c7937..ecc1277de77725df6f672c55b8ec176bcc4389c7 100644 --- a/packages/kokkos/core/unit_test/tools/TestCategoricalTuner.cpp +++ b/packages/kokkos/core/unit_test/tools/TestCategoricalTuner.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // This file tests the categorical tuner diff --git a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.cpp b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.cpp index 2d73aa2e9c3a5bd3599c6c21cfc49dcd4010c959..4d88a5dba3f77b8770a7e5913c80e71648deea50 100644 --- a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.cpp +++ b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp index bb1d3156f53f5b0470303a9748a02b2e532a736a..408160411327cc67ef9c1b535cff1f47fe38956b 100644 --- a/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp +++ b/packages/kokkos/core/unit_test/tools/TestEventCorrectness.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include <gtest/gtest.h> #include "Kokkos_Core.hpp" @@ -55,9 +27,9 @@ class Serial; class OpenMP; class Cuda; class Threads; +class HIP; namespace Experimental { class SYCL; -class HIP; class OpenMPTarget; class HPX; } // namespace Experimental @@ -307,9 +279,15 @@ TEST(kokkosp, test_streams) { } #endif -/** FIXME: OpenMPTarget currently has unexpected fences */ -#ifndef KOKKOS_ENABLE_OPENMPTARGET TEST(kokkosp, async_deep_copy) { +// FIXME_OPENMPTARGET +#ifdef KOKKOS_ENABLE_OPENMPTARGET + if (std::is_same<Kokkos::DefaultExecutionSpace, + Kokkos::Experimental::OpenMPTarget>::value) + GTEST_SKIP() + << "skipping since the OpenMPTarget backend has unexpected fences"; +#endif + using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableFences()); Kokkos::View<float*> left("left", 5), right("right", 5); @@ -333,7 +311,6 @@ TEST(kokkosp, async_deep_copy) { }); ASSERT_TRUE(success); } -#endif TEST(kokkosp, parallel_for) { using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableKernels()); @@ -354,6 +331,8 @@ TEST(kokkosp, parallel_for) { ASSERT_TRUE(success); } +#ifndef KOKKOS_ENABLE_OPENACC +// FIXME_OPENACC: not supported reducer type TEST(kokkosp, parallel_reduce) { using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableKernels()); @@ -377,8 +356,19 @@ TEST(kokkosp, parallel_reduce) { }); ASSERT_TRUE(success); } +#endif +#ifndef KOKKOS_ENABLE_OPENACC +// FIXME_OPENACC: parallel_scan not implemented yet TEST(kokkosp, parallel_scan) { + // FIXME_OPENMPTARGET +#ifdef KOKKOS_ENABLE_OPENMPTARGET + if (std::is_same<Kokkos::DefaultExecutionSpace, + Kokkos::Experimental::OpenMPTarget>::value) + GTEST_SKIP() + << "skipping since the OpenMPTarget backend reports unexpected events"; +#endif + using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableKernels()); auto success = validate_event_set( @@ -395,13 +385,78 @@ TEST(kokkosp, parallel_scan) { } return MatchDiagnostic{true}; }); -// Currently, this test is known to fail with OpenMPTarget -#ifndef KOKKOS_ENABLE_OPENMPTARGET ASSERT_TRUE(success); -#else - (void)success; +} + +TEST(kokkosp, parallel_scan_no_fence) { + // FIXME_THREADS +#ifdef KOKKOS_ENABLE_THREADS + if (std::is_same<Kokkos::DefaultExecutionSpace, Kokkos::Threads>::value) + GTEST_SKIP() << "skipping since the Thread backend always fences"; +#endif + // FIXME_OPENMPTARGET +#ifdef KOKKOS_ENABLE_OPENMPTARGET + if (std::is_same<Kokkos::DefaultExecutionSpace, + Kokkos::Experimental::OpenMPTarget>::value) + GTEST_SKIP() + << "skipping since the OpenMPTarget backend has unexpected fences"; #endif + + using namespace Kokkos::Test::Tools; + listen_tool_events(Config::DisableAll(), Config::EnableKernels(), + Config::EnableFences()); + auto success = validate_absence( + [=]() { + TestScanFunctor tf; + Kokkos::parallel_scan("dogs", Kokkos::RangePolicy<>(0, 1), tf); + }, + [=](BeginFenceEvent begin_event) { + if (begin_event.name.find("Debug Only Check for Execution Error") != + std::string::npos || + begin_event.name.find("Kokkos Profile Tool Fence") != + std::string::npos) + return MatchDiagnostic{false}; + else + return MatchDiagnostic{true}; + }); + ASSERT_TRUE(success); +} + +TEST(kokkosp, parallel_scan_no_fence_view) { + // FIXME_THREADS +#ifdef KOKKOS_ENABLE_THREADS + if (std::is_same<Kokkos::DefaultExecutionSpace, Kokkos::Threads>::value) + GTEST_SKIP() << "skipping since the Thread backend always fences"; +#endif + // FIXME_OPENMPTARGET +#ifdef KOKKOS_ENABLE_OPENMPTARGET + if (std::is_same<Kokkos::DefaultExecutionSpace, + Kokkos::Experimental::OpenMPTarget>::value) + GTEST_SKIP() + << "skipping since the OpenMPTarget backend has unexpected fences"; +#endif + + using namespace Kokkos::Test::Tools; + listen_tool_events(Config::DisableAll(), Config::EnableKernels(), + Config::EnableFences()); + Kokkos::View<typename TestScanFunctor::value_type> v("scan_result"); + auto success = validate_absence( + [=]() { + TestScanFunctor tf; + Kokkos::parallel_scan("dogs", Kokkos::RangePolicy<>(0, 1), tf, v); + }, + [=](BeginFenceEvent begin_event) { + if (begin_event.name.find("Debug Only Check for Execution Error") != + std::string::npos || + begin_event.name.find("Kokkos Profile Tool Fence") != + std::string::npos) + return MatchDiagnostic{false}; + else + return MatchDiagnostic{true}; + }); + ASSERT_TRUE(success); } +#endif TEST(kokkosp, regions) { using namespace Kokkos::Test::Tools; @@ -439,6 +494,14 @@ TEST(kokkosp, fences) { } TEST(kokkosp, raw_allocation) { + // FIXME_OPENMPTARGET +#ifdef KOKKOS_ENABLE_OPENMPTARGET + if (std::is_same<Kokkos::DefaultExecutionSpace, + Kokkos::Experimental::OpenMPTarget>::value) + GTEST_SKIP() + << "skipping since the OpenMPTarget backend reports unexpected events"; +#endif + using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableAllocs()); auto success = validate_event_set( @@ -466,15 +529,18 @@ TEST(kokkosp, raw_allocation) { } return MatchDiagnostic{true}; }); -// Currently, this test is known to fail with OpenMPTarget -#ifndef KOKKOS_ENABLE_OPENMPTARGET ASSERT_TRUE(success); -#else - (void)success; -#endif } TEST(kokkosp, view) { +// FIXME_OPENMPTARGET +#ifdef KOKKOS_ENABLE_OPENMPTARGET + if (std::is_same<Kokkos::DefaultExecutionSpace, + Kokkos::Experimental::OpenMPTarget>::value) + GTEST_SKIP() + << "skipping since the OpenMPTarget backend reports unexpected events"; +#endif + using namespace Kokkos::Test::Tools; listen_tool_events(Config::DisableAll(), Config::EnableAllocs()); auto success = validate_event_set( @@ -497,12 +563,7 @@ TEST(kokkosp, view) { } return MatchDiagnostic{true}; }); -// Currently, this test is known to fail with OpenMPTarget -#ifndef KOKKOS_ENABLE_OPENMPTARGET ASSERT_TRUE(success); -#else - (void)success; -#endif } TEST(kokkosp, sections) { diff --git a/packages/kokkos/core/unit_test/tools/TestIndependence.cpp b/packages/kokkos/core/unit_test/tools/TestIndependence.cpp index 2579c4ef3afc8b57a41a2e075742754adebbd629..b8b8db1d81555e5db5bf52f8f51f75b3313a03e5 100644 --- a/packages/kokkos/core/unit_test/tools/TestIndependence.cpp +++ b/packages/kokkos/core/unit_test/tools/TestIndependence.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <impl/Kokkos_Tools.hpp> int main(int argc, char* argv[]) { diff --git a/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.cpp b/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.cpp index 4008fd3d5b54ac2f219b6555210da2aebf2722a1..7cb2b958331c4b90b0d273b25b46f0d9753306ff 100644 --- a/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.cpp +++ b/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include "Kokkos_Core.hpp" diff --git a/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.hpp b/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.hpp index 2fd43558f674a6760c8125aeeec4381c3da503cd..1b20bd5933885c936efe2e09c75875c0b53d2e11 100644 --- a/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.hpp +++ b/packages/kokkos/core/unit_test/tools/TestLogicalSpaces.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include <gtest/gtest.h> #include "Kokkos_Core.hpp" @@ -131,7 +103,7 @@ void test_malloc_free() { auto* temp = Kokkos::kokkos_malloc<fake_memory_space>("does_malloc_work", 1000); expect_deallocation_event("does_malloc_work", "TestSpace", "Error in free"); - Kokkos::kokkos_free(temp); + Kokkos::kokkos_free<fake_memory_space>(temp); Kokkos::Tools::Experimental::pause_tools(); } void test_chained_spaces() { @@ -167,7 +139,10 @@ struct AccessCheckKernel { template <typename Space> void test_allowed_access() { constexpr const int data_size = 1000; - Kokkos::View<double*, Space> test_view("test_view", data_size); + // We use an unmananged View here since we want to detect a memory access + // violation in the parallel_for and not in the initialization of the View. + std::vector<double> test_data(data_size); + Kokkos::View<double*, Space> test_view(test_data.data(), data_size); AccessCheckKernel<Space> functor{test_view}; Kokkos::parallel_for( "access_allowed", diff --git a/packages/kokkos/core/unit_test/tools/TestProfilingSection.cpp b/packages/kokkos/core/unit_test/tools/TestProfilingSection.cpp index b73307832b47d491de503c14467e9bf746f5cda0..318766ac455fe9db899e7b9f984eac984a4ea0e5 100644 --- a/packages/kokkos/core/unit_test/tools/TestProfilingSection.cpp +++ b/packages/kokkos/core/unit_test/tools/TestProfilingSection.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Profiling_ProfileSection.hpp> diff --git a/packages/kokkos/core/unit_test/tools/TestTuning.cpp b/packages/kokkos/core/unit_test/tools/TestTuning.cpp index 6bc787023efa95a7208b03632279dc0b8beeeb8b..37dc931aa10b22995b8d14f97fc62343690066b9 100644 --- a/packages/kokkos/core/unit_test/tools/TestTuning.cpp +++ b/packages/kokkos/core/unit_test/tools/TestTuning.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // This file tests the primitives of the Tuning system diff --git a/packages/kokkos/core/unit_test/tools/TestWithoutInitializing.cpp b/packages/kokkos/core/unit_test/tools/TestWithoutInitializing.cpp index 8d81098941eaeda73a2f9ac0f87bb412d927b10e..590937f9a5bc6c75123c1c4dcd087e5dddadc341 100644 --- a/packages/kokkos/core/unit_test/tools/TestWithoutInitializing.cpp +++ b/packages/kokkos/core/unit_test/tools/TestWithoutInitializing.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> @@ -58,13 +30,13 @@ TEST(kokkosp, create_mirror_no_init) { [&]() { auto mirror_device = Kokkos::create_mirror(Kokkos::WithoutInitializing, device_view); - auto mirror_host = - Kokkos::create_mirror(Kokkos::WithoutInitializing, - Kokkos::DefaultExecutionSpace{}, host_view); + auto mirror_host = Kokkos::create_mirror( + Kokkos::WithoutInitializing, Kokkos::DefaultHostExecutionSpace{}, + host_view); auto mirror_device_view = Kokkos::create_mirror_view( Kokkos::WithoutInitializing, device_view); auto mirror_host_view = Kokkos::create_mirror_view( - Kokkos::WithoutInitializing, Kokkos::DefaultExecutionSpace{}, + Kokkos::WithoutInitializing, Kokkos::DefaultHostExecutionSpace{}, host_view); }, [&](BeginParallelForEvent) { @@ -91,7 +63,7 @@ TEST(kokkosp, create_mirror_no_init_view_ctor) { device_view); auto mirror_host = Kokkos::create_mirror( Kokkos::view_alloc(Kokkos::HostSpace{}, Kokkos::WithoutInitializing, - Kokkos::DefaultExecutionSpace{}), + Kokkos::DefaultHostExecutionSpace{}), host_view); auto mirror_device_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::HostSpace{}, @@ -99,7 +71,7 @@ TEST(kokkosp, create_mirror_no_init_view_ctor) { device_view); auto mirror_host_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::HostSpace{}, Kokkos::WithoutInitializing, - Kokkos::DefaultExecutionSpace{}), + Kokkos::DefaultHostExecutionSpace{}), host_view); mirror_host_view = Kokkos::create_mirror_view( Kokkos::view_alloc(Kokkos::WithoutInitializing), host_view); diff --git a/packages/kokkos/core/unit_test/tools/include/ToolTestingUtilities.hpp b/packages/kokkos/core/unit_test/tools/include/ToolTestingUtilities.hpp index 10dbea579964a14d7ad0f3acf1b23a8b2eb5221e..24b9bc3739e13d8a3824f013a188aa069a7a55b2 100644 --- a/packages/kokkos/core/unit_test/tools/include/ToolTestingUtilities.hpp +++ b/packages/kokkos/core/unit_test/tools/include/ToolTestingUtilities.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ /** * Before digging in to the code, it's worth taking a moment to review this * design. Fundamentally, what we're looking to do is allow people to test that @@ -92,28 +64,6 @@ struct EventBase; // forward declaration using EventBasePtr = std::shared_ptr<EventBase>; using event_vector = std::vector<EventBasePtr>; -/** - * @brief Base case of a recursive reduction using templates - * Should be replaced with a fold in C++17 - */ - -inline bool are_valid() { return true; } - -/** - * @brief Recursive reduction to check whether any pointer in a set is null - * - * @tparam Head Type of the pointer to examine - * @tparam Tail Types of the rest of the pointers - * @param head The pointer to examine - * @param tail The rest of the pointers - * @return true if no pointer is null, false otherwise - * - */ -template <class Head, class... Tail> -bool are_valid(const Head& head, const Tail&... tail) { - return (head != nullptr) && (are_valid(tail...)); -} - /** * @brief In order to call some arbitrary set of lambdas representing matchers, * we need the ability to look at a lambda, and deduce its arguments. @@ -153,7 +103,7 @@ struct function_traits<R (*)(A...)> { constexpr static int num_arguments = sizeof...(A); template <class Call, class... Args> static auto invoke_as(const Call& call, Args&&... args) { - if (!are_valid(std::dynamic_pointer_cast<A>(std::forward<Args>(args))...)) { + if (!(std::dynamic_pointer_cast<A>(std::forward<Args>(args)) && ...)) { return MatchDiagnostic{false, {"Types didn't match on arguments"}}; } return call(*std::dynamic_pointer_cast<A>(std::forward<Args>(args))...); @@ -177,7 +127,7 @@ struct function_traits<R (C::*)(A...)> { constexpr static int num_arguments = sizeof...(A); template <class Call, class... Args> static auto invoke_as(const Call& call, Args&&... args) { - if (!are_valid(std::dynamic_pointer_cast<A>(std::forward<Args>(args))...)) { + if (!(std::dynamic_pointer_cast<A>(std::forward<Args>(args)) && ...)) { return MatchDiagnostic{false, {"Types didn't match on arguments"}}; } return call(*std::dynamic_pointer_cast<A>(std::forward<Args>(args))...); @@ -202,7 +152,7 @@ struct function_traits<R (C::*)(A...) const> // const constexpr static int num_arguments = sizeof...(A); template <class Call, class... Args> static auto invoke_as(const Call& call, Args&&... args) { - if (!are_valid(std::dynamic_pointer_cast<A>(std::forward<Args>(args))...)) { + if (!(std::dynamic_pointer_cast<A>(std::forward<Args>(args)) && ...)) { return MatchDiagnostic{false, {"Types didn't match on arguments"}}; } return call(*std::dynamic_pointer_cast<A>(std::forward<Args>(args))...); @@ -218,7 +168,7 @@ struct function_traits<R (C::*)(A...) const> // const * @tparam T The functor type */ template <typename T> -struct function_traits<T, Kokkos::Impl::void_t<decltype(&T::operator())> > +struct function_traits<T, std::void_t<decltype(&T::operator())> > : public function_traits<decltype(&T::operator())> {}; /** @@ -1195,8 +1145,7 @@ template <int priority, class Config, class... Configs> void listen_tool_events_impl(std::integral_constant<int, priority> prio, ToolValidatorConfiguration& in, Config conf, Configs... configs) { - invoke_config(in, conf, - std::integral_constant<bool, priority == conf.value>{}); + invoke_config(in, conf, std::bool_constant<priority == conf.value>{}); listen_tool_events_impl(prio, in, configs...); } template <class... Configs> diff --git a/packages/kokkos/core/unit_test/tools/printing-tool.cpp b/packages/kokkos/core/unit_test/tools/printing-tool.cpp index 76b7837d0365306201c83eb8e2ae92523d3a6670..65614e04b1cfd4dcb39f67c70a9e4095c9d35b34 100644 --- a/packages/kokkos/core/unit_test/tools/printing-tool.cpp +++ b/packages/kokkos/core/unit_test/tools/printing-tool.cpp @@ -1,3 +1,18 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER #include <inttypes.h> #include <iostream> @@ -78,7 +93,7 @@ extern "C" void kokkosp_end_parallel_reduce(const uint64_t kID) { std::cout << "kokkosp_end_parallel_reduce:" << kID << "::"; } -extern "C" void kokkosp_push_profile_region(char* regionName) { +extern "C" void kokkosp_push_profile_region(const char* regionName) { std::cout << "kokkosp_push_profile_region:" << regionName << "::"; } @@ -87,13 +102,13 @@ extern "C" void kokkosp_pop_profile_region() { } extern "C" void kokkosp_allocate_data(SpaceHandle handle, const char* name, - void* ptr, uint64_t size) { + const void* ptr, uint64_t size) { std::cout << "kokkosp_allocate_data:" << handle.name << ":" << name << ":" << ptr << ":" << size << "::"; } extern "C" void kokkosp_deallocate_data(SpaceHandle handle, const char* name, - void* ptr, uint64_t size) { + const void* ptr, uint64_t size) { std::cout << "kokkosp_deallocate_data:" << handle.name << ":" << name << ":" << ptr << ":" << size << "::"; } diff --git a/packages/kokkos/core/unit_test/view/TestExtentsDatatypeConversion.cpp b/packages/kokkos/core/unit_test/view/TestExtentsDatatypeConversion.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a48052ab8ae5ab7e837c9ef845221690dd089e1d --- /dev/null +++ b/packages/kokkos/core/unit_test/view/TestExtentsDatatypeConversion.cpp @@ -0,0 +1,89 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include <Kokkos_Core.hpp> +#include <type_traits> + +#ifdef KOKKOS_ENABLE_IMPL_MDSPAN + +namespace { + +// Helper to make static tests more succinct +template <typename DataType, typename Extent> +constexpr bool datatype_matches_extent = + std::is_same_v<typename Kokkos::Experimental::Impl::ExtentsFromDataType< + std::size_t, DataType>::type, + Extent>; + +template <typename DataType, typename BaseType, typename Extents> +constexpr bool extent_matches_datatype = + std::is_same_v<DataType, typename Kokkos::Experimental::Impl:: + DataTypeFromExtents<BaseType, Extents>::type>; + +// Conversion from DataType to extents +// 0-rank view +static_assert( + datatype_matches_extent<double, std::experimental::extents<std::size_t>>); + +// Only dynamic +static_assert(datatype_matches_extent< + double***, std::experimental::extents< + std::size_t, std::experimental::dynamic_extent, + std::experimental::dynamic_extent, + std::experimental::dynamic_extent>>); +// Only static +static_assert(datatype_matches_extent< + double[2][3][17], + std::experimental::extents<std::size_t, std::size_t{2}, + std::size_t{3}, std::size_t{17}>>); + +// Both dynamic and static +static_assert(datatype_matches_extent< + double* * [3][2][8], + std::experimental::extents< + std::size_t, std::experimental::dynamic_extent, + std::experimental::dynamic_extent, std::size_t{3}, + std::size_t{2}, std::size_t{8}>>); + +// Conversion from extents to DataType +// 0-rank extents +static_assert(extent_matches_datatype<double, double, + std::experimental::extents<std::size_t>>); + +// only dynamic +static_assert( + extent_matches_datatype<double****, double, + std::experimental::extents< + std::size_t, std::experimental::dynamic_extent, + std::experimental::dynamic_extent, + std::experimental::dynamic_extent, + std::experimental::dynamic_extent>>); + +// only static +static_assert( + extent_matches_datatype<double[7][5][3], double, + std::experimental::extents<std::size_t, 7, 5, 3>>); + +// both dynamic and static +static_assert( + extent_matches_datatype<double** * [20][45], double, + std::experimental::extents< + std::size_t, std::experimental::dynamic_extent, + std::experimental::dynamic_extent, + std::experimental::dynamic_extent, 20, 45>>); +} // namespace + +#endif // KOKKOS_ENABLE_IMPL_MDSPAN diff --git a/packages/kokkos/doc/Kokkos-Programming-Guide.md b/packages/kokkos/doc/Kokkos-Programming-Guide.md deleted file mode 100644 index 3992dd8130eff3d961da94b5fb42e2df3ed03658..0000000000000000000000000000000000000000 --- a/packages/kokkos/doc/Kokkos-Programming-Guide.md +++ /dev/null @@ -1 +0,0 @@ -[Programming Guide](https://github.com/kokkos/kokkos/wiki) diff --git a/packages/kokkos/doc/README.md b/packages/kokkos/doc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4654a6a4d62b69e7b0e34d33f14b42088bcc1f56 --- /dev/null +++ b/packages/kokkos/doc/README.md @@ -0,0 +1,3 @@ +# WARNING +The content of this directory is wildly outdated. +Please refer to https://kokkos.github.io/kokkos-core-wiki instead. diff --git a/packages/kokkos/doc/develop_builds.md b/packages/kokkos/doc/develop_builds.md deleted file mode 100644 index 3fe4e6f6721c9985bec6d8dce648c516295846ad..0000000000000000000000000000000000000000 --- a/packages/kokkos/doc/develop_builds.md +++ /dev/null @@ -1,56 +0,0 @@ - -# Places to build options: architecture, device, advanced options, cuda options - -These are the files that need to be updated when a new architecture or device is -added: - - + generate_makefile.bash - * Interface for makefile system - + cmake/kokkos_options.cmake - * Interface for cmake system - + Makefile.kokkos - * Main logic for build (make and cmake) and defines (KokkosCore_config.h) - -In general, an architecture is going to be from on of these platforms: - + AMD - + ARM - + IBM - + Intel - + Intel Xeon Phi - + NVIDIA -Although not strictly necessary, it is helpful to keep things organized by -grouping by platform. - -### generate_makefile.sh - -The bash code does not do any error checking on the `--arch=` or `--device=` -arguments thus strictly speaking you do not *need* to do anything to add a -device or architecture; however, you should add it to the help menu. For the -archictectures, please group by one of the platforms listed above. - - -### cmake/kokkos_options.cmake and cmake/kokkos_settings.cmake - -The options for the CMake build system are: `-DKOKKOS_HOST_ARCH:STRING=` and -`-DKOKKOS_ENABLE_<device>:BOOL=`. Although any string can be passed into -KOKKOS_HOST_ARCH option, it is checked against an accepted list. Likewise, the -KOKKOS_ENABLE_<device> must have the option added AND it is formed using the -list. Thus: - + A new architecture should be added to the KOKKOS_HOST_ARCH_LIST variable. - + A new device should be added to the KOKKOS_DEVICES_LIST variable **AND** a - KOKKOS_ENABLE_<newdevice> option specified (see KOKKOS_ENABLE_CUDA for - example). - + A new device should be added to the KOKKOS_DEVICES_LIST variable **AND** a - -The translation from option to the `KOKKOS_SETTINGS` is done in -`kokkos_settings.cmake`. This translation is automated for some types if you ad -to the list, but for others, it may need to be hand coded. - - -### Makefile.kokkos - -This is the main coding used by both the make and cmake system for defining -the sources (generated makefile and cmake snippets by `core/src/Makefile`), for -setting the defines in KokkosCore_config.h, and defining various internal -variables. To understand how to add to this file, you should work closely with -the Kokkos development team. diff --git a/packages/kokkos/doc/hardware_identification/query_cuda_arch.cpp b/packages/kokkos/doc/hardware_identification/query_cuda_arch.cpp deleted file mode 100644 index 879b3ca1e5c4b6a01539ee5997cdb86a68077388..0000000000000000000000000000000000000000 --- a/packages/kokkos/doc/hardware_identification/query_cuda_arch.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include <cstdio> -#include <cuda_runtime_api.h> -int main() { - cudaDeviceProp prop; - const cudaError_t err_code = cudaGetDeviceProperties(&prop, 0); - if (cudaSuccess != err_code) { - fprintf(stderr, "cudaGetDeviceProperties failed: %s\n", - cudaGetErrorString(err_code)); - return -1; - } - switch (prop.major) { - case 3: printf("Kepler"); break; - case 5: printf("Maxwell"); break; - case 6: printf("Pascal"); break; - default: - fprintf(stderr, "Unsupported Device %d%d\n", (int)prop.major, - (int)prop.minor); - return -1; - } - printf("%d%d\n", (int)prop.major, (int)prop.minor); - return 0; -} diff --git a/packages/kokkos/example/build_cmake_in_tree/cmake_example.cpp b/packages/kokkos/example/build_cmake_in_tree/cmake_example.cpp index 3d3afdc171615dea7a61d8bd526ba3782da2937a..b345c48f53556c3354fd893b3e125f03617a20a5 100644 --- a/packages/kokkos/example/build_cmake_in_tree/cmake_example.cpp +++ b/packages/kokkos/example/build_cmake_in_tree/cmake_example.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/build_cmake_installed/CMakeLists.txt b/packages/kokkos/example/build_cmake_installed/CMakeLists.txt index 780f7e6ac6d110573a8958d567063e32edad3764..aaf745b418de894d3403bd0e3176eb972938ac5b 100644 --- a/packages/kokkos/example/build_cmake_installed/CMakeLists.txt +++ b/packages/kokkos/example/build_cmake_installed/CMakeLists.txt @@ -10,6 +10,9 @@ project(Example CXX Fortran) find_package(Kokkos REQUIRED) add_executable(example cmake_example.cpp foo.f) +if(CMAKE_Fortran_COMPILER_ID STREQUAL LLVMFlang) + set_target_properties(example PROPERTIES LINKER_LANGUAGE Fortran) +endif() # This is the only thing required to set up compiler/linker flags target_link_libraries(example Kokkos::kokkos) diff --git a/packages/kokkos/example/build_cmake_installed/cmake_example.cpp b/packages/kokkos/example/build_cmake_installed/cmake_example.cpp index 5101526ab865cdcd2e9e00250530a0db605da756..ca11250edd8b28c40d7fb58bdab1156362f275fb 100644 --- a/packages/kokkos/example/build_cmake_installed/cmake_example.cpp +++ b/packages/kokkos/example/build_cmake_installed/cmake_example.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/build_cmake_installed_different_compiler/bar.cpp b/packages/kokkos/example/build_cmake_installed_different_compiler/bar.cpp index 09ea0e6c4ff702e0a95724bfe7e8c79a951987f3..c50474db9df3bac51a385084eaedfd969d62b60c 100644 --- a/packages/kokkos/example/build_cmake_installed_different_compiler/bar.cpp +++ b/packages/kokkos/example/build_cmake_installed_different_compiler/bar.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> diff --git a/packages/kokkos/example/build_cmake_installed_different_compiler/foo.cpp b/packages/kokkos/example/build_cmake_installed_different_compiler/foo.cpp index f78f07c6f6ba00fcbbf154dcfcb3088d0be1c8fd..e17d34aab15b8c038b57bb4868673d15ae663d3a 100644 --- a/packages/kokkos/example/build_cmake_installed_different_compiler/foo.cpp +++ b/packages/kokkos/example/build_cmake_installed_different_compiler/foo.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/build_cmake_installed_kk_as_language/bar.cpp b/packages/kokkos/example/build_cmake_installed_kk_as_language/bar.cpp index b0280c1f450377d8602a84a3fcbeec2dbf94e4e7..a26f90ac658d5bd894c6d8320f6ffee81a01d9b7 100644 --- a/packages/kokkos/example/build_cmake_installed_kk_as_language/bar.cpp +++ b/packages/kokkos/example/build_cmake_installed_kk_as_language/bar.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <cstdio> void print_cxx() { printf("Hello From C++\n"); } diff --git a/packages/kokkos/example/build_cmake_installed_kk_as_language/cmake_example.cpp b/packages/kokkos/example/build_cmake_installed_kk_as_language/cmake_example.cpp index b9b1c5848d1dd8a1fd082684bfadc8aebd1acb03..c7f24bd5ab6eaa8fe7360028a0fe893d3d595549 100644 --- a/packages/kokkos/example/build_cmake_installed_kk_as_language/cmake_example.cpp +++ b/packages/kokkos/example/build_cmake_installed_kk_as_language/cmake_example.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/make_buildlink/main.cpp b/packages/kokkos/example/make_buildlink/main.cpp index 2dbfb2687c118ba57a3b57d4dceaae6ffee2bea4..f15506d37feb764bfc99dd8e87e338627afd0d62 100644 --- a/packages/kokkos/example/make_buildlink/main.cpp +++ b/packages/kokkos/example/make_buildlink/main.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <Kokkos_Core.hpp> int main(int argc, char* argv[]) { diff --git a/packages/kokkos/example/query_device/query_device.cpp b/packages/kokkos/example/query_device/query_device.cpp index 9c4e9a8c835938c0b301fa1927a2cb5d08e654c1..ad6e5f1113e23ca3f1b6b93a58bbbdaafdb76028 100644 --- a/packages/kokkos/example/query_device/query_device.cpp +++ b/packages/kokkos/example/query_device/query_device.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <iostream> #include <sstream> diff --git a/packages/kokkos/example/tutorial/01_hello_world/hello_world.cpp b/packages/kokkos/example/tutorial/01_hello_world/hello_world.cpp index 5810e0ee7a267c79a823d00516937b8ccd43c0d9..5b8a21af833bba0ab4d6d3bb6fbf3f3a52ce9e84 100644 --- a/packages/kokkos/example/tutorial/01_hello_world/hello_world.cpp +++ b/packages/kokkos/example/tutorial/01_hello_world/hello_world.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp b/packages/kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp index 06f209774eae10a4a11161d17aae979450d6e850..c78f30763613215b88a78a34c6b5ece9fbfb6cdf 100644 --- a/packages/kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp +++ b/packages/kokkos/example/tutorial/01_hello_world_lambda/hello_world_lambda.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/02_simple_reduce/simple_reduce.cpp b/packages/kokkos/example/tutorial/02_simple_reduce/simple_reduce.cpp index 2b7668e515bcbb83ec0c073ebb1422df9a85ba7a..c0fb2dc93079b4aa552e6e6afe8f8f41ee316e8f 100644 --- a/packages/kokkos/example/tutorial/02_simple_reduce/simple_reduce.cpp +++ b/packages/kokkos/example/tutorial/02_simple_reduce/simple_reduce.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/02_simple_reduce_lambda/simple_reduce_lambda.cpp b/packages/kokkos/example/tutorial/02_simple_reduce_lambda/simple_reduce_lambda.cpp index 7f4c356e0ce90896f709922cc10556a6fa08cd04..5cae6da16cf0325c350c6504168faa211334b2b5 100644 --- a/packages/kokkos/example/tutorial/02_simple_reduce_lambda/simple_reduce_lambda.cpp +++ b/packages/kokkos/example/tutorial/02_simple_reduce_lambda/simple_reduce_lambda.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/03_simple_view/simple_view.cpp b/packages/kokkos/example/tutorial/03_simple_view/simple_view.cpp index 46cac62b9df1ab5c9124dffef75089afc1b718ca..8be280f12c19083bbebd40461626d725f003f885 100644 --- a/packages/kokkos/example/tutorial/03_simple_view/simple_view.cpp +++ b/packages/kokkos/example/tutorial/03_simple_view/simple_view.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // // First Kokkos::View (multidimensional array) example: diff --git a/packages/kokkos/example/tutorial/03_simple_view_lambda/simple_view_lambda.cpp b/packages/kokkos/example/tutorial/03_simple_view_lambda/simple_view_lambda.cpp index 33b3a1a7db17740d5f578bace4be2e74e80ed03d..bdcd45b246e2904aea632550354170ce9ee7cb81 100644 --- a/packages/kokkos/example/tutorial/03_simple_view_lambda/simple_view_lambda.cpp +++ b/packages/kokkos/example/tutorial/03_simple_view_lambda/simple_view_lambda.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // // First Kokkos::View (multidimensional array) example: diff --git a/packages/kokkos/example/tutorial/04_simple_memoryspaces/simple_memoryspaces.cpp b/packages/kokkos/example/tutorial/04_simple_memoryspaces/simple_memoryspaces.cpp index 40ad6123e7bb7b1fd8f3b9ad79c01df7105ef5c3..fc9e48e51252beb57493641acccedc7935b219d2 100644 --- a/packages/kokkos/example/tutorial/04_simple_memoryspaces/simple_memoryspaces.cpp +++ b/packages/kokkos/example/tutorial/04_simple_memoryspaces/simple_memoryspaces.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/05_simple_atomics/simple_atomics.cpp b/packages/kokkos/example/tutorial/05_simple_atomics/simple_atomics.cpp index 32b18e4d2047c5f3dcc23614109f4440b4686549..5196250c34bd2987f8385cc749d4e3f727326745 100644 --- a/packages/kokkos/example/tutorial/05_simple_atomics/simple_atomics.cpp +++ b/packages/kokkos/example/tutorial/05_simple_atomics/simple_atomics.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/06_simple_mdrangepolicy/simple_mdrangepolicy.cpp b/packages/kokkos/example/tutorial/06_simple_mdrangepolicy/simple_mdrangepolicy.cpp index aac3b7eba869280ff09c0c5604ce4e4421d3693f..bef4ed2bc988e6d946af9a3bf616b0a4596403d3 100644 --- a/packages/kokkos/example/tutorial/06_simple_mdrangepolicy/simple_mdrangepolicy.cpp +++ b/packages/kokkos/example/tutorial/06_simple_mdrangepolicy/simple_mdrangepolicy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/data_layouts.cpp b/packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/data_layouts.cpp index 75eca5403fd12ae09f2839ef696fafefa9f8f277..dc27f1f537ac2a0573dc68fdf8fc8d33816e15c7 100644 --- a/packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/data_layouts.cpp +++ b/packages/kokkos/example/tutorial/Advanced_Views/01_data_layouts/data_layouts.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Timer.hpp> diff --git a/packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp b/packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp index 0544e572e7e9785369bfc824db783ea2fcd5af53..753d2fd9db8c757d3a379e494864531c1aff8490 100644 --- a/packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp +++ b/packages/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Timer.hpp> diff --git a/packages/kokkos/example/tutorial/Advanced_Views/03_subviews/subviews.cpp b/packages/kokkos/example/tutorial/Advanced_Views/03_subviews/subviews.cpp index 52af4bd3b5ba84b3b5c1b53111900a9104e41922..d464b963c89675e582174df208f3c14786b9ef85 100644 --- a/packages/kokkos/example/tutorial/Advanced_Views/03_subviews/subviews.cpp +++ b/packages/kokkos/example/tutorial/Advanced_Views/03_subviews/subviews.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ // This example simulates one timestep of an explicit // finite-difference discretization of a time-dependent partial diff --git a/packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp b/packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp index 622b24b93131094ebd3c331d4c4f01ae14cca325..3bf8b3dbf3e809cf7673c3343b8d08d389170ad9 100644 --- a/packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp +++ b/packages/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_DualView.hpp> diff --git a/packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp b/packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp index 596b25aaade065c9ade57f90107e17d6fda3d06a..b61ee05ca5459868b0fb768e44e712ee8e32c6c6 100644 --- a/packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp +++ b/packages/kokkos/example/tutorial/Advanced_Views/05_NVIDIA_UVM/uvm_example.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_DualView.hpp> diff --git a/packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/overlapping_deepcopy.cpp b/packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/overlapping_deepcopy.cpp index c03515479d0d7e0365272f87cbe49d11b21f13aa..e0fc2d148009cc86c6b640d3370e17d36a43a90d 100644 --- a/packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/overlapping_deepcopy.cpp +++ b/packages/kokkos/example/tutorial/Advanced_Views/07_Overlapping_DeepCopy/overlapping_deepcopy.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/Algorithms/01_random_numbers/random_numbers.cpp b/packages/kokkos/example/tutorial/Algorithms/01_random_numbers/random_numbers.cpp index 602122b61f1b94788b95052478a6123ae41fbfd9..f3a752972f96d75b4bf1ed1309c64211926cbcb3 100644 --- a/packages/kokkos/example/tutorial/Algorithms/01_random_numbers/random_numbers.cpp +++ b/packages/kokkos/example/tutorial/Algorithms/01_random_numbers/random_numbers.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Random.hpp> diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/thread_teams.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/thread_teams.cpp index 735de65e056c84a5290105db39d5369a50f16ec7..b041f8d435b9586c42f59806ad7c2c3d159468f7 100644 --- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/thread_teams.cpp +++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams/thread_teams.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/thread_teams_lambda.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/thread_teams_lambda.cpp index dcb1e0561bca8b096b528d61128f85c6254c221c..933b254f7c7ba9e2ce8e916c7d9c55e301c7b174 100644 --- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/thread_teams_lambda.cpp +++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/01_thread_teams_lambda/thread_teams_lambda.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/nested_parallel_for.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/nested_parallel_for.cpp index a528b71fe33f817b03dc32bacdbe8cd96271eab7..398810d133195c9534ded415e6ea92b1be70968a 100644 --- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/nested_parallel_for.cpp +++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/02_nested_parallel_for/nested_parallel_for.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/vectorization.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/vectorization.cpp index 8f76110f086e4ca0e7b11d2fc998fc4354f7008e..ae9430a93b0ec79b37a4ddc999284a976db2c196 100644 --- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/vectorization.cpp +++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/03_vectorization/vectorization.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_Random.hpp> diff --git a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/team_scan.cpp b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/team_scan.cpp index cc20a497b2325825cf5faf01e2fd527e71efee53..f7269d62cc764194e85ef9edbc149b22a3d711ab 100644 --- a/packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/team_scan.cpp +++ b/packages/kokkos/example/tutorial/Hierarchical_Parallelism/04_team_scan/team_scan.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <Kokkos_DualView.hpp> @@ -127,9 +99,9 @@ int main(int narg, char* args[]) { Kokkos::Timer timer; // threads/team is automatically limited to maximum supported by the device. - int team_size = TEAM_SIZE; - if (team_size > Device::execution_space::concurrency()) - team_size = Device::execution_space::concurrency(); + int const concurrency = Device::execution_space().concurrency(); + int team_size = TEAM_SIZE; + if (team_size > concurrency) team_size = concurrency; Kokkos::parallel_for(team_policy(nchunks, team_size), find_2_tuples(chunk_size, data, histogram)); Kokkos::fence(); diff --git a/packages/kokkos/example/tutorial/launch_bounds/launch_bounds_reduce.cpp b/packages/kokkos/example/tutorial/launch_bounds/launch_bounds_reduce.cpp index 92f82111f98c6afc966520f58b1709197bedf429..9471d3c16ac54bba57abad06c7189a51f7adbd02 100644 --- a/packages/kokkos/example/tutorial/launch_bounds/launch_bounds_reduce.cpp +++ b/packages/kokkos/example/tutorial/launch_bounds/launch_bounds_reduce.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <Kokkos_Core.hpp> #include <cstdio> diff --git a/packages/kokkos/example/virtual_functions/classes.cpp b/packages/kokkos/example/virtual_functions/classes.cpp index 9041f980ed46e7b05cfe3f2f8c5432fba49890d8..5d855e030d62d5c20d3019a091212b8e69faeee3 100644 --- a/packages/kokkos/example/virtual_functions/classes.cpp +++ b/packages/kokkos/example/virtual_functions/classes.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <classes.hpp> KOKKOS_FUNCTION diff --git a/packages/kokkos/example/virtual_functions/classes.hpp b/packages/kokkos/example/virtual_functions/classes.hpp index 4fa9f595024fb5a18fce62e85edaf10e34ddc0c3..c27a4605720914c35022287f771df79d3aa1b302 100644 --- a/packages/kokkos/example/virtual_functions/classes.hpp +++ b/packages/kokkos/example/virtual_functions/classes.hpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #ifndef KOKKOS_EXAMPLE_VIRTUAL_FUNCTIONS_CLASSES_HPP #define KOKKOS_EXAMPLE_VIRTUAL_FUNCTIONS_CLASSES_HPP diff --git a/packages/kokkos/example/virtual_functions/main.cpp b/packages/kokkos/example/virtual_functions/main.cpp index aaa7afb0340ba308caa84021300fec9e72643aee..3d725a2af543635e36df7d28abdfaf2f3dc367fb 100644 --- a/packages/kokkos/example/virtual_functions/main.cpp +++ b/packages/kokkos/example/virtual_functions/main.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + #include <classes.hpp> int main(int argc, char* argv[]) { diff --git a/packages/kokkos/generate_makefile.bash b/packages/kokkos/generate_makefile.bash index 3b78301fca06e79a6433f57d8eddd2ce9c47ff5e..018426c9b8e9dca8d612a68ca0e6a29b657fccc4 100755 --- a/packages/kokkos/generate_makefile.bash +++ b/packages/kokkos/generate_makefile.bash @@ -70,8 +70,6 @@ get_kokkos_cuda_option_list() { CUDA_OPT_NAME=CUDA_RELOCATABLE_DEVICE_CODE elif [ "${CUDA_}" == "force_uvm" ]; then CUDA_OPT_NAME=CUDA_UVM - elif [ "${CUDA_}" == "use_ldg" ]; then - CUDA_OPT_NAME=CUDA_LDG_INTRINSIC else echo "${CUDA_} is not a valid cuda options..." fi @@ -159,10 +157,11 @@ display_help_text() { echo " ZEN2 = AMD Zen2-Core CPU" echo " ZEN3 = AMD Zen3-Core CPU" echo " [AMD: GPU]" - echo " VEGA900 = AMD GPU MI25 GFX900" echo " VEGA906 = AMD GPU MI50/MI60 GFX906" echo " VEGA908 = AMD GPU MI100 GFX908" echo " VEGA90A = AMD GPU MI200 GFX90A" + echo " NAVI1030 = AMD GPU V620/W6800 GFX1030" + echo " NAVI1100 = AMD GPU RX 7900 XT(X) GFX1100" echo " [ARM]" echo " ARMV80 = ARMv8.0 Compatible CPU" echo " ARMV81 = ARMv8.1 Compatible CPU" @@ -215,9 +214,9 @@ display_help_text() { echo "--cxxflags=[FLAGS] Overwrite CXXFLAGS for library build and test" echo " build. This will still set certain required" echo " flags via KOKKOS_CXXFLAGS (such as -fopenmp," - echo " -std=c++14, etc.)." + echo " -std=c++17, etc.)." echo "--cxxstandard=[FLAGS] Set CMAKE_CXX_STANDARD for library build and test" - echo " c++14 (default), c++17, c++1y, c++1z, c++2a" + echo " 17 (default), 1z, 20, 2a, 23, 2b" echo "--ldflags=[FLAGS] Overwrite LDFLAGS for library build and test" echo " build. This will still set certain required" echo " flags via KOKKOS_LDFLAGS (such as -fopenmp," @@ -505,5 +504,5 @@ if [[ ${COMPILER} == *clang* ]]; then fi fi -echo cmake $COMPILER_CMD -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${KOKKOS_LDFLAGS}" -DCMAKE_INSTALL_PREFIX=${PREFIX} ${KOKKOS_DEVICE_CMD} ${KOKKOS_ARCH_CMD} -DKokkos_ENABLE_TESTS=${KOKKOS_DO_TESTS} -DKokkos_ENABLE_EXAMPLES=${KOKKOS_DO_EXAMPLES} ${KOKKOS_OPTION_CMD} ${KOKKOS_CUDA_OPTION_CMD} ${KOKKOS_HIP_OPTION_CMD} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_EXTENSIONS=OFF ${STANDARD_CMD} ${KOKKOS_DEBUG_CMD} ${KOKKOS_BC_CMD} ${KOKKOS_HWLOC_CMD} ${KOKKOS_HWLOC_PATH_CMD} ${KOKKOS_MEMKIND_CMD} ${KOKKOS_MEMKIND_PATH_CMD} -DKokkos_ENABLE_DEPRECATION_WARNINGS=${KOKKOS_DEPRECATED_CODE_WARNINGS} -DKokkos_ENABLE_DEPRECATED_CODE_3=${KOKKOS_DEPRECATED_CODE} ${KOKKOS_PATH} -cmake $COMPILER_CMD -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS//\"}" -DCMAKE_EXE_LINKER_FLAGS="${KOKKOS_LDFLAGS//\"}" -DCMAKE_INSTALL_PREFIX=${PREFIX} ${KOKKOS_DEVICE_CMD} ${KOKKOS_ARCH_CMD} -DKokkos_ENABLE_TESTS=${KOKKOS_DO_TESTS} -DKokkos_ENABLE_EXAMPLES=${KOKKOS_DO_EXAMPLES} ${KOKKOS_OPTION_CMD} ${KOKKOS_CUDA_OPTION_CMD} ${KOKKOS_HIP_OPTION_CMD} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_EXTENSIONS=OFF ${STANDARD_CMD} ${KOKKOS_DEBUG_CMD} ${KOKKOS_BC_CMD} ${KOKKOS_HWLOC_CMD} ${KOKKOS_HWLOC_PATH_CMD} ${KOKKOS_MEMKIND_CMD} ${KOKKOS_MEMKIND_PATH_CMD} ${PASSTHRU_CMAKE_FLAGS} -DKokkos_ENABLE_DEPRECATION_WARNINGS=${KOKKOS_DEPRECATED_CODE_WARNINGS} -DKokkos_ENABLE_DEPRECATED_CODE_3=${KOKKOS_DEPRECATED_CODE} ${KOKKOS_PATH} +echo cmake $COMPILER_CMD -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${KOKKOS_LDFLAGS}" -DCMAKE_INSTALL_PREFIX=${PREFIX} ${KOKKOS_DEVICE_CMD} ${KOKKOS_ARCH_CMD} -DKokkos_ENABLE_TESTS=${KOKKOS_DO_TESTS} -DKokkos_ENABLE_EXAMPLES=${KOKKOS_DO_EXAMPLES} ${KOKKOS_OPTION_CMD} ${KOKKOS_CUDA_OPTION_CMD} ${KOKKOS_HIP_OPTION_CMD} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_EXTENSIONS=OFF ${STANDARD_CMD} ${KOKKOS_DEBUG_CMD} ${KOKKOS_BC_CMD} ${KOKKOS_HWLOC_CMD} ${KOKKOS_HWLOC_PATH_CMD} ${KOKKOS_MEMKIND_CMD} ${KOKKOS_MEMKIND_PATH_CMD} -DKokkos_ENABLE_DEPRECATION_WARNINGS=${KOKKOS_DEPRECATED_CODE_WARNINGS} -DKokkos_ENABLE_DEPRECATED_CODE_4=${KOKKOS_DEPRECATED_CODE} ${KOKKOS_PATH} +cmake $COMPILER_CMD -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS//\"}" -DCMAKE_EXE_LINKER_FLAGS="${KOKKOS_LDFLAGS//\"}" -DCMAKE_INSTALL_PREFIX=${PREFIX} ${KOKKOS_DEVICE_CMD} ${KOKKOS_ARCH_CMD} -DKokkos_ENABLE_TESTS=${KOKKOS_DO_TESTS} -DKokkos_ENABLE_EXAMPLES=${KOKKOS_DO_EXAMPLES} ${KOKKOS_OPTION_CMD} ${KOKKOS_CUDA_OPTION_CMD} ${KOKKOS_HIP_OPTION_CMD} -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_EXTENSIONS=OFF ${STANDARD_CMD} ${KOKKOS_DEBUG_CMD} ${KOKKOS_BC_CMD} ${KOKKOS_HWLOC_CMD} ${KOKKOS_HWLOC_PATH_CMD} ${KOKKOS_MEMKIND_CMD} ${KOKKOS_MEMKIND_PATH_CMD} ${PASSTHRU_CMAKE_FLAGS} -DKokkos_ENABLE_DEPRECATION_WARNINGS=${KOKKOS_DEPRECATED_CODE_WARNINGS} -DKokkos_ENABLE_DEPRECATED_CODE_4=${KOKKOS_DEPRECATED_CODE} ${KOKKOS_PATH} diff --git a/packages/kokkos/gnu_generate_makefile.bash b/packages/kokkos/gnu_generate_makefile.bash index aab95e12e34c71ba2777f63ee30213fb9b62bab9..5ea159cdd47fc48b0872ae7c3061f176e9a88436 100755 --- a/packages/kokkos/gnu_generate_makefile.bash +++ b/packages/kokkos/gnu_generate_makefile.bash @@ -188,9 +188,9 @@ do echo "--cxxflags=[FLAGS] Overwrite CXXFLAGS for library build and test" echo " build. This will still set certain required" echo " flags via KOKKOS_CXXFLAGS (such as -fopenmp," - echo " -std=c++14, etc.)." + echo " -std=c++17, etc.)." echo "--cxxstandard=[FLAGS] Overwrite KOKKOS_CXX_STANDARD for library build and test" - echo " c++14 (default), c++17, c++1y, c++1z, c++2a" + echo " c++17 (default), c++1z, c++20, c++2a, c++23, c++2b" echo "--ldflags=[FLAGS] Overwrite LDFLAGS for library build and test" echo " build. This will still set certain required" echo " flags via KOKKOS_LDFLAGS (such as -fopenmp," diff --git a/packages/kokkos/master_history.txt b/packages/kokkos/master_history.txt index bd639c847e03cdd0909fc83ccf6d0843148d6bea..73e48268b5a6dbeda0bbaa99cd1adf7badc94640 100644 --- a/packages/kokkos/master_history.txt +++ b/packages/kokkos/master_history.txt @@ -30,3 +30,5 @@ tag: 3.6.00 date: 04:14:2022 master: 2834f94a release: 6ea708ff tag: 3.6.01 date: 06:16:2022 master: b52f8c83 release: afe9b404 tag: 3.7.00 date: 08:25:2022 master: d19aab99 release: 0018e5fb tag: 3.7.01 date: 12:01:2022 master: 61d7db55 release: d3bb8cfe +tag: 4.0.00 date: 02:23:2023 master: 5ad60966 release: 52ea2953 +tag: 4.0.01 date: 04:26:2023 master: aa1f48f3 release: 5893754f diff --git a/packages/kokkos/scripts/apply-clang-format b/packages/kokkos/scripts/apply-clang-format index d988ca7ae29990cc123f43b36d9c01c05cf5d904..7f7fb82686e448516625b65fdb2350cff0341aba 100755 --- a/packages/kokkos/scripts/apply-clang-format +++ b/packages/kokkos/scripts/apply-clang-format @@ -40,4 +40,4 @@ find ${TRACKED_FILES} \ xargs -n 1 -P 10 -I {} bash -c "sed -i -e 's/\s\+$//g' {} && rm -f '{}-e'" # Check that we do not introduce any file with the old copyright -./scripts/update-copyright +./scripts/check-copyright diff --git a/packages/kokkos/scripts/check-copyright b/packages/kokkos/scripts/check-copyright new file mode 100755 index 0000000000000000000000000000000000000000..be696d069aa964df2a187bacb2d509fac8578718 --- /dev/null +++ b/packages/kokkos/scripts/check-copyright @@ -0,0 +1,16 @@ +files=`git ls-files | grep -e '.*\.\(cc\|cpp\|hpp\)' | grep -v 'tpls/'` +echo "" &> scripts/diff_files +tmp=`cat LICENSE_FILE_HEADER | wc -l` +NNEW=$(($tmp)) +for file in $files; do + head -n +$NNEW $file &> header + diff header LICENSE_FILE_HEADER &> header_diff + count=`cat header_diff | wc -l` + #echo $file " " COUNT " " $count >> diff_headers + if [ "$count" -ne "0" ]; then + echo $file >> scripts/diff_files + fi +done +tmpfile=$(mktemp -t kokkos_diff_files.XXXX) +cat scripts/diff_files | sort &> $tmpfile +mv $tmpfile scripts/diff_files diff --git a/packages/kokkos/scripts/diff_files b/packages/kokkos/scripts/diff_files new file mode 100644 index 0000000000000000000000000000000000000000..125568d34557b7d8b087a5ef8bf9934b60f0813a --- /dev/null +++ b/packages/kokkos/scripts/diff_files @@ -0,0 +1,2 @@ + +core/src/Cuda/Kokkos_Cuda_Atomic_Intrinsics.hpp diff --git a/packages/kokkos/scripts/docker/Dockerfile.gcc b/packages/kokkos/scripts/docker/Dockerfile.gcc index 84c432cd2480fa9477c7889b083713186c1a9517..3cfb39dc20ba48417be4fe8100b1eb8dc283ad4f 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.gcc +++ b/packages/kokkos/scripts/docker/Dockerfile.gcc @@ -12,9 +12,9 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \ RUN echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" >> /etc/apt/sources.list && \ echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe" >> /etc/apt/sources.list && \ - apt-get update && apt-get install -y g++-5 && \ - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 5 && \ - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 5 && \ + apt-get update && apt-get install -y g++-8 && \ + update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 && \ + update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 && \ apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/packages/kokkos/scripts/docker/Dockerfile.hipcc b/packages/kokkos/scripts/docker/Dockerfile.hipcc index 3274a59c34ea0f421a717540ce38a01c17279e52..95f76fe89a355d5f6964dc8847a987b50fc455cf 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.hipcc +++ b/packages/kokkos/scripts/docker/Dockerfile.hipcc @@ -1,4 +1,4 @@ -ARG BASE=rocm/dev-ubuntu-20.04:4.5 +ARG BASE=rocm/dev-ubuntu-20.04:5.2 FROM $BASE RUN apt-get update && apt-get install -y \ diff --git a/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject b/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject index e4ab07dbc250b945ce654803409371ff4f6f1db3..9086cba5e8edd734f4d81cd6a18702ed4549ba00 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject +++ b/packages/kokkos/scripts/docker/Dockerfile.kokkosllvmproject @@ -13,6 +13,15 @@ RUN apt-get update && apt-get install -y \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +# unbuntu18.04-based images have libstdc++ that is lacking filesystem support +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ + apt-get update && \ + apt-get install -y g++-9 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + RUN KEYDUMP_URL=https://cloud.cees.ornl.gov/download && \ KEYDUMP_FILE=keydump && \ wget --quiet ${KEYDUMP_URL}/${KEYDUMP_FILE} && \ diff --git a/packages/kokkos/scripts/docker/Dockerfile.openmptarget b/packages/kokkos/scripts/docker/Dockerfile.openmptarget index e10c3f2208f2bb9368f6f33a82da4b43ef61fa30..44c53fef1dd78f6aafe37321df0004f51b2971ff 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.openmptarget +++ b/packages/kokkos/scripts/docker/Dockerfile.openmptarget @@ -38,7 +38,7 @@ RUN CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSIO rm ${CMAKE_SCRIPT} ENV PATH=${CMAKE_DIR}/bin:$PATH -ARG LLVM_VERSION=llvmorg-14.0.0 +ARG LLVM_VERSION=llvmorg-15.0.0 ENV LLVM_DIR=/opt/llvm RUN LLVM_URL=https://github.com/llvm/llvm-project/archive &&\ LLVM_ARCHIVE=${LLVM_VERSION}.tar.gz &&\ diff --git a/packages/kokkos/scripts/docker/Dockerfile.sycl b/packages/kokkos/scripts/docker/Dockerfile.sycl index 0970d2ac5727ce144badf496745c980639185bc4..d7d764e8aa53f89ecb3f93a685a6946ad08f52a2 100644 --- a/packages/kokkos/scripts/docker/Dockerfile.sycl +++ b/packages/kokkos/scripts/docker/Dockerfile.sycl @@ -14,6 +14,15 @@ RUN apt-get update && apt-get install -y \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +# unbuntu18.04-based images have libstdc++ that is lacking filesystem support +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ + apt-get update && \ + apt-get install -y g++-9 && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + RUN KEYDUMP_URL=https://cloud.cees.ornl.gov/download && \ KEYDUMP_FILE=keydump && \ wget --quiet ${KEYDUMP_URL}/${KEYDUMP_FILE} && \ @@ -22,7 +31,7 @@ RUN KEYDUMP_URL=https://cloud.cees.ornl.gov/download && \ gpg --verify ${KEYDUMP_FILE}.sig ${KEYDUMP_FILE} && \ rm ${KEYDUMP_FILE}* -ARG CMAKE_VERSION=3.18.5 +ARG CMAKE_VERSION=3.23.2 ENV CMAKE_DIR=/opt/cmake RUN CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION} && \ CMAKE_SCRIPT=cmake-${CMAKE_VERSION}-Linux-x86_64.sh && \ diff --git a/packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp b/packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp index 883e88b51b7dd6c3f116ea8731934db5b7dde72a..0abfa21eaf1ddb97190ff21fd858319a9bd6960d 100644 --- a/packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp +++ b/packages/kokkos/scripts/testing_scripts/TestEXEC_TEST.cpp @@ -1,47 +1,18 @@ - -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <TestEXEC_Category.hpp> #include <TestTEST.hpp> diff --git a/packages/kokkos/scripts/testing_scripts/generate_makefile.bash b/packages/kokkos/scripts/testing_scripts/generate_makefile.bash index ff9620efa689254af88bf64637e4998ca2d75265..ae1db3186f72df9295535356bfea9a272c861648 100755 --- a/packages/kokkos/scripts/testing_scripts/generate_makefile.bash +++ b/packages/kokkos/scripts/testing_scripts/generate_makefile.bash @@ -167,9 +167,9 @@ do echo "--cxxflags=[FLAGS] Overwrite CXXFLAGS for library build and test" echo " build. This will still set certain required" echo " flags via KOKKOS_CXXFLAGS (such as -fopenmp," - echo " -std=c++14, etc.)." + echo " -std=c++17, etc.)." echo "--cxxstandard=[FLAGS] Overwrite KOKKOS_CXX_STANDARD for library build and test" - echo " c++14 (default), c++17, c++1y, c++1z, c++2a" + echo " c++17 (default), c++1z, c++20, c++2a, c++23, c++2b" echo "--ldflags=[FLAGS] Overwrite LDFLAGS for library build and test" echo " build. This will still set certain required" echo " flags via KOKKOS_LDFLAGS (such as -fopenmp," diff --git a/packages/kokkos/scripts/testing_scripts/gnu_test_all_sandia b/packages/kokkos/scripts/testing_scripts/gnu_test_all_sandia index b2a0677e12fc14bc1b9ecc834e961abee5543efe..57929e897267eb1f12f63de8114f5f9779325254 100755 --- a/packages/kokkos/scripts/testing_scripts/gnu_test_all_sandia +++ b/packages/kokkos/scripts/testing_scripts/gnu_test_all_sandia @@ -95,7 +95,7 @@ CXX_FLAGS_EXTRA="" LD_FLAGS_EXTRA="" KOKKOS_OPTIONS="" -CXX_STANDARD="c++14" +CXX_STANDARD="c++17" # # Handle arguments. @@ -518,7 +518,7 @@ if [ "$PRINT_HELP" = "True" ]; then echo "--build-only: Just do builds, don't run anything" echo "--opt-flag=FLAG: Optimization flag (default: -O3)" echo "--cxxflags-extra=FLAGS: Extra flags to be added to CXX_FLAGS" - echo "--cxxstandard=OPT: c++14 (default), c++17, c++1y, c++1z, c++2a" + echo "--cxxstandard=OPT: c++17 (default), c++1z, c++20, c++2a, c++23, c++2b" echo "--ldflags-extra=FLAGS: Extra flags to be added to LD_FLAGS" echo "--arch=ARCHITECTURE: overwrite architecture flags" echo "--with-cuda-options=OPT: set KOKKOS_CUDA_OPTIONS" diff --git a/packages/kokkos/scripts/testing_scripts/test_all_sandia b/packages/kokkos/scripts/testing_scripts/test_all_sandia index 72ee31707ecafed7e6e6bad506b2e16c4ff95ffc..40c30ba7f4588c19365a0f8df2a683ab4c22e998 100755 --- a/packages/kokkos/scripts/testing_scripts/test_all_sandia +++ b/packages/kokkos/scripts/testing_scripts/test_all_sandia @@ -25,7 +25,7 @@ print_help() { echo "--build-only: Just do builds, don't run anything" echo "--opt-flag=FLAG: Optimization flag (default: -O3)" echo "--cxxflags-extra=FLAGS: Extra flags to be added to CXX_FLAGS" - echo "--cxxstandard=OPT: c++14 (default), c++17, c++1y, c++1z, c++2a" + echo "--cxxstandard=OPT: c++17 (default), c++1z, c++20, c++2a, c++23, c++2b" echo "--ldflags-extra=FLAGS: Extra flags to be added to LD_FLAGS" echo "--arch=ARCHITECTURE: overwrite architecture flags" echo "--with-cuda-options=OPT: set KOKKOS_CUDA_OPTIONS" @@ -73,11 +73,6 @@ HOSTNAME=$(hostname) PROCESSOR=`uname -p` CUDA_ENABLE_CMD= -if [[ "$HOSTNAME" =~ (white|ride).* ]]; then - MACHINE=white - module load git -fi - if [[ "$HOSTNAME" =~ weaver.* ]]; then MACHINE=weaver module load git @@ -165,7 +160,7 @@ CXX_FLAGS_EXTRA="" LD_FLAGS_EXTRA="" KOKKOS_OPTIONS="" -CXX_STANDARD="14" +CXX_STANDARD="17" CTESTTIMEOUT=2000 @@ -405,84 +400,27 @@ elif [ "$MACHINE" = "kokkos-dev" ]; then "cuda/9.2 $CUDA9_MODULE_LIST $CUDA_BUILD_LIST $KOKKOS_PATH/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" ) fi -elif [ "$MACHINE" = "white" ]; then - source /etc/profile.d/modules.sh - SKIP_HWLOC=True - export SLURM_TASKS_PER_NODE=32 - - BASE_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>" - IBM_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/xl/<COMPILER_VERSION>,gcc/7.2.0" - CUDA_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>,gcc/7.2.0,ibm/xl/16.1.1" - CUDA10_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>,gcc/7.4.0,ibm/xl/16.1.1" - - # Don't do pthread with Power - GCC_BUILD_LIST="OpenMP,Serial,OpenMP_Serial" - - if [ "$SPOT_CHECK" = "True" ]; then - # Format: (compiler module-list build-list exe-name warning-flag) - COMPILERS=("gcc/6.4.0 $BASE_MODULE_LIST "OpenMP_Serial" g++ $GCC_WARNING_FLAGS" - "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "ibm/16.1.1 $IBM_MODULE_LIST "Serial" xlC $IBM_WARNING_FLAGS" - "cuda/9.2.88 $CUDA_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.1.105 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - ) - else - # Format: (compiler module-list build-list exe-name warning-flag) - COMPILERS=("gcc/5.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/6.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/7.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/9.3.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "ibm/16.1.1 $IBM_MODULE_LIST $IBM_BUILD_LIST xlC $IBM_WARNING_FLAGS" - "cuda/9.2.88 $CUDA_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.0.130 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.1.105 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - ) - fi - - if [ -z "$ARCH_FLAG" ]; then - ARCH_FLAG="--arch=Power8,Pascal60" - fi elif [ "$MACHINE" = "weaver" ]; then source /etc/profile.d/modules.sh SKIP_HWLOC=True + # For rhel7W queue BASE_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>" - IBM_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/xl/<COMPILER_VERSION>,gcc/7.2.0" - CUDA_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>,ibm/xl/16.1.1,gcc/7.2.0" - CUDA10_MODULE_LIST="cmake/3.19.3,<COMPILER_NAME>/<COMPILER_VERSION>,ibm/xl/16.1.1,gcc/7.4.0" - # Cuda/11 modules available only on the dev queue (rhel8 OS); gcc/8.3.1 loaded by default - CUDA11_MODULE_LIST="cmake/3.21.2,<COMPILER_NAME>/<COMPILER_VERSION>" - # Don't do pthread with Power - GCC_BUILD_LIST="OpenMP,Serial,OpenMP_Serial" + # For rhel8 queue + # Cuda/11 modules available only on the rhel8 queue (rhel8 OS) + RHEL8_BASE_MODULE_LIST="cmake/3.21.2,<COMPILER_NAME>/<COMPILER_VERSION>" + RHEL8_CUDA11_MODULE_LIST="cmake/3.21.2,<COMPILER_NAME>/<COMPILER_VERSION>" - if [ "$SPOT_CHECK" = "True" ]; then - # Format: (compiler module-list build-list exe-name warning-flag) - COMPILERS=("gcc/6.4.0 $BASE_MODULE_LIST "OpenMP_Serial" g++ $GCC_WARNING_FLAGS" - "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "ibm/16.1.1 $IBM_MODULE_LIST "Serial" xlC $IBM_WARNING_FLAGS" - "cuda/9.2.88 $CUDA_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.1.243 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - ) - else - # Format: (compiler module-list build-list exe-name warning-flag) - COMPILERS=("gcc/6.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/7.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/9.3.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "ibm/16.1.1 $IBM_MODULE_LIST $IBM_BUILD_LIST xlC $IBM_WARNING_FLAGS" - "cuda/9.2.88 $CUDA_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.0.130 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.1.105 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.1.243 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.2.089 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/10.2.2 $CUDA10_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "cuda/11.2.2 $CUDA11_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - ) - fi + # Don't do pthread with Power + GCC_IBM_BUILD_LIST="OpenMP,Serial,OpenMP_Serial" + # Format: (compiler module-list build-list exe-name warning-flag) + COMPILERS=("gcc/9.3.0 $BASE_MODULE_LIST $GCC_IBM_BUILD_LIST g++ $GCC_WARNING_FLAGS" + "gcc/8.3.1 $RHEL8_BASE_MODULE_LIST $GCC_IBM_BUILD_LIST g++ $GCC_WARNING_FLAGS" + "cuda/11.2.2 $RHEL8_CUDA11_MODULE_LIST $CUDA_IBM_BUILD_LIST ${KOKKOS_PATH}/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" + ) if [ -z "$ARCH_FLAG" ]; then ARCH_FLAG="--arch=Power9,Volta70" fi @@ -529,10 +467,8 @@ elif [ "$MACHINE" = "caraway" ]; then HIPCLANG_WARNING_FLAGS="-Werror -Wno-unused-command-line-argument -DNDEBUG" # Format: (compiler module-list build-list exe-name warning-flag) - COMPILERS=("rocm/4.3.0 $BASE_MODULE_LIST $HIPCLANG_BUILD_LIST hipcc $HIPCLANG_WARNING_FLAGS" - "rocm/4.5.0 $BASE_MODULE_LIST $HIPCLANG_BUILD_LIST hipcc $HIPCLANG_WARNING_FLAGS" + COMPILERS=("rocm/5.2.0 $BASE_MODULE_LIST $HIPCLANG_BUILD_LIST hipcc $HIPCLANG_WARNING_FLAGS" "cuda/11.4 $CUDA11_MODULE_LIST $CUDA_BUILD_LIST $KOKKOS_PATH/bin/nvcc_wrapper $CUDA_WARNING_FLAGS" - "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" "gcc/8.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" "gcc/9.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" "gcc/10.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" @@ -540,7 +476,7 @@ elif [ "$MACHINE" = "caraway" ]; then ) if [ -z "$ARCH_FLAG" ]; then - ARCH_FLAG="--arch=VEGA906" + ARCH_FLAG="--arch=VEGA908" fi elif [ "$MACHINE" = "blake" ]; then @@ -562,16 +498,8 @@ elif [ "$MACHINE" = "blake" ]; then "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" ) else - COMPILERS=("intel/17.4.196 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS" - "intel/18.0.128 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS" - "intel/18.1.163 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS" - "intel/19.1.144 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS" - "intel/19.3.199 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS" - "intel/19.5.281 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS" + COMPILERS=("intel/19.5.281 $BASE_MODULE_LIST_INTEL $INTEL_BUILD_LIST icpc $INTEL_WARNING_FLAGS" "intel/2021.1.1 $BASE_MODULE_LIST_ONEAPI $INTEL_BUILD_LIST icpx $ONEAPI_WARNING_FLAGS" - "gcc/5.5.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/6.4.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" - "gcc/7.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" "gcc/8.1.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" "gcc/8.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" "gcc/9.2.0 $BASE_MODULE_LIST $GCC_BUILD_LIST g++ $GCC_WARNING_FLAGS" @@ -900,9 +828,6 @@ single_build_and_test() { run_cmd ${KOKKOS_PATH}/generate_makefile.bash --with-devices=$LOCAL_KOKKOS_DEVICES $ARCH_FLAG --compiler=$(which $compiler_exe) --cxxflags=\"$cxxflags\" --cxxstandard=\"$cxx_standard\" --ldflags=\"$ldflags\" $CUDA_ENABLE_CMD --kokkos-path=${KOKKOS_PATH} ${KOKKOS_BOUNDS_CHECK} --no-examples ${KOKKOS_DEPRECATED_CODE} ${KOKKOS_DEPRECATED_CODE_WARNINGS} $extra_args &>> ${desc}.configure.log || { report_and_log_test_result 1 ${desc} configure && return 0; } local make_par_lvl=12 - if [[ "$MACHINE" = white* ]]; then - make_par_lvl=48 - fi local -i build_start_time=$(date +%s) run_cmd make -j $make_par_lvl all >& ${desc}.build.log || { report_and_log_test_result 1 ${desc} build && return 0; } local -i build_end_time=$(date +%s) diff --git a/packages/kokkos/scripts/update-copyright b/packages/kokkos/scripts/update-copyright index 04224f9ec937c2077b501a6e56eccaac67358787..a863d06c042e642d73fb99a37dca55374568f0b4 100755 --- a/packages/kokkos/scripts/update-copyright +++ b/packages/kokkos/scripts/update-copyright @@ -1,6 +1,32 @@ -files=`find . -name '*.cpp' -o -name '*.pc.in' -o -name '*.hpp' -o -name 'LICENSE' -o -name 'Copyright.txt' -o -name '*.cc'` +files=`git ls-files | grep -e '.*\.\(cc\|cpp\|hpp\)' | grep -v 'tpls/'` +echo "" &> diff_files +echo "" &> clean_files +echo "" &> updated_files +tmp=`cat scripts/new_header | wc -l` +NNEW=$(($tmp)) +tmp=`cat scripts/old_header | wc -l` +NOLD=$(($tmp)) +NOLD1=$(($NOLD+1)) for file in $files; do -awk '{if($2=="Copyright" && $3=="(2014)" && $4=="Sandia" && $5=="Corporation") {print "// Copyright (2020) National Technology & Engineering"; print "// Solutions of Sandia, LLC (NTESS).";} else {print $0}}' $file | sed 's/DE-AC04-94AL85000 with Sandia Corporation/DE-NA0003525 with NTESS/g' | sed 's|Kokkos v. 2.0|Kokkos v. 3.0|g' &> tmp -sed -i 's|SANDIA CORPORATION|NTESS|g' tmp -cp tmp $file + head -n +$NOLD $file &> header + diff header scripts/old_header &> old_header_diff + count=`cat old_header_diff | wc -l` + #echo $file " " COUNT " " $count >> diff_headers + if [ "$count" -eq "0" ]; then + echo $file >> clean_files + cat old_header_diff >> clean_files + { head -n +$NNEW scripts/new_header; tail -n +$NOLD1 $file; } > tmp + cp tmp $file + else + head -n +$NNEW $file &> header + diff header scripts/new_header &> new_header_diff + count=`cat new_header_diff | wc -l` + if [ "$count" -eq "0" ]; then + echo $file >> updated_files + else + echo $file >> diff_files + #cat header_diff >> diff_files + tr -d '\n' < diff_files | sed 's|\.\/| |g' &> modify_files + fi + fi done diff --git a/packages/kokkos/simd/src/Kokkos_SIMD.hpp b/packages/kokkos/simd/src/Kokkos_SIMD.hpp index a15a1b8ebf41ae242b6ac0df86dd8cecdae2365c..92807634076ee1719f6c9b2926811cd9fada2f5f 100644 --- a/packages/kokkos/simd/src/Kokkos_SIMD.hpp +++ b/packages/kokkos/simd/src/Kokkos_SIMD.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SIMD_HPP #define KOKKOS_SIMD_HPP @@ -49,10 +21,18 @@ #include <Kokkos_SIMD_Scalar.hpp> +#ifdef KOKKOS_ARCH_AVX2 +#include <Kokkos_SIMD_AVX2.hpp> +#endif + #ifdef KOKKOS_ARCH_AVX512XEON #include <Kokkos_SIMD_AVX512.hpp> #endif +#ifdef __ARM_NEON +#include <Kokkos_SIMD_NEON.hpp> +#endif + namespace Kokkos { namespace Experimental { @@ -62,6 +42,10 @@ namespace Impl { #if defined(KOKKOS_ARCH_AVX512XEON) using host_native = avx512_fixed_size<8>; +#elif defined(KOKKOS_ARCH_AVX2) +using host_native = avx2_fixed_size<4>; +#elif defined(__ARM_NEON) +using host_native = neon_fixed_size<2>; #else using host_native = scalar; #endif @@ -111,9 +95,16 @@ struct ForSpace<Kokkos::Experimental::OpenMPTarget> { }; #endif +#ifdef KOKKOS_ENABLE_OPENACC +template <> +struct ForSpace<Kokkos::Experimental::OpenACC> { + using type = scalar; +}; +#endif + #ifdef KOKKOS_ENABLE_HIP template <> -struct ForSpace<Kokkos::Experimental::HIP> { +struct ForSpace<Kokkos::HIP> { using type = scalar; }; #endif @@ -145,8 +136,12 @@ namespace Impl { template <class... Abis> class abi_set {}; -#ifdef KOKKOS_ARCH_AVX512XEON +#if defined(KOKKOS_ARCH_AVX512XEON) using host_abi_set = abi_set<simd_abi::scalar, simd_abi::avx512_fixed_size<8>>; +#elif defined(KOKKOS_ARCH_AVX2) +using host_abi_set = abi_set<simd_abi::scalar, simd_abi::avx2_fixed_size<4>>; +#elif defined(__ARM_NEON) +using host_abi_set = abi_set<simd_abi::scalar, simd_abi::neon_fixed_size<2>>; #else using host_abi_set = abi_set<simd_abi::scalar>; #endif diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_AVX2.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_AVX2.hpp new file mode 100644 index 0000000000000000000000000000000000000000..86b944efa5408fdf9a886081cc31b81e5441eb1c --- /dev/null +++ b/packages/kokkos/simd/src/Kokkos_SIMD_AVX2.hpp @@ -0,0 +1,1020 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_SIMD_AVX2_HPP +#define KOKKOS_SIMD_AVX2_HPP + +#include <functional> +#include <type_traits> + +#include <Kokkos_SIMD_Common.hpp> + +#include <immintrin.h> + +namespace Kokkos { + +namespace Experimental { + +namespace simd_abi { + +template <int N> +class avx2_fixed_size {}; + +} // namespace simd_abi + +template <> +class simd_mask<double, simd_abi::avx2_fixed_size<4>> { + __m256d m_value; + + public: + class reference { + __m256d& m_mask; + int m_lane; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION __m256d bit_mask() const { + return _mm256_castsi256_pd(_mm256_setr_epi64x( + -std::int64_t(m_lane == 0), -std::int64_t(m_lane == 1), + -std::int64_t(m_lane == 2), -std::int64_t(m_lane == 3))); + } + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(__m256d& mask_arg, + int lane_arg) + : m_mask(mask_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(bool value) const { + if (value) { + m_mask = _mm256_or_pd(bit_mask(), m_mask); + } else { + m_mask = _mm256_andnot_pd(bit_mask(), m_mask); + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const { + return (_mm256_movemask_pd(m_mask) & (1 << m_lane)) != 0; + } + }; + using value_type = bool; + using abi_type = simd_abi::avx2_fixed_size<4>; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(value_type value) + : m_value(_mm256_castsi256_pd(_mm256_set1_epi64x(-std::int64_t(value)))) { + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask( + simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> const& i32_mask); + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 4; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask( + __m256d const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256d() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return static_cast<value_type>( + reference(const_cast<__m256d&>(m_value), int(i))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask + operator||(simd_mask const& other) const { + return simd_mask(_mm256_or_pd(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask + operator&&(simd_mask const& other) const { + return simd_mask(_mm256_and_pd(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask operator!() const { + auto const true_value = static_cast<__m256d>(simd_mask(true)); + return simd_mask(_mm256_andnot_pd(m_value, true_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==( + simd_mask const& other) const { + return _mm256_movemask_pd(m_value) == _mm256_movemask_pd(other.m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=( + simd_mask const& other) const { + return !operator==(other); + } +}; + +template <> +class simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> { + __m128i m_value; + + public: + class reference { + __m128i& m_mask; + int m_lane; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION __m128i bit_mask() const { + return _mm_setr_epi32( + -std::int32_t(m_lane == 0), -std::int32_t(m_lane == 1), + -std::int32_t(m_lane == 2), -std::int32_t(m_lane == 3)); + } + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(__m128i& mask_arg, + int lane_arg) + : m_mask(mask_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(bool value) const { + if (value) { + m_mask = _mm_or_si128(bit_mask(), m_mask); + } else { + m_mask = _mm_andnot_si128(bit_mask(), m_mask); + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const { + return (_mm_movemask_ps(_mm_castsi128_ps(m_mask)) & (1 << m_lane)) != 0; + } + }; + using value_type = bool; + using abi_type = simd_abi::avx2_fixed_size<4>; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(simd_mask const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(simd_mask&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(value_type value) + : m_value(_mm_set1_epi32(-std::int32_t(value))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 4; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask( + __m128i const& value_in) + : m_value(value_in) {} + template <class U> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask( + simd_mask<U, abi_type> const& other) { + for (std::size_t i = 0; i < size(); ++i) (*this)[i] = other[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m128i() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return static_cast<value_type>( + reference(const_cast<__m128i&>(m_value), int(i))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask + operator||(simd_mask const& other) const { + return simd_mask(_mm_or_si128(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask + operator&&(simd_mask const& other) const { + return simd_mask(_mm_and_si128(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask operator!() const { + auto const true_value = static_cast<__m128i>(simd_mask(true)); + return simd_mask(_mm_andnot_si128(m_value, true_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==( + simd_mask const& other) const { + return _mm_movemask_ps(_mm_castsi128_ps(m_value)) == + _mm_movemask_ps(_mm_castsi128_ps(other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=( + simd_mask const& other) const { + return !operator==(other); + } +}; + +template <> +class simd_mask<std::int64_t, simd_abi::avx2_fixed_size<4>> { + __m256i m_value; + + public: + class reference { + __m256i& m_mask; + int m_lane; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION __m256i bit_mask() const { + return _mm256_setr_epi64x( + -std::int64_t(m_lane == 0), -std::int64_t(m_lane == 1), + -std::int64_t(m_lane == 2), -std::int64_t(m_lane == 3)); + } + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(__m256i& mask_arg, + int lane_arg) + : m_mask(mask_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(bool value) const { + if (value) { + m_mask = _mm256_or_si256(bit_mask(), m_mask); + } else { + m_mask = _mm256_andnot_si256(bit_mask(), m_mask); + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const { + return (_mm256_movemask_pd(_mm256_castsi256_pd(m_mask)) & + (1 << m_lane)) != 0; + } + }; + using value_type = bool; + using abi_type = simd_abi::avx2_fixed_size<4>; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(simd_mask const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask(simd_mask&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(value_type value) + : m_value(_mm256_set1_epi64x(-std::int64_t(value))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 4; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask( + __m256i const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask( + simd_mask<std::int32_t, abi_type> const& other) + : m_value(_mm256_cvtepi32_epi64(static_cast<__m128i>(other))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return static_cast<value_type>( + reference(const_cast<__m256i&>(m_value), int(i))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask + operator||(simd_mask const& other) const { + return simd_mask(_mm256_or_si256(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask + operator&&(simd_mask const& other) const { + return simd_mask(_mm256_and_si256(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask operator!() const { + auto const true_value = static_cast<__m256i>(simd_mask(true)); + return simd_mask(_mm256_andnot_si256(m_value, true_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==( + simd_mask const& other) const { + return _mm256_movemask_pd(_mm256_castsi256_pd(m_value)) == + _mm256_movemask_pd(_mm256_castsi256_pd(other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=( + simd_mask const& other) const { + return !operator==(other); + } +}; + +template <> +class simd_mask<std::uint64_t, simd_abi::avx2_fixed_size<4>> { + __m256i m_value; + + public: + class reference { + __m256i& m_mask; + int m_lane; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION __m256i bit_mask() const { + return _mm256_setr_epi64x( + -std::int64_t(m_lane == 0), -std::int64_t(m_lane == 1), + -std::int64_t(m_lane == 2), -std::int64_t(m_lane == 3)); + } + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(__m256i& mask_arg, + int lane_arg) + : m_mask(mask_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(bool value) const { + if (value) { + m_mask = _mm256_or_si256(bit_mask(), m_mask); + } else { + m_mask = _mm256_andnot_si256(bit_mask(), m_mask); + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const { + return (_mm256_movemask_pd(_mm256_castsi256_pd(m_mask)) & + (1 << m_lane)) != 0; + } + }; + using value_type = bool; + using abi_type = simd_abi::avx2_fixed_size<4>; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(value_type value) + : m_value(_mm256_set1_epi64x(-std::int64_t(value))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask( + simd_mask<std::int32_t, abi_type> const& other) + : m_value(_mm256_cvtepi32_epi64(static_cast<__m128i>(other))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 4; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask( + __m256i const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return static_cast<value_type>( + reference(const_cast<__m256i&>(m_value), int(i))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask + operator||(simd_mask const& other) const { + return simd_mask(_mm256_or_si256(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask + operator&&(simd_mask const& other) const { + return simd_mask(_mm256_and_si256(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask operator!() const { + auto const true_value = static_cast<__m256i>(simd_mask(true)); + return simd_mask(_mm256_andnot_si256(m_value, true_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==( + simd_mask const& other) const { + return _mm256_movemask_pd(_mm256_castsi256_pd(m_value)) == + _mm256_movemask_pd(_mm256_castsi256_pd(other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=( + simd_mask const& other) const { + return !operator==(other); + } +}; + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd_mask<double, simd_abi::avx2_fixed_size<4>>::simd_mask( + simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> const& i32_mask) + : m_value(_mm256_castsi256_pd( + _mm256_cvtepi32_epi64(static_cast<__m128i>(i32_mask)))) {} + +template <> +class simd<double, simd_abi::avx2_fixed_size<4>> { + __m256d m_value; + + public: + using value_type = double; + using abi_type = simd_abi::avx2_fixed_size<4>; + using mask_type = simd_mask<value_type, abi_type>; + using reference = value_type&; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 4; + } + template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value) + : m_value(_mm256_set1_pd(value_type(value))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(double a, double b, double c, + double d) + : m_value(_mm256_setr_pd(a, b, c, d)) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd( + __m256d const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reinterpret_cast<value_type*>(&m_value)[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return reinterpret_cast<value_type const*>(&m_value)[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr, + element_aligned_tag) { + m_value = _mm256_loadu_pd(ptr); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to( + value_type* ptr, element_aligned_tag) const { + _mm256_storeu_pd(ptr, m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256d() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<(simd const& other) const { + return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_LT_OS)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>(simd const& other) const { + return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_GT_OS)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<=(simd const& other) const { + return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_LE_OS)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>=(simd const& other) const { + return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_GE_OS)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator==(simd const& other) const { + return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_EQ_OS)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator!=(simd const& other) const { + return mask_type(_mm256_cmp_pd(m_value, other.m_value, _CMP_NEQ_OS)); + } +}; + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::avx2_fixed_size<4>> + operator*(simd<double, simd_abi::avx2_fixed_size<4>> const& lhs, + simd<double, simd_abi::avx2_fixed_size<4>> const& rhs) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_mul_pd(static_cast<__m256d>(lhs), static_cast<__m256d>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::avx2_fixed_size<4>> + operator/(simd<double, simd_abi::avx2_fixed_size<4>> const& lhs, + simd<double, simd_abi::avx2_fixed_size<4>> const& rhs) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_div_pd(static_cast<__m256d>(lhs), static_cast<__m256d>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::avx2_fixed_size<4>> + operator+(simd<double, simd_abi::avx2_fixed_size<4>> const& lhs, + simd<double, simd_abi::avx2_fixed_size<4>> const& rhs) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_add_pd(static_cast<__m256d>(lhs), static_cast<__m256d>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::avx2_fixed_size<4>> + operator-(simd<double, simd_abi::avx2_fixed_size<4>> const& lhs, + simd<double, simd_abi::avx2_fixed_size<4>> const& rhs) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_sub_pd(static_cast<__m256d>(lhs), static_cast<__m256d>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::avx2_fixed_size<4>> + operator-(simd<double, simd_abi::avx2_fixed_size<4>> const& a) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_sub_pd(_mm256_set1_pd(0.0), static_cast<__m256d>(a))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> copysign( + simd<double, simd_abi::avx2_fixed_size<4>> const& a, + simd<double, simd_abi::avx2_fixed_size<4>> const& b) { + __m256d const sign_mask = _mm256_set1_pd(-0.0); + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_xor_pd(_mm256_andnot_pd(sign_mask, static_cast<__m256d>(a)), + _mm256_and_pd(sign_mask, static_cast<__m256d>(b)))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> abs( + simd<double, simd_abi::avx2_fixed_size<4>> const& a) { + __m256d const sign_mask = _mm256_set1_pd(-0.0); + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_andnot_pd(sign_mask, static_cast<__m256d>(a))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> sqrt( + simd<double, simd_abi::avx2_fixed_size<4>> const& a) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_sqrt_pd(static_cast<__m256d>(a))); +} + +#ifdef __INTEL_COMPILER + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> cbrt( + simd<double, simd_abi::avx2_fixed_size<4>> const& a) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_cbrt_pd(static_cast<__m256d>(a))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> exp( + simd<double, simd_abi::avx2_fixed_size<4>> const& a) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_exp_pd(static_cast<__m256d>(a))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> log( + simd<double, simd_abi::avx2_fixed_size<4>> const& a) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_log_pd(static_cast<__m256d>(a))); +} + +#endif + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> fma( + simd<double, simd_abi::avx2_fixed_size<4>> const& a, + simd<double, simd_abi::avx2_fixed_size<4>> const& b, + simd<double, simd_abi::avx2_fixed_size<4>> const& c) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_fmadd_pd(static_cast<__m256d>(a), static_cast<__m256d>(b), + static_cast<__m256d>(c))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> max( + simd<double, simd_abi::avx2_fixed_size<4>> const& a, + simd<double, simd_abi::avx2_fixed_size<4>> const& b) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_max_pd(static_cast<__m256d>(a), static_cast<__m256d>(b))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> min( + simd<double, simd_abi::avx2_fixed_size<4>> const& a, + simd<double, simd_abi::avx2_fixed_size<4>> const& b) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_min_pd(static_cast<__m256d>(a), static_cast<__m256d>(b))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::avx2_fixed_size<4>> condition( + simd_mask<double, simd_abi::avx2_fixed_size<4>> const& a, + simd<double, simd_abi::avx2_fixed_size<4>> const& b, + simd<double, simd_abi::avx2_fixed_size<4>> const& c) { + return simd<double, simd_abi::avx2_fixed_size<4>>( + _mm256_blendv_pd(static_cast<__m256d>(c), static_cast<__m256d>(b), + static_cast<__m256d>(a))); +} + +template <> +class simd<std::int32_t, simd_abi::avx2_fixed_size<4>> { + __m128i m_value; + + public: + using value_type = std::int32_t; + using abi_type = simd_abi::avx2_fixed_size<4>; + using mask_type = simd_mask<value_type, abi_type>; + using reference = value_type&; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 4; + } + template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value) + : m_value(_mm_set1_epi32(value_type(value))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(std::int32_t a, std::int32_t b, + std::int32_t c, std::int32_t d) + : m_value(_mm_setr_epi32(a, b, c, d)) {} + template <class G, + std::enable_if_t< + std::is_invocable_r_v<value_type, G, + std::integral_constant<std::size_t, 0>>, + bool> = false> + KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) + : simd(gen(std::integral_constant<std::size_t, 0>()), + gen(std::integral_constant<std::size_t, 1>()), + gen(std::integral_constant<std::size_t, 2>()), + gen(std::integral_constant<std::size_t, 3>())) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd( + __m128i const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd( + simd<std::uint64_t, abi_type> const& other); + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reinterpret_cast<value_type*>(&m_value)[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return reinterpret_cast<value_type const*>(&m_value)[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr, + element_aligned_tag) { + m_value = _mm_maskload_epi32(ptr, static_cast<__m128i>(mask_type(true))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to( + value_type* ptr, element_aligned_tag) const { + _mm_maskstore_epi32(ptr, static_cast<__m128i>(mask_type(true)), m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m128i() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator==(simd const& other) const { + return mask_type(_mm_cmpeq_epi32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>(simd const& other) const { + return mask_type(_mm_cmpgt_epi32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<(simd const& other) const { + return mask_type(_mm_cmplt_epi32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<=(simd const& other) const { + return ((*this) < other) || ((*this) == other); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>=(simd const& other) const { + return ((*this) > other) || ((*this) == other); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator!=(simd const& other) const { + return !((*this) == other); + } +}; + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> + operator-(simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& lhs, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& rhs) { + return simd<std::int32_t, simd_abi::avx2_fixed_size<4>>( + _mm_sub_epi32(static_cast<__m128i>(lhs), static_cast<__m128i>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> + operator+(simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& lhs, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& rhs) { + return simd<std::int32_t, simd_abi::avx2_fixed_size<4>>( + _mm_add_epi32(static_cast<__m128i>(lhs), static_cast<__m128i>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> + condition(simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> const& a, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& b, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& c) { + return simd<std::int32_t, simd_abi::avx2_fixed_size<4>>(_mm_castps_si128( + _mm_blendv_ps(_mm_castsi128_ps(static_cast<__m128i>(c)), + _mm_castsi128_ps(static_cast<__m128i>(b)), + _mm_castsi128_ps(static_cast<__m128i>(a))))); +} + +template <> +class simd<std::int64_t, simd_abi::avx2_fixed_size<4>> { + __m256i m_value; + + public: + using value_type = std::int64_t; + using abi_type = simd_abi::avx2_fixed_size<4>; + using mask_type = simd_mask<value_type, abi_type>; + using reference = value_type&; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 4; + } + template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value) + : m_value(_mm256_set1_epi64x(value_type(value))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(std::int64_t a, std::int64_t b, + std::int64_t c, std::int64_t d) + : m_value(_mm256_setr_epi64x(a, b, c, d)) {} + template <class G, + std::enable_if_t< + std::is_invocable_r_v<value_type, G, + std::integral_constant<std::size_t, 0>>, + bool> = false> + KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) + : simd(gen(std::integral_constant<std::size_t, 0>()), + gen(std::integral_constant<std::size_t, 1>()), + gen(std::integral_constant<std::size_t, 2>()), + gen(std::integral_constant<std::size_t, 3>())) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd( + __m256i const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd( + simd<std::uint64_t, abi_type> const& other); + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd( + simd<std::int32_t, abi_type> const& other) + : m_value(_mm256_cvtepi32_epi64(static_cast<__m128i>(other))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reinterpret_cast<value_type*>(&m_value)[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return reinterpret_cast<value_type const*>(&m_value)[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr, + element_aligned_tag) { + m_value = _mm256_maskload_epi64(ptr, static_cast<__m256i>(mask_type(true))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to( + value_type* ptr, element_aligned_tag) const { + _mm256_maskstore_epi64(ptr, static_cast<__m256i>(mask_type(true)), m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i() + const { + return m_value; + } + // AVX2 only has eq and gt comparisons for int64 + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator==(simd const& other) const { + return mask_type(_mm256_cmpeq_epi64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>(simd const& other) const { + return mask_type(_mm256_cmpgt_epi64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<(simd const& other) const { + return other > (*this); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<=(simd const& other) const { + return ((*this) < other) || ((*this) == other); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>=(simd const& other) const { + return ((*this) > other) || ((*this) == other); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator!=(simd const& other) const { + return !((*this) == other); + } +}; + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int64_t, simd_abi::avx2_fixed_size<4>> + operator-(simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& lhs, + simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& rhs) { + return simd<std::int64_t, simd_abi::avx2_fixed_size<4>>( + _mm256_sub_epi64(static_cast<__m256i>(lhs), static_cast<__m256i>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int64_t, simd_abi::avx2_fixed_size<4>> + operator-(simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& a) { + return simd<std::int64_t, simd_abi::avx2_fixed_size<4>>(0) - a; +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<std::int64_t, simd_abi::avx2_fixed_size<4>> condition( + simd_mask<std::int64_t, simd_abi::avx2_fixed_size<4>> const& a, + simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& b, + simd<std::int64_t, simd_abi::avx2_fixed_size<4>> const& c) { + return simd<std::int64_t, simd_abi::avx2_fixed_size<4>>(_mm256_castpd_si256( + _mm256_blendv_pd(_mm256_castsi256_pd(static_cast<__m256i>(c)), + _mm256_castsi256_pd(static_cast<__m256i>(b)), + _mm256_castsi256_pd(static_cast<__m256i>(a))))); +} + +template <> +class simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> { + __m256i m_value; + + public: + using value_type = std::uint64_t; + using abi_type = simd_abi::avx2_fixed_size<4>; + using mask_type = simd_mask<value_type, abi_type>; + using reference = value_type&; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 4; + } + template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value) + : m_value(_mm256_set1_epi64x(bit_cast<std::int64_t>(value_type(value)))) { + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr simd(__m256i const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd( + simd<std::int32_t, abi_type> const& other) + : m_value(_mm256_cvtepi32_epi64(static_cast<__m128i>(other))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd( + simd<std::int64_t, abi_type> const& other) + : m_value(static_cast<__m256i>(other)) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reinterpret_cast<value_type*>(&m_value)[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return reinterpret_cast<value_type const*>(&m_value)[i]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd + operator>>(unsigned int rhs) const { + return _mm256_srli_epi64(m_value, rhs); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd operator>>( + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& rhs) const { + return _mm256_srlv_epi64(m_value, + _mm256_cvtepi32_epi64(static_cast<__m128i>(rhs))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd + operator<<(unsigned int rhs) const { + return _mm256_slli_epi64(m_value, rhs); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd operator<<( + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& rhs) const { + return _mm256_sllv_epi64(m_value, + _mm256_cvtepi32_epi64(static_cast<__m128i>(rhs))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd + operator&(simd const& other) const { + return _mm256_and_si256(m_value, other.m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd + operator|(simd const& other) const { + return _mm256_or_si256(m_value, other.m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator __m256i() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator==(simd const& other) const { + return mask_type(_mm256_cmpeq_epi64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator!=(simd const& other) const { + return !((*this) == other); + } +}; + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<std::int64_t, simd_abi::avx2_fixed_size<4>>::simd( + simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& other) + : m_value(static_cast<__m256i>(other)) {} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> condition( + simd_mask<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& a, + simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& b, + simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& c) { + return simd<std::uint64_t, simd_abi::avx2_fixed_size<4>>(_mm256_castpd_si256( + _mm256_blendv_pd(_mm256_castsi256_pd(static_cast<__m256i>(c)), + _mm256_castsi256_pd(static_cast<__m256i>(b)), + _mm256_castsi256_pd(static_cast<__m256i>(a))))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<std::int32_t, simd_abi::avx2_fixed_size<4>>::simd( + simd<std::uint64_t, simd_abi::avx2_fixed_size<4>> const& other) { + for (std::size_t i = 0; i < 4; ++i) { + (*this)[i] = std::int32_t(other[i]); + } +} + +template <> +class const_where_expression<simd_mask<double, simd_abi::avx2_fixed_size<4>>, + simd<double, simd_abi::avx2_fixed_size<4>>> { + public: + using abi_type = simd_abi::avx2_fixed_size<4>; + using value_type = simd<double, abi_type>; + using mask_type = simd_mask<double, abi_type>; + + protected: + value_type& m_value; + mask_type const& m_mask; + + public: + const_where_expression(mask_type const& mask_arg, value_type const& value_arg) + : m_value(const_cast<value_type&>(value_arg)), m_mask(mask_arg) {} + [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr mask_type const& + mask() const { + return m_mask; + } + [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr value_type const& + value() const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void copy_to(double* mem, element_aligned_tag) const { + _mm256_maskstore_pd(mem, _mm256_castpd_si256(static_cast<__m256d>(m_mask)), + static_cast<__m256d>(m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void scatter_to( + double* mem, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& index) const { + for (std::size_t lane = 0; lane < 4; ++lane) { + if (m_mask[lane]) mem[index[lane]] = m_value[lane]; + } + } +}; + +template <> +class where_expression<simd_mask<double, simd_abi::avx2_fixed_size<4>>, + simd<double, simd_abi::avx2_fixed_size<4>>> + : public const_where_expression< + simd_mask<double, simd_abi::avx2_fixed_size<4>>, + simd<double, simd_abi::avx2_fixed_size<4>>> { + public: + where_expression( + simd_mask<double, simd_abi::avx2_fixed_size<4>> const& mask_arg, + simd<double, simd_abi::avx2_fixed_size<4>>& value_arg) + : const_where_expression(mask_arg, value_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void copy_from(double const* mem, element_aligned_tag) { + m_value = value_type(_mm256_maskload_pd( + mem, _mm256_castpd_si256(static_cast<__m256d>(m_mask)))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void gather_from( + double const* mem, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>> const& index) { + m_value = value_type(_mm256_mask_i32gather_pd( + _mm256_set1_pd(0.0), mem, static_cast<__m128i>(index), + static_cast<__m256d>(m_mask), 8)); + } + template <class U, + std::enable_if_t<std::is_convertible_v< + U, simd<double, simd_abi::avx2_fixed_size<4>>>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void operator=(U&& x) { + auto const x_as_value_type = + static_cast<simd<double, simd_abi::avx2_fixed_size<4>>>( + std::forward<U>(x)); + m_value = simd<double, simd_abi::avx2_fixed_size<4>>(_mm256_blendv_pd( + static_cast<__m256d>(m_value), static_cast<__m256d>(x_as_value_type), + static_cast<__m256d>(m_mask))); + } +}; + +template <> +class const_where_expression< + simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>>, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>>> { + public: + using abi_type = simd_abi::avx2_fixed_size<4>; + using value_type = simd<std::int32_t, abi_type>; + using mask_type = simd_mask<std::int32_t, abi_type>; + + protected: + value_type& m_value; + mask_type const& m_mask; + + public: + const_where_expression(mask_type const& mask_arg, value_type const& value_arg) + : m_value(const_cast<value_type&>(value_arg)), m_mask(mask_arg) {} + [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr mask_type const& + mask() const { + return m_mask; + } + [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr value_type const& + value() const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void copy_to(std::int32_t* mem, element_aligned_tag) const { + _mm_maskstore_epi32(mem, static_cast<__m128i>(m_mask), + static_cast<__m128i>(m_value)); + } +}; + +template <> +class where_expression<simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>>, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>>> + : public const_where_expression< + simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>>, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>>> { + public: + where_expression( + simd_mask<std::int32_t, simd_abi::avx2_fixed_size<4>> const& mask_arg, + simd<std::int32_t, simd_abi::avx2_fixed_size<4>>& value_arg) + : const_where_expression(mask_arg, value_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void copy_from(std::int32_t const* mem, element_aligned_tag) { + m_value = value_type(_mm_maskload_epi32(mem, static_cast<__m128i>(m_mask))); + } +}; + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp index 1df0730ac48aa1fa51109942f4c210d84e426f4f..b63bb569bb7573282db1d298988d0041f2929474 100644 --- a/packages/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp +++ b/packages/kokkos/simd/src/Kokkos_SIMD_AVX512.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SIMD_AVX512_HPP #define KOKKOS_SIMD_AVX512_HPP diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_Common.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_Common.hpp index ae2843b3055a6d602460dfb31031807cb7abe7d4..c29d49fb3ab4a781605f0be164b39413ffe9c989 100644 --- a/packages/kokkos/simd/src/Kokkos_SIMD_Common.hpp +++ b/packages/kokkos/simd/src/Kokkos_SIMD_Common.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SIMD_COMMON_HPP #define KOKKOS_SIMD_COMMON_HPP @@ -154,6 +126,44 @@ template <class T> return const_where_expression(mask, value); } +// fallback simd multiplication using generator constructor +// At the time of this writing, this fallback is only used +// to multiply vectors of 64-bit signed integers for the AVX2 backend + +template <class T, class Abi> +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator*( + simd<T, Abi> const& lhs, simd<T, Abi> const& rhs) { + return simd<T, Abi>([&](std::size_t i) { return lhs[i] * rhs[i]; }); +} + +// fallback simd shift using generator constructor +// At the time of this writing, these fallbacks are only used +// to shift vectors of 64-bit unsigned integers for the NEON backend + +template <class T, class U, class Abi> +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator>>( + simd<T, Abi> const& lhs, unsigned int rhs) { + return simd<T, Abi>([&](std::size_t i) { return lhs[i] >> rhs; }); +} + +template <class T, class U, class Abi> +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator<<( + simd<T, Abi> const& lhs, unsigned int rhs) { + return simd<T, Abi>([&](std::size_t i) { return lhs[i] << rhs; }); +} + +template <class T, class U, class Abi> +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator>>( + simd<T, Abi> const& lhs, simd<U, Abi> const& rhs) { + return simd<T, Abi>([&](std::size_t i) { return lhs[i] >> rhs[i]; }); +} + +template <class T, class U, class Abi> +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd<T, Abi> operator<<( + simd<T, Abi> const& lhs, simd<U, Abi> const& rhs) { + return simd<T, Abi>([&](std::size_t i) { return lhs[i] << rhs[i]; }); +} + // The code below provides: // operator@(simd<T, Abi>, Arithmetic) // operator@(Arithmetic, simd<T, Abi>) @@ -323,6 +333,43 @@ template <class T, class Abi> return a == simd_mask<T, Abi>(false); } +template <class T, class Abi> +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION T +hmin(const_where_expression<simd_mask<T, Abi>, simd<T, Abi>> const& x) { + auto const& v = x.value(); + auto const& m = x.mask(); + auto result = Kokkos::reduction_identity<T>::min(); + for (std::size_t i = 0; i < v.size(); ++i) { + if (m[i]) result = Kokkos::min(result, v[i]); + } + return result; +} + +template <class T, class Abi> +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION T +hmax(const_where_expression<simd_mask<T, Abi>, simd<T, Abi>> const& x) { + auto const& v = x.value(); + auto const& m = x.mask(); + auto result = Kokkos::reduction_identity<T>::max(); + for (std::size_t i = 0; i < v.size(); ++i) { + if (m[i]) result = Kokkos::max(result, v[i]); + } + return result; +} + +template <class T, class Abi> +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION T +reduce(const_where_expression<simd_mask<T, Abi>, simd<T, Abi>> const& x, T, + std::plus<>) { + auto const& v = x.value(); + auto const& m = x.mask(); + auto result = Kokkos::reduction_identity<T>::sum(); + for (std::size_t i = 0; i < v.size(); ++i) { + if (m[i]) result += v[i]; + } + return result; +} + } // namespace Experimental template <class T, class Abi> diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_NEON.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_NEON.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2473004098e23e0be990ef9535a1c23d3970aeed --- /dev/null +++ b/packages/kokkos/simd/src/Kokkos_SIMD_NEON.hpp @@ -0,0 +1,995 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#ifndef KOKKOS_SIMD_NEON_HPP +#define KOKKOS_SIMD_NEON_HPP + +#include <functional> +#include <type_traits> + +#include <Kokkos_SIMD_Common.hpp> + +#include <arm_neon.h> + +namespace Kokkos { + +namespace Experimental { + +namespace simd_abi { + +template <int N> +class neon_fixed_size {}; + +} // namespace simd_abi + +namespace Impl { + +template <class Derived, int Bits> +class neon_mask; + +template <class Derived> +class neon_mask<Derived, 64> { + uint64x2_t m_value; + + public: + class reference { + uint64x2_t& m_mask; + int m_lane; + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(uint64x2_t& mask_arg, + int lane_arg) + : m_mask(mask_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(bool value) const { + // this switch statement is needed because the lane argument has to be a + // constant + switch (m_lane) { + case 0: + m_mask = vsetq_lane_u64(value ? 0xFFFFFFFFFFFFFFFFULL : 0, m_mask, 0); + break; + case 1: + m_mask = vsetq_lane_u64(value ? 0xFFFFFFFFFFFFFFFFULL : 0, m_mask, 1); + break; + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const { + switch (m_lane) { + case 0: return vgetq_lane_u64(m_mask, 0) != 0; + case 1: return vgetq_lane_u64(m_mask, 1) != 0; + } + return false; + } + }; + using value_type = bool; + using abi_type = simd_abi::neon_fixed_size<2>; + using implementation_type = uint64x2_t; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit neon_mask(value_type value) + : m_value(vmovq_n_u64(value ? 0xFFFFFFFFFFFFFFFFULL : 0)) {} + template <class U> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask( + neon_mask<U, 32> const& other) { + operator[](0) = bool(other[0]); + operator[](1) = bool(other[1]); + } + template <class U> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask(neon_mask<U, 64> const& other) + : neon_mask(static_cast<uint64x2_t>(other)) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 2; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit neon_mask( + uint64x2_t const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator uint64x2_t() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return static_cast<value_type>( + reference(const_cast<uint64x2_t&>(m_value), int(i))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived + operator||(neon_mask const& other) const { + return Derived(vorrq_u64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived + operator&&(neon_mask const& other) const { + return Derived(vandq_u64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived operator!() const { + auto const true_value = static_cast<uint64x2_t>(neon_mask(true)); + return Derived(veorq_u64(m_value, true_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==( + neon_mask const& other) const { + uint64x2_t const elementwise_equality = vceqq_u64(m_value, other.m_value); + uint32x2_t const narrow_elementwise_equality = + vqmovn_u64(elementwise_equality); + uint64x1_t const overall_equality_neon = + vreinterpret_u64_u32(narrow_elementwise_equality); + uint64_t const overall_equality = vget_lane_u64(overall_equality_neon, 0); + return overall_equality == 0xFFFFFFFFFFFFFFFFULL; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=( + neon_mask const& other) const { + return !operator==(other); + } +}; + +template <class Derived> +class neon_mask<Derived, 32> { + uint32x2_t m_value; + + public: + class reference { + uint32x2_t& m_mask; + int m_lane; + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(uint32x2_t& mask_arg, + int lane_arg) + : m_mask(mask_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(bool value) const { + switch (m_lane) { + case 0: + m_mask = vset_lane_u32(value ? 0xFFFFFFFFU : 0, m_mask, 0); + break; + case 1: + m_mask = vset_lane_u32(value ? 0xFFFFFFFFU : 0, m_mask, 1); + break; + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator bool() const { + switch (m_lane) { + case 0: return vget_lane_u32(m_mask, 0) != 0; + case 1: return vget_lane_u32(m_mask, 1) != 0; + } + return false; + } + }; + using value_type = bool; + using abi_type = simd_abi::neon_fixed_size<2>; + using implementation_type = uint32x2_t; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit neon_mask(value_type value) + : m_value(vmov_n_u32(value ? 0xFFFFFFFFU : 0)) {} + template <class U> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask(neon_mask<U, 64> const& other) + : m_value(vqmovn_u64(static_cast<uint64x2_t>(other))) {} + template <class U> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION neon_mask(neon_mask<U, 32> const& other) + : m_value(static_cast<uint32x2_t>(other)) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 2; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit neon_mask( + uint32x2_t const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator uint32x2_t() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return static_cast<value_type>( + reference(const_cast<uint32x2_t&>(m_value), int(i))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived + operator||(neon_mask const& other) const { + return Derived(vorr_u32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived + operator&&(neon_mask const& other) const { + return Derived(vand_u32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION Derived operator!() const { + auto const true_value = static_cast<uint32x2_t>(neon_mask(true)); + return Derived(veor_u32(m_value, true_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator==( + neon_mask const& other) const { + uint32x2_t const elementwise_equality = vceq_u32(m_value, other.m_value); + uint64x1_t const overall_equality_neon = + vreinterpret_u64_u32(elementwise_equality); + uint64_t const overall_equality = vget_lane_u64(overall_equality_neon, 0); + return overall_equality == 0xFFFFFFFFFFFFFFFFULL; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION bool operator!=( + neon_mask const& other) const { + return !operator==(other); + } +}; + +} // namespace Impl + +template <class T> +class simd_mask<T, simd_abi::neon_fixed_size<2>> + : public Impl::neon_mask<simd_mask<T, simd_abi::neon_fixed_size<2>>, + sizeof(T) * 8> { + using base_type = Impl::neon_mask<simd_mask<T, simd_abi::neon_fixed_size<2>>, + sizeof(T) * 8>; + + public: + using implementation_type = typename base_type::implementation_type; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd_mask(bool value) + : base_type(value) {} + template <class U> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd_mask( + simd_mask<U, simd_abi::neon_fixed_size<2>> const& other) + : base_type(other) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd_mask( + implementation_type const& value) + : base_type(value) {} +}; + +template <> +class simd<double, simd_abi::neon_fixed_size<2>> { + float64x2_t m_value; + + public: + using value_type = double; + using abi_type = simd_abi::neon_fixed_size<2>; + using mask_type = simd_mask<value_type, abi_type>; + class reference { + float64x2_t& m_value; + int m_lane; + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(float64x2_t& mask_arg, + int lane_arg) + : m_value(mask_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(double value) const { + switch (m_lane) { + case 0: m_value = vsetq_lane_f64(value, m_value, 0); break; + case 1: m_value = vsetq_lane_f64(value, m_value, 1); break; + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator double() const { + switch (m_lane) { + case 0: return vgetq_lane_f64(m_value, 0); + case 1: return vgetq_lane_f64(m_value, 1); + } + return 0; + } + }; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 2; + } + template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value) + : m_value(vmovq_n_f64(value_type(value))) {} + template <class G, + std::enable_if_t< + // basically, can you do { value_type r = + // gen(std::integral_constant<std::size_t, i>()); } + std::is_invocable_r_v<value_type, G, + std::integral_constant<std::size_t, 0>>, + bool> = false> + KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) { + m_value = vsetq_lane_f64(gen(std::integral_constant<std::size_t, 0>()), + m_value, 0); + m_value = vsetq_lane_f64(gen(std::integral_constant<std::size_t, 1>()), + m_value, 1); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd( + float64x2_t const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return reference(const_cast<simd*>(this)->m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr, + element_aligned_tag) { + m_value = vld1q_f64(ptr); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to( + value_type* ptr, element_aligned_tag) const { + vst1q_f64(ptr, m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit + operator float64x2_t() const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<(simd const& other) const { + return mask_type(vcltq_f64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>(simd const& other) const { + return mask_type(vcgtq_f64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<=(simd const& other) const { + return mask_type(vcleq_f64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>=(simd const& other) const { + return mask_type(vcgeq_f64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator==(simd const& other) const { + return mask_type(vceqq_f64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator!=(simd const& other) const { + return !(operator==(other)); + } +}; + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::neon_fixed_size<2>> + operator*(simd<double, simd_abi::neon_fixed_size<2>> const& lhs, + simd<double, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vmulq_f64(static_cast<float64x2_t>(lhs), static_cast<float64x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::neon_fixed_size<2>> + operator/(simd<double, simd_abi::neon_fixed_size<2>> const& lhs, + simd<double, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vdivq_f64(static_cast<float64x2_t>(lhs), static_cast<float64x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::neon_fixed_size<2>> + operator+(simd<double, simd_abi::neon_fixed_size<2>> const& lhs, + simd<double, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vaddq_f64(static_cast<float64x2_t>(lhs), static_cast<float64x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::neon_fixed_size<2>> + operator-(simd<double, simd_abi::neon_fixed_size<2>> const& lhs, + simd<double, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vsubq_f64(static_cast<float64x2_t>(lhs), static_cast<float64x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::neon_fixed_size<2>> + operator-(simd<double, simd_abi::neon_fixed_size<2>> const& a) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vnegq_f64(static_cast<float64x2_t>(a))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::neon_fixed_size<2>> abs( + simd<double, simd_abi::neon_fixed_size<2>> const& a) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vabsq_f64(static_cast<float64x2_t>(a))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::neon_fixed_size<2>> copysign( + simd<double, simd_abi::neon_fixed_size<2>> const& a, + simd<double, simd_abi::neon_fixed_size<2>> const& b) { + uint64x2_t const sign_mask = vreinterpretq_u64_f64(vmovq_n_f64(-0.0)); + return simd<double, simd_abi::neon_fixed_size<2>>(vreinterpretq_f64_u64( + vorrq_u64(vreinterpretq_u64_f64(static_cast<float64x2_t>(abs(a))), + vandq_u64(sign_mask, vreinterpretq_u64_f64( + static_cast<float64x2_t>(b)))))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::neon_fixed_size<2>> sqrt( + simd<double, simd_abi::neon_fixed_size<2>> const& a) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vsqrtq_f64(static_cast<float64x2_t>(a))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::neon_fixed_size<2>> fma( + simd<double, simd_abi::neon_fixed_size<2>> const& a, + simd<double, simd_abi::neon_fixed_size<2>> const& b, + simd<double, simd_abi::neon_fixed_size<2>> const& c) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vfmaq_f64(static_cast<float64x2_t>(c), static_cast<float64x2_t>(b), + static_cast<float64x2_t>(a))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::neon_fixed_size<2>> max( + simd<double, simd_abi::neon_fixed_size<2>> const& a, + simd<double, simd_abi::neon_fixed_size<2>> const& b) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vmaxq_f64(static_cast<float64x2_t>(a), static_cast<float64x2_t>(b))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<double, simd_abi::neon_fixed_size<2>> min( + simd<double, simd_abi::neon_fixed_size<2>> const& a, + simd<double, simd_abi::neon_fixed_size<2>> const& b) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vminq_f64(static_cast<float64x2_t>(a), static_cast<float64x2_t>(b))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<double, simd_abi::neon_fixed_size<2>> + condition(simd_mask<double, simd_abi::neon_fixed_size<2>> const& a, + simd<double, simd_abi::neon_fixed_size<2>> const& b, + simd<double, simd_abi::neon_fixed_size<2>> const& c) { + return simd<double, simd_abi::neon_fixed_size<2>>( + vbslq_f64(static_cast<uint64x2_t>(a), static_cast<float64x2_t>(b), + static_cast<float64x2_t>(c))); +} + +template <> +class simd<std::int32_t, simd_abi::neon_fixed_size<2>> { + int32x2_t m_value; + + public: + using value_type = std::int32_t; + using abi_type = simd_abi::neon_fixed_size<2>; + using mask_type = simd_mask<value_type, abi_type>; + class reference { + int32x2_t& m_value; + int m_lane; + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(int32x2_t& value_arg, + int lane_arg) + : m_value(value_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(std::int32_t value) const { + switch (m_lane) { + case 0: m_value = vset_lane_s32(value, m_value, 0); break; + case 1: m_value = vset_lane_s32(value, m_value, 1); break; + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator std::int32_t() const { + switch (m_lane) { + case 0: return vget_lane_s32(m_value, 0); + case 1: return vget_lane_s32(m_value, 1); + } + return 0; + } + }; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 2; + } + template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value) + : m_value(vmov_n_s32(value_type(value))) {} + template <class G, + std::enable_if_t< + std::is_invocable_r_v<value_type, G, + std::integral_constant<std::size_t, 0>>, + bool> = false> + KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) { + m_value = vset_lane_s32(gen(std::integral_constant<std::size_t, 0>()), + m_value, 0); + m_value = vset_lane_s32(gen(std::integral_constant<std::size_t, 1>()), + m_value, 1); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd( + int32x2_t const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd( + simd<std::uint64_t, abi_type> const& other); + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return reference(const_cast<simd*>(this)->m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr, + element_aligned_tag) { + m_value = vld1_s32(ptr); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to( + value_type* ptr, element_aligned_tag) const { + vst1_s32(ptr, m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator int32x2_t() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator==(simd const& other) const { + return mask_type(vceq_s32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>(simd const& other) const { + return mask_type(vcgt_s32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<(simd const& other) const { + return mask_type(vclt_s32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<=(simd const& other) const { + return mask_type(vcle_s32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>=(simd const& other) const { + return mask_type(vcge_s32(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator!=(simd const& other) const { + return !((*this) == other); + } +}; + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int32_t, simd_abi::neon_fixed_size<2>> + operator-(simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& a) { + return simd<std::int32_t, simd_abi::neon_fixed_size<2>>( + vneg_s32(static_cast<int32x2_t>(a))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int32_t, simd_abi::neon_fixed_size<2>> + operator-(simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& lhs, + simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<std::int32_t, simd_abi::neon_fixed_size<2>>( + vsub_s32(static_cast<int32x2_t>(lhs), static_cast<int32x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int32_t, simd_abi::neon_fixed_size<2>> + operator+(simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& lhs, + simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<std::int32_t, simd_abi::neon_fixed_size<2>>( + vadd_s32(static_cast<int32x2_t>(lhs), static_cast<int32x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int32_t, simd_abi::neon_fixed_size<2>> + condition(simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>> const& a, + simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& b, + simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& c) { + return simd<std::int32_t, simd_abi::neon_fixed_size<2>>( + vbsl_s32(static_cast<uint32x2_t>(a), static_cast<int32x2_t>(b), + static_cast<int32x2_t>(c))); +} + +template <> +class simd<std::int64_t, simd_abi::neon_fixed_size<2>> { + int64x2_t m_value; + + public: + using value_type = std::int64_t; + using abi_type = simd_abi::neon_fixed_size<2>; + using mask_type = simd_mask<value_type, abi_type>; + class reference { + int64x2_t& m_value; + int m_lane; + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(int64x2_t& value_arg, + int lane_arg) + : m_value(value_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(std::int64_t value) const { + switch (m_lane) { + case 0: m_value = vsetq_lane_s64(value, m_value, 0); break; + case 1: m_value = vsetq_lane_s64(value, m_value, 1); break; + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator std::int64_t() const { + switch (m_lane) { + case 0: return vgetq_lane_s64(m_value, 0); + case 1: return vgetq_lane_s64(m_value, 1); + } + return 0; + } + }; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 2; + } + template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value) + : m_value(vmovq_n_s64(value_type(value))) {} + template <class G, + std::enable_if_t< + std::is_invocable_r_v<value_type, G, + std::integral_constant<std::size_t, 0>>, + bool> = false> + KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) { + m_value = vsetq_lane_s64(gen(std::integral_constant<std::size_t, 0>()), + m_value, 0); + m_value = vsetq_lane_s64(gen(std::integral_constant<std::size_t, 1>()), + m_value, 1); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd( + int64x2_t const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd( + simd<std::uint64_t, abi_type> const&); + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return reference(const_cast<simd*>(this)->m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_from(value_type const* ptr, + element_aligned_tag) { + m_value = vld1q_s64(ptr); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void copy_to( + value_type* ptr, element_aligned_tag) const { + vst1q_s64(ptr, m_value); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator int64x2_t() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator==(simd const& other) const { + return mask_type(vceqq_s64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>(simd const& other) const { + return mask_type(vcgtq_s64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<(simd const& other) const { + return mask_type(vcltq_s64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator<=(simd const& other) const { + return mask_type(vcleq_s64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator>=(simd const& other) const { + return mask_type(vcgeq_s64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator!=(simd const& other) const { + return !((*this) == other); + } +}; + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int64_t, simd_abi::neon_fixed_size<2>> + operator-(simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& a) { + return simd<std::int64_t, simd_abi::neon_fixed_size<2>>( + vnegq_s64(static_cast<int64x2_t>(a))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int64_t, simd_abi::neon_fixed_size<2>> + operator-(simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& lhs, + simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<std::int64_t, simd_abi::neon_fixed_size<2>>( + vsubq_s64(static_cast<int64x2_t>(lhs), static_cast<int64x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int64_t, simd_abi::neon_fixed_size<2>> + operator+(simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& lhs, + simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<std::int64_t, simd_abi::neon_fixed_size<2>>( + vaddq_s64(static_cast<int64x2_t>(lhs), static_cast<int64x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::int64_t, simd_abi::neon_fixed_size<2>> + condition(simd_mask<std::int64_t, simd_abi::neon_fixed_size<2>> const& a, + simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& b, + simd<std::int64_t, simd_abi::neon_fixed_size<2>> const& c) { + return simd<std::int64_t, simd_abi::neon_fixed_size<2>>( + vbslq_s64(static_cast<uint64x2_t>(a), static_cast<int64x2_t>(b), + static_cast<int64x2_t>(c))); +} + +template <> +class simd<std::uint64_t, simd_abi::neon_fixed_size<2>> { + uint64x2_t m_value; + + public: + using value_type = std::uint64_t; + using abi_type = simd_abi::neon_fixed_size<2>; + using mask_type = simd_mask<value_type, abi_type>; + class reference { + uint64x2_t& m_value; + int m_lane; + + public: + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference(uint64x2_t& value_arg, + int lane_arg) + : m_value(value_arg), m_lane(lane_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference + operator=(std::uint64_t value) const { + switch (m_lane) { + case 0: m_value = vsetq_lane_u64(value, m_value, 0); break; + case 1: m_value = vsetq_lane_u64(value, m_value, 1); break; + } + return *this; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION operator std::uint64_t() const { + switch (m_lane) { + case 0: return vgetq_lane_u64(m_value, 0); + case 1: return vgetq_lane_u64(m_value, 1); + } + return 0; + } + }; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd() = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd const&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd& operator=(simd&&) = default; + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION static constexpr std::size_t size() { + return 2; + } + template <class U, std::enable_if_t<std::is_convertible_v<U, value_type>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd(U&& value) + : m_value(vmovq_n_u64(value_type(value))) {} + template <class G, + std::enable_if_t< + std::is_invocable_r_v<value_type, G, + std::integral_constant<std::size_t, 0>>, + bool> = false> + KOKKOS_FORCEINLINE_FUNCTION simd(G&& gen) { + m_value = vsetq_lane_u64(gen(std::integral_constant<std::size_t, 0>()), + m_value, 0); + m_value = vsetq_lane_u64(gen(std::integral_constant<std::size_t, 1>()), + m_value, 1); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit simd( + uint64x2_t const& value_in) + : m_value(value_in) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION explicit simd( + simd<std::int32_t, abi_type> const& other) + : m_value( + vreinterpretq_u64_s64(vmovl_s32(static_cast<int32x2_t>(other)))) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION reference operator[](std::size_t i) { + return reference(m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION value_type + operator[](std::size_t i) const { + return reference(const_cast<simd*>(this)->m_value, int(i)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd + operator&(simd const& other) const { + return simd(vandq_u64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd + operator|(simd const& other) const { + return simd(vorrq_u64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr explicit operator uint64x2_t() + const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd + operator<<(unsigned int rhs) const { + return simd(vshlq_u64(m_value, vmovq_n_s64(std::int64_t(rhs)))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION simd + operator>>(unsigned int rhs) const { + return simd(vshlq_u64(m_value, vmovq_n_s64(-std::int64_t(rhs)))); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator==(simd const& other) const { + return mask_type(vceqq_u64(m_value, other.m_value)); + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION mask_type + operator!=(simd const& other) const { + return !((*this) == other); + } +}; + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> + operator-(simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& lhs, + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<std::uint64_t, simd_abi::neon_fixed_size<2>>( + vsubq_u64(static_cast<uint64x2_t>(lhs), static_cast<uint64x2_t>(rhs))); +} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> + operator+(simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& lhs, + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& rhs) { + return simd<std::uint64_t, simd_abi::neon_fixed_size<2>>( + vaddq_u64(static_cast<uint64x2_t>(lhs), static_cast<uint64x2_t>(rhs))); +} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<std::int32_t, simd_abi::neon_fixed_size<2>>::simd( + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& other) + : m_value( + vmovn_s64(vreinterpretq_s64_u64(static_cast<uint64x2_t>(other)))) {} + +KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION +simd<std::int64_t, simd_abi::neon_fixed_size<2>>::simd( + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& other) + : m_value(vreinterpretq_s64_u64(static_cast<uint64x2_t>(other))) {} + +[[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> + condition(simd_mask<std::uint64_t, simd_abi::neon_fixed_size<2>> const& a, + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& b, + simd<std::uint64_t, simd_abi::neon_fixed_size<2>> const& c) { + return simd<std::uint64_t, simd_abi::neon_fixed_size<2>>( + vbslq_u64(static_cast<uint64x2_t>(a), static_cast<uint64x2_t>(b), + static_cast<uint64x2_t>(c))); +} + +template <> +class const_where_expression<simd_mask<double, simd_abi::neon_fixed_size<2>>, + simd<double, simd_abi::neon_fixed_size<2>>> { + public: + using abi_type = simd_abi::neon_fixed_size<2>; + using value_type = simd<double, abi_type>; + using mask_type = simd_mask<double, abi_type>; + + protected: + value_type& m_value; + mask_type const& m_mask; + + public: + const_where_expression(mask_type const& mask_arg, value_type const& value_arg) + : m_value(const_cast<value_type&>(value_arg)), m_mask(mask_arg) {} + [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr mask_type const& + mask() const { + return m_mask; + } + [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr value_type const& + value() const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void copy_to(double* mem, element_aligned_tag) const { + if (m_mask[0]) mem[0] = m_value[0]; + if (m_mask[1]) mem[1] = m_value[1]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void scatter_to( + double* mem, + simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& index) const { + if (m_mask[0]) mem[index[0]] = m_value[0]; + if (m_mask[1]) mem[index[1]] = m_value[1]; + } +}; + +template <> +class where_expression<simd_mask<double, simd_abi::neon_fixed_size<2>>, + simd<double, simd_abi::neon_fixed_size<2>>> + : public const_where_expression< + simd_mask<double, simd_abi::neon_fixed_size<2>>, + simd<double, simd_abi::neon_fixed_size<2>>> { + public: + where_expression( + simd_mask<double, simd_abi::neon_fixed_size<2>> const& mask_arg, + simd<double, simd_abi::neon_fixed_size<2>>& value_arg) + : const_where_expression(mask_arg, value_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void copy_from(double const* mem, element_aligned_tag) { + if (m_mask[0]) m_value[0] = mem[0]; + if (m_mask[1]) m_value[1] = mem[1]; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void gather_from( + double const* mem, + simd<std::int32_t, simd_abi::neon_fixed_size<2>> const& index) { + if (m_mask[0]) m_value[0] = mem[index[0]]; + if (m_mask[1]) m_value[1] = mem[index[1]]; + } + template <class U, + std::enable_if_t<std::is_convertible_v< + U, simd<double, simd_abi::neon_fixed_size<2>>>, + bool> = false> + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION void operator=(U&& x) { + auto const x_as_value_type = + static_cast<simd<double, simd_abi::neon_fixed_size<2>>>( + std::forward<U>(x)); + m_value = static_cast<simd<double, simd_abi::neon_fixed_size<2>>>( + vbslq_f64(static_cast<uint64x2_t>(m_mask), + static_cast<float64x2_t>(x_as_value_type), + static_cast<float64x2_t>(m_value))); + } +}; + +template <> +class const_where_expression< + simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>>, + simd<std::int32_t, simd_abi::neon_fixed_size<2>>> { + public: + using abi_type = simd_abi::neon_fixed_size<2>; + using value_type = simd<std::int32_t, abi_type>; + using mask_type = simd_mask<std::int32_t, abi_type>; + + protected: + value_type& m_value; + mask_type const& m_mask; + + public: + const_where_expression(mask_type const& mask_arg, value_type const& value_arg) + : m_value(const_cast<value_type&>(value_arg)), m_mask(mask_arg) {} + [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr mask_type const& + mask() const { + return m_mask; + } + [[nodiscard]] KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION constexpr value_type const& + value() const { + return m_value; + } + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void copy_to(std::int32_t* mem, element_aligned_tag) const { + if (m_mask[0]) mem[0] = m_value[0]; + if (m_mask[1]) mem[1] = m_value[1]; + } +}; + +template <> +class where_expression<simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>>, + simd<std::int32_t, simd_abi::neon_fixed_size<2>>> + : public const_where_expression< + simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>>, + simd<std::int32_t, simd_abi::neon_fixed_size<2>>> { + public: + where_expression( + simd_mask<std::int32_t, simd_abi::neon_fixed_size<2>> const& mask_arg, + simd<std::int32_t, simd_abi::neon_fixed_size<2>>& value_arg) + : const_where_expression(mask_arg, value_arg) {} + KOKKOS_IMPL_HOST_FORCEINLINE_FUNCTION + void copy_from(std::int32_t const* mem, element_aligned_tag) { + if (m_mask[0]) m_value[0] = mem[0]; + if (m_mask[1]) m_value[1] = mem[1]; + } +}; + +} // namespace Experimental +} // namespace Kokkos + +#endif diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp b/packages/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp index f0d06695e50750874a68aa68af0f06e61c688feb..e878eec296880d8383761e3449494b74e8b216e8 100644 --- a/packages/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp +++ b/packages/kokkos/simd/src/Kokkos_SIMD_Scalar.hpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #ifndef KOKKOS_SIMD_SCALAR_HPP #define KOKKOS_SIMD_SCALAR_HPP @@ -322,11 +294,11 @@ class where_expression<simd_mask<T, simd_abi::scalar>, } }; -template <class T, class BinaryOp> +template <class T> [[nodiscard]] KOKKOS_FORCEINLINE_FUNCTION T reduce(const_where_expression<simd_mask<T, simd_abi::scalar>, simd<T, simd_abi::scalar>> const& x, - T identity_element, BinaryOp) { + T identity_element, std::plus<>) { return static_cast<bool>(x.mask()) ? static_cast<T>(x.value()) : identity_element; } diff --git a/packages/kokkos/simd/src/Kokkos_SIMD_dummy.cpp b/packages/kokkos/simd/src/Kokkos_SIMD_dummy.cpp index d273cb6d54d70f2e816c341525eee366744ae6b8..8d14900dba80c936d8c6c6145ec7f16ed1ab5706 100644 --- a/packages/kokkos/simd/src/Kokkos_SIMD_dummy.cpp +++ b/packages/kokkos/simd/src/Kokkos_SIMD_dummy.cpp @@ -1,3 +1,19 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + // This file is needed in order to get the linker language // for the header only submodule. // While we set the language properties in our normal cmake diff --git a/packages/kokkos/simd/unit_tests/TestSIMD.cpp b/packages/kokkos/simd/unit_tests/TestSIMD.cpp index fdf72e91c84af4c8ba757703aa2fe7353b3d9e62..92c77033b9a84eecdb0c0782ae86619ea1272318 100644 --- a/packages/kokkos/simd/unit_tests/TestSIMD.cpp +++ b/packages/kokkos/simd/unit_tests/TestSIMD.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> @@ -198,7 +170,7 @@ void host_check_binary_op_one_loader(BinaryOp binary_op, std::size_t n, simd_type expected_result; for (std::size_t lane = 0; lane < nlanes; ++lane) { expected_result[lane] = - binary_op.on_host(first_arg[lane], second_arg[lane]); + binary_op.on_host(T(first_arg[lane]), T(second_arg[lane])); } simd_type const computed_result = binary_op.on_host(first_arg, second_arg); host_check_equality(expected_result, computed_result, nlanes); @@ -317,6 +289,70 @@ inline void host_check_math_ops() { host_check_binary_op_all_loaders<Abi>(divides(), n, first_args, second_args); } +template <class Abi> +inline void host_check_mask_ops() { + using mask_type = Kokkos::Experimental::simd_mask<double, Abi>; + EXPECT_FALSE(none_of(mask_type(true))); + EXPECT_TRUE(none_of(mask_type(false))); + EXPECT_TRUE(all_of(mask_type(true))); + EXPECT_FALSE(all_of(mask_type(false))); +} + +template <class Abi> +inline void host_check_conversions() { + { + auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(1); + auto b = Kokkos::Experimental::simd<std::int64_t, Abi>(a); + EXPECT_TRUE(all_of(b == decltype(b)(1))); + } + { + auto a = Kokkos::Experimental::simd<std::int32_t, Abi>(1); + auto b = Kokkos::Experimental::simd<std::uint64_t, Abi>(a); + EXPECT_TRUE(all_of(b == decltype(b)(1))); + } + { + auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(1); + auto b = Kokkos::Experimental::simd<std::int32_t, Abi>(a); + EXPECT_TRUE(all_of(b == decltype(b)(1))); + } + { + auto a = Kokkos::Experimental::simd_mask<double, Abi>(true); + auto b = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(a); + EXPECT_TRUE(b == decltype(b)(true)); + } + { + auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true); + auto b = Kokkos::Experimental::simd_mask<std::uint64_t, Abi>(a); + EXPECT_TRUE(b == decltype(b)(true)); + } + { + auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true); + auto b = Kokkos::Experimental::simd_mask<std::int64_t, Abi>(a); + EXPECT_TRUE(b == decltype(b)(true)); + } + { + auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true); + auto b = Kokkos::Experimental::simd_mask<double, Abi>(a); + EXPECT_TRUE(b == decltype(b)(true)); + } +} + +template <class Abi> +inline void host_check_shifts() { + auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(8); + auto b = a >> 1; + EXPECT_TRUE(all_of(b == decltype(b)(4))); +} + +template <class Abi> +inline void host_check_condition() { + auto a = Kokkos::Experimental::condition( + Kokkos::Experimental::simd<std::int32_t, Abi>(1) > 0, + Kokkos::Experimental::simd<std::uint64_t, Abi>(16), + Kokkos::Experimental::simd<std::uint64_t, Abi>(20)); + EXPECT_TRUE(all_of(a == decltype(a)(16))); +} + template <class Abi> KOKKOS_INLINE_FUNCTION void device_check_math_ops() { std::size_t constexpr n = 11; @@ -330,14 +366,90 @@ KOKKOS_INLINE_FUNCTION void device_check_math_ops() { second_args); } +template <class Abi> +KOKKOS_INLINE_FUNCTION void device_check_mask_ops() { + using mask_type = Kokkos::Experimental::simd_mask<double, Abi>; + kokkos_checker checker; + checker.truth(!none_of(mask_type(true))); + checker.truth(none_of(mask_type(false))); + checker.truth(all_of(mask_type(true))); + checker.truth(!all_of(mask_type(false))); +} + +template <class Abi> +KOKKOS_INLINE_FUNCTION void device_check_conversions() { + kokkos_checker checker; + { + auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(1); + auto b = Kokkos::Experimental::simd<std::int64_t, Abi>(a); + checker.truth(all_of(b == decltype(b)(1))); + } + { + auto a = Kokkos::Experimental::simd<std::int32_t, Abi>(1); + auto b = Kokkos::Experimental::simd<std::uint64_t, Abi>(a); + checker.truth(all_of(b == decltype(b)(1))); + } + { + auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(1); + auto b = Kokkos::Experimental::simd<std::int32_t, Abi>(a); + checker.truth(all_of(b == decltype(b)(1))); + } + { + auto a = Kokkos::Experimental::simd_mask<double, Abi>(true); + auto b = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(a); + checker.truth(b == decltype(b)(true)); + } + { + auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true); + auto b = Kokkos::Experimental::simd_mask<std::uint64_t, Abi>(a); + checker.truth(b == decltype(b)(true)); + } + { + auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true); + auto b = Kokkos::Experimental::simd_mask<std::int64_t, Abi>(a); + checker.truth(b == decltype(b)(true)); + } + { + auto a = Kokkos::Experimental::simd_mask<std::int32_t, Abi>(true); + auto b = Kokkos::Experimental::simd_mask<double, Abi>(a); + checker.truth(b == decltype(b)(true)); + } +} + +template <class Abi> +KOKKOS_INLINE_FUNCTION void device_check_shifts() { + kokkos_checker checker; + auto a = Kokkos::Experimental::simd<std::uint64_t, Abi>(8); + auto b = a >> 1; + checker.truth(all_of(b == decltype(b)(4))); +} + +template <class Abi> +KOKKOS_INLINE_FUNCTION void device_check_condition() { + kokkos_checker checker; + auto a = Kokkos::Experimental::condition( + Kokkos::Experimental::simd<std::int32_t, Abi>(1) > 0, + Kokkos::Experimental::simd<std::uint64_t, Abi>(16), + Kokkos::Experimental::simd<std::uint64_t, Abi>(20)); + checker.truth(all_of(a == decltype(a)(16))); +} + template <class Abi> inline void host_check_abi() { host_check_math_ops<Abi>(); + host_check_mask_ops<Abi>(); + host_check_conversions<Abi>(); + host_check_shifts<Abi>(); + host_check_condition<Abi>(); } template <class Abi> KOKKOS_INLINE_FUNCTION void device_check_abi() { device_check_math_ops<Abi>(); + device_check_mask_ops<Abi>(); + device_check_conversions<Abi>(); + device_check_shifts<Abi>(); + device_check_condition<Abi>(); } inline void host_check_abis(Kokkos::Experimental::Impl::abi_set<>) {} @@ -374,3 +486,32 @@ TEST(simd, device) { Kokkos::parallel_for(Kokkos::RangePolicy<Kokkos::IndexType<int>>(0, 1), simd_device_functor()); } + +TEST(simd, test_size) { +#if defined(KOKKOS_ARCH_AVX512XEON) + constexpr auto width = 8; + using Abi = Kokkos::Experimental::simd_abi::avx512_fixed_size<width>; + static_assert(width == + Kokkos::Experimental::simd<std::uint32_t, Abi>::size()); + +#elif defined(KOKKOS_ARCH_AVX2) + constexpr auto width = 4; + using Abi = Kokkos::Experimental::simd_abi::avx2_fixed_size<width>; + +#elif defined(__ARM_NEON) + constexpr auto width = 2; + using Abi = Kokkos::Experimental::simd_abi::neon_fixed_size<width>; + +#else + constexpr auto width = 1; + using Abi = Kokkos::Experimental::simd_abi::scalar; + static_assert(width == + Kokkos::Experimental::simd<std::uint32_t, Abi>::size()); +#endif + + static_assert(width == Kokkos::Experimental::simd<double, Abi>::size()); + static_assert(width == Kokkos::Experimental::simd<std::int64_t, Abi>::size()); + static_assert(width == + Kokkos::Experimental::simd<std::uint64_t, Abi>::size()); + static_assert(width == Kokkos::Experimental::simd<std::int32_t, Abi>::size()); +} diff --git a/packages/kokkos/simd/unit_tests/UnitTestMain.cpp b/packages/kokkos/simd/unit_tests/UnitTestMain.cpp index e245aad35fc33a595a16f711dbd4a63a0c7f8948..11a1cb717a3414b42aec8cda20e13be5ab99ce09 100644 --- a/packages/kokkos/simd/unit_tests/UnitTestMain.cpp +++ b/packages/kokkos/simd/unit_tests/UnitTestMain.cpp @@ -1,46 +1,18 @@ -/* //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering // Solutions of Sandia, LLC (NTESS). // // Under the terms of Contract DE-NA0003525 with NTESS, // the U.S. Government retains certain rights in this software. // -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the Corporation nor the names of the -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Questions? Contact Christian R. Trott (crtrott@sandia.gov) -// -// ************************************************************************ //@HEADER -*/ #include <gtest/gtest.h> #include <Kokkos_Core.hpp> diff --git a/packages/kokkos/tpls/desul/Config.hpp.cmake.in b/packages/kokkos/tpls/desul/Config.hpp.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..40ab5c1c6cb1f4a042b945202434594a8f810181 --- /dev/null +++ b/packages/kokkos/tpls/desul/Config.hpp.cmake.in @@ -0,0 +1,17 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_CONFIG_HPP_ +#define DESUL_ATOMICS_CONFIG_HPP_ + +#cmakedefine DESUL_ATOMICS_ENABLE_CUDA +#cmakedefine DESUL_ATOMICS_ENABLE_HIP +#cmakedefine DESUL_ATOMICS_ENABLE_SYCL +#cmakedefine DESUL_ATOMICS_ENABLE_OPENMP + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_CXX.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_CXX.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8115a967a87023a4afdbadf05e3a409d3fc5edcd --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_CXX.hpp @@ -0,0 +1,49 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_ADAPT_CXX_HPP_ +#define DESUL_ATOMICS_ADAPT_CXX_HPP_ + +#include <atomic> +#include <desul/atomics/Common.hpp> + +namespace desul { +namespace Impl { + +template <class MemoryOrderDesul> +struct CXXMemoryOrder; + +template <> +struct CXXMemoryOrder<MemoryOrderRelaxed> { + static constexpr std::memory_order value = std::memory_order_relaxed; +}; + +template <> +struct CXXMemoryOrder<MemoryOrderAcquire> { + static constexpr std::memory_order value = std::memory_order_acquire; +}; + +template <> +struct CXXMemoryOrder<MemoryOrderRelease> { + static constexpr std::memory_order value = std::memory_order_release; +}; + +template <> +struct CXXMemoryOrder<MemoryOrderAcqRel> { + static constexpr std::memory_order value = std::memory_order_acq_rel; +}; + +template <> +struct CXXMemoryOrder<MemoryOrderSeqCst> { + static constexpr std::memory_order value = std::memory_order_seq_cst; +}; + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_GCC.hpp new file mode 100644 index 0000000000000000000000000000000000000000..baf220a0b07725469d7d67a8a01652dcdfed18b1 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_GCC.hpp @@ -0,0 +1,48 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_ADAPT_GCC_HPP_ +#define DESUL_ATOMICS_ADAPT_GCC_HPP_ + +#include <desul/atomics/Common.hpp> + +namespace desul { +namespace Impl { + +template <class MemoryOrder> +struct GCCMemoryOrder; + +template <> +struct GCCMemoryOrder<MemoryOrderRelaxed> { + static constexpr int value = __ATOMIC_RELAXED; +}; + +template <> +struct GCCMemoryOrder<MemoryOrderAcquire> { + static constexpr int value = __ATOMIC_ACQUIRE; +}; + +template <> +struct GCCMemoryOrder<MemoryOrderRelease> { + static constexpr int value = __ATOMIC_RELEASE; +}; + +template <> +struct GCCMemoryOrder<MemoryOrderAcqRel> { + static constexpr int value = __ATOMIC_ACQ_REL; +}; + +template <> +struct GCCMemoryOrder<MemoryOrderSeqCst> { + static constexpr int value = __ATOMIC_SEQ_CST; +}; + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/SYCLConversions.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_SYCL.hpp similarity index 60% rename from packages/kokkos/tpls/desul/include/desul/atomics/SYCLConversions.hpp rename to packages/kokkos/tpls/desul/include/desul/atomics/Adapt_SYCL.hpp index 7debf91d6debc6354b16e2ccc7b5aafad0629983..c8449d495dccf072c00ba65c87d0f09711748923 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/SYCLConversions.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Adapt_SYCL.hpp @@ -6,15 +6,18 @@ Source: https://github.com/desul/desul SPDX-License-Identifier: (BSD-3-Clause) */ -#ifndef DESUL_ATOMICS_SYCL_CONVERSIONS_HPP_ -#define DESUL_ATOMICS_SYCL_CONVERSIONS_HPP_ -#ifdef DESUL_HAVE_SYCL_ATOMICS +#ifndef DESUL_ATOMICS_ADAPT_SYCL_HPP_ +#define DESUL_ATOMICS_ADAPT_SYCL_HPP_ -// clang-format off -#include "desul/atomics/Common.hpp" +#include <desul/atomics/Common.hpp> +// FIXME_SYCL SYCL2020 dictates that <sycl/sycl.hpp> is the header to include +// but icpx 2022.1.0 and earlier versions only provide <CL/sycl.hpp> +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else #include <CL/sycl.hpp> -// clang-format on +#endif namespace desul { namespace Impl { @@ -34,68 +37,81 @@ using sycl_memory_scope = std::conditional_t<extended_namespace, sycl_sync_and_atomics::memory_scope, sycl::memory_scope>; +//<editor-fold desc="SYCL memory order"> +// The default memory order for sycl::atomic_ref +// can be seq_cst, acq_rel, or relaxed according to the +// "SYCL 2020 Specification (revision 6)", see +// https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:atomic-references. +// Thus, we map MemoryOrderAcquire and MemoryOrderRelease to acq_rel. template <class MemoryOrder, bool extended_namespace = true> -struct DesulToSYCLMemoryOrder; +struct SYCLMemoryOrder; + template <bool extended_namespace> -struct DesulToSYCLMemoryOrder<MemoryOrderSeqCst, extended_namespace> { +struct SYCLMemoryOrder<MemoryOrderSeqCst, extended_namespace> { static constexpr sycl_memory_order<extended_namespace> value = sycl_memory_order<extended_namespace>::seq_cst; }; template <bool extended_namespace> -struct DesulToSYCLMemoryOrder<MemoryOrderAcquire, extended_namespace> { +struct SYCLMemoryOrder<MemoryOrderAcquire, extended_namespace> { static constexpr sycl_memory_order<extended_namespace> value = - sycl_memory_order<extended_namespace>::acquire; + sycl_memory_order<extended_namespace>::acq_rel; }; template <bool extended_namespace> -struct DesulToSYCLMemoryOrder<MemoryOrderRelease, extended_namespace> { +struct SYCLMemoryOrder<MemoryOrderRelease, extended_namespace> { static constexpr sycl_memory_order<extended_namespace> value = - sycl_memory_order<extended_namespace>::release; + sycl_memory_order<extended_namespace>::acq_rel; }; template <bool extended_namespace> -struct DesulToSYCLMemoryOrder<MemoryOrderAcqRel, extended_namespace> { +struct SYCLMemoryOrder<MemoryOrderAcqRel, extended_namespace> { static constexpr sycl_memory_order<extended_namespace> value = sycl_memory_order<extended_namespace>::acq_rel; }; template <bool extended_namespace> -struct DesulToSYCLMemoryOrder<MemoryOrderRelaxed, extended_namespace> { +struct SYCLMemoryOrder<MemoryOrderRelaxed, extended_namespace> { static constexpr sycl_memory_order<extended_namespace> value = sycl_memory_order<extended_namespace>::relaxed; }; +//</editor-fold> +//<editor-fold desc="SYCL memory scope"> template <class MemoryScope, bool extended_namespace = true> -struct DesulToSYCLMemoryScope; +struct SYCLMemoryScope; + template <bool extended_namespace> -struct DesulToSYCLMemoryScope<MemoryScopeCore, extended_namespace> { +struct SYCLMemoryScope<MemoryScopeCore, extended_namespace> { static constexpr sycl_memory_scope<extended_namespace> value = sycl_memory_scope<extended_namespace>::work_group; }; + template <bool extended_namespace> -struct DesulToSYCLMemoryScope<MemoryScopeDevice, extended_namespace> { +struct SYCLMemoryScope<MemoryScopeDevice, extended_namespace> { static constexpr sycl_memory_scope<extended_namespace> value = sycl_memory_scope<extended_namespace>::device; }; + template <bool extended_namespace> -struct DesulToSYCLMemoryScope<MemoryScopeSystem, extended_namespace> { +struct SYCLMemoryScope<MemoryScopeSystem, extended_namespace> { static constexpr sycl_memory_scope<extended_namespace> value = sycl_memory_scope<extended_namespace>::system; }; +//</editor-fold> // FIXME_SYCL generic_space isn't available yet for CUDA. #ifdef __NVPTX__ template <class T, class MemoryOrder, class MemoryScope> using sycl_atomic_ref = sycl::atomic_ref<T, - DesulToSYCLMemoryOrder<MemoryOrder>::value, - DesulToSYCLMemoryScope<MemoryScope>::value, + SYCLMemoryOrder<MemoryOrder>::value, + SYCLMemoryScope<MemoryScope>::value, sycl::access::address_space::global_space>; #else template <class T, class MemoryOrder, class MemoryScope> using sycl_atomic_ref = sycl::atomic_ref<T, - DesulToSYCLMemoryOrder<MemoryOrder>::value, - DesulToSYCLMemoryScope<MemoryScope>::value, + SYCLMemoryOrder<MemoryOrder>::value, + SYCLMemoryScope<MemoryScope>::value, sycl::access::address_space::generic_space>; #endif + } // namespace Impl } // namespace desul #endif -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Atomic_Ref.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Atomic_Ref.hpp index fbf2dcf6b7cb2972f2d43b81f0b55b45951ee03c..3d69dcf6c50ce0ab034f125ac979bd37a4ac1a56 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Atomic_Ref.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Atomic_Ref.hpp @@ -10,13 +10,12 @@ SPDX-License-Identifier: (BSD-3-Clause) #define DESUL_ATOMIC_REF_IMPL_HPP_ #include <cstddef> +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Generic.hpp> +#include <desul/atomics/Macros.hpp> #include <memory> #include <type_traits> -#include "desul/atomics/Common.hpp" -#include "desul/atomics/Generic.hpp" -#include "desul/atomics/Macros.hpp" - namespace desul { namespace Impl { diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/CUDA.hpp deleted file mode 100644 index 87c0df4af91827793e0d95c43b1af08df88263fe..0000000000000000000000000000000000000000 --- a/packages/kokkos/tpls/desul/include/desul/atomics/CUDA.hpp +++ /dev/null @@ -1,664 +0,0 @@ -/* -Copyright (c) 2019, Lawrence Livermore National Security, LLC -and DESUL project contributors. See the COPYRIGHT file for details. -Source: https://github.com/desul/desul - -SPDX-License-Identifier: (BSD-3-Clause) -*/ -#ifndef DESUL_ATOMICS_CUDA_HPP_ -#define DESUL_ATOMICS_CUDA_HPP_ - -#ifdef DESUL_HAVE_CUDA_ATOMICS -// When building with Clang we need to include the device functions always since Clang -// must see a consistent overload set in both device and host compilation, but that -// means we need to know on the host what to make visible, i.e. we need a host side -// compile knowledge of architecture. -#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700)) || \ - (!defined(__NVCC__) && !defined(DESUL_CUDA_ARCH_IS_PRE_VOLTA)) -#define DESUL_HAVE_CUDA_ATOMICS_ASM -#include <desul/atomics/cuda/CUDA_asm.hpp> -#endif - -#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 700)) || \ - (!defined(__NVCC__) && !defined(DESUL_HAVE_CUDA_ATOMICS_ASM)) -namespace desul { -namespace Impl { -template <class T> -struct is_cuda_atomic_integer_type { - static constexpr bool value = std::is_same<T, int>::value || - std::is_same<T, unsigned int>::value || - std::is_same<T, unsigned long long int>::value; -}; - -template <class T> -struct is_cuda_atomic_add_type { - static constexpr bool value = is_cuda_atomic_integer_type<T>::value || -#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 600) - std::is_same<T, double>::value || -#endif - std::is_same<T, float>::value; -}; - -template <class T> -struct is_cuda_atomic_sub_type { - static constexpr bool value = - std::is_same<T, int>::value || std::is_same<T, unsigned int>::value; -}; -} // namespace Impl - -// Atomic Add -template <class T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T> - atomic_fetch_add(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicAdd(dest, val); -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T> - atomic_fetch_add(T* dest, T val, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicAdd(dest, val); - __threadfence(); - return return_val; -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T> - atomic_fetch_add(T* dest, T val, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_add(dest, val, MemoryOrder(), MemoryScopeDevice()); -} - -// Atomic Sub -template <class T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T> - atomic_fetch_sub(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicSub(dest, val); -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T> - atomic_fetch_sub(T* dest, T val, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicSub(dest, val); - __threadfence(); - return return_val; -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T> - atomic_fetch_sub(T* dest, T val, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_sub(dest, val, MemoryOrder(), MemoryScopeDevice()); -} - -// Wrap around atomic add -__device__ inline unsigned int atomic_fetch_inc_mod(unsigned int* dest, - unsigned int val, - MemoryOrderRelaxed, - MemoryScopeDevice) { - return atomicInc(dest, val); -} - -template <typename MemoryOrder> -__device__ inline unsigned int atomic_fetch_inc_mod(unsigned int* dest, - unsigned int val, - MemoryOrder, - MemoryScopeDevice) { - __threadfence(); - unsigned int return_val = atomicInc(dest, val); - __threadfence(); - return return_val; -} - -template <typename MemoryOrder> -__device__ inline unsigned int atomic_fetch_inc_mod(unsigned int* dest, - unsigned int val, - MemoryOrder, - MemoryScopeCore) { - return atomic_fetch_inc_mod(dest, val, MemoryOrder(), MemoryScopeDevice()); -} - -// Wrap around atomic sub -__device__ inline unsigned int atomic_fetch_dec_mod(unsigned int* dest, - unsigned int val, - MemoryOrderRelaxed, - MemoryScopeDevice) { - return atomicDec(dest, val); -} - -template <typename MemoryOrder> -__device__ inline unsigned int atomic_fetch_dec_mod(unsigned int* dest, - unsigned int val, - MemoryOrder, - MemoryScopeDevice) { - __threadfence(); - unsigned int return_val = atomicDec(dest, val); - __threadfence(); - return return_val; -} - -template <typename MemoryOrder> -__device__ inline unsigned int atomic_fetch_dec_mod(unsigned int* dest, - unsigned int val, - MemoryOrder, - MemoryScopeCore) { - return atomic_fetch_dec_mod(dest, val, MemoryOrder(), MemoryScopeDevice()); -} - -// Atomic Inc -template <typename T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T> - atomic_fetch_inc(T* dest, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicAdd(dest, T(1)); -} - -template <typename T, typename MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T> - atomic_fetch_inc(T* dest, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicAdd(dest, T(1)); - __threadfence(); - - return return_val; -} - -template <typename T, typename MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_add_type<T>::value, T> - atomic_fetch_inc(T* dest, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_add(dest, T(1), MemoryOrder(), MemoryScopeDevice()); -} - -// Atomic Dec -template <typename T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T> - atomic_fetch_dec(T* dest, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicSub(dest, T(1)); -} - -template <typename T, typename MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T> - atomic_fetch_dec(T* dest, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicSub(dest, T(1)); - __threadfence(); - return return_val; -} - -template <typename T, typename MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_sub_type<T>::value, T> - atomic_fetch_dec(T* dest, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_sub(dest, T(1), MemoryOrder(), MemoryScopeDevice()); -} - -// Atomic Max -template <class T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_max(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicMax(dest, val); -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_max(T* dest, T val, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicMax(dest, val); - __threadfence(); - return return_val; -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_max(T* dest, T val, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_max(dest, val, MemoryOrder(), MemoryScopeDevice()); -} - -// Atomic Min -template <class T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_min(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicMin(dest, val); -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_min(T* dest, T val, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicMin(dest, val); - __threadfence(); - return return_val; -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_min(T* dest, T val, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_min(dest, val, MemoryOrder(), MemoryScopeDevice()); -} - -// Atomic And -template <class T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_and(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicAnd(dest, val); -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_and(T* dest, T val, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicAnd(dest, val); - __threadfence(); - return return_val; -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_and(T* dest, T val, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_and(dest, val, MemoryOrder(), MemoryScopeDevice()); -} - -// Atomic XOR -template <class T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_xor(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicXor(dest, val); -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_xor(T* dest, T val, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicXor(dest, val); - __threadfence(); - return return_val; -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_xor(T* dest, T val, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_xor(dest, val, MemoryOrder(), MemoryScopeDevice()); -} - -// Atomic OR -template <class T> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_or(T* dest, T val, MemoryOrderRelaxed, MemoryScopeDevice) { - return atomicOr(dest, val); -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_or(T* dest, T val, MemoryOrder, MemoryScopeDevice) { - __threadfence(); - T return_val = atomicOr(dest, val); - __threadfence(); - return return_val; -} - -template <class T, class MemoryOrder> -__device__ inline - std::enable_if_t<Impl::is_cuda_atomic_integer_type<T>::value, T> - atomic_fetch_or(T* dest, T val, MemoryOrder, MemoryScopeCore) { - return atomic_fetch_or(dest, val, MemoryOrder(), MemoryScopeDevice()); -} -} // namespace desul -#endif - -#if !defined(__NVCC__) -// Functions defined as device functions in CUDA which don't exist in the GCC overload -// set -namespace desul { - -#if defined(DESUL_HAVE_CUDA_ATOMICS_ASM) -#define DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(TYPE, ORDER, SCOPE) \ - inline void atomic_add(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \ - (void)atomic_fetch_add(dest, val, order, scope); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(int32_t, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(long, - MemoryOrderRelaxed, - MemoryScopeDevice); // only for ASM? -DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(unsigned int, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(unsigned long long, - MemoryOrderRelaxed, - MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(float, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_ADD(double, MemoryOrderRelaxed, MemoryScopeDevice); - -#define DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(TYPE, ORDER, SCOPE) \ - inline void atomic_sub(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \ - (void)atomic_fetch_sub(dest, val, order, scope); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(int32_t, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(long, - MemoryOrderRelaxed, - MemoryScopeDevice); // only for ASM? -DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(unsigned int, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(float, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_SUB(double, MemoryOrderRelaxed, MemoryScopeDevice); - -#define DESUL_IMPL_CUDA_HOST_ATOMIC_INC(TYPE, ORDER, SCOPE) \ - inline void atomic_inc(TYPE* const dest, ORDER order, SCOPE scope) { \ - (void)atomic_fetch_inc(dest, order, scope); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_INC(unsigned int, - MemoryOrderRelaxed, - MemoryScopeDevice); // only for ASM? - -#define DESUL_IMPL_CUDA_HOST_ATOMIC_DEC(TYPE, ORDER, SCOPE) \ - inline void atomic_dec(TYPE* const dest, ORDER order, SCOPE scope) { \ - (void)atomic_fetch_dec(dest, order, scope); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_DEC(unsigned, - MemoryOrderRelaxed, - MemoryScopeDevice); // only for ASM? - -#endif // DESUL_HAVE_CUDA_ATOMICS_ASM - -#define DESUL_IMPL_CUDA_HOST_ATOMIC_INC_MOD(TYPE, ORDER, SCOPE) \ - inline TYPE atomic_fetch_inc_mod(TYPE* dest, TYPE val, ORDER order, SCOPE scope) { \ - using cas_t = typename Impl::atomic_compare_exchange_type<sizeof(TYPE)>::type; \ - cas_t oldval = reinterpret_cast<cas_t&>(*dest); \ - cas_t assume = oldval; \ - do { \ - assume = oldval; \ - TYPE newval = (reinterpret_cast<TYPE&>(assume) >= val) \ - ? static_cast<TYPE>(0) \ - : reinterpret_cast<TYPE&>(assume) + static_cast<TYPE>(1); \ - oldval = desul::atomic_compare_exchange(reinterpret_cast<cas_t*>(dest), \ - assume, \ - reinterpret_cast<cas_t&>(newval), \ - order, \ - scope); \ - } while (assume != oldval); \ - return reinterpret_cast<TYPE&>(oldval); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_INC_MOD(unsigned int, - MemoryOrderRelaxed, - MemoryScopeDevice); -#define DESUL_IMPL_CUDA_HOST_ATOMIC_DEC_MOD(TYPE, ORDER, SCOPE) \ - inline TYPE atomic_fetch_dec_mod(TYPE* dest, TYPE val, ORDER order, SCOPE scope) { \ - using cas_t = typename Impl::atomic_compare_exchange_type<sizeof(TYPE)>::type; \ - cas_t oldval = reinterpret_cast<cas_t&>(*dest); \ - cas_t assume = oldval; \ - do { \ - assume = oldval; \ - TYPE newval = ((reinterpret_cast<TYPE&>(assume) == static_cast<TYPE>(0)) | \ - (reinterpret_cast<TYPE&>(assume) > val)) \ - ? val \ - : reinterpret_cast<TYPE&>(assume) - static_cast<TYPE>(1); \ - oldval = desul::atomic_compare_exchange(reinterpret_cast<cas_t*>(dest), \ - assume, \ - reinterpret_cast<cas_t&>(newval), \ - order, \ - scope); \ - } while (assume != oldval); \ - return reinterpret_cast<TYPE&>(oldval); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_DEC_MOD(unsigned int, - MemoryOrderRelaxed, - MemoryScopeDevice); - -#define DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_ADD(TYPE, ORDER, SCOPE) \ - inline TYPE atomic_fetch_add(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \ - return Impl::atomic_fetch_oper( \ - Impl::AddOper<TYPE, const TYPE>(), dest, val, order, scope); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_ADD(float, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_ADD(double, MemoryOrderRelaxed, MemoryScopeDevice); - -#define DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_SUB(TYPE, ORDER, SCOPE) \ - inline TYPE atomic_fetch_sub(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \ - return Impl::atomic_fetch_oper( \ - Impl::SubOper<TYPE, const TYPE>(), dest, val, order, scope); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_SUB(float, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_SUB(double, MemoryOrderRelaxed, MemoryScopeDevice); - -#define DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(TYPE, ORDER, SCOPE) \ - inline TYPE atomic_fetch_max(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \ - return Impl::atomic_fetch_oper( \ - Impl::MaxOper<TYPE, const TYPE>(), dest, val, order, scope); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(int, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(long, - MemoryOrderRelaxed, - MemoryScopeDevice); // only for ASM? -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(unsigned int, - MemoryOrderRelaxed, - MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(unsigned long, - MemoryOrderRelaxed, - MemoryScopeDevice); -// DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MAX(unsigned long -// long,MemoryOrderRelaxed,MemoryScopeDevice); - -#define DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(TYPE, ORDER, SCOPE) \ - inline TYPE atomic_fetch_min(TYPE* const dest, TYPE val, ORDER order, SCOPE scope) { \ - return Impl::atomic_fetch_oper( \ - Impl::MinOper<TYPE, const TYPE>(), dest, val, order, scope); \ - } -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(int, MemoryOrderRelaxed, MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(long, - MemoryOrderRelaxed, - MemoryScopeDevice); // only for ASM? -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(unsigned int, - MemoryOrderRelaxed, - MemoryScopeDevice); -DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(unsigned long, - MemoryOrderRelaxed, - MemoryScopeDevice); -// DESUL_IMPL_CUDA_HOST_ATOMIC_FETCH_MIN(unsigned long -// long,MemoryOrderRelaxed,MemoryScopeDevice); inline void atomic_fetch_max(int32_t* -// const dest, int32_t val, MemoryOrderRelaxed order, MemoryScopeDevice scope) { - -} // namespace desul - -// Functions defined int the GCC overload set but not in the device overload set -namespace desul { -__device__ inline unsigned long long atomic_fetch_add(unsigned long long* const dest, - unsigned long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::AddOper<unsigned long long, const unsigned long long>(), - dest, - val, - order, - scope); -} -__device__ inline long long atomic_fetch_add(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::AddOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_fetch_add(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::AddOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long long atomic_fetch_sub(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::SubOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_fetch_sub(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::SubOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long atomic_fetch_max(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::MaxOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long atomic_fetch_min(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::MinOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long atomic_fetch_or(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::OrOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long long atomic_fetch_or(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::OrOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_fetch_xor(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::XorOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long long atomic_fetch_xor(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::XorOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_fetch_and(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::AndOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long long atomic_fetch_and(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_fetch_oper( - Impl::AndOper<long long, const long long>(), dest, val, order, scope); -} - -__device__ inline unsigned long long atomic_add_fetch(unsigned long long* const dest, - unsigned long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::AddOper<unsigned long long, const unsigned long long>(), - dest, - val, - order, - scope); -} -__device__ inline long long atomic_add_fetch(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::AddOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_add_fetch(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::AddOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long long atomic_sub_fetch(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::SubOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_sub_fetch(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::SubOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long long atomic_or_fetch(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::OrOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_or_fetch(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::OrOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long long atomic_xor_fetch(long long* const dest, - long long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::XorOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_xor_fetch(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::XorOper<long, const long>(), dest, val, order, scope); -} -__device__ inline long long atomic_and_fetch(long long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::AndOper<long long, const long long>(), dest, val, order, scope); -} -__device__ inline long atomic_and_fetch(long* const dest, - long val, - MemoryOrderRelaxed order, - MemoryScopeDevice scope) { - return Impl::atomic_oper_fetch( - Impl::AndOper<long, const long>(), dest, val, order, scope); -} -} // namespace desul -#endif - -#endif // DESUL_HAVE_CUDA_ATOMICS -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Common.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Common.hpp index aef098e4d8caf6b0d7e9a418cdeff0a9349acce0..b7353e7dba8318255a733a12f7bbcdc1806e121d 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Common.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Common.hpp @@ -8,12 +8,11 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_COMMON_HPP_ #define DESUL_ATOMICS_COMMON_HPP_ -#include <atomic> + #include <cstdint> +#include <desul/atomics/Macros.hpp> #include <type_traits> -#include "desul/atomics/Macros.hpp" - namespace desul { struct alignas(16) Dummy16ByteValue { int64_t value1; @@ -27,8 +26,7 @@ struct alignas(16) Dummy16ByteValue { }; } // namespace desul -// MemoryOrder Tags - +//<editor-fold desc="Memory Order Tags"> namespace desul { // Memory order sequential consistent struct MemoryOrderSeqCst {}; @@ -41,9 +39,9 @@ struct MemoryOrderRelease {}; // Memory order relaxed struct MemoryOrderRelaxed {}; } // namespace desul +//</editor-fold> -// Memory Scope Tags - +//<editor-fold desc="Memory Scope Tags"> namespace desul { // Entire machine scope (e.g. for global arrays) struct MemoryScopeSystem {}; @@ -56,75 +54,11 @@ struct MemoryScopeCore {}; // Caller scoped (i.e. NOT atomic!) struct MemoryScopeCaller {}; } // namespace desul - -#ifndef __ATOMIC_RELAXED -#define __ATOMIC_RELAXED 0 -#define __ATOMIC_CONSUME 1 -#define __ATOMIC_ACQUIRE 2 -#define __ATOMIC_RELEASE 3 -#define __ATOMIC_ACQ_REL 4 -#define __ATOMIC_SEQ_CST 5 -#endif +//</editor-fold> namespace desul { -template <class MemoryOrderDesul> -struct GCCMemoryOrder; - -template <> -struct GCCMemoryOrder<MemoryOrderRelaxed> { - static constexpr int value = __ATOMIC_RELAXED; -}; - -template <> -struct GCCMemoryOrder<MemoryOrderAcquire> { - static constexpr int value = __ATOMIC_ACQUIRE; -}; - -template <> -struct GCCMemoryOrder<MemoryOrderRelease> { - static constexpr int value = __ATOMIC_RELEASE; -}; - -template <> -struct GCCMemoryOrder<MemoryOrderAcqRel> { - static constexpr int value = __ATOMIC_ACQ_REL; -}; - -template <> -struct GCCMemoryOrder<MemoryOrderSeqCst> { - static constexpr int value = __ATOMIC_SEQ_CST; -}; - -template <class MemoryOrderDesul> -struct CXXMemoryOrder; - -template <> -struct CXXMemoryOrder<MemoryOrderRelaxed> { - static constexpr std::memory_order value = std::memory_order_relaxed; -}; - -template <> -struct CXXMemoryOrder<MemoryOrderAcquire> { - static constexpr std::memory_order value = std::memory_order_acquire; -}; - -template <> -struct CXXMemoryOrder<MemoryOrderRelease> { - static constexpr std::memory_order value = std::memory_order_release; -}; - -template <> -struct CXXMemoryOrder<MemoryOrderAcqRel> { - static constexpr std::memory_order value = std::memory_order_acq_rel; -}; - -template <> -struct CXXMemoryOrder<MemoryOrderSeqCst> { - static constexpr std::memory_order value = std::memory_order_seq_cst; -}; - namespace Impl { -template <typename MemoryOrder> +template <class MemoryOrder> struct CmpExchFailureOrder { using memory_order = std::conditional_t< std::is_same<MemoryOrder, MemoryOrderAcqRel>{}, @@ -133,15 +67,14 @@ struct CmpExchFailureOrder { MemoryOrderRelaxed, MemoryOrder>>; }; -template <typename MemoryOrder> +template <class MemoryOrder> using cmpexch_failure_memory_order = typename CmpExchFailureOrder<MemoryOrder>::memory_order; } // namespace Impl - } // namespace desul // We should in principle use std::numeric_limits, but that requires constexpr function -// support on device Currently that is still considered experimetal on CUDA and +// support on device Currently that is still considered experimental on CUDA and // sometimes not reliable. namespace desul { namespace Impl { @@ -150,11 +83,11 @@ struct numeric_limits_max; template <> struct numeric_limits_max<uint32_t> { - static constexpr uint32_t value = 0xffffffffu; + static constexpr auto value = static_cast<uint32_t>(-1); }; template <> struct numeric_limits_max<uint64_t> { - static constexpr uint64_t value = 0xfffffffflu; + static constexpr auto value = static_cast<uint64_t>(-1); }; constexpr bool atomic_always_lock_free(std::size_t size) { @@ -174,24 +107,30 @@ DESUL_INLINE_FUNCTION bool atomic_is_lock_free() noexcept { ; } -template <std::size_t N> -struct atomic_compare_exchange_type; +//<editor-fold desc="Underlying type for atomic compare exchange"> +template <std::size_t Bytes> +struct atomic_compare_exchange_helper; template <> -struct atomic_compare_exchange_type<4> { +struct atomic_compare_exchange_helper<4> { using type = int32_t; }; template <> -struct atomic_compare_exchange_type<8> { +struct atomic_compare_exchange_helper<8> { using type = int64_t; }; template <> -struct atomic_compare_exchange_type<16> { +struct atomic_compare_exchange_helper<16> { using type = Dummy16ByteValue; }; +template <class T> +using atomic_compare_exchange_t = + typename atomic_compare_exchange_helper<sizeof(T)>::type; +//</editor-fold> + template <class T> struct dont_deduce_this_parameter { using type = T; @@ -202,4 +141,5 @@ using dont_deduce_this_parameter_t = typename dont_deduce_this_parameter<T>::typ } // namespace Impl } // namespace desul + #endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange.hpp index d947dac27500fb1ebc63b89465de4b8f3bb8d77c..e91569e1dee8e6073f06e018aa5d75b0e13075d3 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange.hpp @@ -9,28 +9,27 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_HPP_ #define DESUL_ATOMICS_COMPARE_EXCHANGE_HPP_ -#include "desul/atomics/Compare_Exchange_ScopeCaller.hpp" -#include "desul/atomics/Macros.hpp" +#include <desul/atomics/Macros.hpp> #ifdef DESUL_HAVE_GCC_ATOMICS -#include "desul/atomics/Compare_Exchange_GCC.hpp" +#include <desul/atomics/Compare_Exchange_GCC.hpp> #endif #ifdef DESUL_HAVE_MSVC_ATOMICS -#include "desul/atomics/Compare_Exchange_MSVC.hpp" -#endif -#ifdef DESUL_HAVE_SERIAL_ATOMICS -#include "desul/atomics/Compare_Exchange_Serial.hpp" +#include <desul/atomics/Compare_Exchange_MSVC.hpp> #endif #ifdef DESUL_HAVE_CUDA_ATOMICS -#include "desul/atomics/Compare_Exchange_CUDA.hpp" +#include <desul/atomics/Compare_Exchange_CUDA.hpp> #endif #ifdef DESUL_HAVE_HIP_ATOMICS -#include "desul/atomics/Compare_Exchange_HIP.hpp" +#include <desul/atomics/Compare_Exchange_HIP.hpp> #endif #ifdef DESUL_HAVE_OPENMP_ATOMICS -#include "desul/atomics/Compare_Exchange_OpenMP.hpp" +#include <desul/atomics/Compare_Exchange_OpenMP.hpp> #endif #ifdef DESUL_HAVE_SYCL_ATOMICS -#include "desul/atomics/Compare_Exchange_SYCL.hpp" +#include <desul/atomics/Compare_Exchange_SYCL.hpp> #endif + +#include <desul/atomics/Compare_Exchange_ScopeCaller.hpp> + #endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp index 310c59f55ef4ca1342a7e1a113535f185b38692a..456d6b011e681ea8bbac80bbc1b158fb57d25b9d 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_CUDA.hpp @@ -8,65 +8,31 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_CUDA_HPP_ #define DESUL_ATOMICS_COMPARE_EXCHANGE_CUDA_HPP_ -#include "desul/atomics/Common.hpp" -#include "desul/atomics/Lock_Array_Cuda.hpp" -#ifdef DESUL_HAVE_CUDA_ATOMICS -namespace desul { -// Only include if compiling device code, or the CUDA compiler is not NVCC (i.e. Clang) -// atomic_thread_fence implementation -#if defined(__CUDA_ARCH__) || !defined(__NVCC__) -__device__ inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { - __threadfence(); -} -__device__ inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { - __threadfence(); -} -__device__ inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) { - __threadfence(); -} -__device__ inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) { - __threadfence(); -} -__device__ inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) { - __threadfence_block(); -} -__device__ inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) { - __threadfence_block(); -} -__device__ inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) { - __threadfence_block(); -} -__device__ inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) { - __threadfence_block(); -} -#if (__CUDA_ARCH__ >= 600) || !defined(__NVCC__) -__device__ inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeNode) { - __threadfence_system(); -} -__device__ inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeNode) { - __threadfence_system(); -} -__device__ inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeNode) { - __threadfence_system(); -} -__device__ inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeNode) { - __threadfence_system(); -} -#endif -#endif -} // namespace desul +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Lock_Array_CUDA.hpp> +#include <desul/atomics/Thread_Fence_CUDA.hpp> +#include <type_traits> + +// Including CUDA ptx based exchange atomics +// When building with clang we need to include the device functions always +// since clang must see a consistent overload set in both device and host compilation +// but that means we need to know on the host what to make visible, i.e. we need +// a host side compile knowledge of architecture. +// We simply can say DESUL proper doesn't support clang CUDA build pre Volta, +// Kokkos has that knowledge and so I use it here, allowing in Kokkos to use +// clang with pre Volta as CUDA compiler +#ifndef DESUL_CUDA_ARCH_IS_PRE_VOLTA + +#include <desul/atomics/cuda/CUDA_asm_exchange.hpp> + +#else -// Compare Exchange for PRE Volta, not supported with CLANG as CUDA compiler, since we -// do NOT have a way of having the code included for clang only when the CC is smaller -// than 700 But on Clang the device side symbol list must be independent of -// __CUDA_ARCH__ -// FIXME temporary fix for https://github.com/kokkos/kokkos/issues/4390 -#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ < 700) || \ - (!defined(__NVCC__) && defined(DESUL_CUDA_ARCH_IS_PRE_VOLTA) && 0) namespace desul { -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange( +namespace Impl { + +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) { static_assert(sizeof(unsigned int) == 4, "this function assumes an unsigned int is 32-bit"); @@ -75,11 +41,11 @@ __device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_excha reinterpret_cast<unsigned int&>(value)); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) { static_assert(sizeof(unsigned long long int) == 8, - "this function assumes an unsigned long long is 64-bit"); + "this function assumes an unsigned long long is 64-bit"); unsigned long long int return_val = atomicCAS(reinterpret_cast<unsigned long long int*>(dest), reinterpret_cast<unsigned long long int&>(compare), @@ -87,39 +53,39 @@ __device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_excha return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderRelease, MemoryScope) { - T return_val = atomic_compare_exchange( + T return_val = device_atomic_compare_exchange( dest, compare, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderAcquire, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_compare_exchange( + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = device_atomic_compare_exchange( dest, compare, value, MemoryOrderRelaxed(), MemoryScope()); return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderAcqRel, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_compare_exchange( + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = device_atomic_compare_exchange( dest, compare, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_exchange( T* const dest, T value, MemoryOrderRelaxed, MemoryScope) { static_assert(sizeof(unsigned int) == 4, "this function assumes an unsigned int is 32-bit"); @@ -127,157 +93,151 @@ __device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange( reinterpret_cast<unsigned int&>(value)); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_exchange( T* const dest, T value, MemoryOrderRelaxed, MemoryScope) { static_assert(sizeof(unsigned long long int) == 8, - "this function assumes an unsigned long long is 64-bit"); + "this function assumes an unsigned long long is 64-bit"); unsigned long long int return_val = atomicExch(reinterpret_cast<unsigned long long int*>(dest), reinterpret_cast<unsigned long long int&>(value)); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_exchange(T* const dest, T value, MemoryOrderRelease, MemoryScope) { - T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange( + T* const dest, T value, MemoryOrderRelease, MemoryScope) { + T return_val = + device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_exchange(T* const dest, T value, MemoryOrderAcquire, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange( + T* const dest, T value, MemoryOrderAcquire, MemoryScope) { + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = + device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_exchange(T* const dest, T value, MemoryOrderAcqRel, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange( + T* const dest, T value, MemoryOrderAcqRel, MemoryScope) { + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = + device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return reinterpret_cast<T&>(return_val); } +} // namespace Impl } // namespace desul -#endif -// Including CUDA ptx based exchange atomics -// When building with clang we need to include the device functions always -// since clang must see a consistent overload set in both device and host compilation -// but that means we need to know on the host what to make visible, i.e. we need -// a host side compile knowledge of architecture. -// We simply can say DESUL proper doesn't support clang CUDA build pre Volta, -// Kokkos has that knowledge and so I use it here, allowing in Kokkos to use -// clang with pre Volta as CUDA compiler -#if (defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700)) || \ - (!defined(__NVCC__) && !defined(DESUL_CUDA_ARCH_IS_PRE_VOLTA)) -#include <desul/atomics/cuda/CUDA_asm_exchange.hpp> #endif // SeqCst is not directly supported by PTX, need the additional fences: -#if defined(__CUDA_ARCH__) || !defined(__NVCC__) namespace desul { -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange( - T* const dest, T value, MemoryOrderSeqCst, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); +namespace Impl { +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_exchange(T* const dest, + T value, + MemoryOrderSeqCst, + MemoryScope) { + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = + device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange( - T* const dest, T value, MemoryOrderSeqCst, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_exchange(T* const dest, + T value, + MemoryOrderSeqCst, + MemoryScope) { + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = + device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderSeqCst, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_compare_exchange( + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = device_atomic_compare_exchange( dest, compare, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderSeqCst, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_compare_exchange( + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = device_atomic_compare_exchange( dest, compare, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return return_val; } -} // namespace desul -#endif -#if defined(__CUDA_ARCH__) || !defined(__NVCC__) -namespace desul { -template <typename T, class MemoryOrder, class MemoryScope> -__device__ typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type -atomic_compare_exchange( +template <class T, class MemoryOrder, class MemoryScope> +__device__ std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrder, MemoryScope scope) { - // This is a way to avoid dead lock in a warp or wave front + // This is a way to avoid deadlock in a warp or wave front T return_val; int done = 0; - unsigned int mask = DESUL_IMPL_ACTIVEMASK; - unsigned int active = DESUL_IMPL_BALLOT_MASK(mask, 1); + unsigned int mask = __activemask(); + unsigned int active = __ballot_sync(mask, 1); unsigned int done_active = 0; while (active != done_active) { if (!done) { - if (Impl::lock_address_cuda((void*)dest, scope)) { + if (lock_address_cuda((void*)dest, scope)) { if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value) - atomic_thread_fence(MemoryOrderRelease(), scope); - atomic_thread_fence(MemoryOrderAcquire(), scope); + device_atomic_thread_fence(MemoryOrderRelease(), scope); + device_atomic_thread_fence(MemoryOrderAcquire(), scope); return_val = *dest; if (return_val == compare) { *dest = value; - atomic_thread_fence(MemoryOrderRelease(), scope); + device_atomic_thread_fence(MemoryOrderRelease(), scope); } - Impl::unlock_address_cuda((void*)dest, scope); + unlock_address_cuda((void*)dest, scope); done = 1; } } - done_active = DESUL_IMPL_BALLOT_MASK(mask, done); + done_active = __ballot_sync(mask, done); } return return_val; } -template <typename T, class MemoryOrder, class MemoryScope> -__device__ typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type -atomic_exchange(T* const dest, T value, MemoryOrder, MemoryScope scope) { - // This is a way to avoid dead lock in a warp or wave front + +template <class T, class MemoryOrder, class MemoryScope> +__device__ std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T> +device_atomic_exchange(T* const dest, T value, MemoryOrder, MemoryScope scope) { + // This is a way to avoid deadlock in a warp or wave front T return_val; int done = 0; - unsigned int mask = DESUL_IMPL_ACTIVEMASK; - unsigned int active = DESUL_IMPL_BALLOT_MASK(mask, 1); + unsigned int mask = __activemask(); + unsigned int active = __ballot_sync(mask, 1); unsigned int done_active = 0; while (active != done_active) { if (!done) { - if (Impl::lock_address_cuda((void*)dest, scope)) { + if (lock_address_cuda((void*)dest, scope)) { if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value) - atomic_thread_fence(MemoryOrderRelease(), scope); - atomic_thread_fence(MemoryOrderAcquire(), scope); + device_atomic_thread_fence(MemoryOrderRelease(), scope); + device_atomic_thread_fence(MemoryOrderAcquire(), scope); return_val = *dest; *dest = value; - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address_cuda((void*)dest, scope); + device_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address_cuda((void*)dest, scope); done = 1; } } - done_active = DESUL_IMPL_BALLOT_MASK(mask, done); + done_active = __ballot_sync(mask, done); } return return_val; } +} // namespace Impl } // namespace desul -#endif #endif -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp index fad3c43b046feb67ee05a3a86fe9986e349d5686..d8bac620bd95b44165865c759cb72535c30cc820 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_GCC.hpp @@ -8,18 +8,17 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_GCC_HPP_ #define DESUL_ATOMICS_COMPARE_EXCHANGE_GCC_HPP_ -#include "desul/atomics/Common.hpp" -#ifdef DESUL_HAVE_GCC_ATOMICS -#if !defined(DESUL_HAVE_16BYTE_COMPARE_AND_SWAP) && !defined(__CUDACC__) -// This doesn't work in WSL?? -//#define DESUL_HAVE_16BYTE_COMPARE_AND_SWAP -#endif -namespace desul { +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Lock_Array.hpp> +#include <desul/atomics/Thread_Fence_GCC.hpp> +#include <type_traits> +namespace desul { namespace Impl { + template <class T> -struct atomic_exchange_available_gcc { +struct host_atomic_exchange_available_gcc { constexpr static bool value = #ifndef DESUL_HAVE_LIBATOMIC ((sizeof(T) == 4 && alignof(T) == 4) || @@ -30,35 +29,30 @@ struct atomic_exchange_available_gcc { #endif std::is_trivially_copyable<T>::value; }; -} // namespace Impl -#if defined(__clang__) && (__clang_major__ >= 7) && !defined(__APPLE__) // clang-format off // Disable warning for large atomics on clang 7 and up (checked with godbolt) // error: large atomic operation may incur significant performance penalty [-Werror,-Watomic-alignment] // https://godbolt.org/z/G7YhqhbG6 // clang-format on +#if defined(__clang__) && (__clang_major__ >= 7) && !defined(__APPLE__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Watomic-alignment" #endif -template <class MemoryOrder, class MemoryScope> -void atomic_thread_fence(MemoryOrder, MemoryScope) { - __atomic_thread_fence(GCCMemoryOrder<MemoryOrder>::value); -} -template <typename T, class MemoryOrder, class MemoryScope> -std::enable_if_t<Impl::atomic_exchange_available_gcc<T>::value, T> atomic_exchange( +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<host_atomic_exchange_available_gcc<T>::value, T> host_atomic_exchange( T* dest, T value, MemoryOrder, MemoryScope) { T return_val; __atomic_exchange(dest, &value, &return_val, GCCMemoryOrder<MemoryOrder>::value); return return_val; } -// Failure mode for atomic_compare_exchange_n cannot be RELEASE nor ACQREL so -// Those two get handled separatly. -template <typename T, class MemoryOrder, class MemoryScope> -std::enable_if_t<Impl::atomic_exchange_available_gcc<T>::value, T> -atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) { +// Failure mode for host_atomic_compare_exchange_n cannot be RELEASE nor ACQREL so +// Those two get handled separately. +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<host_atomic_exchange_available_gcc<T>::value, T> +host_atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) { (void)__atomic_compare_exchange(dest, &compare, &value, @@ -68,25 +62,70 @@ atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) { return compare; } -template <typename T, class MemoryScope> -std::enable_if_t<Impl::atomic_exchange_available_gcc<T>::value, T> -atomic_compare_exchange(T* dest, T compare, T value, MemoryOrderRelease, MemoryScope) { +template <class T, class MemoryScope> +std::enable_if_t<host_atomic_exchange_available_gcc<T>::value, T> +host_atomic_compare_exchange( + T* dest, T compare, T value, MemoryOrderRelease, MemoryScope) { (void)__atomic_compare_exchange( dest, &compare, &value, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED); return compare; } -template <typename T, class MemoryScope> -std::enable_if_t<Impl::atomic_exchange_available_gcc<T>::value, T> -atomic_compare_exchange(T* dest, T compare, T value, MemoryOrderAcqRel, MemoryScope) { +template <class T, class MemoryScope> +std::enable_if_t<host_atomic_exchange_available_gcc<T>::value, T> +host_atomic_compare_exchange( + T* dest, T compare, T value, MemoryOrderAcqRel, MemoryScope) { (void)__atomic_compare_exchange( dest, &compare, &value, false, __ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE); return compare; } +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<!host_atomic_exchange_available_gcc<T>::value, T> host_atomic_exchange( + T* const dest, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope scope) { + // Acquire a lock for the address + // clang-format off + while (!lock_address((void*)dest, scope)) {} + // clang-format on + + host_atomic_thread_fence(MemoryOrderAcquire(), scope); + T return_val = *dest; + *dest = val; + host_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address((void*)dest, scope); + return return_val; +} + +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<!host_atomic_exchange_available_gcc<T>::value, T> +host_atomic_compare_exchange(T* const dest, + dont_deduce_this_parameter_t<const T> compare, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope scope) { + // Acquire a lock for the address + // clang-format off + while (!lock_address((void*)dest, scope)) {} + // clang-format on + + host_atomic_thread_fence(MemoryOrderAcquire(), scope); + T return_val = *dest; + if (return_val == compare) { + *dest = val; + host_atomic_thread_fence(MemoryOrderRelease(), scope); + } + unlock_address((void*)dest, scope); + return return_val; +} + #if defined(__clang__) && (__clang_major__ >= 7) && !defined(__APPLE__) #pragma GCC diagnostic pop #endif + +} // namespace Impl } // namespace desul -#endif + #endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp index 96739bc1fc705d04d7df05a5ddd91b72069de508..8c909bacdf41d10bc3d342ef740f339c107e132e 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_HIP.hpp @@ -8,50 +8,17 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_HIP_HPP_ #define DESUL_ATOMICS_COMPARE_EXCHANGE_HIP_HPP_ -#include "desul/atomics/Common.hpp" -#include "desul/atomics/Lock_Array_HIP.hpp" -#ifdef DESUL_HAVE_HIP_ATOMICS +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Lock_Array_HIP.hpp> +#include <desul/atomics/Thread_Fence_HIP.hpp> +#include <type_traits> + namespace desul { -inline __device__ void atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { - __threadfence(); -} -inline __device__ void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { - __threadfence(); -} -inline __device__ void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) { - __threadfence(); -} -inline __device__ void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) { - __threadfence(); -} -inline __device__ void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) { - __threadfence_block(); -} -inline __device__ void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) { - __threadfence_block(); -} -inline __device__ void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) { - __threadfence_block(); -} -inline __device__ void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) { - __threadfence_block(); -} -inline __device__ void atomic_thread_fence(MemoryOrderRelease, MemoryScopeNode) { - __threadfence_system(); -} -inline __device__ void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeNode) { - __threadfence_system(); -} -inline __device__ void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeNode) { - __threadfence_system(); -} -inline __device__ void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeNode) { - __threadfence_system(); -} +namespace Impl { -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) { static_assert(sizeof(unsigned int) == 4, "this function assumes an unsigned int is 32-bit"); @@ -60,11 +27,11 @@ __device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_excha reinterpret_cast<unsigned int&>(value)); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) { static_assert(sizeof(unsigned long long int) == 8, - "this function assumes an unsigned long long is 64-bit"); + "this function assumes an unsigned long long is 64-bit"); unsigned long long int return_val = atomicCAS(reinterpret_cast<unsigned long long int*>(dest), reinterpret_cast<unsigned long long int&>(compare), @@ -72,9 +39,9 @@ __device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_excha return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderRelease, MemoryScope) { T return_val = atomic_compare_exchange( dest, compare, value, MemoryOrderRelaxed(), MemoryScope()); @@ -82,9 +49,9 @@ atomic_compare_exchange( return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderAcquire, MemoryScope) { atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); T return_val = atomic_compare_exchange( @@ -92,9 +59,9 @@ atomic_compare_exchange( return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderAcqRel, MemoryScope) { atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); T return_val = atomic_compare_exchange( @@ -103,8 +70,8 @@ atomic_compare_exchange( return return_val; } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4, T> device_atomic_exchange( T* const dest, T value, MemoryOrderRelaxed, MemoryScope) { static_assert(sizeof(unsigned int) == 4, "this function assumes an unsigned int is 32-bit"); @@ -112,118 +79,122 @@ __device__ typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange( reinterpret_cast<unsigned int&>(value)); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 8, T> device_atomic_exchange( T* const dest, T value, MemoryOrderRelaxed, MemoryScope) { static_assert(sizeof(unsigned long long int) == 8, - "this function assumes an unsigned long long is 64-bit"); + "this function assumes an unsigned long long is 64-bit"); unsigned long long int return_val = atomicExch(reinterpret_cast<unsigned long long int*>(dest), reinterpret_cast<unsigned long long int&>(value)); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_exchange(T* const dest, T compare, T value, MemoryOrderRelease, MemoryScope) { - T return_val = atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange( + T* const dest, T compare, T value, MemoryOrderRelease, MemoryScope) { + T return_val = device_atomic_compare_exchange( dest, compare, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange( T* const dest, T /*compare*/, T value, MemoryOrderAcquire, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = + device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_exchange(T* const dest, T value, MemoryOrderAcqRel, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange( + T* const dest, T value, MemoryOrderAcqRel, MemoryScope) { + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = + device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_exchange(T* const dest, T value, MemoryOrderSeqCst, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> device_atomic_exchange( + T* const dest, T value, MemoryOrderSeqCst, MemoryScope) { + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = + device_atomic_exchange(dest, value, MemoryOrderRelaxed(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryScope> -__device__ typename std::enable_if<sizeof(T) == 4 || sizeof(T) == 8, T>::type -atomic_compare_exchange( +template <class T, class MemoryScope> +__device__ std::enable_if_t<sizeof(T) == 4 || sizeof(T) == 8, T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrderSeqCst, MemoryScope) { - atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); - T return_val = atomic_compare_exchange( + device_atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + T return_val = device_atomic_compare_exchange( dest, compare, value, MemoryOrderRelaxed(), MemoryScope()); - atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); + device_atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); return return_val; } -template <typename T, class MemoryOrder, class MemoryScope> -__device__ typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type -atomic_compare_exchange( +template <class T, class MemoryOrder, class MemoryScope> +__device__ std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T> +device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrder, MemoryScope scope) { - // This is a way to avoid dead lock in a warp or wave front + // This is a way to avoid deadlock in a warp or wave front T return_val; int done = 0; - unsigned long long int active = DESUL_IMPL_BALLOT_MASK(1); + unsigned long long int active = __ballot(1); unsigned long long int done_active = 0; while (active != done_active) { if (!done) { - if (Impl::lock_address_hip((void*)dest, scope)) { + if (lock_address_hip((void*)dest, scope)) { if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value) atomic_thread_fence(MemoryOrderRelease(), scope); atomic_thread_fence(MemoryOrderAcquire(), scope); return_val = *dest; if (return_val == compare) { *dest = value; - atomic_thread_fence(MemoryOrderRelease(), scope); + device_atomic_thread_fence(MemoryOrderRelease(), scope); } - Impl::unlock_address_hip((void*)dest, scope); + unlock_address_hip((void*)dest, scope); done = 1; } } - done_active = DESUL_IMPL_BALLOT_MASK(done); + done_active = __ballot(done); } return return_val; } -template <typename T, class MemoryOrder, class MemoryScope> -__device__ typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type -atomic_exchange(T* const dest, T value, MemoryOrder, MemoryScope scope) { - // This is a way to avoid dead lock in a warp or wave front +template <class T, class MemoryOrder, class MemoryScope> +__device__ std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T> +device_atomic_exchange(T* const dest, T value, MemoryOrder, MemoryScope scope) { + // This is a way to avoid deadlock in a warp or wave front T return_val; int done = 0; - unsigned long long int active = DESUL_IMPL_BALLOT_MASK(1); + unsigned long long int active = __ballot(1); unsigned long long int done_active = 0; while (active != done_active) { if (!done) { - if (Impl::lock_address_hip((void*)dest, scope)) { + if (lock_address_hip((void*)dest, scope)) { if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value) atomic_thread_fence(MemoryOrderRelease(), scope); - atomic_thread_fence(MemoryOrderAcquire(), scope); + device_atomic_thread_fence(MemoryOrderAcquire(), scope); return_val = *dest; *dest = value; - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address_hip((void*)dest, scope); + device_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address_hip((void*)dest, scope); done = 1; } } - done_active = DESUL_IMPL_BALLOT_MASK(done); + done_active = __ballot(done); } return return_val; } + +} // namespace Impl } // namespace desul -#endif + #endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp index edf72f13db8d2ea80af5cb35b64230e362290372..12a70735e84afa6d5a5fd89d10c68f2e7daae2ab 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_MSVC.hpp @@ -8,157 +8,120 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_MSVC_HPP_ #define DESUL_ATOMICS_COMPARE_EXCHANGE_MSVC_HPP_ -#include <type_traits> -#include "desul/atomics/Common.hpp" -#ifdef DESUL_HAVE_MSVC_ATOMICS +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Thread_Fence_MSVC.hpp> +#include <type_traits> #ifndef DESUL_HAVE_16BYTE_COMPARE_AND_SWAP #define DESUL_HAVE_16BYTE_COMPARE_AND_SWAP #endif namespace desul { +namespace Impl { // Forward declare these functions. They use compare_exchange themselves // so the actual header file with them comes after this file is included. -namespace Impl { -template <typename MemoryScope> -inline bool lock_address(void* ptr, MemoryScope ms); +template <class MemoryScope> +bool lock_address(void* ptr, MemoryScope ms); -template <typename MemoryScope> +template <class MemoryScope> void unlock_address(void* ptr, MemoryScope ms); -} // namespace Impl - -template <class MemoryOrder, class MemoryScope> -void atomic_thread_fence(MemoryOrder, MemoryScope) { - std::atomic_thread_fence(CXXMemoryOrder<MemoryOrder>::value); -} - -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 1, T>::type atomic_exchange(T* const dest, - T val, - MemoryOrderRelaxed, - MemoryScope) { - char return_val = _InterlockedExchange8((char*)dest, *((char*)&val)); - return *(reinterpret_cast<T*>(&return_val)); -} - -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 2, T>::type atomic_exchange(T* const dest, - T val, - MemoryOrderRelaxed, - MemoryScope) { - short return_val = _InterlockedExchange16((short*)dest, *((short*)&val)); - return *(reinterpret_cast<T*>(&return_val)); -} -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(T* const dest, - T val, - MemoryOrderRelaxed, - MemoryScope) { - long return_val = _InterlockedExchange((long*)dest, *((long*)&val)); - return *(reinterpret_cast<T*>(&return_val)); -} +} // namespace Impl +} // namespace desul -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(T* const dest, - T val, - MemoryOrderRelaxed, - MemoryScope) { - __int64 return_val = _InterlockedExchange64((__int64*)dest, *((__int64*)&val)); - return *(reinterpret_cast<T*>(&return_val)); -} +namespace desul { +namespace Impl { -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 1, T>::type atomic_exchange(T* const dest, - T val, - MemoryOrderSeqCst, - MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 1, T> host_atomic_exchange(T* const dest, + T val, + MemoryOrder, + MemoryScope) { char return_val = _InterlockedExchange8((char*)dest, *((char*)&val)); return *(reinterpret_cast<T*>(&return_val)); } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 2, T>::type atomic_exchange(T* const dest, - T val, - MemoryOrderSeqCst, - MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 2, T> host_atomic_exchange(T* const dest, + T val, + MemoryOrder, + MemoryScope) { short return_val = _InterlockedExchange16((short*)dest, *((short*)&val)); return *(reinterpret_cast<T*>(&return_val)); } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(T* const dest, - T val, - MemoryOrderSeqCst, - MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 4, T> host_atomic_exchange(T* const dest, + T val, + MemoryOrder, + MemoryScope) { long return_val = _InterlockedExchange((long*)dest, *((long*)&val)); return *(reinterpret_cast<T*>(&return_val)); } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(T* const dest, - T val, - MemoryOrderSeqCst, - MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 8, T> host_atomic_exchange(T* const dest, + T val, + MemoryOrder, + MemoryScope) { __int64 return_val = _InterlockedExchange64((__int64*)dest, *((__int64*)&val)); return *(reinterpret_cast<T*>(&return_val)); } -template <typename T, class MemoryOrder, class MemoryScope> -typename std::enable_if<(sizeof(T) != 1 && sizeof(T) != 2 && sizeof(T) != 4 && - sizeof(T) != 8), - T>::type -atomic_exchange(T* const dest, T val, MemoryOrder, MemoryScope scope) { - while (!Impl::lock_address((void*)dest, scope)) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<(sizeof(T) != 1 && sizeof(T) != 2 && sizeof(T) != 4 && sizeof(T) != 8), + T> +host_atomic_exchange(T* const dest, T val, MemoryOrder, MemoryScope scope) { + while (!lock_address((void*)dest, scope)) { } if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value) - atomic_thread_fence(MemoryOrderRelease(), scope); - atomic_thread_fence(MemoryOrderAcquire(), scope); + host_atomic_thread_fence(MemoryOrderRelease(), scope); + host_atomic_thread_fence(MemoryOrderAcquire(), scope); T return_val = *dest; *dest = val; - atomic_thread_fence(MemoryOrderRelease(), scope); + host_atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address((void*)dest, scope); + unlock_address((void*)dest, scope); return return_val; } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 1, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 1, T> host_atomic_compare_exchange( + T* const dest, T compare, T val, MemoryOrder, MemoryScope) { char return_val = _InterlockedCompareExchange8((char*)dest, *((char*)&val), *((char*)&compare)); return *(reinterpret_cast<T*>(&return_val)); } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 2, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 2, T> host_atomic_compare_exchange( + T* const dest, T compare, T val, MemoryOrder, MemoryScope) { short return_val = _InterlockedCompareExchange16((short*)dest, *((short*)&val), *((short*)&compare)); return *(reinterpret_cast<T*>(&return_val)); } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 4, T> host_atomic_compare_exchange( + T* const dest, T compare, T val, MemoryOrder, MemoryScope) { long return_val = _InterlockedCompareExchange((long*)dest, *((long*)&val), *((long*)&compare)); return *(reinterpret_cast<T*>(&return_val)); } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 8, T> host_atomic_compare_exchange( + T* const dest, T compare, T val, MemoryOrder, MemoryScope) { __int64 return_val = _InterlockedCompareExchange64( (__int64*)dest, *((__int64*)&val), *((__int64*)&compare)); return *(reinterpret_cast<T*>(&return_val)); } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 16, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderRelaxed, MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 16, T> host_atomic_compare_exchange( + T* const dest, T compare, T val, MemoryOrder, MemoryScope) { Dummy16ByteValue* val16 = reinterpret_cast<Dummy16ByteValue*>(&val); (void)_InterlockedCompareExchange128(reinterpret_cast<__int64*>(dest), val16->value2, @@ -167,71 +130,28 @@ typename std::enable_if<sizeof(T) == 16, T>::type atomic_compare_exchange( return compare; } -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 1, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) { - char return_val = - _InterlockedCompareExchange8((char*)dest, *((char*)&val), *((char*)&compare)); - return *(reinterpret_cast<T*>(&return_val)); -} - -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 2, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) { - short return_val = - _InterlockedCompareExchange16((short*)dest, *((short*)&val), *((short*)&compare)); - return *(reinterpret_cast<T*>(&return_val)); -} - -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) { - long return_val = - _InterlockedCompareExchange((long*)dest, *((long*)&val), *((long*)&compare)); - return *(reinterpret_cast<T*>(&return_val)); -} - -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) { - __int64 return_val = _InterlockedCompareExchange64( - (__int64*)dest, *((__int64*)&val), *((__int64*)&compare)); - return *(reinterpret_cast<T*>(&return_val)); -} - -template <typename T, class MemoryScope> -typename std::enable_if<sizeof(T) == 16, T>::type atomic_compare_exchange( - T* const dest, T compare, T val, MemoryOrderSeqCst, MemoryScope) { - Dummy16ByteValue* val16 = reinterpret_cast<Dummy16ByteValue*>(&val); - (void)_InterlockedCompareExchange128(reinterpret_cast<__int64*>(dest), - val16->value2, - val16->value1, - (reinterpret_cast<__int64*>(&compare))); - return compare; -} - -template <typename T, class MemoryOrder, class MemoryScope> -typename std::enable_if<(sizeof(T) != 1 && sizeof(T) != 2 && sizeof(T) != 4 && - sizeof(T) != 8 && sizeof(T) != 16), - T>::type -atomic_compare_exchange( +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<(sizeof(T) != 1 && sizeof(T) != 2 && sizeof(T) != 4 && + sizeof(T) != 8 && sizeof(T) != 16), + T> +host_atomic_compare_exchange( T* const dest, T compare, T val, MemoryOrder, MemoryScope scope) { - while (!Impl::lock_address((void*)dest, scope)) { + while (!lock_address((void*)dest, scope)) { } if (std::is_same<MemoryOrder, MemoryOrderSeqCst>::value) - atomic_thread_fence(MemoryOrderRelease(), scope); - atomic_thread_fence(MemoryOrderAcquire(), scope); + host_atomic_thread_fence(MemoryOrderRelease(), scope); + host_atomic_thread_fence(MemoryOrderAcquire(), scope); T return_val = *dest; if (return_val == compare) { *dest = val; - atomic_thread_fence(MemoryOrderRelease(), scope); + host_atomic_thread_fence(MemoryOrderRelease(), scope); } - Impl::unlock_address((void*)dest, scope); + unlock_address((void*)dest, scope); return return_val; } +} // namespace Impl } // namespace desul #endif -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp index dfea81a4d6cb507f0d13d8972ab757b9853ddeea..115740d4c54b8c846d168ed5458337b5ff191cd3 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_OpenMP.hpp @@ -5,115 +5,82 @@ Source: https://github.com/desul/desul SPDX-License-Identifier: (BSD-3-Clause) */ + #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_OPENMP_HPP_ #define DESUL_ATOMICS_COMPARE_EXCHANGE_OPENMP_HPP_ + #include <omp.h> -#include "desul/atomics/Common.hpp" +#include <desul/atomics/Adapt_GCC.hpp> +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Thread_Fence_OpenMP.hpp> -#ifdef DESUL_HAVE_OPENMP_ATOMICS namespace desul { +namespace Impl { -#if _OPENMP > 201800 -// atomic_thread_fence for Core Scope -inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) { -// There is no seq_cst flush in OpenMP, isn't it the same anyway for fence? -#pragma omp flush acq_rel -} -inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) { -#pragma omp flush acq_rel -} -inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) { -#pragma omp flush release -} -inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) { -#pragma omp flush acquire -} -// atomic_thread_fence for Device Scope -inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) { -// There is no seq_cst flush in OpenMP, isn't it the same anyway for fence? -#pragma omp flush acq_rel -} -inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) { -#pragma omp flush acq_rel -} -inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { -#pragma omp flush release -} -inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { -#pragma omp flush acquire -} -#else -// atomic_thread_fence for Core Scope -inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) { -#pragma omp flush -} -inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) { -#pragma omp flush -} -inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) { -#pragma omp flush -} -inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) { -#pragma omp flush -} -// atomic_thread_fence for Device Scope -inline void atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) { -#pragma omp flush -} -inline void atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) { -#pragma omp flush -} -inline void atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { -#pragma omp flush -} -inline void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { -#pragma omp flush -} -#endif - -template <typename T, class MemoryOrder, class MemoryScope> -T atomic_exchange(T* dest, T value, MemoryOrder, MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +T host_atomic_exchange(T* dest, T value, MemoryOrder, MemoryScope) { T return_val; - if (!std::is_same<MemoryOrder, MemoryOrderRelaxed>::value) + if (!std::is_same<MemoryOrder, MemoryOrderRelaxed>::value) { atomic_thread_fence(MemoryOrderAcquire(), MemoryScope()); + } T& x = *dest; #pragma omp atomic capture { return_val = x; x = value; } - if (!std::is_same<MemoryOrder, MemoryOrderRelaxed>::value) + if (!std::is_same<MemoryOrder, MemoryOrderRelaxed>::value) { atomic_thread_fence(MemoryOrderRelease(), MemoryScope()); + } return return_val; } -// OpenMP doesn't have compare exchange, so we use build-ins and rely on testing that -// this works Note that means we test this in OpenMPTarget offload regions! -template <typename T, class MemoryOrder, class MemoryScope> -std::enable_if_t<Impl::atomic_always_lock_free(sizeof(T)), T> atomic_compare_exchange( +// OpenMP doesn't have compare exchange, so we use built-in functions and rely on +// testing that this works Note that means we test this in OpenMPTarget offload regions! +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<atomic_always_lock_free(sizeof(T)), T> host_atomic_compare_exchange( T* dest, T compare, T value, MemoryOrder, MemoryScope) { - using cas_t = typename Impl::atomic_compare_exchange_type<sizeof(T)>::type; + using cas_t = atomic_compare_exchange_t<T>; cas_t retval = __sync_val_compare_and_swap(reinterpret_cast<volatile cas_t*>(dest), reinterpret_cast<cas_t&>(compare), reinterpret_cast<cas_t&>(value)); return reinterpret_cast<T&>(retval); } -#if defined(__clang__) && (__clang_major__ >= 7) +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<!atomic_always_lock_free(sizeof(T)), T> // FIXME_OPENMP +host_atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) { +#if 0 + (void)__atomic_compare_exchange(dest, + &compare, + &value, + false, + GCCMemoryOrder<MemoryOrder>::value, + GCCMemoryOrder<MemoryOrder>::value); +#else + (void)dest; + (void)value; +#endif + return compare; +} + +#if 0 // FIXME_OPENMP + // Disable warning for large atomics on clang 7 and up (checked with godbolt) // clang-format off // error: large atomic operation may incur significant performance penalty [-Werror,-Watomic-alignment] // clang-format on +#if defined(__clang__) && (__clang_major__ >= 7) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Watomic-alignment" #endif // Make 16 byte cas work on host at least #pragma omp begin declare variant match(device = {kind(host)}) -template <typename T, class MemoryOrder, class MemoryScope> -std::enable_if_t<!Impl::atomic_always_lock_free(sizeof(T)) && (sizeof(T) == 16), T> -atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<!atomic_always_lock_free(sizeof(T)) && (sizeof(T) == 16), T> +host_atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) { (void)__atomic_compare_exchange(dest, &compare, &value, @@ -125,10 +92,11 @@ atomic_compare_exchange(T* dest, T compare, T value, MemoryOrder, MemoryScope) { #pragma omp end declare variant #pragma omp begin declare variant match(device = {kind(nohost)}) -template <typename T, class MemoryOrder, class MemoryScope> -std::enable_if_t<!Impl::atomic_always_lock_free(sizeof(T)) && (sizeof(T) == 16), T> -atomic_compare_exchange(T* /*dest*/, T /*compare*/, T value, MemoryOrder, MemoryScope) { - // FIXME make sure this never gets called +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<!atomic_always_lock_free(sizeof(T)) && (sizeof(T) == 16), T> +device_atomic_compare_exchange( + T* /*dest*/, T /*compare*/, T value, MemoryOrder, MemoryScope) { + // FIXME_OPENMP make sure this never gets called return value; } #pragma omp end declare variant @@ -137,6 +105,9 @@ atomic_compare_exchange(T* /*dest*/, T /*compare*/, T value, MemoryOrder, Memory #pragma GCC diagnostic pop #endif -} // namespace desul #endif + +} // namespace Impl +} // namespace desul + #endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp index 6c8c68511001962e4d3a56ab425ee982560971a5..34e36bc4e4bfc5720061bbc024cd7b480cb4a6bf 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_SYCL.hpp @@ -9,91 +9,88 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_SYCL_HPP_ #define DESUL_ATOMICS_COMPARE_EXCHANGE_SYCL_HPP_ -// clang-format off -#include "desul/atomics/SYCLConversions.hpp" -#include "desul/atomics/Common.hpp" +#include <desul/atomics/Adapt_SYCL.hpp> +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Thread_Fence_SYCL.hpp> +// FIXME_SYCL SYCL2020 dictates that <sycl/sycl.hpp> is the header to include +// but icpx 2022.1.0 and earlier versions only provide <CL/sycl.hpp> +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else #include <CL/sycl.hpp> -// clang-format on - -#ifdef DESUL_HAVE_SYCL_ATOMICS +#endif namespace desul { +namespace Impl { -template <class MemoryOrder, class MemoryScope> -inline void atomic_thread_fence(MemoryOrder, MemoryScope) { - sycl::atomic_fence( - Impl::DesulToSYCLMemoryOrder<MemoryOrder, /*extended namespace*/ false>::value, - Impl::DesulToSYCLMemoryScope<MemoryScope, /*extended namespace*/ false>::value); -} - -template <typename T, class MemoryOrder, class MemoryScope> -typename std::enable_if<sizeof(T) == 4, T>::type atomic_compare_exchange( +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 4, T> device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrder, MemoryScope) { static_assert(sizeof(unsigned int) == 4, "this function assumes an unsigned int is 32-bit"); - Impl::sycl_atomic_ref<unsigned int, MemoryOrder, MemoryScope> dest_ref( + sycl_atomic_ref<unsigned int, MemoryOrder, MemoryScope> dest_ref( *reinterpret_cast<unsigned int*>(dest)); dest_ref.compare_exchange_strong(*reinterpret_cast<unsigned int*>(&compare), *reinterpret_cast<unsigned int*>(&value)); return compare; } -template <typename T, class MemoryOrder, class MemoryScope> -typename std::enable_if<sizeof(T) == 8, T>::type atomic_compare_exchange( + +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 8, T> device_atomic_compare_exchange( T* const dest, T compare, T value, MemoryOrder, MemoryScope) { static_assert(sizeof(unsigned long long int) == 8, "this function assumes an unsigned long long is 64-bit"); - Impl::sycl_atomic_ref<unsigned long long int, MemoryOrder, MemoryScope> dest_ref( + sycl_atomic_ref<unsigned long long int, MemoryOrder, MemoryScope> dest_ref( *reinterpret_cast<unsigned long long int*>(dest)); dest_ref.compare_exchange_strong(*reinterpret_cast<unsigned long long int*>(&compare), *reinterpret_cast<unsigned long long int*>(&value)); return compare; } -template <typename T, class MemoryOrder, class MemoryScope> -typename std::enable_if<sizeof(T) == 4, T>::type atomic_exchange(T* const dest, - T value, - MemoryOrder, - MemoryScope) { +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 4, T> device_atomic_exchange(T* const dest, + T value, + MemoryOrder, + MemoryScope) { static_assert(sizeof(unsigned int) == 4, "this function assumes an unsigned int is 32-bit"); - Impl::sycl_atomic_ref<unsigned int, MemoryOrder, MemoryScope> dest_ref( + sycl_atomic_ref<unsigned int, MemoryOrder, MemoryScope> dest_ref( *reinterpret_cast<unsigned int*>(dest)); unsigned int return_val = dest_ref.exchange(*reinterpret_cast<unsigned int*>(&value)); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryOrder, class MemoryScope> -typename std::enable_if<sizeof(T) == 8, T>::type atomic_exchange(T* const dest, - T value, - MemoryOrder, - MemoryScope) { + +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<sizeof(T) == 8, T> device_atomic_exchange(T* const dest, + T value, + MemoryOrder, + MemoryScope) { static_assert(sizeof(unsigned long long int) == 8, "this function assumes an unsigned long long is 64-bit"); - Impl::sycl_atomic_ref<unsigned long long int, MemoryOrder, MemoryScope> dest_ref( + sycl_atomic_ref<unsigned long long int, MemoryOrder, MemoryScope> dest_ref( *reinterpret_cast<unsigned long long int*>(dest)); unsigned long long int return_val = dest_ref.exchange(reinterpret_cast<unsigned long long int&>(value)); return reinterpret_cast<T&>(return_val); } -template <typename T, class MemoryOrder, class MemoryScope> -typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type -atomic_compare_exchange( +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T> +device_atomic_compare_exchange( T* const /*dest*/, T compare, T /*value*/, MemoryOrder, MemoryScope) { - // FIXME_SYCL not implemented - assert(false); + assert(false); // FIXME_SYCL not implemented return compare; } -template <typename T, class MemoryOrder, class MemoryScope> -typename std::enable_if<(sizeof(T) != 8) && (sizeof(T) != 4), T>::type atomic_exchange( +template <class T, class MemoryOrder, class MemoryScope> +std::enable_if_t<(sizeof(T) != 8) && (sizeof(T) != 4), T> device_atomic_exchange( T* const /*dest*/, T value, MemoryOrder, MemoryScope) { - // FIXME_SYCL not implemented - assert(false); + assert(false); // FIXME_SYCL not implemented return value; } +} // namespace Impl } // namespace desul #endif -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp index fff6320c51bbd3ba3d39e019161af96a59ab1902..2bfb4651a847e39f0b64ce4ce6ebe1090e739298 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_ScopeCaller.hpp @@ -8,15 +8,13 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_SCOPECALLER_HPP_ #define DESUL_ATOMICS_COMPARE_EXCHANGE_SCOPECALLER_HPP_ -#include "desul/atomics/Common.hpp" -namespace desul { +#include <desul/atomics/Common.hpp> -template <class MemoryOrder> -DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrder, MemoryScopeCaller) {} +namespace desul { #define DESUL_ATOMIC_EXCHANGE_SCOPECALLER(MEMORY_ORDER) \ - template <typename T> \ + template <class T> \ DESUL_INLINE_FUNCTION T atomic_exchange( \ T* dest, T value, MEMORY_ORDER, MemoryScopeCaller) { \ T return_val = *dest; \ @@ -24,7 +22,7 @@ DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrder, MemoryScopeCaller) { return return_val; \ } \ \ - template <typename T> \ + template <class T> \ DESUL_INLINE_FUNCTION T atomic_compare_exchange( \ T* dest, T compare, T value, MEMORY_ORDER, MemoryScopeCaller) { \ T current_val = *dest; \ @@ -39,5 +37,7 @@ DESUL_ATOMIC_EXCHANGE_SCOPECALLER(MemoryOrderAcquire) DESUL_ATOMIC_EXCHANGE_SCOPECALLER(MemoryOrderRelaxed) #undef DESUL_ATOMIC_EXCHANGE_SCOPECALLER + } // namespace desul + #endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_Serial.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_Serial.hpp deleted file mode 100644 index 9d0db5c9e1318e8350e621dbf17f5e6c2c2de83d..0000000000000000000000000000000000000000 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Compare_Exchange_Serial.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (c) 2019, Lawrence Livermore National Security, LLC -and DESUL project contributors. See the COPYRIGHT file for details. -Source: https://github.com/desul/desul - -SPDX-License-Identifier: (BSD-3-Clause) -*/ -#ifndef DESUL_ATOMICS_COMPARE_EXCHANGE_SERIAL_HPP_ -#define DESUL_ATOMICS_COMPARE_EXCHANGE_SERIAL_HPP_ - -#ifdef DESUL_HAVE_SERIAL_ATOMICS -namespace desul { -template <class MemoryScope> -void atomic_thread_fence(MemoryOrderAcquire, MemoryScope) {} - -template <class MemoryScope> -void atomic_thread_fence(MemoryOrderRelease, MemoryScope) {} - -template <typename T, class MemoryScope> -T atomic_compare_exchange( - T* const dest, T compare, T value, MemoryOrderRelaxed, MemoryScope) { - T old = *dest; - if (old == compare) { - *dest = value; - } else { - old = compare; - } - return compare; -} -template <typename T, class MemoryScope> -T atomic_compare_exchange( - T* const dest, T compare, T value, MemoryOrderSeqCst, MemoryScope) { - T old = *dest; - if (old == compare) { - *dest = value; - } else { - old = compare; - } - return compare; -} -} // namespace desul -#endif -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op.hpp new file mode 100644 index 0000000000000000000000000000000000000000..adf75c574371d9946f4d3d9c345f38ee549397c5 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op.hpp @@ -0,0 +1,35 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_FETCH_OP_HPP_ +#define DESUL_ATOMICS_FETCH_OP_HPP_ + +#include <desul/atomics/Macros.hpp> + +#ifdef DESUL_HAVE_GCC_ATOMICS +#include <desul/atomics/Fetch_Op_GCC.hpp> +#endif +#ifdef DESUL_HAVE_CUDA_ATOMICS +#include <desul/atomics/Fetch_Op_CUDA.hpp> +#endif +#ifdef DESUL_HAVE_HIP_ATOMICS +#include <desul/atomics/Fetch_Op_HIP.hpp> +#endif +#ifdef DESUL_HAVE_OPENMP_ATOMICS +#include <desul/atomics/Fetch_Op_OpenMP.hpp> +#endif +#ifdef DESUL_HAVE_SYCL_ATOMICS +#include <desul/atomics/Fetch_Op_SYCL.hpp> +#endif + +#include <desul/atomics/Fetch_Op_ScopeCaller.hpp> + +// Must come last +#include <desul/atomics/Fetch_Op_Generic.hpp> + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_CUDA.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5c662bfc58ba63702568efa19da928efa9823161 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_CUDA.hpp @@ -0,0 +1,132 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_FETCH_OP_CUDA_HPP_ +#define DESUL_ATOMICS_FETCH_OP_CUDA_HPP_ + +#ifndef DESUL_CUDA_ARCH_IS_PRE_VOLTA + +#define DESUL_HAVE_CUDA_ATOMICS_ASM + +#include <desul/atomics/cuda/CUDA_asm.hpp> + +#else + +namespace desul { +namespace Impl { + +// clang-format off +inline __device__ int device_atomic_fetch_add( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_add( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_add(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +inline __device__ float device_atomic_fetch_add( float* ptr, float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +#ifndef DESUL_CUDA_ARCH_IS_PRE_PASCAL +inline __device__ double device_atomic_fetch_add( double* ptr, double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +#endif + +inline __device__ int device_atomic_fetch_sub( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_sub( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_sub(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } +inline __device__ float device_atomic_fetch_sub( float* ptr, float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } +#ifndef DESUL_CUDA_ARCH_IS_PRE_PASCAL +inline __device__ double device_atomic_fetch_sub( double* ptr, double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } +#endif + +inline __device__ int device_atomic_fetch_min( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_min( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_min(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } + +inline __device__ int device_atomic_fetch_max( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_max( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_max(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } + +inline __device__ int device_atomic_fetch_and( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_and( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_and(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } + +inline __device__ int device_atomic_fetch_or ( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } +inline __device__ unsigned int device_atomic_fetch_or ( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_or (unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } + +inline __device__ int device_atomic_fetch_xor( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_xor( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_xor(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } + +inline __device__ int device_atomic_fetch_inc( int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1 ); } +inline __device__ unsigned int device_atomic_fetch_inc( unsigned int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1u ); } +inline __device__ unsigned long long device_atomic_fetch_inc(unsigned long long* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1ull); } + +inline __device__ int device_atomic_fetch_dec( int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, 1 ); } +inline __device__ unsigned int device_atomic_fetch_dec( unsigned int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, 1u ); } +inline __device__ unsigned long long device_atomic_fetch_dec(unsigned long long* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -1 ); } + +inline __device__ unsigned int device_atomic_fetch_inc_mod( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicInc(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_dec_mod( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicDec(ptr, val); } +// clang-format on + +#define DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, TYPE) \ + template <class MemoryOrder> \ + __device__ TYPE device_atomic_fetch_##OP( \ + TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeDevice) { \ + __threadfence(); \ + TYPE return_val = \ + device_atomic_fetch_##OP(ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice()); \ + __threadfence(); \ + return return_val; \ + } \ + template <class MemoryOrder> \ + __device__ TYPE device_atomic_fetch_##OP( \ + TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeCore) { \ + return device_atomic_fetch_##OP(ptr, val, MemoryOrder(), MemoryScopeDevice()); \ + } + +#define DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(OP) \ + DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, int) \ + DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, unsigned int) \ + DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, unsigned long long) + +#ifdef DESUL_CUDA_ARCH_IS_PRE_PASCAL + +#define DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(OP) \ + DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, float) + +#else + +#define DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(OP) \ + DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, float) \ + DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(OP, double) + +#endif + +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(min) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(max) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(and) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(or) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(xor) + +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(add) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(add) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(sub) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(sub) + +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(inc) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(dec) + +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(inc_mod, unsigned int) +DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP(dec_mod, unsigned int) + +#undef DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT +#undef DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP_INTEGRAL +#undef DESUL_IMPL_CUDA_DEVICE_ATOMIC_FETCH_OP + +} // namespace Impl +} // namespace desul + +#endif + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_GCC.hpp new file mode 100644 index 0000000000000000000000000000000000000000..51e0634051166a8a120fff0fbc26bc0753e8a0b1 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_GCC.hpp @@ -0,0 +1,51 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_FETCH_OP_GCC_HPP_ +#define DESUL_ATOMICS_FETCH_OP_GCC_HPP_ + +#include <desul/atomics/Adapt_GCC.hpp> +#include <type_traits> + +namespace desul { +namespace Impl { + +// clang-format off +#define DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MEMORY_ORDER, MEMORY_SCOPE) \ + template <class T> \ + std::enable_if_t<std::is_integral<T>::value, T> host_atomic_fetch_##OP (T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ + return __atomic_fetch_##OP (dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ + } \ + template <class T> \ + std::enable_if_t<std::is_integral<T>::value, T> host_atomic_##OP##_fetch(T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ + return __atomic_##OP##_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ + } + +#define DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(OP) \ + DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderRelaxed, MemoryScopeNode ) \ + DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderRelaxed, MemoryScopeDevice) \ + DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderRelaxed, MemoryScopeCore ) \ + DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderSeqCst , MemoryScopeNode ) \ + DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderSeqCst , MemoryScopeDevice) \ + DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE(OP, MemoryOrderSeqCst , MemoryScopeCore ) +// clang-format on + +DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(add) +DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(sub) +DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(and) +DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(xor) +DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(or) +DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL(nand) + +#undef DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL +#undef DESUL_IMPL_GCC_HOST_ATOMIC_FETCH_OP_INTEGRAL_ORDER_SCOPE + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_Generic.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_Generic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a94ff8ef1875ed5ce96e7440e2c41292878bb63c --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_Generic.hpp @@ -0,0 +1,167 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_FETCH_OP_GENERIC_HPP_ +#define DESUL_ATOMICS_FETCH_OP_GENERIC_HPP_ + +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Lock_Based_Fetch_Op.hpp> +#include <desul/atomics/Lock_Free_Fetch_Op.hpp> +#include <desul/atomics/Operator_Function_Objects.hpp> +#include <type_traits> + +namespace desul { +namespace Impl { + +#define DESUL_IMPL_ATOMIC_FETCH_OP(ANNOTATION, HOST_OR_DEVICE, OP) \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_##OP( \ + T* const dest, const T val, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_fetch_oper( \ + OP##_operator<T, const T>(), dest, val, order, scope); \ + } \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_##OP##_fetch( \ + T* const dest, const T val, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_oper_fetch( \ + OP##_operator<T, const T>(), dest, val, order, scope); \ + } + +#define DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(OP) \ + DESUL_IMPL_ATOMIC_FETCH_OP(DESUL_IMPL_HOST_FUNCTION, host, OP) \ + DESUL_IMPL_ATOMIC_FETCH_OP(DESUL_IMPL_DEVICE_FUNCTION, device, OP) + +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(add) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(sub) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(max) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(min) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(mul) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(div) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(mod) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(and) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(or) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(xor) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(nand) + +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(inc_mod) +DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE(dec_mod) + +#undef DESUL_IMPL_ATOMIC_FETCH_OP_HOST_AND_DEVICE +#undef DESUL_IMPL_ATOMIC_FETCH_OP + +#define DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT(ANNOTATION, HOST_OR_DEVICE, OP) \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_##OP( \ + T* const dest, const unsigned int val, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_fetch_oper( \ + OP##_operator<T, const unsigned int>(), dest, val, order, scope); \ + } \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_##OP##_fetch( \ + T* const dest, const unsigned int val, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_oper_fetch( \ + OP##_operator<T, const unsigned int>(), dest, val, order, scope); \ + } + +#define DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT_HOST_AND_DEVICE(OP) \ + DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT(DESUL_IMPL_HOST_FUNCTION, host, OP) \ + DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT(DESUL_IMPL_DEVICE_FUNCTION, device, OP) + +DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT_HOST_AND_DEVICE(lshift) +DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT_HOST_AND_DEVICE(rshift) + +#undef DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT_HOST_AND_DEVICE +#undef DESUL_IMPL_ATOMIC_FETCH_OP_SHIFT + +#define DESUL_IMPL_ATOMIC_LOAD_AND_STORE(ANNOTATION, HOST_OR_DEVICE) \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_load( \ + const T* const dest, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_fetch_oper( \ + load_operator<T, const T>(), const_cast<T*>(dest), T(), order, scope); \ + } \ + \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION void HOST_OR_DEVICE##_atomic_store( \ + T* const dest, const T val, MemoryOrder order, MemoryScope scope) { \ + (void)HOST_OR_DEVICE##_atomic_fetch_oper( \ + store_operator<T, const T>(), dest, val, order, scope); \ + } + +DESUL_IMPL_ATOMIC_LOAD_AND_STORE(DESUL_IMPL_HOST_FUNCTION, host) +DESUL_IMPL_ATOMIC_LOAD_AND_STORE(DESUL_IMPL_DEVICE_FUNCTION, device) + +#undef DESUL_IMPL_ATOMIC_LOAD_AND_STORE + +#define DESUL_IMPL_ATOMIC_OP(ANNOTATION, HOST_OR_DEVICE, OP) \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION void HOST_OR_DEVICE##_atomic_##OP( \ + T* const dest, const T val, MemoryOrder order, MemoryScope scope) { \ + (void)HOST_OR_DEVICE##_atomic_fetch_##OP(dest, val, order, scope); \ + } + +#define DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(OP) \ + DESUL_IMPL_ATOMIC_OP(DESUL_IMPL_HOST_FUNCTION, host, OP) \ + DESUL_IMPL_ATOMIC_OP(DESUL_IMPL_DEVICE_FUNCTION, device, OP) + +DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(add) +DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(sub) +DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(mul) +DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(div) +DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(min) +DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE(max) + +#undef DESUL_IMPL_ATOMIC_OP_HOST_AND_DEVICE +#undef DESUL_IMPL_ATOMIC_OP + +#define DESUL_IMPL_ATOMIC_INCREMENT_DECREMENT(ANNOTATION, HOST_OR_DEVICE) \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_inc_fetch( \ + T* const dest, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_add_fetch(dest, T(1), order, scope); \ + } \ + \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_dec_fetch( \ + T* const dest, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_sub_fetch(dest, T(1), order, scope); \ + } \ + \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_inc( \ + T* const dest, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_fetch_add(dest, T(1), order, scope); \ + } \ + \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_dec( \ + T* const dest, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_fetch_sub(dest, T(1), order, scope); \ + } \ + \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION void HOST_OR_DEVICE##_atomic_inc( \ + T* const dest, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_add(dest, T(1), order, scope); \ + } \ + \ + template <class T, class MemoryOrder, class MemoryScope> \ + ANNOTATION void HOST_OR_DEVICE##_atomic_dec( \ + T* const dest, MemoryOrder order, MemoryScope scope) { \ + return HOST_OR_DEVICE##_atomic_sub(dest, T(1), order, scope); \ + } + +DESUL_IMPL_ATOMIC_INCREMENT_DECREMENT(DESUL_IMPL_HOST_FUNCTION, host) +DESUL_IMPL_ATOMIC_INCREMENT_DECREMENT(DESUL_IMPL_DEVICE_FUNCTION, device) + +#undef DESUL_IMPL_ATOMIC_INCREMENT_DECREMENT + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_HIP.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e9c749809de5910368a7694e354d50874e58fa9d --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_HIP.hpp @@ -0,0 +1,109 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_FECH_OP_HIP_HPP_ +#define DESUL_ATOMICS_FECH_OP_HIP_HPP_ + +namespace desul { +namespace Impl { + +// clang-format off +inline __device__ int device_atomic_fetch_add( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_add( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_add(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +inline __device__ float device_atomic_fetch_add( float* ptr, float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } +inline __device__ double device_atomic_fetch_add( double* ptr, double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } + +inline __device__ int device_atomic_fetch_sub( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_sub( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_sub(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } +inline __device__ float device_atomic_fetch_sub( float* ptr, float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } +inline __device__ double device_atomic_fetch_sub( double* ptr, double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } + +inline __device__ int device_atomic_fetch_min( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_min( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_min(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } + +inline __device__ int device_atomic_fetch_max( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_max( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_max(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } + +inline __device__ int device_atomic_fetch_and( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_and( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_and(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } + +inline __device__ int device_atomic_fetch_or ( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } +inline __device__ unsigned int device_atomic_fetch_or ( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_or (unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } + +inline __device__ int device_atomic_fetch_xor( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_xor( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } +inline __device__ unsigned long long device_atomic_fetch_xor(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } + +inline __device__ int device_atomic_fetch_inc( int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1 ); } +inline __device__ unsigned int device_atomic_fetch_inc( unsigned int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1u ); } +inline __device__ unsigned long long device_atomic_fetch_inc(unsigned long long* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1ull); } + +inline __device__ int device_atomic_fetch_dec( int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, 1 ); } +inline __device__ unsigned int device_atomic_fetch_dec( unsigned int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, 1u ); } +inline __device__ unsigned long long device_atomic_fetch_dec(unsigned long long* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -1 ); } + +inline __device__ unsigned int device_atomic_fetch_inc_mod( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicInc(ptr, val); } +inline __device__ unsigned int device_atomic_fetch_dec_mod( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicDec(ptr, val); } +// clang-format on + +#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, TYPE) \ + template <class MemoryOrder> \ + __device__ TYPE device_atomic_fetch_##OP( \ + TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeDevice) { \ + __threadfence(); \ + TYPE return_val = \ + device_atomic_fetch_##OP(ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice()); \ + __threadfence(); \ + return return_val; \ + } \ + template <class MemoryOrder> \ + __device__ TYPE device_atomic_fetch_##OP( \ + TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeCore) { \ + return device_atomic_fetch_##OP(ptr, val, MemoryOrder(), MemoryScopeDevice()); \ + } + +#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(OP) \ + DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, int) \ + DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, unsigned int) \ + DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, unsigned long long) + +#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(OP) \ + DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, float) \ + DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, double) + +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(min) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(max) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(and) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(or) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(xor) + +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(add) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(add) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(sub) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(sub) + +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(inc) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(dec) + +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(inc_mod, unsigned int) +DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(dec_mod, unsigned int) + +#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT +#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL +#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_OpenMP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_OpenMP.hpp new file mode 100644 index 0000000000000000000000000000000000000000..042d555642be031c2dd2c8dc8b15356ebf234b02 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_OpenMP.hpp @@ -0,0 +1,132 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ +#ifndef DESUL_ATOMICS_FETCH_OP_OPENMP_HPP_ +#define DESUL_ATOMICS_FETCH_OP_OPENMP_HPP_ + +#include <desul/atomics/Common.hpp> +#include <desul/atomics/openmp/OpenMP_40.hpp> + +#if 0 // FIXME_OPENMP +namespace desul { +namespace Impl { + +// clang-format off +//<editor-fold desc="atomic_fetch_{add,sub,and,or,xor}"> +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_add( +T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { tmp = *ptr; *ptr += val; } + return tmp; +} + +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_sub( +T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { tmp = *ptr; *ptr -= val; } + return tmp; +} + +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_and( +T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { tmp = *ptr; *ptr &= val; } + return tmp; +} + +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_or( +T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { tmp = *ptr; *ptr |= val; } + return tmp; +} + +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_xor( +T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { tmp = *ptr; *ptr ^= val; } + return tmp; +} +//</editor-fold> + +//<editor-fold desc="atomic_{add,sub,and,or,xor}_fetch"> +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_add_fetch( + T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { *ptr += val; tmp = *ptr; } + return tmp; +} + +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_sub_fetch( + T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { *ptr -= val; tmp = *ptr; } + return tmp; +} + +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_and_fetch( + T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { *ptr &= val; tmp = *ptr; } + return tmp; +} + +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_or_fetch( + T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { *ptr |= val; tmp = *ptr; } + return tmp; +} + +template <class T> +std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_xor_fetch( + T* ptr, T val, MemoryOrderRelaxed, MemoryScopeDevice) { + T tmp; +#pragma omp atomic capture + { *ptr ^= val; tmp = *ptr; } + return tmp; +} +//</editor-fold> +// clang-format on + +#define DESUL_IMPL_OPENMP_HOST_ATOMIC_FETCH_OP_ARITHMETIC(OP, MEMORY_ORDER) \ + template <class T> \ + std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_fetch_##OP( \ + T* ptr, T val, MemoryOrderRelaxed, MemoryScopeCore) { \ + return host_atomic_fetch_##OP( \ + ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice()); \ + } \ + template <class T> \ + std::enable_if_t<std::is_arithmetic<T>::value, T> host_atomic_##OP##_fetch( \ + T* ptr, T val, MemoryOrderRelaxed, MemoryScopeCore) { \ + return host_atomic_##OP##_fetch( \ + ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice()); \ + } + +} // namespace Impl +} // namespace desul +#endif + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/SYCL.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_SYCL.hpp similarity index 72% rename from packages/kokkos/tpls/desul/include/desul/atomics/SYCL.hpp rename to packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_SYCL.hpp index da34564f6967313e9c7c8ea1e215feec67b40197..afe5861551a4076cb245123d9277fc76ca1052a7 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/SYCL.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_SYCL.hpp @@ -5,29 +5,29 @@ Source: https://github.com/desul/desul SPDX-License-Identifier: (BSD-3-Clause) */ -#ifndef DESUL_ATOMICS_SYCL_HPP_ -#define DESUL_ATOMICS_SYCL_HPP_ -#ifdef DESUL_HAVE_SYCL_ATOMICS +#ifndef DESUL_ATOMICS_FETCH_OP_SYCL_HPP_ +#define DESUL_ATOMICS_FETCH_OP_SYCL_HPP_ -// clang-format off -#include "desul/atomics/SYCLConversions.hpp" -#include "desul/atomics/Common.hpp" -// clang-format on +#include <desul/atomics/Adapt_SYCL.hpp> +#include <desul/atomics/Common.hpp> namespace desul { +namespace Impl { -#define DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER(OPER, TYPE) \ - template <class MemoryOrder> \ - TYPE atomic_fetch_##OPER(TYPE* dest, TYPE val, MemoryOrder, MemoryScopeDevice) { \ - Impl::sycl_atomic_ref<TYPE, MemoryOrder, MemoryScopeDevice> dest_ref(*dest); \ - return dest_ref.fetch_##OPER(val); \ - } \ - template <class MemoryOrder> \ - TYPE atomic_fetch_##OPER(TYPE* dest, TYPE val, MemoryOrder, MemoryScopeCore) { \ - Impl::sycl_atomic_ref<TYPE, MemoryOrder, MemoryScopeCore> dest_ref(*dest); \ - return dest_ref.fetch_##OPER(val); \ +// clang-format off +#define DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER(OPER, TYPE) \ + template <class MemoryOrder> \ + TYPE device_atomic_fetch_##OPER(TYPE* dest, TYPE val, MemoryOrder, MemoryScopeDevice) { \ + sycl_atomic_ref<TYPE, MemoryOrder, MemoryScopeDevice> dest_ref(*dest); \ + return dest_ref.fetch_##OPER(val); \ + } \ + template <class MemoryOrder> \ + TYPE device_atomic_fetch_##OPER(TYPE* dest, TYPE val, MemoryOrder, MemoryScopeCore ) { \ + sycl_atomic_ref<TYPE, MemoryOrder, MemoryScopeCore> dest_ref(*dest); \ + return dest_ref.fetch_##OPER(val); \ } +// clang-format on #define DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER_INTEGRAL(OPER) \ DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER(OPER, int) \ @@ -58,7 +58,7 @@ DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER_FLOATING_POINT(max) #undef DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER_INTEGRAL #undef DESUL_IMPL_SYCL_ATOMIC_FETCH_OPER +} // namespace Impl } // namespace desul -#endif // DESUL_HAVE_SYCL_ATOMICS -#endif // DESUL_ATOMICS_SYCL_HPP_ +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_ScopeCaller.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_ScopeCaller.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6d4623e35bc5033cdf6a461166b2b2fffbad7a92 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Fetch_Op_ScopeCaller.hpp @@ -0,0 +1,55 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_FETCH_OP_SCOPECALLER_HPP_ +#define DESUL_ATOMICS_FETCH_OP_SCOPECALLER_HPP_ + +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Macros.hpp> + +namespace desul { +namespace Impl { + +#define DESUL_IMPL_ATOMIC_FETCH_OPER(ANNOTATION, HOST_OR_DEVICE) \ + template <class Oper, class T, class MemoryOrder> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_oper( \ + const Oper& op, \ + T* const dest, \ + dont_deduce_this_parameter_t<const T> val, \ + MemoryOrder /*order*/, \ + MemoryScopeCaller /*scope*/) { \ + T oldval = *dest; \ + *dest = op.apply(oldval, val); \ + return oldval; \ + } \ + \ + template <class Oper, class T, class MemoryOrder> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_oper_fetch( \ + const Oper& op, \ + T* const dest, \ + dont_deduce_this_parameter_t<const T> val, \ + MemoryOrder /*order*/, \ + MemoryScopeCaller /*scope*/) { \ + T oldval = *dest; \ + T newval = op.apply(oldval, val); \ + *dest = newval; \ + return newval; \ + } + +DESUL_IMPL_ATOMIC_FETCH_OPER(DESUL_IMPL_HOST_FUNCTION, host) +DESUL_IMPL_ATOMIC_FETCH_OPER(DESUL_IMPL_DEVICE_FUNCTION, device) + +#undef DESUL_IMPL_ATOMIC_FETCH_OPER + +} // namespace Impl +} // namespace desul + +// FIXME consider implementing directly atomic_fetch_##OP and atomic_##OP##_fetch or +// dropping this placeholder + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/GCC.hpp deleted file mode 100644 index 239c84fd30dc899c85109d82a3de7d9e66b3b73d..0000000000000000000000000000000000000000 --- a/packages/kokkos/tpls/desul/include/desul/atomics/GCC.hpp +++ /dev/null @@ -1,135 +0,0 @@ -/* -Copyright (c) 2019, Lawrence Livermore National Security, LLC -and DESUL project contributors. See the COPYRIGHT file for details. -Source: https://github.com/desul/desul - -SPDX-License-Identifier: (BSD-3-Clause) -*/ -#ifndef DESUL_ATOMICS_GCC_HPP_ -#define DESUL_ATOMICS_GCC_HPP_ - -#ifdef DESUL_HAVE_GCC_ATOMICS - -#include <type_traits> -/* -Built - in Function : type __atomic_add_fetch(type * ptr, type val, int memorder) -Built - in Function : type __atomic_sub_fetch(type * ptr, type val, int memorder) -Built - in Function : type __atomic_and_fetch(type * ptr, type val, int memorder) -Built - in Function : type __atomic_xor_fetch(type * ptr, type val, int memorder) -Built - in Function : type __atomic_or_fetch(type * ptr, type val, int memorder) -Built - in Function : type __atomic_nand_fetch(type * ptr, type val, int memorder) -*/ - -#define DESUL_GCC_INTEGRAL_OP_ATOMICS(MEMORY_ORDER, MEMORY_SCOPE) \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_add( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_fetch_add(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_sub( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_fetch_sub(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_and( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_fetch_and(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_or( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_fetch_or(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_xor( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_fetch_xor(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_fetch_nand( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_fetch_nand(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_add_fetch( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_add_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_sub_fetch( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_sub_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_and_fetch( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_and_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_or_fetch( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_or_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_xor_fetch( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_xor_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } \ - template <typename T> \ - typename std::enable_if<std::is_integral<T>::value, T>::type atomic_nand_fetch( \ - T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { \ - return __atomic_nand_fetch(dest, value, GCCMemoryOrder<MEMORY_ORDER>::value); \ - } - -namespace desul { -DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderRelaxed, MemoryScopeNode) -DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderRelaxed, MemoryScopeDevice) -DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderRelaxed, MemoryScopeCore) -DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderSeqCst, MemoryScopeNode) -DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderSeqCst, MemoryScopeDevice) -DESUL_GCC_INTEGRAL_OP_ATOMICS(MemoryOrderSeqCst, MemoryScopeCore) - -template <typename T, class MemoryOrder, class MemoryScope> -std::enable_if_t<!Impl::atomic_exchange_available_gcc<T>::value, T> atomic_exchange( - T* const dest, - Impl::dont_deduce_this_parameter_t<const T> val, - MemoryOrder /*order*/, - MemoryScope scope) { - // Acquire a lock for the address - // clang-format off - while (!Impl::lock_address((void*)dest, scope)) {} - // clang-format on - - atomic_thread_fence(MemoryOrderAcquire(), scope); - T return_val = *dest; - *dest = val; - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address((void*)dest, scope); - return return_val; -} - -template <typename T, class MemoryOrder, class MemoryScope> -std::enable_if_t<!Impl::atomic_exchange_available_gcc<T>::value, T> -atomic_compare_exchange(T* const dest, - Impl::dont_deduce_this_parameter_t<const T> compare, - Impl::dont_deduce_this_parameter_t<const T> val, - MemoryOrder /*order*/, - MemoryScope scope) { - // Acquire a lock for the address - // clang-format off - while (!Impl::lock_address((void*)dest, scope)) {} - // clang-format on - - atomic_thread_fence(MemoryOrderAcquire(), scope); - T return_val = *dest; - if (return_val == compare) { - *dest = val; - atomic_thread_fence(MemoryOrderRelease(), scope); - } - Impl::unlock_address((void*)dest, scope); - return return_val; -} -} // namespace desul -#endif -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Generic.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Generic.hpp index 1fffd3b2931c3f78ee6ca5911cdff31b55e9e566..fef10222e34ed056b89dc0cc8babfb91fd504d00 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Generic.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Generic.hpp @@ -8,718 +8,366 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_GENERIC_HPP_ #define DESUL_ATOMICS_GENERIC_HPP_ - +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Compare_Exchange.hpp> +#include <desul/atomics/Fetch_Op.hpp> +#include <desul/atomics/Lock_Array.hpp> +#include <desul/atomics/Macros.hpp> +#include <desul/atomics/Thread_Fence.hpp> #include <type_traits> -#if defined(__GNUC__) && (!defined(__clang__)) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif -#include "desul/atomics/Common.hpp" -#include "desul/atomics/Compare_Exchange.hpp" -#include "desul/atomics/Lock_Array.hpp" -#include "desul/atomics/Macros.hpp" -// Combination operands to be used in an Compare and Exchange based atomic -// operation -namespace desul { -namespace Impl { - -template <class Scalar1, class Scalar2> -struct MaxOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { - return (val1 > val2 ? val1 : val2); - } - DESUL_FORCEINLINE_FUNCTION - static constexpr bool check_early_exit(Scalar1 const& val1, Scalar2 const& val2) { - return val1 > val2; - } -}; - -template <class Scalar1, class Scalar2> -struct MinOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { - return (val1 < val2 ? val1 : val2); - } - DESUL_FORCEINLINE_FUNCTION - static constexpr bool check_early_exit(Scalar1 const& val1, Scalar2 const& val2) { - return val1 < val2; - } -}; - -template <typename Op, typename Scalar1, typename Scalar2, typename = bool> -struct may_exit_early : std::false_type {}; - -// This exit early optimization causes weird compiler errors with MSVC 2019 -#ifndef DESUL_HAVE_MSVC_ATOMICS -template <typename Op, typename Scalar1, typename Scalar2> -struct may_exit_early<Op, - Scalar1, - Scalar2, - decltype(Op::check_early_exit(std::declval<Scalar1 const&>(), - std::declval<Scalar2 const&>()))> - : std::true_type {}; -#endif - -template <typename Op, typename Scalar1, typename Scalar2> -constexpr DESUL_FUNCTION - typename std::enable_if<may_exit_early<Op, Scalar1, Scalar2>::value, bool>::type - check_early_exit(Op const&, Scalar1 const& val1, Scalar2 const& val2) { - return Op::check_early_exit(val1, val2); -} - -template <typename Op, typename Scalar1, typename Scalar2> -constexpr DESUL_FUNCTION - typename std::enable_if<!may_exit_early<Op, Scalar1, Scalar2>::value, bool>::type - check_early_exit(Op const&, Scalar1 const&, Scalar2 const&) { - return false; -} - -template <class Scalar1, class Scalar2> -struct AddOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 + val2; } -}; - -template <class Scalar1, class Scalar2> -struct SubOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 - val2; } -}; - -template <class Scalar1, class Scalar2> -struct MulOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 * val2; } -}; - -template <class Scalar1, class Scalar2> -struct DivOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 / val2; } -}; - -template <class Scalar1, class Scalar2> -struct ModOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 % val2; } -}; - -template <class Scalar1, class Scalar2> -struct AndOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 & val2; } -}; - -template <class Scalar1, class Scalar2> -struct OrOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 | val2; } -}; - -template <class Scalar1, class Scalar2> -struct XorOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 ^ val2; } -}; - -template <class Scalar1, class Scalar2> -struct NandOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { - return ~(val1 & val2); - } -}; - -template <class Scalar1, class Scalar2> -struct LShiftOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { - return val1 << val2; - } -}; - -template <class Scalar1, class Scalar2> -struct RShiftOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { - return val1 >> val2; - } -}; - -template <class Scalar1, class Scalar2> -struct IncModOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { - return ((val1 >= val2) ? Scalar1(0) : val1 + Scalar1(1)); - } -}; - -template <class Scalar1, class Scalar2> -struct DecModOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { - return (((val1 == Scalar1(0)) | (val1 > val2)) ? val2 : (val1 - Scalar1(1))); - } -}; - -template <class Scalar1, class Scalar2> -struct StoreOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1&, const Scalar2& val2) { return val2; } -}; - -template <class Scalar1, class Scalar2> -struct LoadOper { - DESUL_FORCEINLINE_FUNCTION - static Scalar1 apply(const Scalar1& val1, const Scalar2&) { return val1; } -}; - -template <class Oper, - typename T, - class MemoryOrder, - class MemoryScope, - // equivalent to: - // requires atomic_always_lock_free(sizeof(T)) - std::enable_if_t<atomic_always_lock_free(sizeof(T)), int> = 0> -DESUL_INLINE_FUNCTION T atomic_fetch_oper(const Oper& op, - T* const dest, - dont_deduce_this_parameter_t<const T> val, - MemoryOrder order, - MemoryScope scope) { - using cas_t = typename atomic_compare_exchange_type<sizeof(T)>::type; - cas_t oldval = reinterpret_cast<cas_t&>(*dest); - cas_t assume = oldval; - - do { - if (Impl::check_early_exit(op, reinterpret_cast<T&>(oldval), val)) - return reinterpret_cast<T&>(oldval); - assume = oldval; - T newval = op.apply(reinterpret_cast<T&>(assume), val); - oldval = desul::atomic_compare_exchange(reinterpret_cast<cas_t*>(dest), - assume, - reinterpret_cast<cas_t&>(newval), - order, - scope); - } while (assume != oldval); - - return reinterpret_cast<T&>(oldval); -} - -template <class Oper, - typename T, - class MemoryOrder, - class MemoryScope, - // equivalent to: - // requires atomic_always_lock_free(sizeof(T)) - std::enable_if_t<atomic_always_lock_free(sizeof(T)), int> = 0> -DESUL_INLINE_FUNCTION T atomic_oper_fetch(const Oper& op, - T* const dest, - dont_deduce_this_parameter_t<const T> val, - MemoryOrder order, - MemoryScope scope) { - using cas_t = typename atomic_compare_exchange_type<sizeof(T)>::type; - cas_t oldval = reinterpret_cast<cas_t&>(*dest); - T newval = val; - cas_t assume = oldval; - do { - if (Impl::check_early_exit(op, reinterpret_cast<T&>(oldval), val)) - return reinterpret_cast<T&>(oldval); - assume = oldval; - newval = op.apply(reinterpret_cast<T&>(assume), val); - oldval = desul::atomic_compare_exchange(reinterpret_cast<cas_t*>(dest), - assume, - reinterpret_cast<cas_t&>(newval), - order, - scope); - } while (assume != oldval); - - return newval; -} - -template <class Oper, - typename T, - class MemoryOrder, - class MemoryScope, - // equivalent to: - // requires !atomic_always_lock_free(sizeof(T)) - std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> -DESUL_INLINE_FUNCTION T atomic_fetch_oper(const Oper& op, - T* const dest, - dont_deduce_this_parameter_t<const T> val, - MemoryOrder /*order*/, - MemoryScope scope) { -#if defined(DESUL_HAVE_FORWARD_PROGRESS) - // Acquire a lock for the address - while (!Impl::lock_address((void*)dest, scope)) { - } - atomic_thread_fence(MemoryOrderAcquire(), scope); - T return_val = *dest; - *dest = op.apply(return_val, val); - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address((void*)dest, scope); - return return_val; -#elif defined(DESUL_HAVE_GPU_LIKE_PROGRESS) - // This is a way to avoid dead lock in a warp or wave front - T return_val; - int done = 0; -#ifdef __HIPCC__ - unsigned long long int active = DESUL_IMPL_BALLOT_MASK(1); - unsigned long long int done_active = 0; - while (active != done_active) { - if (!done) { - if (Impl::lock_address_hip((void*)dest, scope)) { - atomic_thread_fence(MemoryOrderAcquire(), scope); - return_val = *dest; - *dest = op.apply(return_val, val); - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address_hip((void*)dest, scope); - done = 1; - } - } - done_active = DESUL_IMPL_BALLOT_MASK(done); - } - return return_val; -// FIXME_SYCL not implemented -#elif defined(__SYCL_DEVICE_ONLY__) - (void)op; - (void)dest; - (void)scope; - (void)return_val; - (void)done; - - assert(false); - return val; -#else - unsigned int mask = DESUL_IMPL_ACTIVEMASK; - unsigned int active = DESUL_IMPL_BALLOT_MASK(mask, 1); - unsigned int done_active = 0; - while (active != done_active) { - if (!done) { - if (Impl::lock_address_cuda((void*)dest, scope)) { - atomic_thread_fence(MemoryOrderAcquire(), scope); - return_val = *dest; - *dest = op.apply(return_val, val); - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address_cuda((void*)dest, scope); - done = 1; - } - } - done_active = DESUL_IMPL_BALLOT_MASK(mask, done); - } - return return_val; -#endif -#else - static_assert(false, "Unimplemented lock based atomic\n"); - return val; -#endif -} - -template <class Oper, - typename T, - class MemoryOrder, - class MemoryScope, - // equivalent to: - // requires !atomic_always_lock_free(sizeof(T)) - std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> -DESUL_INLINE_FUNCTION T atomic_oper_fetch(const Oper& op, - T* const dest, - dont_deduce_this_parameter_t<const T> val, - MemoryOrder /*order*/, - MemoryScope scope) { -#if defined(DESUL_HAVE_FORWARD_PROGRESS) - // Acquire a lock for the address - while (!Impl::lock_address((void*)dest, scope)) { - } +namespace desul { - atomic_thread_fence(MemoryOrderAcquire(), scope); - T return_val = op.apply(*dest, val); - *dest = return_val; - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address((void*)dest, scope); - return return_val; -#elif defined(DESUL_HAVE_GPU_LIKE_PROGRESS) - // This is a way to avoid dead lock in a warp or wave front - T return_val; - int done = 0; -#ifdef __HIPCC__ - unsigned long long int active = DESUL_IMPL_BALLOT_MASK(1); - unsigned long long int done_active = 0; - while (active != done_active) { - if (!done) { - if (Impl::lock_address_hip((void*)dest, scope)) { - atomic_thread_fence(MemoryOrderAcquire(), scope); - return_val = op.apply(*dest, val); - *dest = return_val; - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address_hip((void*)dest, scope); - done = 1; - } - } - done_active = DESUL_IMPL_BALLOT_MASK(done); - } - return return_val; - // FIXME_SYCL not implemented -#elif defined(__SYCL_DEVICE_ONLY__) - (void)op; - (void)dest; - (void)scope; - (void)done; - - assert(false); - return val; -#else - unsigned int mask = DESUL_IMPL_ACTIVEMASK; - unsigned int active = DESUL_IMPL_BALLOT_MASK(mask, 1); - unsigned int done_active = 0; - while (active != done_active) { - if (!done) { - if (Impl::lock_address_cuda((void*)dest, scope)) { - atomic_thread_fence(MemoryOrderAcquire(), scope); - return_val = op.apply(*dest, val); - *dest = return_val; - atomic_thread_fence(MemoryOrderRelease(), scope); - Impl::unlock_address_cuda((void*)dest, scope); - done = 1; - } - } - done_active = DESUL_IMPL_BALLOT_MASK(mask, done); - } - return return_val; -#endif -#else - static_assert(false, "Unimplemented lock based atomic\n"); - return val; -#endif +template <class MemoryOrder, class MemoryScope> +DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrder order, MemoryScope scope) { + DESUL_IF_ON_DEVICE(return Impl::device_atomic_thread_fence(order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_thread_fence(order, scope);) } - -template <class Oper, typename T, class MemoryOrder> -DESUL_INLINE_FUNCTION T atomic_fetch_oper(const Oper& op, - T* const dest, - dont_deduce_this_parameter_t<const T> val, - MemoryOrder /*order*/, - MemoryScopeCaller /*scope*/) { - T oldval = *dest; - *dest = op.apply(oldval, val); - return oldval; +template <class T, class MemoryOrder, class MemoryScope> +DESUL_INLINE_FUNCTION T +atomic_exchange(T* dest, T val, MemoryOrder order, MemoryScope scope) { + DESUL_IF_ON_DEVICE(return Impl::device_atomic_exchange(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_exchange(dest, val, order, scope);) } -template <class Oper, typename T, class MemoryOrder> -DESUL_INLINE_FUNCTION T atomic_oper_fetch(const Oper& op, - T* const dest, - dont_deduce_this_parameter_t<const T> val, - MemoryOrder /*order*/, - MemoryScopeCaller /*scope*/) { - T oldval = *dest; - T newval = op.apply(oldval, val); - *dest = newval; - return newval; +template <class T, class MemoryOrder, class MemoryScope> +DESUL_INLINE_FUNCTION T +atomic_compare_exchange(T* dest, T cmp, T val, MemoryOrder order, MemoryScope scope) { + DESUL_IF_ON_DEVICE( + return Impl::device_atomic_compare_exchange(dest, cmp, val, order, scope);) + DESUL_IF_ON_HOST( + return Impl::host_atomic_compare_exchange(dest, cmp, val, order, scope);) } -} // namespace Impl -} // namespace desul - -namespace desul { - // Fetch_Oper atomics: return value before operation -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_add(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::AddOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_add(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_add(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_sub(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::SubOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_sub(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_sub(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_max(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::MaxOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_max(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_max(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_min(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::MinOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_min(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_min(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_mul(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::MulOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_mul(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_mul(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_div(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::DivOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_div(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_div(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_mod(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::ModOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_mod(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_mod(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_and(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::AndOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_and(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_and(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_or(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::OrOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_or(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_or(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_xor(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::XorOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_xor(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_xor(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_nand(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper(Impl::NandOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_nand(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_nand(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_lshift(T* const dest, const unsigned int val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper( - Impl::LShiftOper<T, const unsigned int>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_lshift(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_lshift(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_rshift(T* const dest, const unsigned int val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper( - Impl::RShiftOper<T, const unsigned int>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_rshift(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_rshift(dest, val, order, scope);) } // Oper Fetch atomics: return value after operation -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_add_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::AddOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_add_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_add_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_sub_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::SubOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_sub_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_sub_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_max_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::MaxOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_max_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_max_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_min_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::MinOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_min_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_min_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_mul_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::MulOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_mul_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_mul_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_div_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::DivOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_div_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_div_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_mod_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::ModOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_mod_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_mod_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_and_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::AndOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_and_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_and_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_or_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::OrOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_or_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_or_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_xor_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::XorOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_xor_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_xor_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_nand_fetch(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch(Impl::NandOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_nand_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_nand_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_lshift_fetch(T* const dest, const unsigned int val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch( - Impl::LShiftOper<T, const unsigned int>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_lshift_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_lshift_fetch(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_rshift_fetch(T* const dest, const unsigned int val, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_oper_fetch( - Impl::RShiftOper<T, const unsigned int>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_rshift_fetch(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_rshift_fetch(dest, val, order, scope);) } // Other atomics -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_load(const T* const dest, MemoryOrder order, MemoryScope scope) { - return Impl::atomic_fetch_oper( - Impl::LoadOper<T, const T>(), const_cast<T*>(dest), T(), order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_load(dest, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_load(dest, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_store(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - (void)Impl::atomic_fetch_oper(Impl::StoreOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_store(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_store(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_add(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - (void)atomic_fetch_add(dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_add(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_add(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_sub(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - (void)atomic_fetch_sub(dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_sub(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_sub(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_mul(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - (void)atomic_fetch_mul(dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_mul(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_mul(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_div(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - (void)atomic_fetch_div(dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_div(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_div(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_min(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - (void)atomic_fetch_min(dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_min(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_min(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_max(T* const dest, const T val, MemoryOrder order, MemoryScope scope) { - (void)atomic_fetch_max(dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_max(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_max(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_inc_fetch(T* const dest, MemoryOrder order, MemoryScope scope) { - return atomic_add_fetch(dest, T(1), order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_inc_fetch(dest, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_inc_fetch(dest, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_dec_fetch(T* const dest, MemoryOrder order, MemoryScope scope) { - return atomic_sub_fetch(dest, T(1), order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_dec_fetch(dest, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_dec_fetch(dest, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_inc(T* const dest, MemoryOrder order, MemoryScope scope) { - return atomic_fetch_add(dest, T(1), order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_inc(dest, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_inc(dest, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_inc_mod(T* const dest, T val, MemoryOrder order, MemoryScope scope) { - static_assert(std::is_unsigned<T>::value, - "Signed types not supported by atomic_fetch_inc_mod."); - return Impl::atomic_fetch_oper( - Impl::IncModOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_inc_mod(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_inc_mod(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_dec(T* const dest, MemoryOrder order, MemoryScope scope) { - return atomic_fetch_sub(dest, T(1), order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_dec(dest, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_dec(dest, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION T atomic_fetch_dec_mod(T* const dest, T val, MemoryOrder order, MemoryScope scope) { - static_assert(std::is_unsigned<T>::value, - "Signed types not supported by atomic_fetch_dec_mod."); - return Impl::atomic_fetch_oper( - Impl::DecModOper<T, const T>(), dest, val, order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_fetch_dec_mod(dest, val, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_fetch_dec_mod(dest, val, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_inc(T* const dest, MemoryOrder order, MemoryScope scope) { - return atomic_add(dest, T(1), order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_inc(dest, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_inc(dest, order, scope);) } -template <typename T, class MemoryOrder, class MemoryScope> +template <class T, class MemoryOrder, class MemoryScope> DESUL_INLINE_FUNCTION void atomic_dec(T* const dest, MemoryOrder order, MemoryScope scope) { - return atomic_sub(dest, T(1), order, scope); + DESUL_IF_ON_DEVICE(return Impl::device_atomic_dec(dest, order, scope);) + DESUL_IF_ON_HOST(return Impl::host_atomic_dec(dest, order, scope);) } // FIXME -template <typename T, +template <class T, class SuccessMemoryOrder, class FailureMemoryOrder, class MemoryScope> @@ -739,7 +387,7 @@ DESUL_INLINE_FUNCTION bool atomic_compare_exchange_strong( } } -template <typename T, +template <class T, class SuccessMemoryOrder, class FailureMemoryOrder, class MemoryScope> @@ -755,12 +403,4 @@ DESUL_INLINE_FUNCTION bool atomic_compare_exchange_weak(T* const dest, } // namespace desul -#include <desul/atomics/CUDA.hpp> -#include <desul/atomics/GCC.hpp> -#include <desul/atomics/HIP.hpp> -#include <desul/atomics/OpenMP.hpp> -#include <desul/atomics/SYCL.hpp> -#if defined(__GNUC__) && (!defined(__clang__)) -#pragma GCC diagnostic pop -#endif #endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/HIP.hpp deleted file mode 100644 index e51406e54dfd8661e9b8ec9cdfed5e3e293f00d7..0000000000000000000000000000000000000000 --- a/packages/kokkos/tpls/desul/include/desul/atomics/HIP.hpp +++ /dev/null @@ -1,222 +0,0 @@ -/* -Copyright (c) 2019, Lawrence Livermore National Security, LLC -and DESUL project contributors. See the COPYRIGHT file for details. -Source: https://github.com/desul/desul - -SPDX-License-Identifier: (BSD-3-Clause) -*/ -#ifndef DESUL_ATOMICS_HIP_HPP_ -#define DESUL_ATOMICS_HIP_HPP_ - -#ifdef __HIP_DEVICE_COMPILE__ -namespace desul { - -// header file is organized as follows: -// 1/ device-side overload set from atomic functions provided by HIP -// 2/ fallback implementation on host-side for atomic functions defined in 1/ that are -// not included in the GCC overload set -// 3/ fallback implementation on device-side for atomic functions from the GCC -// overload set that are not defined in 1/ - -// clang-format off -inline __device__ int atomic_fetch_add( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } -inline __device__ unsigned int atomic_fetch_add( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } -inline __device__ unsigned long long atomic_fetch_add(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } -inline __device__ float atomic_fetch_add( float* ptr, float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } -inline __device__ double atomic_fetch_add( double* ptr, double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, val); } - -inline __device__ int atomic_fetch_sub( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, val); } -inline __device__ unsigned int atomic_fetch_sub( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, val); } -inline __device__ unsigned long long atomic_fetch_sub(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } -inline __device__ float atomic_fetch_sub( float* ptr, float val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } -inline __device__ double atomic_fetch_sub( double* ptr, double val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -val); } - -inline __device__ int atomic_fetch_min( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } -inline __device__ unsigned int atomic_fetch_min( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } -inline __device__ unsigned long long atomic_fetch_min(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMin(ptr, val); } - -inline __device__ int atomic_fetch_max( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } -inline __device__ unsigned int atomic_fetch_max( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } -inline __device__ unsigned long long atomic_fetch_max(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicMax(ptr, val); } - -inline __device__ int atomic_fetch_and( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } -inline __device__ unsigned int atomic_fetch_and( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } -inline __device__ unsigned long long atomic_fetch_and(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAnd(ptr, val); } - -inline __device__ int atomic_fetch_or ( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } -inline __device__ unsigned int atomic_fetch_or ( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } -inline __device__ unsigned long long atomic_fetch_or (unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicOr (ptr, val); } - -inline __device__ int atomic_fetch_xor( int* ptr, int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } -inline __device__ unsigned int atomic_fetch_xor( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } -inline __device__ unsigned long long atomic_fetch_xor(unsigned long long* ptr, unsigned long long val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicXor(ptr, val); } - -inline __device__ int atomic_fetch_inc( int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1 ); } -inline __device__ unsigned int atomic_fetch_inc( unsigned int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1u ); } -inline __device__ unsigned long long atomic_fetch_inc(unsigned long long* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, 1ull); } - -inline __device__ int atomic_fetch_dec( int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, 1 ); } -inline __device__ unsigned int atomic_fetch_dec( unsigned int* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicSub(ptr, 1u ); } -inline __device__ unsigned long long atomic_fetch_dec(unsigned long long* ptr, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicAdd(ptr, -1 ); } - -inline __device__ unsigned int atomic_fetch_inc_mod( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicInc(ptr, val); } -inline __device__ unsigned int atomic_fetch_dec_mod( unsigned int* ptr, unsigned int val, MemoryOrderRelaxed, MemoryScopeDevice) { return atomicDec(ptr, val); } -// clang-format on - -#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, TYPE) \ - template <class MemoryOrder> \ - inline __device__ TYPE atomic_fetch_##OP( \ - TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeDevice) { \ - __threadfence(); \ - TYPE return_val = \ - atomic_fetch_##OP(ptr, val, MemoryOrderRelaxed(), MemoryScopeDevice()); \ - __threadfence(); \ - return return_val; \ - } \ - template <class MemoryOrder> \ - inline __device__ TYPE atomic_fetch_##OP( \ - TYPE* ptr, TYPE val, MemoryOrder, MemoryScopeCore) { \ - return atomic_fetch_##OP(ptr, val, MemoryOrder(), MemoryScopeDevice()); \ - } - -#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(OP) \ - DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, int) \ - DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, unsigned int) \ - DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, unsigned long long) - -#define DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(OP) \ - DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, float) \ - DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(OP, double) - -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(min) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(max) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(and) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(or) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(xor) - -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(add) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(add) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT(sub) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(sub) - -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(inc) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL(dec) - -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(inc_mod, unsigned int) -DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP(dec_mod, unsigned int) - -#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_FLOATING_POINT -#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP_INTEGRAL -#undef DESUL_IMPL_HIP_DEVICE_ATOMIC_FETCH_OP - -// 2/ host-side fallback implementation for atomic functions not provided by GCC - -#define DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, TYPE) \ - template <class MemoryOrder> \ - inline __host__ TYPE atomic_fetch_##OP_LOWERCASE( \ - TYPE* ptr, TYPE val, MemoryOrder order, MemoryScopeDevice scope) { \ - return Impl::atomic_fetch_oper( \ - Impl::OP_PASCAL_CASE##Oper<TYPE, const TYPE>(), ptr, val, order, scope); \ - } \ - template <class MemoryOrder> \ - inline __host__ TYPE atomic_fetch_##OP_LOWERCASE( \ - TYPE* ptr, TYPE val, MemoryOrder order, MemoryScopeCore scope) { \ - return Impl::atomic_fetch_oper( \ - Impl::OP_PASCAL_CASE##Oper<TYPE, const TYPE>(), ptr, val, order, scope); \ - } - -#define DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_INTEGRAL(OP_LOWERCASE, OP_PASCAL_CASE) \ - DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, int) \ - DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, unsigned int) \ - DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN( \ - OP_LOWERCASE, OP_PASCAL_CASE, unsigned long long) - -#define DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_FLOATING_POINT(OP_LOWERCASE, \ - OP_PASCAL_CASE) \ - DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, float) \ - DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE, double) - -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_INTEGRAL(min, Min) -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_INTEGRAL(max, Max) -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_FLOATING_POINT(add, Add) -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_FLOATING_POINT(sub, Sub) - -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(inc_mod, IncMod, unsigned int) -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN(dec_mod, DecMod, unsigned int) - -#undef DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_FLOATING_POINT -#undef DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN_INTEGRAL -#undef DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_FUN - -#define DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT(TYPE) \ - template <class MemoryOrder> \ - inline __host__ TYPE atomic_fetch_inc( \ - TYPE* ptr, MemoryOrder order, MemoryScopeDevice scope) { \ - return atomic_fetch_add(ptr, static_cast<TYPE>(1), order, scope); \ - } \ - template <class MemoryOrder> \ - inline __host__ TYPE atomic_fetch_inc( \ - TYPE* ptr, MemoryOrder order, MemoryScopeCore scope) { \ - return atomic_fetch_add(ptr, static_cast<TYPE>(1), order, scope); \ - } \ - template <class MemoryOrder> \ - inline __host__ TYPE atomic_fetch_dec( \ - TYPE* ptr, MemoryOrder order, MemoryScopeDevice scope) { \ - return atomic_fetch_sub(ptr, static_cast<TYPE>(1), order, scope); \ - } \ - template <class MemoryOrder> \ - inline __host__ TYPE atomic_fetch_dec( \ - TYPE* ptr, MemoryOrder order, MemoryScopeCore scope) { \ - return atomic_fetch_sub(ptr, static_cast<TYPE>(1), order, scope); \ - } - -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT(int) -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT(unsigned int) -DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT(unsigned long long) - -#undef DESUL_IMPL_HIP_HOST_FALLBACK_ATOMIC_INCREMENT_DECREMENT - -// 3/ device-side fallback implementation for atomic functions defined in GCC overload -// set - -#define DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE( \ - OP_LOWERCASE, OP_PASCAL_CASE, MEMORY_ORDER, MEMORY_SCOPE) \ - template <class T> \ - inline __device__ std::enable_if_t<std::is_integral<T>::value, T> \ - atomic_##OP_LOWERCASE##_fetch( \ - T* ptr, T val, MEMORY_ORDER order, MEMORY_SCOPE scope) { \ - return Impl::atomic_oper_fetch( \ - Impl::OP_PASCAL_CASE##Oper<T, const T>(), ptr, val, order, scope); \ - } \ - template <class T> \ - inline __device__ std::enable_if_t<std::is_integral<T>::value, T> \ - atomic_fetch_##OP_LOWERCASE( \ - T* ptr, T val, MEMORY_ORDER order, MEMORY_SCOPE scope) { \ - return Impl::atomic_fetch_oper( \ - Impl::OP_PASCAL_CASE##Oper<T, const T>(), ptr, val, order, scope); \ - } - -// clang-format off -#define DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(OP_LOWERCASE, OP_PASCAL_CASE) \ - DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderRelaxed, MemoryScopeNode) \ - DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderRelaxed, MemoryScopeDevice) \ - DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderRelaxed, MemoryScopeCore) \ - DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderSeqCst, MemoryScopeNode) \ - DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderSeqCst, MemoryScopeDevice) \ - DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE(OP_LOWERCASE, OP_PASCAL_CASE, MemoryOrderSeqCst, MemoryScopeCore) -// clang-format on - -DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(add, Add) -DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(sub, Sub) -DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(and, And) -DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(or, Or) -DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(xor, Xor) -DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN(nand, Nand) - -#undef DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN -#undef DESUL_IMPL_HIP_DEVICE_FALLBACK_ATOMIC_FUN_ORDER_SCOPE - -} // namespace desul - -#endif -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array.hpp index 6b2d4e74bd3cf28c9d5c8389e2153758f097e3b1..a5af4c48c2eb0a652548c53c9bc4a49f791a952a 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array.hpp @@ -9,19 +9,24 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_LOCK_ARRAY_HPP_ #define DESUL_ATOMICS_LOCK_ARRAY_HPP_ -#include "desul/atomics/Compare_Exchange.hpp" -#include "desul/atomics/Lock_Array_Cuda.hpp" -#include "desul/atomics/Lock_Array_HIP.hpp" -#include "desul/atomics/Macros.hpp" +#include <desul/atomics/Compare_Exchange.hpp> +#include <desul/atomics/Macros.hpp> +#ifdef DESUL_HAVE_CUDA_ATOMICS +#include <desul/atomics/Lock_Array_CUDA.hpp> +#endif +#ifdef DESUL_HAVE_HIP_ATOMICS +#include <desul/atomics/Lock_Array_HIP.hpp> +#endif namespace desul { namespace Impl { -struct host_locks__ { + +struct HostLocks { static constexpr uint32_t HOST_SPACE_ATOMIC_MASK = 0xFFFF; static constexpr uint32_t HOST_SPACE_ATOMIC_XOR_MASK = 0x5A39; - template <typename is_always_void = void> + template <class is_always_void = void> static int32_t* get_host_locks_() { - static int32_t HOST_SPACE_ATOMIC_LOCKS_DEVICE[HOST_SPACE_ATOMIC_MASK + 1] = {0}; + static int32_t HOST_SPACE_ATOMIC_LOCKS_DEVICE[HOST_SPACE_ATOMIC_MASK + 1] = {}; return HOST_SPACE_ATOMIC_LOCKS_DEVICE; } static inline int32_t* get_host_lock_(void* ptr) { @@ -33,7 +38,7 @@ struct host_locks__ { inline void init_lock_arrays() { static bool is_initialized = false; if (!is_initialized) { - host_locks__::get_host_locks_(); + HostLocks::get_host_locks_(); is_initialized = true; } @@ -55,17 +60,29 @@ inline void finalize_lock_arrays() { finalize_lock_arrays_hip(); #endif } -template <typename MemoryScope> -inline bool lock_address(void* ptr, MemoryScope ms) { - return 0 == - atomic_exchange( - host_locks__::get_host_lock_(ptr), int32_t(1), MemoryOrderSeqCst(), ms); + +inline void ensure_lock_arrays_on_device() { +#ifdef DESUL_HAVE_CUDA_ATOMICS + ensure_cuda_lock_arrays_on_device(); +#endif + +#ifdef DESUL_HAVE_HIP_ATOMICS + DESUL_ENSURE_HIP_LOCK_ARRAYS_ON_DEVICE(); +#endif } -template <typename MemoryScope> + +template <class MemoryScope> +bool lock_address(void* ptr, MemoryScope ms) { + return 0 == atomic_exchange( + HostLocks::get_host_lock_(ptr), int32_t(1), MemoryOrderSeqCst(), ms); +} + +template <class MemoryScope> void unlock_address(void* ptr, MemoryScope ms) { (void)atomic_exchange( - host_locks__::get_host_lock_(ptr), int32_t(0), MemoryOrderSeqCst(), ms); + HostLocks::get_host_lock_(ptr), int32_t(0), MemoryOrderSeqCst(), ms); } + } // namespace Impl } // namespace desul diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_CUDA.hpp similarity index 75% rename from packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp rename to packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_CUDA.hpp index 1815adb4a7621c8b4b3d93ac626c417f1c42644b..e0e4e129acc9f18e27393c82b2be6ab1154cc059 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_Cuda.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_CUDA.hpp @@ -19,14 +19,6 @@ SPDX-License-Identifier: (BSD-3-Clause) namespace desul { namespace Impl { -#ifdef __CUDA_ARCH__ -#define DESUL_IMPL_BALLOT_MASK(m, x) __ballot_sync(m, x) -#define DESUL_IMPL_ACTIVEMASK __activemask() -#else -#define DESUL_IMPL_BALLOT_MASK(m, x) m == 0 ? 0 : 1 -#define DESUL_IMPL_ACTIVEMASK 0 -#endif - /// \brief This global variable in Host space is the central definition /// of these arrays. extern int32_t* CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h; @@ -76,7 +68,7 @@ namespace Impl { /// instances in other translation units, we must update this CUDA global /// variable based on the Host global variable prior to running any kernels /// that will use it. -/// That is the purpose of the KOKKOS_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE macro. +/// That is the purpose of the ensure_cuda_lock_arrays_on_device function. __device__ #ifdef __CUDACC_RDC__ __constant__ extern @@ -138,33 +130,42 @@ namespace { static int lock_array_copied = 0; inline int eliminate_warning_for_lock_array() { return lock_array_copied; } } // namespace + +#ifdef __CUDACC_RDC__ +inline +#else +inline static +#endif + void + copy_cuda_lock_arrays_to_device() { + if (lock_array_copied == 0) { + cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_DEVICE, + &CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, + sizeof(int32_t*)); + cudaMemcpyToSymbol(CUDA_SPACE_ATOMIC_LOCKS_NODE, + &CUDA_SPACE_ATOMIC_LOCKS_NODE_h, + sizeof(int32_t*)); + } + lock_array_copied = 1; +} + } // namespace Impl } // namespace desul -/* It is critical that this code be a macro, so that it will - capture the right address for desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE - putting this in an inline function will NOT do the right thing! */ -#define DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() \ - { \ - if (::desul::Impl::lock_array_copied == 0) { \ - cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE, \ - &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h, \ - sizeof(int32_t*)); \ - cudaMemcpyToSymbol(::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE, \ - &::desul::Impl::CUDA_SPACE_ATOMIC_LOCKS_NODE_h, \ - sizeof(int32_t*)); \ - } \ - ::desul::Impl::lock_array_copied = 1; \ - } #endif /* defined( __CUDACC__ ) */ #endif /* defined( DESUL_HAVE_CUDA_ATOMICS ) */ +namespace desul { + #if defined(__CUDACC_RDC__) || (!defined(__CUDACC__)) -#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() +inline void ensure_cuda_lock_arrays_on_device() {} #else -#define DESUL_ENSURE_CUDA_LOCK_ARRAYS_ON_DEVICE() \ - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE() +static inline void ensure_cuda_lock_arrays_on_device() { + Impl::copy_cuda_lock_arrays_to_device(); +} #endif -#endif /* #ifndef KOKKOS_CUDA_LOCKS_HPP_ */ +} // namespace desul + +#endif /* #ifndef DESUL_ATOMICS_LOCK_ARRAY_CUDA_HPP_ */ diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp index 7c843f23c9547db6dc818a6d762ac3d7fa2c58ca..1ab9544eb4ed71299d9dd4fb72cbed6f514370e8 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Array_HIP.hpp @@ -9,24 +9,16 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_LOCK_ARRAY_HIP_HPP_ #define DESUL_ATOMICS_LOCK_ARRAY_HIP_HPP_ -#include "desul/atomics/Common.hpp" -#include "desul/atomics/Macros.hpp" - -#ifdef DESUL_HAVE_HIP_ATOMICS - #include <hip/hip_runtime.h> #include <cstdint> +#include "desul/atomics/Common.hpp" +#include "desul/atomics/Macros.hpp" + namespace desul { namespace Impl { -#ifdef __HIP_DEVICE_COMPILE__ -#define DESUL_IMPL_BALLOT_MASK(x) __ballot(x) -#else -#define DESUL_IMPL_BALLOT_MASK(x) 0 -#endif - /** * \brief This global variable in Host space is the central definition of these * arrays. @@ -161,8 +153,6 @@ inline int eliminate_warning_for_lock_array() { return lock_array_copied; } ::desul::Impl::lock_array_copied = 1; \ } -#endif - #if defined(DESUL_HIP_RDC) || (!defined(__HIPCC__)) #define DESUL_ENSURE_HIP_LOCK_ARRAYS_ON_DEVICE() #else diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e7c36673e282e5f8543ea3876eb8b649893d4e92 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op.hpp @@ -0,0 +1,26 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HPP_ +#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HPP_ + +#include <desul/atomics/Macros.hpp> + +#ifdef DESUL_HAVE_CUDA_ATOMICS +#include <desul/atomics/Lock_Based_Fetch_Op_CUDA.hpp> +#endif +#ifdef DESUL_HAVE_HIP_ATOMICS +#include <desul/atomics/Lock_Based_Fetch_Op_HIP.hpp> +#endif +#ifdef DESUL_HAVE_SYCL_ATOMICS +#include <desul/atomics/Lock_Based_Fetch_Op_Unimplemented.hpp> +#endif + +#include <desul/atomics/Lock_Based_Fetch_Op_Host.hpp> + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_CUDA.hpp new file mode 100644 index 0000000000000000000000000000000000000000..44d8149fcb1e2cec660eb4b18c8e42a0986797b2 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_CUDA.hpp @@ -0,0 +1,91 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_CUDA_HPP_ +#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_CUDA_HPP_ + +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Lock_Array_CUDA.hpp> +#include <desul/atomics/Thread_Fence_CUDA.hpp> +#include <type_traits> + +namespace desul { +namespace Impl { + +template <class Oper, + class T, + class MemoryOrder, + class MemoryScope, + // equivalent to: + // requires !atomic_always_lock_free(sizeof(T)) + std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> +__device__ T device_atomic_fetch_oper(const Oper& op, + T* const dest, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope scope) { + // This is a way to avoid deadlock in a warp or wave front + T return_val; + int done = 0; + unsigned int mask = __activemask(); + unsigned int active = __ballot_sync(mask, 1); + unsigned int done_active = 0; + while (active != done_active) { + if (!done) { + if (lock_address_cuda((void*)dest, scope)) { + device_atomic_thread_fence(MemoryOrderAcquire(), scope); + return_val = *dest; + *dest = op.apply(return_val, val); + device_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address_cuda((void*)dest, scope); + done = 1; + } + } + done_active = __ballot_sync(mask, done); + } + return return_val; +} + +template <class Oper, + class T, + class MemoryOrder, + class MemoryScope, + // equivalent to: + // requires !atomic_always_lock_free(sizeof(T)) + std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> +__device__ T device_atomic_oper_fetch(const Oper& op, + T* const dest, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope scope) { + // This is a way to avoid deadlock in a warp or wave front + T return_val; + int done = 0; + unsigned int mask = __activemask(); + unsigned int active = __ballot_sync(mask, 1); + unsigned int done_active = 0; + while (active != done_active) { + if (!done) { + if (lock_address_cuda((void*)dest, scope)) { + device_atomic_thread_fence(MemoryOrderAcquire(), scope); + return_val = op.apply(*dest, val); + *dest = return_val; + device_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address_cuda((void*)dest, scope); + done = 1; + } + } + done_active = __ballot_sync(mask, done); + } + return return_val; +} + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_HIP.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2a50509550aa4b7728bda525c5dd49adf969a6b6 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_HIP.hpp @@ -0,0 +1,88 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HIP_HPP_ +#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HIP_HPP_ + +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Lock_Array_HIP.hpp> +#include <desul/atomics/Thread_Fence_HIP.hpp> +#include <type_traits> + +namespace desul { +namespace Impl { + +template <class Oper, + class T, + class MemoryOrder, + class MemoryScope, + // equivalent to: + // requires !atomic_always_lock_free(sizeof(T)) + std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> +__device__ T device_atomic_fetch_oper(const Oper& op, + T* const dest, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope scope) { + // This is a way to avoid deadlock in a warp or wave front + T return_val; + int done = 0; + unsigned long long int active = __ballot(1); + unsigned long long int done_active = 0; + while (active != done_active) { + if (!done) { + if (lock_address_hip((void*)dest, scope)) { + device_atomic_thread_fence(MemoryOrderAcquire(), scope); + return_val = *dest; + *dest = op.apply(return_val, val); + device_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address_hip((void*)dest, scope); + done = 1; + } + } + done_active = __ballot(done); + } + return return_val; +} + +template <class Oper, + class T, + class MemoryOrder, + class MemoryScope, + // equivalent to: + // requires !atomic_always_lock_free(sizeof(T)) + std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> +__device__ T device_atomic_oper_fetch(const Oper& op, + T* const dest, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope scope) { + // This is a way to avoid deadlock in a warp or wave front + T return_val; + int done = 0; + unsigned long long int active = __ballot(1); + unsigned long long int done_active = 0; + while (active != done_active) { + if (!done) { + if (lock_address_hip((void*)dest, scope)) { + device_atomic_thread_fence(MemoryOrderAcquire(), scope); + return_val = op.apply(*dest, val); + *dest = return_val; + device_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address_hip((void*)dest, scope); + done = 1; + } + } + done_active = __ballot(done); + } + return return_val; +} +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Host.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Host.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c0b0a49024c2560f2acfd2ce6d2760bab69f9a77 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Host.hpp @@ -0,0 +1,71 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HOST_HPP_ +#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_HOST_HPP_ + +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Lock_Array.hpp> +#include <desul/atomics/Thread_Fence.hpp> +#include <type_traits> + +namespace desul { +namespace Impl { + +template <class Oper, + class T, + class MemoryOrder, + class MemoryScope, + // equivalent to: + // requires !atomic_always_lock_free(sizeof(T)) + std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> +inline T host_atomic_fetch_oper(const Oper& op, + T* const dest, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope scope) { + // Acquire a lock for the address + while (!lock_address((void*)dest, scope)) { + } + + host_atomic_thread_fence(MemoryOrderAcquire(), scope); + T return_val = *dest; + *dest = op.apply(return_val, val); + host_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address((void*)dest, scope); + return return_val; +} + +template <class Oper, + class T, + class MemoryOrder, + class MemoryScope, + // equivalent to: + // requires !atomic_always_lock_free(sizeof(T)) + std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> +inline T host_atomic_oper_fetch(const Oper& op, + T* const dest, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope scope) { + // Acquire a lock for the address + while (!lock_address((void*)dest, scope)) { + } + + host_atomic_thread_fence(MemoryOrderAcquire(), scope); + T return_val = op.apply(*dest, val); + *dest = return_val; + host_atomic_thread_fence(MemoryOrderRelease(), scope); + unlock_address((void*)dest, scope); + return return_val; +} + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Unimplemented.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Unimplemented.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b9f9fac5359ea9b2dce5cfaa1dbd81beb6f11352 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Based_Fetch_Op_Unimplemented.hpp @@ -0,0 +1,55 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_LOCK_BASED_FETCH_OP_UNIMPLEMENTED_HPP_ +#define DESUL_ATOMICS_LOCK_BASED_FETCH_OP_UNIMPLEMENTED_HPP_ + +#include <cassert> +#include <desul/atomics/Common.hpp> +#include <type_traits> + +namespace desul { +namespace Impl { + +template <class Oper, + class T, + class MemoryOrder, + class MemoryScope, + // equivalent to: + // requires !atomic_always_lock_free(sizeof(T)) + std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> +DESUL_INLINE_FUNCTION T +device_atomic_fetch_oper(const Oper& /*op*/, + T* const /*dest*/, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope /*scope*/) { + assert(false); + return val; // FIXME not implemented +} + +template <class Oper, + class T, + class MemoryOrder, + class MemoryScope, + // equivalent to: + // requires !atomic_always_lock_free(sizeof(T)) + std::enable_if_t<!atomic_always_lock_free(sizeof(T)), int> = 0> +DESUL_INLINE_FUNCTION T +device_atomic_oper_fetch(const Oper& /*op*/, + T* const /*dest*/, + dont_deduce_this_parameter_t<const T> val, + MemoryOrder /*order*/, + MemoryScope /*scope*/) { + assert(false); + return val; // FIXME not implemented +} +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Free_Fetch_Op.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Free_Fetch_Op.hpp new file mode 100644 index 0000000000000000000000000000000000000000..266642704410f7360bb5dc7e4c34990b75c4e8b4 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Lock_Free_Fetch_Op.hpp @@ -0,0 +1,99 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_LOCK_FREE_FETCH_OP_HPP_ +#define DESUL_ATOMICS_LOCK_FREE_FETCH_OP_HPP_ + +#include <desul/atomics/Common.hpp> +#include <desul/atomics/Compare_Exchange.hpp> +#include <type_traits> + +#if defined(__GNUC__) && (!defined(__clang__)) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif + +namespace desul { +namespace Impl { + +#define DESUL_IMPL_ATOMIC_FETCH_OPER(ANNOTATION, HOST_OR_DEVICE) \ + template <class Oper, \ + class T, \ + class MemoryOrder, \ + class MemoryScope, \ + std::enable_if_t<atomic_always_lock_free(sizeof(T)), int> = 0> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_fetch_oper( \ + const Oper& op, \ + T* const dest, \ + dont_deduce_this_parameter_t<const T> val, \ + MemoryOrder order, \ + MemoryScope scope) { \ + using cas_t = atomic_compare_exchange_t<T>; \ + cas_t oldval = reinterpret_cast<cas_t&>(*dest); \ + cas_t assume = oldval; \ + \ + do { \ + if (check_early_exit(op, reinterpret_cast<T&>(oldval), val)) \ + return reinterpret_cast<T&>(oldval); \ + assume = oldval; \ + T newval = op.apply(reinterpret_cast<T&>(assume), val); \ + oldval = \ + HOST_OR_DEVICE##_atomic_compare_exchange(reinterpret_cast<cas_t*>(dest), \ + assume, \ + reinterpret_cast<cas_t&>(newval), \ + order, \ + scope); \ + } while (assume != oldval); \ + \ + return reinterpret_cast<T&>(oldval); \ + } \ + \ + template <class Oper, \ + class T, \ + class MemoryOrder, \ + class MemoryScope, \ + std::enable_if_t<atomic_always_lock_free(sizeof(T)), int> = 0> \ + ANNOTATION T HOST_OR_DEVICE##_atomic_oper_fetch( \ + const Oper& op, \ + T* const dest, \ + dont_deduce_this_parameter_t<const T> val, \ + MemoryOrder order, \ + MemoryScope scope) { \ + using cas_t = atomic_compare_exchange_t<T>; \ + cas_t oldval = reinterpret_cast<cas_t&>(*dest); \ + T newval = val; \ + cas_t assume = oldval; \ + do { \ + if (check_early_exit(op, reinterpret_cast<T&>(oldval), val)) \ + return reinterpret_cast<T&>(oldval); \ + assume = oldval; \ + newval = op.apply(reinterpret_cast<T&>(assume), val); \ + oldval = \ + HOST_OR_DEVICE##_atomic_compare_exchange(reinterpret_cast<cas_t*>(dest), \ + assume, \ + reinterpret_cast<cas_t&>(newval), \ + order, \ + scope); \ + } while (assume != oldval); \ + \ + return newval; \ + } + +DESUL_IMPL_ATOMIC_FETCH_OPER(DESUL_IMPL_HOST_FUNCTION, host) +DESUL_IMPL_ATOMIC_FETCH_OPER(DESUL_IMPL_DEVICE_FUNCTION, device) + +#undef DESUL_IMPL_ATOMIC_FETCH_OPER + +} // namespace Impl +} // namespace desul + +#if defined(__GNUC__) && (!defined(__clang__)) +#pragma GCC diagnostic pop +#endif + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Macros.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Macros.hpp index 0890b2dbc5af20f3d3f111ee3846d8117ce05c5b..992fb9fa66bf32a863e8ac4fbd4aaf690d13e69d 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/Macros.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Macros.hpp @@ -9,43 +9,39 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_MACROS_HPP_ #define DESUL_ATOMICS_MACROS_HPP_ +#include <desul/atomics/Config.hpp> + // Macros -#if (!defined(__CUDA_ARCH__) || !defined(__NVCC__)) && \ - (!defined(__HIP_DEVICE_COMPILE) || !defined(__HIP_PLATFORM_HCC__)) && \ - !defined(__SYCL_DEVICE_ONLY__) && !defined(DESUL_HAVE_OPENMP_ATOMICS) && \ - !defined(DESUL_HAVE_SERIAL_ATOMICS) -#define DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS +#if defined(DESUL_ATOMICS_ENABLE_CUDA) && defined(__CUDACC__) +#define DESUL_HAVE_CUDA_ATOMICS #endif -// ONLY use GNUC atomics if not compiling for the device -// and we didn't explicitly say to use OPENMP or SERIAL atomics -#if defined(__GNUC__) && defined(DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS) -#define DESUL_HAVE_GCC_ATOMICS +#if defined(DESUL_ATOMICS_ENABLE_HIP) && defined(__HIPCC__) +#define DESUL_HAVE_HIP_ATOMICS #endif -// Equivalent to above: if we are compiling for the device we -// need to use CUDA/HIP/SYCL atomics instead of MSVC atomics -#if defined(_MSC_VER) && defined(DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS) -#define DESUL_HAVE_MSVC_ATOMICS +#if defined(DESUL_ATOMICS_ENABLE_SYCL) && defined(SYCL_LANGUAGE_VERSION) +#define DESUL_HAVE_SYCL_ATOMICS #endif -#undef DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS - -#ifdef __CUDACC__ -#define DESUL_HAVE_CUDA_ATOMICS +#if defined(DESUL_ATOMICS_ENABLE_OPENMP) +#define DESUL_HAVE_OPENMP_ATOMICS #endif -#ifdef __HIPCC__ -#define DESUL_HAVE_HIP_ATOMICS +// ONLY use GNUC atomics if not explicitly say to use OpenMP atomics +#if !defined(DESUL_HAVE_OPENMP_ATOMICS) && defined(__GNUC__) +#define DESUL_HAVE_GCC_ATOMICS #endif -#ifdef __SYCL_DEVICE_ONLY__ -#define DESUL_HAVE_SYCL_ATOMICS +// Equivalent to above for MSVC atomics +#if !defined(DESUL_HAVE_OPENMP_ATOMICS) && defined(_MSC_VER) +#define DESUL_HAVE_MSVC_ATOMICS #endif -#if defined(__CUDA_ARCH__) || defined(__HIP_DEVICE_COMPILE__) || \ - defined(__SYCL_DEVICE_ONLY__) +#if (defined(DESUL_ATOMICS_ENABLE_CUDA) && defined(__CUDA_ARCH__)) || \ + (defined(DESUL_ATOMICS_ENABLE_HIP) && defined(__HIP_DEVICE_COMPILE__)) || \ + (defined(DESUL_ATOMICS_ENABLE_SYCL) && defined(__SYCL_DEVICE_ONLY__)) #define DESUL_HAVE_GPU_LIKE_PROGRESS #endif @@ -53,14 +49,76 @@ SPDX-License-Identifier: (BSD-3-Clause) #define DESUL_FORCEINLINE_FUNCTION inline __host__ __device__ #define DESUL_INLINE_FUNCTION inline __host__ __device__ #define DESUL_FUNCTION __host__ __device__ +#define DESUL_IMPL_HOST_FUNCTION __host__ +#define DESUL_IMPL_DEVICE_FUNCTION __device__ #else #define DESUL_FORCEINLINE_FUNCTION inline #define DESUL_INLINE_FUNCTION inline #define DESUL_FUNCTION +#define DESUL_IMPL_HOST_FUNCTION +#define DESUL_IMPL_DEVICE_FUNCTION #endif #if !defined(DESUL_HAVE_GPU_LIKE_PROGRESS) #define DESUL_HAVE_FORWARD_PROGRESS #endif +#define DESUL_IMPL_STRIP_PARENS(X) DESUL_IMPL_ESC(DESUL_IMPL_ISH X) +#define DESUL_IMPL_ISH(...) DESUL_IMPL_ISH __VA_ARGS__ +#define DESUL_IMPL_ESC(...) DESUL_IMPL_ESC_(__VA_ARGS__) +#define DESUL_IMPL_ESC_(...) DESUL_IMPL_VAN_##__VA_ARGS__ +#define DESUL_IMPL_VAN_DESUL_IMPL_ISH + +#if (defined(DESUL_ATOMICS_ENABLE_CUDA) && defined(__CUDACC__)) && defined(__NVCOMPILER) +#include <nv/target> +#define DESUL_IF_ON_DEVICE(CODE) NV_IF_TARGET(NV_IS_DEVICE, CODE) +#define DESUL_IF_ON_HOST(CODE) NV_IF_TARGET(NV_IS_HOST, CODE) +#endif + +// FIXME OpenMP Offload differentiate between device and host, but do we need this? +#if defined(DESUL_HAVE_OPENMP_ATOMICS) +#if 0 +// Base function. +static constexpr bool desul_impl_omp_on_host() { return true; } + +#pragma omp begin declare variant match(device = {kind(host)}) +static constexpr bool desul_impl_omp_on_host() { return true; } +#pragma omp end declare variant + +#pragma omp begin declare variant match(device = {kind(nohost)}) +static constexpr bool desul_impl_omp_on_host() { return false; } +#pragma omp end declare variant + +#define DESUL_IF_ON_DEVICE(CODE) \ + if constexpr (!desul_impl_omp_on_host()) { \ + DESUL_IMPL_STRIP_PARENS(CODE) \ + } +#define DESUL_IF_ON_HOST(CODE) \ + if constexpr (desul_impl_omp_on_host()) { \ + DESUL_IMPL_STRIP_PARENS(CODE) \ + } +#else +#define DESUL_IF_ON_DEVICE(CODE) \ + {} +#define DESUL_IF_ON_HOST(CODE) \ + { DESUL_IMPL_STRIP_PARENS(CODE) } +#endif +#endif + +#if !defined(DESUL_IF_ON_HOST) && !defined(DESUL_IF_ON_DEVICE) +#if (defined(DESUL_ATOMICS_ENABLE_CUDA) && defined(__CUDA_ARCH__)) || \ + (defined(DESUL_ATOMICS_ENABLE_HIP) && defined(__HIP_DEVICE_COMPILE__)) || \ + (defined(DESUL_ATOMICS_ENABLE_SYCL) && defined(__SYCL_DEVICE_ONLY__)) +#define DESUL_IF_ON_DEVICE(CODE) \ + { DESUL_IMPL_STRIP_PARENS(CODE) } +#define DESUL_IF_ON_HOST(CODE) \ + {} +#else +#define DESUL_IF_ON_DEVICE(CODE) \ + {} +#define DESUL_IF_ON_HOST(CODE) \ + { DESUL_IMPL_STRIP_PARENS(CODE) } +#endif +#endif + #endif // DESUL_ATOMICS_MACROS_HPP_ diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/OpenMP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/OpenMP.hpp deleted file mode 100644 index bc6fb26c2fc9ee1ec7d9f4deb6c4592a81c19fc9..0000000000000000000000000000000000000000 --- a/packages/kokkos/tpls/desul/include/desul/atomics/OpenMP.hpp +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright (c) 2019, Lawrence Livermore National Security, LLC -and DESUL project contributors. See the COPYRIGHT file for details. -Source: https://github.com/desul/desul - -SPDX-License-Identifier: (BSD-3-Clause) -*/ -#ifndef DESUL_ATOMICS_OPENMP_HPP_ -#define DESUL_ATOMICS_OPENMP_HPP_ - -#ifdef DESUL_HAVE_OPENMP_ATOMICS - -#include <desul/atomics/openmp/OpenMP_40.hpp> -#endif -#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Operator_Function_Objects.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Operator_Function_Objects.hpp new file mode 100644 index 0000000000000000000000000000000000000000..be90cdbbd86ffc42a674eacc5f1cea70dc42c8cf --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Operator_Function_Objects.hpp @@ -0,0 +1,175 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_OPERATOR_FUNCTION_OBJECTS_HPP_ +#define DESUL_ATOMICS_OPERATOR_FUNCTION_OBJECTS_HPP_ + +#include <desul/atomics/Macros.hpp> +#include <type_traits> + +// Function objects that represent common arithmetic and logical +// Combination operands to be used in a compare-and-exchange based atomic operation +namespace desul { +namespace Impl { + +template <class Scalar1, class Scalar2> +struct max_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { + return (val1 > val2 ? val1 : val2); + } + DESUL_FORCEINLINE_FUNCTION + static constexpr bool check_early_exit(Scalar1 const& val1, Scalar2 const& val2) { + return val1 > val2; + } +}; + +template <class Scalar1, class Scalar2> +struct min_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { + return (val1 < val2 ? val1 : val2); + } + DESUL_FORCEINLINE_FUNCTION + static constexpr bool check_early_exit(Scalar1 const& val1, Scalar2 const& val2) { + return val1 < val2; + } +}; + +template <class Op, class Scalar1, class Scalar2, class = bool> +struct may_exit_early : std::false_type {}; + +// This exit early optimization causes weird compiler errors with MSVC 2019 +#ifndef DESUL_HAVE_MSVC_ATOMICS +template <class Op, class Scalar1, class Scalar2> +struct may_exit_early<Op, + Scalar1, + Scalar2, + decltype(Op::check_early_exit(std::declval<Scalar1 const&>(), + std::declval<Scalar2 const&>()))> + : std::true_type {}; +#endif + +template <class Op, class Scalar1, class Scalar2> +constexpr DESUL_FUNCTION + std::enable_if_t<may_exit_early<Op, Scalar1, Scalar2>::value, bool> + check_early_exit(Op const&, Scalar1 const& val1, Scalar2 const& val2) { + return Op::check_early_exit(val1, val2); +} + +template <class Op, class Scalar1, class Scalar2> +constexpr DESUL_FUNCTION + std::enable_if_t<!may_exit_early<Op, Scalar1, Scalar2>::value, bool> + check_early_exit(Op const&, Scalar1 const&, Scalar2 const&) { + return false; +} + +template <class Scalar1, class Scalar2> +struct add_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 + val2; } +}; + +template <class Scalar1, class Scalar2> +struct sub_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 - val2; } +}; + +template <class Scalar1, class Scalar2> +struct mul_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 * val2; } +}; + +template <class Scalar1, class Scalar2> +struct div_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 / val2; } +}; + +template <class Scalar1, class Scalar2> +struct mod_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 % val2; } +}; + +template <class Scalar1, class Scalar2> +struct and_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 & val2; } +}; + +template <class Scalar1, class Scalar2> +struct or_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 | val2; } +}; + +template <class Scalar1, class Scalar2> +struct xor_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { return val1 ^ val2; } +}; + +template <class Scalar1, class Scalar2> +struct nand_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { + return ~(val1 & val2); + } +}; + +template <class Scalar1, class Scalar2> +struct lshift_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { + return val1 << val2; + } +}; + +template <class Scalar1, class Scalar2> +struct rshift_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { + return val1 >> val2; + } +}; + +template <class Scalar1, class Scalar2> +struct inc_mod_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { + return ((val1 >= val2) ? Scalar1(0) : val1 + Scalar1(1)); + } +}; + +template <class Scalar1, class Scalar2> +struct dec_mod_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2& val2) { + return (((val1 == Scalar1(0)) | (val1 > val2)) ? val2 : (val1 - Scalar1(1))); + } +}; + +template <class Scalar1, class Scalar2> +struct store_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1&, const Scalar2& val2) { return val2; } +}; + +template <class Scalar1, class Scalar2> +struct load_operator { + DESUL_FORCEINLINE_FUNCTION + static Scalar1 apply(const Scalar1& val1, const Scalar2&) { return val1; } +}; + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence.hpp new file mode 100644 index 0000000000000000000000000000000000000000..24078aae07fe90196a77cba4e3114fe086dbf049 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence.hpp @@ -0,0 +1,35 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_THREAD_FENCE_HPP_ +#define DESUL_ATOMICS_THREAD_FENCE_HPP_ + +#include <desul/atomics/Macros.hpp> + +#ifdef DESUL_HAVE_GCC_ATOMICS +#include <desul/atomics/Thread_Fence_GCC.hpp> +#endif +#ifdef DESUL_HAVE_MSVC_ATOMICS +#include <desul/atomics/Thread_Fence_MSVC.hpp> +#endif +#ifdef DESUL_HAVE_CUDA_ATOMICS +#include <desul/atomics/Thread_Fence_CUDA.hpp> +#endif +#ifdef DESUL_HAVE_HIP_ATOMICS +#include <desul/atomics/Thread_Fence_HIP.hpp> +#endif +#ifdef DESUL_HAVE_OPENMP_ATOMICS +#include <desul/atomics/Thread_Fence_OpenMP.hpp> +#endif +#ifdef DESUL_HAVE_SYCL_ATOMICS +#include <desul/atomics/Thread_Fence_SYCL.hpp> +#endif + +#include <desul/atomics/Thread_Fence_ScopeCaller.hpp> + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_CUDA.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_CUDA.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ad2c043ed10d4dd8b77773f9ceed2093561cc766 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_CUDA.hpp @@ -0,0 +1,37 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_THREAD_FENCE_CUDA_HPP_ +#define DESUL_ATOMICS_THREAD_FENCE_CUDA_HPP_ + +#include <desul/atomics/Common.hpp> + +namespace desul { +namespace Impl { + +// clang-format off +inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { __threadfence(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { __threadfence(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeDevice) { __threadfence(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeDevice) { __threadfence(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore ) { __threadfence_block(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore ) { __threadfence_block(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeCore ) { __threadfence_block(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeCore ) { __threadfence_block(); } +#ifndef DESUL_CUDA_ARCH_IS_PRE_PASCAL +inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeNode ) { __threadfence_system(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeNode ) { __threadfence_system(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeNode ) { __threadfence_system(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeNode ) { __threadfence_system(); } +#endif +// clang-format on + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_GCC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_GCC.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4839cbd0fedeb372f8038eb99886ba17a3c18c57 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_GCC.hpp @@ -0,0 +1,25 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_THREAD_FENCE_GCC_HPP_ +#define DESUL_ATOMICS_THREAD_FENCE_GCC_HPP_ + +#include <desul/atomics/Adapt_GCC.hpp> + +namespace desul { +namespace Impl { + +template <class MemoryOrder, class MemoryScope> +void host_atomic_thread_fence(MemoryOrder, MemoryScope) { + __atomic_thread_fence(GCCMemoryOrder<MemoryOrder>::value); +} + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_HIP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_HIP.hpp new file mode 100644 index 0000000000000000000000000000000000000000..67fc7ffd2c90f4cb42c284a23f703e44dba9b2fd --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_HIP.hpp @@ -0,0 +1,35 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_THREAD_FENCE_HIP_HPP_ +#define DESUL_ATOMICS_THREAD_FENCE_HIP_HPP_ + +#include <desul/atomics/Common.hpp> + +namespace desul { +namespace Impl { + +// clang-format off +inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { __threadfence(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { __threadfence(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeDevice) { __threadfence(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeDevice) { __threadfence(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore ) { __threadfence_block(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore ) { __threadfence_block(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeCore ) { __threadfence_block(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeCore ) { __threadfence_block(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderRelease, MemoryScopeNode ) { __threadfence_system(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeNode ) { __threadfence_system(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeNode ) { __threadfence_system(); } +inline __device__ void device_atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeNode ) { __threadfence_system(); } +// clang-format on + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_MSVC.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_MSVC.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d5919f85001ac3c435ff82de07ead266cd024f87 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_MSVC.hpp @@ -0,0 +1,27 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_THREAD_FENCE_MSVC_HPP_ +#define DESUL_ATOMICS_THREAD_FENCE_MSVC_HPP_ + +#include <atomic> +#include <desul/atomics/Adapt_CXX.hpp> +#include <desul/atomics/Common.hpp> + +namespace desul { +namespace Impl { + +template <class MemoryOrder, class MemoryScope> +void host_atomic_thread_fence(MemoryOrder, MemoryScope) { + std::atomic_thread_fence(Impl::CXXMemoryOrder<MemoryOrder>::value); +} + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_OpenMP.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_OpenMP.hpp new file mode 100644 index 0000000000000000000000000000000000000000..72fc7a5e7c61a64d9ff6be22e41081eedaa32c30 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_OpenMP.hpp @@ -0,0 +1,79 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_THREAD_FENCE_OPENMP_HPP_ +#define DESUL_ATOMICS_THREAD_FENCE_OPENMP_HPP_ + +#include <omp.h> + +#include <desul/atomics/Common.hpp> + +namespace desul { +namespace Impl { + +#if _OPENMP > 201800 + +// There is no seq_cst flush in OpenMP, isn't it the same anyway for fence? +inline void host_atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) { +#pragma omp flush acq_rel +} +inline void host_atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) { +#pragma omp flush acq_rel +} +inline void host_atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) { +#pragma omp flush release +} +inline void host_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) { +#pragma omp flush acquire +} +inline void host_atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) { +#pragma omp flush acq_rel +} +inline void host_atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) { +#pragma omp flush acq_rel +} +inline void host_atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { +#pragma omp flush release +} +inline void host_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { +#pragma omp flush acquire +} + +#else + +inline void host_atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeCore) { +#pragma omp flush +} +inline void host_atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeCore) { +#pragma omp flush +} +inline void host_atomic_thread_fence(MemoryOrderRelease, MemoryScopeCore) { +#pragma omp flush +} +inline void host_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCore) { +#pragma omp flush +} +inline void host_atomic_thread_fence(MemoryOrderSeqCst, MemoryScopeDevice) { +#pragma omp flush +} +inline void host_atomic_thread_fence(MemoryOrderAcqRel, MemoryScopeDevice) { +#pragma omp flush +} +inline void host_atomic_thread_fence(MemoryOrderRelease, MemoryScopeDevice) { +#pragma omp flush +} +inline void host_atomic_thread_fence(MemoryOrderAcquire, MemoryScopeDevice) { +#pragma omp flush +} + +#endif + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_SYCL.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_SYCL.hpp new file mode 100644 index 0000000000000000000000000000000000000000..769e92abfebbe00089eb5104b7065cd922132b87 --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_SYCL.hpp @@ -0,0 +1,35 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_THREAD_FENCE_SYCL_HPP_ +#define DESUL_ATOMICS_THREAD_FENCE_SYCL_HPP_ + +#include <desul/atomics/Adapt_SYCL.hpp> +#include <desul/atomics/Common.hpp> + +// FIXME_SYCL SYCL2020 dictates that <sycl/sycl.hpp> is the header to include +// but icpx 2022.1.0 and earlier versions only provide <CL/sycl.hpp> +#if __has_include(<sycl/sycl.hpp>) +#include <sycl/sycl.hpp> +#else +#include <CL/sycl.hpp> +#endif + +namespace desul { +namespace Impl { + +template <class MemoryOrder, class MemoryScope> +void device_atomic_thread_fence(MemoryOrder, MemoryScope) { + sycl::atomic_fence(SYCLMemoryOrder<MemoryOrder, /*extended namespace*/ false>::value, + SYCLMemoryScope<MemoryScope, /*extended namespace*/ false>::value); +} + +} // namespace Impl +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_ScopeCaller.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_ScopeCaller.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3f58bf5b2e9ab69a504ac66266854b453a3bc6ac --- /dev/null +++ b/packages/kokkos/tpls/desul/include/desul/atomics/Thread_Fence_ScopeCaller.hpp @@ -0,0 +1,26 @@ +/* +Copyright (c) 2019, Lawrence Livermore National Security, LLC +and DESUL project contributors. See the COPYRIGHT file for details. +Source: https://github.com/desul/desul + +SPDX-License-Identifier: (BSD-3-Clause) +*/ + +#ifndef DESUL_ATOMICS_THREAD_FENCE_SCOPECALLER_HPP_ +#define DESUL_ATOMICS_THREAD_FENCE_SCOPECALLER_HPP_ + +#include <desul/atomics/Common.hpp> + +namespace desul { + +// clang-format off +DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderSeqCst , MemoryScopeCaller) {} +DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderAcqRel , MemoryScopeCaller) {} +DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderRelease, MemoryScopeCaller) {} +DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderAcquire, MemoryScopeCaller) {} +DESUL_INLINE_FUNCTION void atomic_thread_fence(MemoryOrderRelaxed, MemoryScopeCaller) {} +// clang-format on + +} // namespace desul + +#endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp index 461d3e0928a19840973d1c971ccd100968193a42..96e0dfa269b363afc53beab3a1dc1776a57a0a2f 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm.hpp @@ -1,18 +1,17 @@ -#include<limits> +#include <limits> namespace desul { -#if defined(__CUDA_ARCH__) || (defined(__clang__) && !defined(__NVCC__)) +namespace Impl { // Choose the variant of atomics we are using later -#if !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_GENERIC) && \ - !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_PREDICATE) && \ - !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL) && \ - !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_FORCEGLOBAL) -#if (__CUDACC_VER_MAJOR__ > 11) || ((__CUDACC_VER_MAJOR__==11) && (__CUDACC_VER_MINOR__>1)) +#if !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_PREDICATE) && \ + !defined(DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL) +#if (__CUDACC_VER_MAJOR__ > 11) || \ + ((__CUDACC_VER_MAJOR__ == 11) && (__CUDACC_VER_MINOR__ > 1)) #define DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL #else #define DESUL_IMPL_ATOMIC_CUDA_PTX_PREDICATE #endif #endif -#include<desul/atomics/cuda/cuda_cc7_asm.inc> +#include <desul/atomics/cuda/cuda_cc7_asm.inc> -#endif -} +} // namespace Impl +} // namespace desul diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp index 0ab95e6a00a4e67ffad0232f8652e8a0c9d4f6e6..8841c07dbfe2fe04fe4fde11cb4ab7dc52305998 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/CUDA_asm_exchange.hpp @@ -1,8 +1,6 @@ -#include<limits> +#include <limits> namespace desul { -#if defined(__CUDA_ARCH__) || (defined(__clang__) && !defined(__NVCC__)) - -#include<desul/atomics/cuda/cuda_cc7_asm_exchange.inc> - -#endif +namespace Impl { +#include <desul/atomics/cuda/cuda_cc7_asm_exchange.inc> } +} // namespace desul diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc index 6de590a952fa38f60c58a34c9499a420502ae381..47de0e0866f925352ab5c1ca81db441530012aaa 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc @@ -1,7 +1,3 @@ -#ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_GENERIC -#include "cuda_cc7_asm_atomic_fetch_op.inc_generic" -#endif - #ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL #include "cuda_cc7_asm_atomic_fetch_op.inc_isglobal" #endif @@ -10,9 +6,3 @@ #include "cuda_cc7_asm_atomic_fetch_op.inc_predicate" #endif -// This version is not generally safe -// Only here for performance comparison purposes -#ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_FORCEGLOBAL -#include "cuda_cc7_asm_atomic_fetch_op.inc_forceglobal" -#endif - diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal index 3d077ae637ad9960ef687fff2456181033bf8d73..ef5798f21138e936cd63d8593fc9c245f1d75d92 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_isglobal @@ -6,7 +6,7 @@ #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_AND() \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \ uint32_t asm_result = 0u; \ if(__isGlobal(dest)) { \ @@ -17,7 +17,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_ return reinterpret_cast<ctype&>(asm_result); \ } \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \ uint64_t asm_result = 0u; \ if(__isGlobal(dest)) { \ @@ -30,7 +30,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_ #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_OR() \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \ uint32_t asm_result = 0u; \ if(__isGlobal(dest)) { \ @@ -41,7 +41,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_ return reinterpret_cast<ctype&>(asm_result); \ } \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \ uint64_t asm_result = 0u; \ if(__isGlobal(dest)) { \ @@ -54,7 +54,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_ #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_XOR() \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \ uint32_t asm_result = 0u; \ if(__isGlobal(dest)) { \ @@ -65,7 +65,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_ return reinterpret_cast<ctype&>(asm_result); \ } \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \ uint64_t asm_result = 0u; \ if(__isGlobal(dest)) { \ @@ -78,7 +78,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_ // Fetch atomics #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_ADD(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result=0; \ if(__isGlobal(dest)) { \ asm volatile("atom.add.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(value) : "memory"); \ @@ -89,7 +89,7 @@ inline __device__ ctype atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_SUB(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result=0; \ ctype neg_value = -value; \ if(__isGlobal(dest)) { \ @@ -101,7 +101,7 @@ inline __device__ ctype atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_MIN(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result=0; \ if(__isGlobal(dest)) { \ asm volatile("atom.min.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(value) : "memory"); \ @@ -112,7 +112,7 @@ inline __device__ ctype atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_MAX(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result=0; \ if(__isGlobal(dest)) { \ asm volatile("atom.max.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(value) : "memory"); \ @@ -123,7 +123,7 @@ inline __device__ ctype atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_INC(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result = 0; \ ctype limit = desul::Impl::numeric_limits_max<ctype>::value; \ if(__isGlobal(dest)) { \ @@ -133,7 +133,7 @@ inline __device__ ctype atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMO } \ return result; \ } \ -inline __device__ ctype atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result = 0; \ if(__isGlobal(dest)) { \ asm volatile("atom.inc.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(limit) : "memory"); \ @@ -144,7 +144,7 @@ inline __device__ ctype atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_I } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_DEC(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result = 0; \ ctype limit = desul::Impl::numeric_limits_max<ctype>::value; \ if(__isGlobal(dest)) { \ @@ -154,7 +154,7 @@ inline __device__ ctype atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMO } \ return result; \ } \ -inline __device__ ctype atomic_fetch_dec_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_dec_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result = 0; \ if(__isGlobal(dest)) { \ asm volatile("atom.dec.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_ctype " %0,[%1],%2;" : reg_ret_ctype(result) : "l"(dest),reg_ctype(limit) : "memory"); \ diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate index 4039448c6bb63038b65b58bd819c9adf0a75a8a8..c80efc5e7cf043d06a7f82fc3643f3566c5bd6e6 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_fetch_op.inc_predicate @@ -6,7 +6,7 @@ #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_AND() \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \ uint32_t asm_result = 0u; \ asm volatile( \ @@ -20,7 +20,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_ return reinterpret_cast<ctype&>(asm_result); \ } \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_and(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \ uint64_t asm_result = 0u; \ asm volatile( \ @@ -36,7 +36,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_ #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_OR() \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \ uint32_t asm_result = 0u; \ asm volatile( \ @@ -50,7 +50,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_ return reinterpret_cast<ctype&>(asm_result); \ } \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_or(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \ uint64_t asm_result = 0u; \ asm volatile( \ @@ -66,7 +66,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_ #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_XOR() \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \ uint32_t asm_result = 0u; \ asm volatile( \ @@ -80,7 +80,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_ return reinterpret_cast<ctype&>(asm_result); \ } \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_fetch_xor(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \ uint64_t asm_result = 0u; \ asm volatile( \ @@ -96,7 +96,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_ // Fetch atomics #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_ADD(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result=0; \ asm volatile( \ "{\n\t" \ @@ -110,7 +110,7 @@ inline __device__ ctype atomic_fetch_add(ctype* dest, ctype value, __DESUL_IMPL_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_SUB(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result=0; \ ctype neg_value = -value; \ asm volatile( \ @@ -125,7 +125,7 @@ inline __device__ ctype atomic_fetch_sub(ctype* dest, ctype value, __DESUL_IMPL_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_MIN(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result=0; \ asm volatile( \ "{\n\t" \ @@ -139,7 +139,7 @@ inline __device__ ctype atomic_fetch_min(ctype* dest, ctype value, __DESUL_IMPL_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_MAX(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result=0; \ asm volatile( \ "{\n\t" \ @@ -153,7 +153,7 @@ inline __device__ ctype atomic_fetch_max(ctype* dest, ctype value, __DESUL_IMPL_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_INC(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result = 0; \ ctype limit = desul::Impl::numeric_limits_max<ctype>::value; \ asm volatile( \ @@ -166,7 +166,7 @@ inline __device__ ctype atomic_fetch_inc(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMO : reg_ret_ctype(result) : "l"(dest),reg_ctype(limit) : "memory"); \ return result; \ } \ -inline __device__ ctype atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result = 0; \ asm volatile( \ "{\n\t" \ @@ -180,7 +180,7 @@ inline __device__ ctype atomic_fetch_inc_mod(ctype* dest, ctype limit, __DESUL_I } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_FETCH_DEC(ctype,asm_ctype,reg_ctype,reg_ret_ctype) \ -inline __device__ ctype atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result = 0; \ ctype limit = desul::Impl::numeric_limits_max<ctype>::value; \ asm volatile( \ @@ -193,7 +193,7 @@ inline __device__ ctype atomic_fetch_dec(ctype* dest, __DESUL_IMPL_CUDA_ASM_MEMO : reg_ret_ctype(result) : "l"(dest),reg_ctype(limit) : "memory"); \ return result; \ } \ -inline __device__ ctype atomic_fetch_dec_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ ctype device_atomic_fetch_dec_mod(ctype* dest, ctype limit, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ ctype result = 0; \ asm volatile( \ "{\n\t" \ diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc index ca02410515db3491c002b569f01ee150d1c0c683..7d2651d857c7c5b19313cb42a9d59f10cb109d2d 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc @@ -1,7 +1,3 @@ -#ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_GENERIC -#include "cuda_cc7_asm_atomic_op.inc_generic" -#endif - #ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_ISGLOBAL #include "cuda_cc7_asm_atomic_op.inc_isglobal" #endif @@ -10,9 +6,3 @@ #include "cuda_cc7_asm_atomic_op.inc_predicate" #endif -// This version is not generally safe -// Only here for performance comparison purposes -#ifdef DESUL_IMPL_ATOMIC_CUDA_PTX_FORCEGLOBAL -#include "cuda_cc7_asm_atomic_op.inc_forceglobal" -#endif - diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal index ba8937883423e62b9461b6d764d24022531db719..7bc6d4d9d19d76636988368f9153d83e2930531d 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_isglobal @@ -4,7 +4,7 @@ // Non Returning Atomic Operations #define __DESUL_IMPL_CUDA_ASM_ATOMIC_ADD(type,asm_type,reg_type) \ -inline __device__ void atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ if(__isGlobal(dest)) { \ asm volatile("red.add.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(value) : "memory"); \ } else { \ @@ -13,7 +13,7 @@ inline __device__ void atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_SUB(type,asm_type,reg_type) \ -inline __device__ void atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ type neg_value = -value; \ if(__isGlobal(dest)) { \ asm volatile("red.add.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(neg_value) : "memory"); \ @@ -23,7 +23,7 @@ inline __device__ void atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_MIN(type,asm_type,reg_type) \ -inline __device__ void atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ if(__isGlobal(dest)) { \ asm volatile("red.min.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(value) : "memory"); \ } else { \ @@ -32,7 +32,7 @@ inline __device__ void atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_MAX(type,asm_type,reg_type) \ -inline __device__ void atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ if(__isGlobal(dest)) { \ asm volatile("red.max.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(value) : "memory"); \ } else { \ @@ -41,7 +41,7 @@ inline __device__ void atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_INC(type,asm_type,reg_type) \ -inline __device__ void atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ type limit = desul::Impl::numeric_limits_max<type>::value; \ if(__isGlobal(dest)) { \ asm volatile("red.inc.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(limit) : "memory"); \ @@ -51,7 +51,7 @@ inline __device__ void atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_DEC(type,asm_type,reg_type) \ -inline __device__ void atomic_dec(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_dec(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ type limit = desul::Impl::numeric_limits_max<type>::value; \ if(__isGlobal(dest)) { \ asm volatile("red.dec.global" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM asm_type " [%0],%1;" :: "l"(dest),reg_type(limit) : "memory"); \ diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate index 46e0ccf5e747e151039f68e17a72c82a05fc14fc..4ae8e46266e0f4b72a384db76b7f258314bc2838 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_atomic_op.inc_predicate @@ -4,7 +4,7 @@ // Non Returning Atomic Operations #define __DESUL_IMPL_CUDA_ASM_ATOMIC_ADD(type,asm_type,reg_type) \ -inline __device__ void atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ asm volatile( \ "{\n\t" \ ".reg .pred p;\n\t" \ @@ -16,7 +16,7 @@ inline __device__ void atomic_add(type* dest, type value, __DESUL_IMPL_CUDA_ASM_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_SUB(type,asm_type,reg_type) \ -inline __device__ void atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ type neg_value = -value; \ asm volatile( \ "{\n\t" \ @@ -29,7 +29,7 @@ inline __device__ void atomic_sub(type* dest, type value, __DESUL_IMPL_CUDA_ASM_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_MIN(type,asm_type,reg_type) \ -inline __device__ void atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ asm volatile( \ "{\n\t" \ ".reg .pred p;\n\t" \ @@ -41,7 +41,7 @@ inline __device__ void atomic_min(type* dest, type value, __DESUL_IMPL_CUDA_ASM_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_MAX(type,asm_type,reg_type) \ -inline __device__ void atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ asm volatile( \ "{\n\t" \ ".reg .pred p;\n\t" \ @@ -53,7 +53,7 @@ inline __device__ void atomic_max(type* dest, type value, __DESUL_IMPL_CUDA_ASM_ } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_INC(type,asm_type,reg_type) \ -inline __device__ void atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ type limit = desul::Impl::numeric_limits_max<type>::value; \ asm volatile( \ "{\n\t" \ @@ -66,7 +66,7 @@ inline __device__ void atomic_inc(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER } #define __DESUL_IMPL_CUDA_ASM_ATOMIC_DEC(type,asm_type,reg_type) \ -inline __device__ void atomic_dec(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ void device_atomic_dec(type* dest, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ type limit = desul::Impl::numeric_limits_max<type>::value; \ asm volatile( \ "{\n\t" \ diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc index 51d992087e35f8842fbc143f8e903273499d4507..eccafde74b494ad7f0b9023137cd0ce1ef231588 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc +++ b/packages/kokkos/tpls/desul/include/desul/atomics/cuda/cuda_cc7_asm_exchange_op.inc @@ -1,14 +1,14 @@ #define __DESUL_IMPL_CUDA_ASM_ATOMIC_EXCHANGE() \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_exchange(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename ::std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_exchange(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \ uint32_t asm_result = 0u; \ asm volatile("atom.exch" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM ".b32" " %0,[%1],%2;" : "=r"(asm_result) : "l"(dest),"r"(asm_value) : "memory"); \ return reinterpret_cast<ctype&>(asm_result); \ } \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_exchange(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename ::std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_exchange(ctype* dest, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \ uint64_t asm_result = 0u; \ asm volatile("atom.exch" __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER_ASM __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE_ASM ".b64" " %0,[%1],%2;" : "=l"(asm_result) : "l"(dest),"l"(asm_value) : "memory"); \ @@ -17,7 +17,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_ #define __DESUL_IMPL_CUDA_ASM_ATOMIC_COMPARE_EXCHANGE() \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_compare_exchange(ctype* dest, ctype compare, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename ::std::enable_if<sizeof(ctype)==4, ctype>::type device_atomic_compare_exchange(ctype* dest, ctype compare, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint32_t asm_value = reinterpret_cast<uint32_t&>(value); \ uint32_t asm_compare = reinterpret_cast<uint32_t&>(compare); \ uint32_t asm_result = 0u; \ @@ -25,7 +25,7 @@ inline __device__ typename std::enable_if<sizeof(ctype)==4, ctype>::type atomic_ return reinterpret_cast<ctype&>(asm_result); \ } \ template<class ctype> \ -inline __device__ typename std::enable_if<sizeof(ctype)==8, ctype>::type atomic_compare_exchange(ctype* dest, ctype compare, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ +inline __device__ typename ::std::enable_if<sizeof(ctype)==8, ctype>::type device_atomic_compare_exchange(ctype* dest, ctype compare, ctype value, __DESUL_IMPL_CUDA_ASM_MEMORY_ORDER, __DESUL_IMPL_CUDA_ASM_MEMORY_SCOPE) { \ uint64_t asm_value = reinterpret_cast<uint64_t&>(value); \ uint64_t asm_compare = reinterpret_cast<uint64_t&>(compare); \ uint64_t asm_result = 0u; \ diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp b/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp index f4f1bbd96ee6b73d5ec15372256bb4177c033234..bc9ef5b696a6eca92acc206b3dfd2987696d426c 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp +++ b/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40.hpp @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2019, Lawrence Livermore National Security, LLC and DESUL project contributors. See the COPYRIGHT file for details. Source: https://github.com/desul/desul @@ -8,65 +8,64 @@ SPDX-License-Identifier: (BSD-3-Clause) #ifndef DESUL_ATOMICS_OPENMP40_HPP_ #define DESUL_ATOMICS_OPENMP40_HPP_ -#include<type_traits> + +#include <type_traits> namespace desul { namespace Impl { - template<class MEMORY_ORDER_TMP, class MEMORY_SCOPE_TMP> - void openmp_maybe_call_pre_capture_flush(MEMORY_ORDER_TMP, MEMORY_SCOPE_TMP) {} - template<class MEMORY_SCOPE_TMP> - void openmp_maybe_call_pre_capture_flush(MemoryOrderAcquire, MEMORY_SCOPE_TMP) { - atomic_thread_fence(MemoryOrderAcquire(), MEMORY_SCOPE_TMP()); - } - template<class MEMORY_SCOPE_TMP> - void openmp_maybe_call_pre_capture_flush(MemoryOrderAcqRel, MEMORY_SCOPE_TMP) { - atomic_thread_fence(MemoryOrderAcqRel(), MEMORY_SCOPE_TMP()); - } - template<class MEMORY_SCOPE_TMP> - void openmp_maybe_call_pre_capture_flush(MemoryOrderSeqCst, MEMORY_SCOPE_TMP) { - atomic_thread_fence(MemoryOrderSeqCst(), MEMORY_SCOPE_TMP()); - } - - template<class MEMORY_ORDER_TMP, class MEMORY_SCOPE_TMP> - void openmp_maybe_call_post_capture_flush(MEMORY_ORDER_TMP, MEMORY_SCOPE_TMP) {} - template<class MEMORY_SCOPE_TMP> - void openmp_maybe_call_post_capture_flush(MemoryOrderRelease, MEMORY_SCOPE_TMP) { - atomic_thread_fence(MemoryOrderRelease(), MEMORY_SCOPE_TMP()); - } - template<class MEMORY_SCOPE_TMP> - void openmp_maybe_call_post_capture_flush(MemoryOrderAcqRel, MEMORY_SCOPE_TMP) { - atomic_thread_fence(MemoryOrderAcqRel(), MEMORY_SCOPE_TMP()); - } - template<class MEMORY_SCOPE_TMP> - void openmp_maybe_call_post_capture_flush(MemoryOrderSeqCst, MEMORY_SCOPE_TMP) { - atomic_thread_fence(MemoryOrderSeqCst(), MEMORY_SCOPE_TMP()); - } +template <class MEMORY_ORDER_TMP, class MEMORY_SCOPE_TMP> +void openmp_maybe_call_pre_capture_flush(MEMORY_ORDER_TMP, MEMORY_SCOPE_TMP) {} +template <class MEMORY_SCOPE_TMP> +void openmp_maybe_call_pre_capture_flush(MemoryOrderAcquire, MEMORY_SCOPE_TMP) { + atomic_thread_fence(MemoryOrderAcquire(), MEMORY_SCOPE_TMP()); +} +template <class MEMORY_SCOPE_TMP> +void openmp_maybe_call_pre_capture_flush(MemoryOrderAcqRel, MEMORY_SCOPE_TMP) { + atomic_thread_fence(MemoryOrderAcqRel(), MEMORY_SCOPE_TMP()); +} +template <class MEMORY_SCOPE_TMP> +void openmp_maybe_call_pre_capture_flush(MemoryOrderSeqCst, MEMORY_SCOPE_TMP) { + atomic_thread_fence(MemoryOrderSeqCst(), MEMORY_SCOPE_TMP()); +} - template<class T> - struct is_openmp_atomic_type_t { - static constexpr bool value = std::is_arithmetic<T>::value; - }; - template<class T> - constexpr bool is_openmp_atomic_type_v = is_openmp_atomic_type_t<T>::value; +template <class MEMORY_ORDER_TMP, class MEMORY_SCOPE_TMP> +void openmp_maybe_call_post_capture_flush(MEMORY_ORDER_TMP, MEMORY_SCOPE_TMP) {} +template <class MEMORY_SCOPE_TMP> +void openmp_maybe_call_post_capture_flush(MemoryOrderRelease, MEMORY_SCOPE_TMP) { + atomic_thread_fence(MemoryOrderRelease(), MEMORY_SCOPE_TMP()); +} +template <class MEMORY_SCOPE_TMP> +void openmp_maybe_call_post_capture_flush(MemoryOrderAcqRel, MEMORY_SCOPE_TMP) { + atomic_thread_fence(MemoryOrderAcqRel(), MEMORY_SCOPE_TMP()); } +template <class MEMORY_SCOPE_TMP> +void openmp_maybe_call_post_capture_flush(MemoryOrderSeqCst, MEMORY_SCOPE_TMP) { + atomic_thread_fence(MemoryOrderSeqCst(), MEMORY_SCOPE_TMP()); } +template <class T> +constexpr bool is_openmp_atomic_type_v = std::is_arithmetic<T>::value; +} // namespace Impl +} // namespace desul + namespace desul { +namespace impl { // Can't use a macro approach to get all definitions since the ops include #pragma omp // So gonna use multiple inclusion of the same code snippet here. -// Can't do Node level atomics this way with OpenMP Target, but we could -// have a define which says whether or not Device level IS node level (e.g. for pure CPU node) +// Can't do Node level atomics this way with OpenMP Target, but we could +// have a define which says whether or not Device level IS node level (e.g. for pure CPU +// node) #define MEMORY_ORDER MemoryOrderRelaxed // #define MEMORY_SCOPE MemoryScopeNode // #include<desul/atomics/openmp/OpenMP_40_op.inc> // #undef MEMORY_SCOPE #define MEMORY_SCOPE MemoryScopeDevice -#include<desul/atomics/openmp/OpenMP_40_op.inc> +#include <desul/atomics/openmp/OpenMP_40_op.inc> #undef MEMORY_SCOPE #define MEMORY_SCOPE MemoryScopeCore -#include<desul/atomics/openmp/OpenMP_40_op.inc> +#include <desul/atomics/openmp/OpenMP_40_op.inc> #undef MEMORY_SCOPE #undef MEMORY_ORDER @@ -75,10 +74,10 @@ namespace desul { // #include<desul/atomics/openmp/OpenMP_40_op.inc> // #undef MEMORY_SCOPE #define MEMORY_SCOPE MemoryScopeDevice -#include<desul/atomics/openmp/OpenMP_40_op.inc> +#include <desul/atomics/openmp/OpenMP_40_op.inc> #undef MEMORY_SCOPE #define MEMORY_SCOPE MemoryScopeCore -#include<desul/atomics/openmp/OpenMP_40_op.inc> +#include <desul/atomics/openmp/OpenMP_40_op.inc> #undef MEMORY_SCOPE #undef MEMORY_ORDER @@ -87,11 +86,12 @@ namespace desul { // #include<desul/atomics/openmp/OpenMP_40_op.inc> // #undef MEMORY_SCOPE #define MEMORY_SCOPE MemoryScopeDevice -#include<desul/atomics/openmp/OpenMP_40_op.inc> +#include <desul/atomics/openmp/OpenMP_40_op.inc> #undef MEMORY_SCOPE #define MEMORY_SCOPE MemoryScopeCore -#include<desul/atomics/openmp/OpenMP_40_op.inc> +#include <desul/atomics/openmp/OpenMP_40_op.inc> #undef MEMORY_SCOPE #undef MEMORY_ORDER +} // namespace impl } // namespace desul #endif diff --git a/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc b/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc index a65f2a457dff8b2ec6e186411359e73b729fb5e1..7a65edda3932d1e190e6a949b11e517b906243b5 100644 --- a/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc +++ b/packages/kokkos/tpls/desul/include/desul/atomics/openmp/OpenMP_40_op.inc @@ -1,6 +1,6 @@ template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_add( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_add( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -10,7 +10,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_sub( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_sub( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -20,7 +20,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_and( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_and( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -30,7 +30,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_or( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_or( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -40,7 +40,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_fetch_xor( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_fetch_xor( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -50,7 +50,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_add_fetch( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_add_fetch( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -60,7 +60,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_sub_fetch( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_sub_fetch( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -70,7 +70,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_and_fetch( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_and_fetch( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -80,7 +80,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_or_fetch( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_or_fetch( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); @@ -90,7 +90,7 @@ return tmp; } template <typename T> - std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> atomic_xor_fetch( + std::enable_if_t<Impl::is_openmp_atomic_type_v<T>,T> host_atomic_xor_fetch( T* const dest, T value, MEMORY_ORDER, MEMORY_SCOPE) { T tmp; Impl::openmp_maybe_call_pre_capture_flush(MEMORY_ORDER(), MEMORY_SCOPE()); diff --git a/packages/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp b/packages/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp index cb8482c5da8b83bb1fc6323dea09fffce86d115b..19944b378e2c47090dbe3ce28913017a3f308933 100644 --- a/packages/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp +++ b/packages/kokkos/tpls/desul/src/Lock_Array_CUDA.cpp @@ -70,7 +70,7 @@ void init_lock_arrays_cuda() { "init_lock_arrays_cuda: cudaMalloc host locks"); auto error_sync1 = cudaDeviceSynchronize(); - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); check_error_and_throw_cuda(error_sync1, "init_lock_arrays_cuda: post mallocs"); init_lock_arrays_cuda_kernel<<<(CUDA_SPACE_ATOMIC_MASK + 1 + 255) / 256, 256>>>(); auto error_sync2 = cudaDeviceSynchronize(); @@ -85,7 +85,7 @@ void finalize_lock_arrays_cuda() { CUDA_SPACE_ATOMIC_LOCKS_DEVICE_h = nullptr; CUDA_SPACE_ATOMIC_LOCKS_NODE_h = nullptr; #ifdef __CUDACC_RDC__ - DESUL_IMPL_COPY_CUDA_LOCK_ARRAYS_TO_DEVICE(); + copy_cuda_lock_arrays_to_device(); #endif } diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/compressed_pair.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/compressed_pair.hpp new file mode 100644 index 0000000000000000000000000000000000000000..163ec5fa56a418b6e7d7f94ffd74780e9e038805 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/compressed_pair.hpp @@ -0,0 +1,225 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "macros.hpp" +#include "trait_backports.hpp" + +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) +# include "no_unique_address.hpp" +#endif + +namespace std { +namespace experimental { +namespace detail { + +// For no unique address emulation, this is the case taken when neither are empty. +// For real `[[no_unique_address]]`, this case is always taken. +template <class _T, class _U, class _Enable = void> struct __compressed_pair { + _MDSPAN_NO_UNIQUE_ADDRESS _T __t_val; + _MDSPAN_NO_UNIQUE_ADDRESS _U __u_val; + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept { return __t_val; } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__first() const noexcept { + return __t_val; + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept { return __u_val; } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept { + return __u_val; + } + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair(__compressed_pair const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair(__compressed_pair &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + operator=(__compressed_pair const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + operator=(__compressed_pair &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__compressed_pair() noexcept = default; + template <class _TLike, class _ULike> + MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_TLike &&__t, _ULike &&__u) + : __t_val((_TLike &&) __t), __u_val((_ULike &&) __u) {} +}; + +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + +// First empty. +template <class _T, class _U> +struct __compressed_pair< + _T, _U, + enable_if_t<_MDSPAN_TRAIT(is_empty, _T) && !_MDSPAN_TRAIT(is_empty, _U)>> + : private _T { + _U __u_val; + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept { + return *static_cast<_T *>(this); + } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__first() const noexcept { + return *static_cast<_T const *>(this); + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept { return __u_val; } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept { + return __u_val; + } + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair(__compressed_pair const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair(__compressed_pair &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + operator=(__compressed_pair const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + operator=(__compressed_pair &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__compressed_pair() noexcept = default; + template <class _TLike, class _ULike> + MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_TLike &&__t, _ULike &&__u) + : _T((_TLike &&) __t), __u_val((_ULike &&) __u) {} +}; + +// Second empty. +template <class _T, class _U> +struct __compressed_pair< + _T, _U, + enable_if_t<!_MDSPAN_TRAIT(is_empty, _T) && _MDSPAN_TRAIT(is_empty, _U)>> + : private _U { + _T __t_val; + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept { return __t_val; } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__first() const noexcept { + return __t_val; + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept { + return *static_cast<_U *>(this); + } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept { + return *static_cast<_U const *>(this); + } + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair(__compressed_pair const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair(__compressed_pair &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + operator=(__compressed_pair const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + operator=(__compressed_pair &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__compressed_pair() noexcept = default; + + template <class _TLike, class _ULike> + MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_TLike &&__t, _ULike &&__u) + : _U((_ULike &&) __u), __t_val((_TLike &&) __t) {} +}; + +// Both empty. +template <class _T, class _U> +struct __compressed_pair< + _T, _U, + enable_if_t<_MDSPAN_TRAIT(is_empty, _T) && _MDSPAN_TRAIT(is_empty, _U)>> + // We need to use the __no_unique_address_emulation wrapper here to avoid + // base class ambiguities. +#ifdef _MDSPAN_COMPILER_MSVC +// MSVC doesn't allow you to access public static member functions of a type +// when you *happen* to privately inherit from that type. + : protected __no_unique_address_emulation<_T, 0>, + protected __no_unique_address_emulation<_U, 1> +#else + : private __no_unique_address_emulation<_T, 0>, + private __no_unique_address_emulation<_U, 1> +#endif +{ + using __first_base_t = __no_unique_address_emulation<_T, 0>; + using __second_base_t = __no_unique_address_emulation<_U, 1>; + + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__first() noexcept { + return this->__first_base_t::__ref(); + } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__first() const noexcept { + return this->__first_base_t::__ref(); + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _U &__second() noexcept { + return this->__second_base_t::__ref(); + } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _U const &__second() const noexcept { + return this->__second_base_t::__ref(); + } + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair(__compressed_pair const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __compressed_pair(__compressed_pair &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + operator=(__compressed_pair const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __compressed_pair & + operator=(__compressed_pair &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__compressed_pair() noexcept = default; + template <class _TLike, class _ULike> + MDSPAN_INLINE_FUNCTION constexpr __compressed_pair(_TLike &&__t, _ULike &&__u) noexcept + : __first_base_t(_T((_TLike &&) __t)), + __second_base_t(_U((_ULike &&) __u)) + { } +}; + +#endif // !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + +} // end namespace detail +} // end namespace experimental +} // end namespace std diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/config.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/config.hpp new file mode 100644 index 0000000000000000000000000000000000000000..63cb63b9e903f05f439eecf5c89eb18b9a0a9983 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/config.hpp @@ -0,0 +1,302 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#ifndef __has_include +# define __has_include(x) 0 +#endif + +#if __has_include(<version>) +# include <version> +#else +# include <type_traits> +# include <utility> +#endif + +#ifdef _MSVC_LANG +#define _MDSPAN_CPLUSPLUS _MSVC_LANG +#else +#define _MDSPAN_CPLUSPLUS __cplusplus +#endif + +#define MDSPAN_CXX_STD_14 201402L +#define MDSPAN_CXX_STD_17 201703L +#define MDSPAN_CXX_STD_20 202002L + +#define MDSPAN_HAS_CXX_14 (_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_14) +#define MDSPAN_HAS_CXX_17 (_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_17) +#define MDSPAN_HAS_CXX_20 (_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_20) + +static_assert(_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_14, "mdspan requires C++14 or later."); + +#ifndef _MDSPAN_COMPILER_CLANG +# if defined(__clang__) +# define _MDSPAN_COMPILER_CLANG __clang__ +# endif +#endif + +#if !defined(_MDSPAN_COMPILER_MSVC) && !defined(_MDSPAN_COMPILER_MSVC_CLANG) +# if defined(_MSC_VER) +# if !defined(_MDSPAN_COMPILER_CLANG) +# define _MDSPAN_COMPILER_MSVC _MSC_VER +# else +# define _MDSPAN_COMPILER_MSVC_CLANG _MSC_VER +# endif +# endif +#endif + +#ifndef _MDSPAN_COMPILER_INTEL +# ifdef __INTEL_COMPILER +# define _MDSPAN_COMPILER_INTEL __INTEL_COMPILER +# endif +#endif + +#ifndef _MDSPAN_COMPILER_APPLECLANG +# ifdef __apple_build_version__ +# define _MDSPAN_COMPILER_APPLECLANG __apple_build_version__ +# endif +#endif + +#ifndef _MDSPAN_HAS_CUDA +# if defined(__CUDACC__) +# define _MDSPAN_HAS_CUDA __CUDACC__ +# endif +#endif + +#ifndef _MDSPAN_HAS_HIP +# if defined(__HIPCC__) +# define _MDSPAN_HAS_HIP __HIPCC__ +# endif +#endif + +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 +#endif + +#ifndef _MDSPAN_PRESERVE_STANDARD_LAYOUT +// Preserve standard layout by default, but we're not removing the old version +// that turns this off until we're sure this doesn't have an unreasonable cost +// to the compiler or optimizer. +# define _MDSPAN_PRESERVE_STANDARD_LAYOUT 1 +#endif + +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) +# if ((__has_cpp_attribute(no_unique_address) >= 201803L) && \ + (!defined(__NVCC__) || MDSPAN_HAS_CXX_20) && \ + (!defined(_MDSPAN_COMPILER_MSVC) || MDSPAN_HAS_CXX_20)) +# define _MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS 1 +# define _MDSPAN_NO_UNIQUE_ADDRESS [[no_unique_address]] +# else +# define _MDSPAN_NO_UNIQUE_ADDRESS +# endif +#endif + +// NVCC older than 11.6 chokes on the no-unique-address-emulation +// so just pretend to use it (to avoid the full blown EBO workaround +// which NVCC also doesn't like ...), and leave the macro empty +#ifndef _MDSPAN_NO_UNIQUE_ADDRESS +# if defined(__NVCC__) +# define _MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS 1 +# define _MDSPAN_USE_FAKE_ATTRIBUTE_NO_UNIQUE_ADDRESS +# endif +# define _MDSPAN_NO_UNIQUE_ADDRESS +#endif + +#ifndef _MDSPAN_USE_CONCEPTS +# if defined(__cpp_concepts) && __cpp_concepts >= 201507L +# define _MDSPAN_USE_CONCEPTS 1 +# endif +#endif + +#ifndef _MDSPAN_USE_FOLD_EXPRESSIONS +# if (defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603L) \ + || (!defined(__cpp_fold_expressions) && MDSPAN_HAS_CXX_17) +# define _MDSPAN_USE_FOLD_EXPRESSIONS 1 +# endif +#endif + +#ifndef _MDSPAN_USE_INLINE_VARIABLES +# if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L \ + || (!defined(__cpp_inline_variables) && MDSPAN_HAS_CXX_17) +# define _MDSPAN_USE_INLINE_VARIABLES 1 +# endif +#endif + +#ifndef _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS +# if (!(defined(__cpp_lib_type_trait_variable_templates) && __cpp_lib_type_trait_variable_templates >= 201510L) \ + || !MDSPAN_HAS_CXX_17) +# if !(defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_17) +# define _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS 1 +# endif +# endif +#endif + +#ifndef _MDSPAN_USE_VARIABLE_TEMPLATES +# if (defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 && MDSPAN_HAS_CXX_17) \ + || (!defined(__cpp_variable_templates) && MDSPAN_HAS_CXX_17) +# define _MDSPAN_USE_VARIABLE_TEMPLATES 1 +# endif +#endif // _MDSPAN_USE_VARIABLE_TEMPLATES + +#ifndef _MDSPAN_USE_CONSTEXPR_14 +# if (defined(__cpp_constexpr) && __cpp_constexpr >= 201304) \ + || (!defined(__cpp_constexpr) && MDSPAN_HAS_CXX_14) \ + && (!(defined(__INTEL_COMPILER) && __INTEL_COMPILER <= 1700)) +# define _MDSPAN_USE_CONSTEXPR_14 1 +# endif +#endif + +#ifndef _MDSPAN_USE_INTEGER_SEQUENCE +# if defined(_MDSPAN_COMPILER_MSVC) +# if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304) +# define _MDSPAN_USE_INTEGER_SEQUENCE 1 +# endif +# endif +#endif +#ifndef _MDSPAN_USE_INTEGER_SEQUENCE +# if (defined(__cpp_lib_integer_sequence) && __cpp_lib_integer_sequence >= 201304) \ + || (!defined(__cpp_lib_integer_sequence) && MDSPAN_HAS_CXX_14) \ + /* as far as I can tell, libc++ seems to think this is a C++11 feature... */ \ + || (defined(__GLIBCXX__) && __GLIBCXX__ > 20150422 && __GNUC__ < 5 && !defined(__INTEL_CXX11_MODE__)) + // several compilers lie about integer_sequence working properly unless the C++14 standard is used +# define _MDSPAN_USE_INTEGER_SEQUENCE 1 +# elif defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_14 + // appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14 making + // integer_sequence work +# define _MDSPAN_USE_INTEGER_SEQUENCE 1 +# endif +#endif + +#ifndef _MDSPAN_USE_RETURN_TYPE_DEDUCTION +# if (defined(__cpp_return_type_deduction) && __cpp_return_type_deduction >= 201304) \ + || (!defined(__cpp_return_type_deduction) && MDSPAN_HAS_CXX_14) +# define _MDSPAN_USE_RETURN_TYPE_DEDUCTION 1 +# endif +#endif + +#ifndef _MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION +// GCC 10's CTAD seems sufficiently broken to prevent its use. +# if (defined(_MDSPAN_COMPILER_CLANG) || !defined(__GNUC__) || __GNUC__ >= 11) \ + && ((defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201703) \ + || (!defined(__cpp_deduction_guides) && MDSPAN_HAS_CXX_17)) +# define _MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1 +# endif +#endif + +#ifndef _MDSPAN_USE_ALIAS_TEMPLATE_ARGUMENT_DEDUCTION +// GCC 10's CTAD seems sufficiently broken to prevent its use. +# if (defined(_MDSPAN_COMPILER_CLANG) || !defined(__GNUC__) || __GNUC__ >= 11) \ + && ((defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201907) \ + || (!defined(__cpp_deduction_guides) && MDSPAN_HAS_CXX_20)) +# define _MDSPAN_USE_ALIAS_TEMPLATE_ARGUMENT_DEDUCTION 1 +# endif +#endif + +#ifndef _MDSPAN_USE_STANDARD_TRAIT_ALIASES +# if (defined(__cpp_lib_transformation_trait_aliases) && __cpp_lib_transformation_trait_aliases >= 201304) \ + || (!defined(__cpp_lib_transformation_trait_aliases) && MDSPAN_HAS_CXX_14) +# define _MDSPAN_USE_STANDARD_TRAIT_ALIASES 1 +# elif defined(_MDSPAN_COMPILER_APPLECLANG) && MDSPAN_HAS_CXX_14 + // appleclang seems to be missing the __cpp_lib_... macros, but doesn't seem to lie about C++14 +# define _MDSPAN_USE_STANDARD_TRAIT_ALIASES 1 +# endif +#endif + +#ifndef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND +# ifdef __GNUC__ +# if __GNUC__ < 9 +# define _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND 1 +# endif +# endif +#endif + +#ifndef MDSPAN_CONDITIONAL_EXPLICIT +# if MDSPAN_HAS_CXX_20 && !defined(_MDSPAN_COMPILER_MSVC) +# define MDSPAN_CONDITIONAL_EXPLICIT(COND) explicit(COND) +# else +# define MDSPAN_CONDITIONAL_EXPLICIT(COND) +# endif +#endif + +#ifndef MDSPAN_USE_BRACKET_OPERATOR +# if defined(__cpp_multidimensional_subscript) +# define MDSPAN_USE_BRACKET_OPERATOR 1 +# else +# define MDSPAN_USE_BRACKET_OPERATOR 0 +# endif +#endif + +#ifndef MDSPAN_USE_PAREN_OPERATOR +# if !MDSPAN_USE_BRACKET_OPERATOR +# define MDSPAN_USE_PAREN_OPERATOR 1 +# else +# define MDSPAN_USE_PAREN_OPERATOR 0 +# endif +#endif + +#if MDSPAN_USE_BRACKET_OPERATOR +# define __MDSPAN_OP(mds,...) mds[__VA_ARGS__] +// Corentins demo compiler for subscript chokes on empty [] call, +// though I believe the proposal supports it? +#ifdef MDSPAN_NO_EMPTY_BRACKET_OPERATOR +# define __MDSPAN_OP0(mds) mds.accessor().access(mds.data_handle(),0) +#else +# define __MDSPAN_OP0(mds) mds[] +#endif +# define __MDSPAN_OP1(mds, a) mds[a] +# define __MDSPAN_OP2(mds, a, b) mds[a,b] +# define __MDSPAN_OP3(mds, a, b, c) mds[a,b,c] +# define __MDSPAN_OP4(mds, a, b, c, d) mds[a,b,c,d] +# define __MDSPAN_OP5(mds, a, b, c, d, e) mds[a,b,c,d,e] +# define __MDSPAN_OP6(mds, a, b, c, d, e, f) mds[a,b,c,d,e,f] +#else +# define __MDSPAN_OP(mds,...) mds(__VA_ARGS__) +# define __MDSPAN_OP0(mds) mds() +# define __MDSPAN_OP1(mds, a) mds(a) +# define __MDSPAN_OP2(mds, a, b) mds(a,b) +# define __MDSPAN_OP3(mds, a, b, c) mds(a,b,c) +# define __MDSPAN_OP4(mds, a, b, c, d) mds(a,b,c,d) +# define __MDSPAN_OP5(mds, a, b, c, d, e) mds(a,b,c,d,e) +# define __MDSPAN_OP6(mds, a, b, c, d, e, f) mds(a,b,c,d,e,f) +#endif diff --git a/packages/kokkos/core/src/Kokkos_HIP.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/default_accessor.hpp similarity index 55% rename from packages/kokkos/core/src/Kokkos_HIP.hpp rename to packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/default_accessor.hpp index c387b5945d77aff8922e49d1d8c9f369deac8667..d26a7e6dad270b0ebadea63b1323f55ec850e855 100644 --- a/packages/kokkos/core/src/Kokkos_HIP.hpp +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/default_accessor.hpp @@ -2,11 +2,10 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation // -// Under the terms of Contract DE-NA0003525 with NTESS, +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without @@ -24,10 +23,10 @@ // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -42,36 +41,46 @@ //@HEADER */ -#ifndef KOKKOS_IMPL_PUBLIC_INCLUDE -#include <Kokkos_Macros.hpp> -#ifndef KOKKOS_ENABLE_DEPRECATED_CODE_3 -static_assert(false, - "Including non-public Kokkos header files is not allowed."); -#else -KOKKOS_IMPL_WARNING("Including non-public Kokkos header files is not allowed.") -#endif -#endif -#ifndef KOKKOS_HIP_HPP -#define KOKKOS_HIP_HPP +#pragma once -#include <Kokkos_Core_fwd.hpp> +#include "macros.hpp" -#if defined(KOKKOS_ENABLE_HIP) +#include <cstddef> // size_t -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- +namespace std { +namespace experimental { -#include <Kokkos_HIP_Space.hpp> -#include <Kokkos_Parallel.hpp> +template <class ElementType> +struct default_accessor { -#include <HIP/Kokkos_HIP_Half_Impl_Type.hpp> -#include <HIP/Kokkos_HIP_Half_Conversion.hpp> -#include <HIP/Kokkos_HIP_Instance.hpp> -#include <HIP/Kokkos_HIP_MDRangePolicy.hpp> -#include <HIP/Kokkos_HIP_Parallel_Range.hpp> -#include <HIP/Kokkos_HIP_Parallel_MDRange.hpp> -#include <HIP/Kokkos_HIP_Parallel_Team.hpp> -#include <HIP/Kokkos_HIP_UniqueToken.hpp> + using offset_policy = default_accessor; + using element_type = ElementType; + using reference = ElementType&; + using data_handle_type = ElementType*; -#endif -#endif + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr default_accessor() noexcept = default; + + MDSPAN_TEMPLATE_REQUIRES( + class OtherElementType, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, OtherElementType(*)[], element_type(*)[]) + ) + ) + MDSPAN_INLINE_FUNCTION + constexpr default_accessor(default_accessor<OtherElementType>) noexcept {} + + MDSPAN_INLINE_FUNCTION + constexpr data_handle_type + offset(data_handle_type p, size_t i) const noexcept { + return p + i; + } + + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference access(data_handle_type p, size_t i) const noexcept { + return p[i]; + } + +}; + +} // end namespace experimental +} // end namespace std diff --git a/packages/kokkos/core/src/impl/Kokkos_PhysicalLayout.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/dynamic_extent.hpp similarity index 57% rename from packages/kokkos/core/src/impl/Kokkos_PhysicalLayout.hpp rename to packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/dynamic_extent.hpp index bc0a7df3e03969a37f70c71ce5497fd0f864fb2d..206540292d7e783be48ac46502d070013bac6880 100644 --- a/packages/kokkos/core/src/impl/Kokkos_PhysicalLayout.hpp +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/dynamic_extent.hpp @@ -2,11 +2,10 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation // -// Under the terms of Contract DE-NA0003525 with NTESS, +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without @@ -24,10 +23,10 @@ // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -42,36 +41,33 @@ //@HEADER */ -#ifndef KOKKOS_PHYSICAL_LAYOUT_HPP -#define KOKKOS_PHYSICAL_LAYOUT_HPP +#pragma once -#include <Kokkos_View.hpp> +#include "macros.hpp" -namespace Kokkos { -namespace Impl { +#include <cstddef> // size_t +#include <limits> // numeric_limits -struct PhysicalLayout { - enum LayoutType { Left, Right, Scalar, Error }; - LayoutType layout_type; - int rank; - long long int stride[9]; // distance between two neighboring elements in a - // given dimension +namespace std { +namespace experimental { - template <class T, class L, class D, class M> - PhysicalLayout(const View<T, L, D, M>& view) - : layout_type( - is_same<typename View<T, L, D, M>::array_layout, LayoutLeft>::value - ? Left - : (is_same<typename View<T, L, D, M>::array_layout, - LayoutRight>::value - ? Right - : Error)), - rank(view.Rank) { - for (int i = 0; i < 9; i++) stride[i] = 0; - view.stride(stride); - } -}; +_MDSPAN_INLINE_VARIABLE constexpr auto dynamic_extent = std::numeric_limits<size_t>::max(); -} // namespace Impl -} // namespace Kokkos -#endif +namespace detail { + +template <class> +constexpr auto __make_dynamic_extent() { + return dynamic_extent; +} + +template <size_t> +constexpr auto __make_dynamic_extent_integral() { + return dynamic_extent; +} + +} // end namespace detail + +} // end namespace experimental +} // namespace std + +//============================================================================================================== diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/extents.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/extents.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ce562ed7e2f16b6a7fa6b860d2a94129fe39c0e8 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/extents.hpp @@ -0,0 +1,543 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "macros.hpp" +#include "static_array.hpp" +#include "standard_layout_static_array.hpp" +#include "trait_backports.hpp" // integer_sequence, etc. + +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) +# include "no_unique_address.hpp" +#endif + +#include <array> +#include <cstddef> + +namespace std { +namespace experimental { + +namespace detail { + +template<size_t ... Extents> +struct _count_dynamic_extents; + +template<size_t E, size_t ... Extents> +struct _count_dynamic_extents<E,Extents...> { + static constexpr size_t val = (E==dynamic_extent?1:0) + _count_dynamic_extents<Extents...>::val; +}; + +template<> +struct _count_dynamic_extents<> { + static constexpr size_t val = 0; +}; + +template <size_t... Extents, size_t... OtherExtents> +static constexpr std::false_type _check_compatible_extents( + std::false_type, std::integer_sequence<size_t, Extents...>, std::integer_sequence<size_t, OtherExtents...> +) noexcept { return { }; } + +template <size_t... Extents, size_t... OtherExtents> +static std::integral_constant< + bool, + _MDSPAN_FOLD_AND( + ( + Extents == dynamic_extent + || OtherExtents == dynamic_extent + || Extents == OtherExtents + ) /* && ... */ + ) +> +_check_compatible_extents( + std::true_type, std::integer_sequence<size_t, Extents...>, std::integer_sequence<size_t, OtherExtents...> +) noexcept { return { }; } + +struct __extents_tag { }; + +} // end namespace detail + +template <class ThisIndexType, size_t... Extents> +class extents +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : private detail::__no_unique_address_emulation< + detail::__partially_static_sizes_tagged<detail::__extents_tag, ThisIndexType , size_t, Extents...>> +#endif +{ +public: + + using rank_type = size_t; + using index_type = ThisIndexType; + using size_type = make_unsigned_t<index_type>; + +// internal typedefs which for technical reasons are public + using __storage_t = detail::__partially_static_sizes_tagged<detail::__extents_tag, index_type, size_t, Extents...>; + +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + _MDSPAN_NO_UNIQUE_ADDRESS __storage_t __storage_; +#else + using __base_t = detail::__no_unique_address_emulation<__storage_t>; +#endif + +// private members dealing with the way we internally store dynamic extents + private: + + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + __storage_t& __storage() noexcept { +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + return __storage_; +#else + return this->__base_t::__ref(); +#endif + } + MDSPAN_FORCE_INLINE_FUNCTION + constexpr __storage_t const& __storage() const noexcept { +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + return __storage_; +#else + return this->__base_t::__ref(); +#endif + } + + template <size_t... Idxs> + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr + std::size_t _static_extent_impl(size_t n, std::integer_sequence<size_t, Idxs...>) noexcept { + return _MDSPAN_FOLD_PLUS_RIGHT(((Idxs == n) ? Extents : 0), /* + ... + */ 0); + } + + template <class, size_t...> + friend class extents; + + template <class OtherIndexType, size_t... OtherExtents, size_t... Idxs> + MDSPAN_INLINE_FUNCTION + constexpr bool _eq_impl(std::experimental::extents<OtherIndexType, OtherExtents...>, false_type, index_sequence<Idxs...>) const noexcept { return false; } + template <class OtherIndexType, size_t... OtherExtents, size_t... Idxs> + MDSPAN_INLINE_FUNCTION + constexpr bool _eq_impl( + std::experimental::extents<OtherIndexType, OtherExtents...> other, + true_type, index_sequence<Idxs...> + ) const noexcept { + return _MDSPAN_FOLD_AND( + (__storage().template __get_n<Idxs>() == other.__storage().template __get_n<Idxs>()) /* && ... */ + ); + } + + template <class OtherIndexType, size_t... OtherExtents, size_t... Idxs> + MDSPAN_INLINE_FUNCTION + constexpr bool _not_eq_impl(std::experimental::extents<OtherIndexType, OtherExtents...>, false_type, index_sequence<Idxs...>) const noexcept { return true; } + template <class OtherIndexType, size_t... OtherExtents, size_t... Idxs> + MDSPAN_INLINE_FUNCTION + constexpr bool _not_eq_impl( + std::experimental::extents<OtherIndexType, OtherExtents...> other, + true_type, index_sequence<Idxs...> + ) const noexcept { + return _MDSPAN_FOLD_OR( + (__storage().template __get_n<Idxs>() != other.__storage().template __get_n<Idxs>()) /* || ... */ + ); + } + +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + MDSPAN_INLINE_FUNCTION constexpr explicit + extents(__base_t&& __b) noexcept + : __base_t(::std::move(__b)) + { } +#endif + + +// public interface: +public: + /* Defined above for use in the private code + using rank_type = size_t; + using index_type = ThisIndexType; + */ + + MDSPAN_INLINE_FUNCTION + static constexpr rank_type rank() noexcept { return sizeof...(Extents); } + MDSPAN_INLINE_FUNCTION + static constexpr rank_type rank_dynamic() noexcept { return _MDSPAN_FOLD_PLUS_RIGHT((rank_type(Extents == dynamic_extent)), /* + ... + */ 0); } + + //-------------------------------------------------------------------------------- + // Constructors, Destructors, and Assignment + + // Default constructor + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr extents() noexcept = default; + + // Converting constructor + MDSPAN_TEMPLATE_REQUIRES( + class OtherIndexType, size_t... OtherExtents, + /* requires */ ( + /* multi-stage check to protect from invalid pack expansion when sizes don't match? */ + decltype(detail::_check_compatible_extents( + std::integral_constant<bool, sizeof...(Extents) == sizeof...(OtherExtents)>{}, + std::integer_sequence<size_t, Extents...>{}, + std::integer_sequence<size_t, OtherExtents...>{} + ))::value + ) + ) + MDSPAN_INLINE_FUNCTION + MDSPAN_CONDITIONAL_EXPLICIT( + (((Extents != dynamic_extent) && (OtherExtents == dynamic_extent)) || ...) || + (std::numeric_limits<index_type>::max() < std::numeric_limits<OtherIndexType>::max())) + constexpr extents(const extents<OtherIndexType, OtherExtents...>& __other) + noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __storage_{ +#else + : __base_t(__base_t{__storage_t{ +#endif + __other.__storage().__enable_psa_conversion() +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + }}) +#endif + { + /* TODO: precondition check + * other.extent(r) equals Er for each r for which Er is a static extent, and + * either + * - sizeof...(OtherExtents) is zero, or + * - other.extent(r) is a representable value of type index_type for all rank index r of other + */ + } + +#ifdef __NVCC__ + MDSPAN_TEMPLATE_REQUIRES( + class... Integral, + /* requires */ ( + // TODO: check whether the other version works with newest NVCC, doesn't with 11.4 + // NVCC seems to pick up rank_dynamic from the wrong extents type??? + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, Integral, index_type) /* && ... */) && + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Integral) /* && ... */) && + // NVCC chokes on the fold thingy here so wrote the workaround + ((sizeof...(Integral) == detail::_count_dynamic_extents<Extents...>::val) || + (sizeof...(Integral) == sizeof...(Extents))) + ) + ) +#else + MDSPAN_TEMPLATE_REQUIRES( + class... Integral, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, Integral, index_type) /* && ... */) && + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Integral) /* && ... */) && + ((sizeof...(Integral) == rank_dynamic()) || (sizeof...(Integral) == rank())) + ) + ) +#endif + MDSPAN_INLINE_FUNCTION + explicit constexpr extents(Integral... exts) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __storage_{ +#else + : __base_t(__base_t{typename __base_t::__stored_type{ +#endif + std::conditional_t<sizeof...(Integral)==rank_dynamic(), + detail::__construct_psa_from_dynamic_exts_values_tag_t, + detail::__construct_psa_from_all_exts_values_tag_t>(), + static_cast<index_type>(exts)... +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + }}) +#endif + { + /* TODO: precondition check + * If sizeof...(IndexTypes) != rank_dynamic() is true, exts_arr[r] equals Er for each r for which Er is a static extent, and + * either + * - sizeof...(exts) == 0 is true, or + * - each element of exts is nonnegative and is a representable value of type index_type. + */ + } + + // TODO: check whether this works with newest NVCC, doesn't with 11.4 +#ifdef __NVCC__ + // NVCC seems to pick up rank_dynamic from the wrong extents type??? + // NVCC chokes on the fold thingy here so wrote the workaround + MDSPAN_TEMPLATE_REQUIRES( + class IndexType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, IndexType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, IndexType) && + ((N == detail::_count_dynamic_extents<Extents...>::val) || + (N == sizeof...(Extents))) + ) + ) +#else + MDSPAN_TEMPLATE_REQUIRES( + class IndexType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, IndexType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, IndexType) && + (N == rank() || N == rank_dynamic()) + ) + ) +#endif + MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic()) + MDSPAN_INLINE_FUNCTION + constexpr + extents(std::array<IndexType, N> const& exts) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __storage_{ +#else + : __base_t(__base_t{typename __base_t::__stored_type{ +#endif + std::conditional_t<N==rank_dynamic(), + detail::__construct_psa_from_dynamic_exts_array_tag_t<0>, + detail::__construct_psa_from_all_exts_array_tag_t>(), + std::array<IndexType,N>{exts} +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + }}) +#endif + { + /* TODO: precondition check + * If N != rank_dynamic() is true, exts[r] equals Er for each r for which Er is a static extent, and + * either + * - N is zero, or + * - exts[r] is nonnegative and is a representable value of type index_type for all rank index r + */ + } + +#ifdef __cpp_lib_span + // TODO: check whether the below works with newest NVCC, doesn't with 11.4 +#ifdef __NVCC__ + // NVCC seems to pick up rank_dynamic from the wrong extents type??? + // NVCC chokes on the fold thingy here so wrote the workaround + MDSPAN_TEMPLATE_REQUIRES( + class IndexType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, IndexType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, IndexType) && + ((N == detail::_count_dynamic_extents<Extents...>::val) || + (N == sizeof...(Extents))) + ) + ) +#else + MDSPAN_TEMPLATE_REQUIRES( + class IndexType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, IndexType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, IndexType) && + (N == rank() || N == rank_dynamic()) + ) + ) +#endif + MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic()) + MDSPAN_INLINE_FUNCTION + constexpr + extents(std::span<IndexType, N> exts) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __storage_{ +#else + : __base_t(__base_t{typename __base_t::__stored_type{ +#endif + std::conditional_t<N==rank_dynamic(), + detail::__construct_psa_from_dynamic_exts_array_tag_t<0>, + detail::__construct_psa_from_all_exts_array_tag_t>(), + exts +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + }}) +#endif + { + /* TODO: precondition check + * If N != rank_dynamic() is true, exts[r] equals Er for each r for which Er is a static extent, and + * either + * - N is zero, or + * - exts[r] is nonnegative and is a representable value of type index_type for all rank index r + */ + } +#endif + + // Need this constructor for some submdspan implementation stuff + // for the layout_stride case where I use an extents object for strides + MDSPAN_INLINE_FUNCTION + constexpr explicit + extents(__storage_t const& sto ) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __storage_{ +#else + : __base_t(__base_t{ +#endif + sto +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + }) +#endif + { } + + //-------------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION + static constexpr + size_t static_extent(size_t n) noexcept { + // Can't do assert here since that breaks true constexpr ness + // assert(n<rank()); + return _static_extent_impl(n, std::make_integer_sequence<size_t, sizeof...(Extents)>{}); + } + + MDSPAN_INLINE_FUNCTION + constexpr + index_type extent(size_t n) const noexcept { + // Can't do assert here since that breaks true constexpr ness + // assert(n<rank()); + return __storage().__get(n); + } + + //-------------------------------------------------------------------------------- + + template<class OtherIndexType, size_t... RHS> + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator==(extents const& lhs, extents<OtherIndexType, RHS...> const& rhs) noexcept { + return lhs._eq_impl( + rhs, std::integral_constant<bool, (sizeof...(RHS) == rank())>{}, + make_index_sequence<sizeof...(RHS)>{} + ); + } + +#if !(MDSPAN_HAS_CXX_20) + template<class OtherIndexType, size_t... RHS> + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator!=(extents const& lhs, extents<OtherIndexType, RHS...> const& rhs) noexcept { + return lhs._not_eq_impl( + rhs, std::integral_constant<bool, (sizeof...(RHS) == rank())>{}, + make_index_sequence<sizeof...(RHS)>{} + ); + } +#endif + + // End of public interface + +public: // (but not really) + + MDSPAN_INLINE_FUNCTION static constexpr + extents __make_extents_impl(detail::__partially_static_sizes<index_type, size_t,Extents...>&& __bs) noexcept { + // This effectively amounts to a sideways cast that can be done in a constexpr + // context, but we have to do it to handle the case where the extents and the + // strides could accidentally end up with the same types in their hierarchies + // somehow (which would cause layout_stride::mapping to not be standard_layout) + return extents( +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + __base_t{ +#endif + ::std::move(__bs.template __with_tag<detail::__extents_tag>()) +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#endif + ); + } + + template <size_t N> + MDSPAN_FORCE_INLINE_FUNCTION + constexpr + index_type __extent() const noexcept { + return __storage().template __get_n<N>(); + } + + template <size_t N, size_t Default=dynamic_extent> + MDSPAN_INLINE_FUNCTION + static constexpr + index_type __static_extent() noexcept { + return __storage_t::template __get_static_n<N, Default>(); + } + +}; + +namespace detail { + +template <class IndexType, size_t Rank, class Extents = ::std::experimental::extents<IndexType>> +struct __make_dextents; + +template <class IndexType, size_t Rank, size_t... ExtentsPack> +struct __make_dextents<IndexType, Rank, ::std::experimental::extents<IndexType, ExtentsPack...>> { + using type = typename __make_dextents<IndexType, Rank - 1, + ::std::experimental::extents<IndexType, ::std::experimental::dynamic_extent, ExtentsPack...>>::type; +}; + +template <class IndexType, size_t... ExtentsPack> +struct __make_dextents<IndexType, 0, ::std::experimental::extents<IndexType, ExtentsPack...>> { + using type = ::std::experimental::extents<IndexType, ExtentsPack...>; +}; + +} // end namespace detail + +template <class IndexType, size_t Rank> +using dextents = typename detail::__make_dextents<IndexType, Rank>::type; + +#if defined(_MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION) +template <class... IndexTypes> +extents(IndexTypes...) + -> extents<size_t, detail::__make_dynamic_extent<IndexTypes>()...>; +#endif + +namespace detail { + +template <class T> +struct __is_extents : ::std::false_type {}; + +template <class IndexType, size_t... ExtentsPack> +struct __is_extents<::std::experimental::extents<IndexType, ExtentsPack...>> : ::std::true_type {}; + +template <class T> +static constexpr bool __is_extents_v = __is_extents<T>::value; + + +template <typename Extents> +struct __extents_to_partially_static_sizes; + +template <class IndexType, size_t... ExtentsPack> +struct __extents_to_partially_static_sizes<::std::experimental::extents<IndexType, ExtentsPack...>> { + using type = detail::__partially_static_sizes< + typename ::std::experimental::extents<IndexType, ExtentsPack...>::index_type, size_t, + ExtentsPack...>; +}; + +template <typename Extents> +using __extents_to_partially_static_sizes_t = typename __extents_to_partially_static_sizes<Extents>::type; + +} // end namespace detail +} // end namespace experimental +} // end namespace std diff --git a/packages/kokkos/core/src/impl/Kokkos_Timer.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/full_extent_t.hpp similarity index 64% rename from packages/kokkos/core/src/impl/Kokkos_Timer.hpp rename to packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/full_extent_t.hpp index 6edf571d7892e4260fc7d617a1a86a63d265baa2..e5ede0f9d594be0433e94b97cb716dcbb7779614 100644 --- a/packages/kokkos/core/src/impl/Kokkos_Timer.hpp +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/full_extent_t.hpp @@ -2,11 +2,10 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation // -// Under the terms of Contract DE-NA0003525 with NTESS, +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without @@ -24,10 +23,10 @@ // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -42,28 +41,16 @@ //@HEADER */ -#ifndef KOKKOS_IMPLWALLTIME_HPP -#define KOKKOS_IMPLWALLTIME_HPP +#pragma once -#include <Kokkos_Macros.hpp> +#include "macros.hpp" -KOKKOS_IMPL_WARNING("This file is deprecated. Use <Kokkos_Timer.hpp> instead.") +namespace std { +namespace experimental { -#include <Kokkos_Timer.hpp> +struct full_extent_t { explicit full_extent_t() = default; }; -#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_3 -namespace Kokkos { -namespace Impl { +_MDSPAN_INLINE_VARIABLE constexpr auto full_extent = full_extent_t{ }; -/** \brief Time since construction - * Timer promoted from Impl to Kokkos ns - * This file included for backwards compatibility - */ -using Timer KOKKOS_DEPRECATED_WITH_COMMENT("Use Kokkos::Timer instead!") = - Kokkos::Timer; - -} // namespace Impl -} // namespace Kokkos -#endif - -#endif /* #ifndef KOKKOS_IMPLWALLTIME_HPP */ +} // end namespace experimental +} // namespace std diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_left.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_left.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8cd2e14fb8d7039727ee7a1f87e5a29cdd875136 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_left.hpp @@ -0,0 +1,240 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "macros.hpp" +#include "trait_backports.hpp" +#include "extents.hpp" + +namespace std { +namespace experimental { + +//============================================================================== + +template <class Extents> +class layout_left::mapping { + public: + using extents_type = Extents; + using index_type = typename extents_type::index_type; + using size_type = typename extents_type::size_type; + using rank_type = typename extents_type::rank_type; + using layout_type = layout_left; + private: + + static_assert(detail::__is_extents_v<extents_type>, "std::experimental::layout_left::mapping must be instantiated with a specialization of std::experimental::extents."); + + template <class> + friend class mapping; + + // i0+(i1 + E(1)*(i2 + E(2)*i3)) + template <size_t r, size_t Rank> + struct __rank_count {}; + + template <size_t r, size_t Rank, class I, class... Indices> + constexpr index_type __compute_offset( + __rank_count<r,Rank>, const I& i, Indices... idx) const { + return __compute_offset(__rank_count<r+1,Rank>(), idx...) * + __extents.template __extent<r>() + i; + } + + template<class I> + constexpr index_type __compute_offset( + __rank_count<extents_type::rank()-1,extents_type::rank()>, const I& i) const { + return i; + } + + constexpr index_type __compute_offset(__rank_count<0,0>) const { return 0; } + + public: + + //-------------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(mapping const&) noexcept = default; + + constexpr mapping(extents_type const& __exts) noexcept + :__extents(__exts) + { } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherExtents, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) + ) + ) + MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma + MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + mapping(mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor) + :__extents(other.extents()) + { + /* + * TODO: check precondition + * other.required_span_size() is a representable value of type index_type + */ + } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherExtents, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) && + (extents_type::rank() <= 1) + ) + ) + MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma + MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + mapping(layout_right::mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor) + :__extents(other.extents()) + { + /* + * TODO: check precondition + * other.required_span_size() is a representable value of type index_type + */ + } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherExtents, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) + ) + ) + MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0)) + MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + mapping(layout_stride::mapping<OtherExtents> const& other) // NOLINT(google-explicit-constructor) + :__extents(other.extents()) + { + /* + * TODO: check precondition + * other.required_span_size() is a representable value of type index_type + */ + #ifndef __CUDA_ARCH__ + size_t stride = 1; + for(rank_type r=0; r<__extents.rank(); r++) { + if(stride != other.stride(r)) + throw std::runtime_error("Assigning layout_stride to layout_left with invalid strides."); + stride *= __extents.extent(r); + } + #endif + } + + MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; + + MDSPAN_INLINE_FUNCTION + constexpr const extents_type& extents() const noexcept { + return __extents; + } + + MDSPAN_INLINE_FUNCTION + constexpr index_type required_span_size() const noexcept { + index_type value = 1; + for(rank_type r=0; r<extents_type::rank(); r++) value*=__extents.extent(r); + return value; + } + + //-------------------------------------------------------------------------------- + + MDSPAN_TEMPLATE_REQUIRES( + class... Indices, + /* requires */ ( + (sizeof...(Indices) == extents_type::rank()) && + _MDSPAN_FOLD_AND( + (_MDSPAN_TRAIT(is_convertible, Indices, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices)) + ) + ) + ) + constexpr index_type operator()(Indices... idxs) const noexcept { + return __compute_offset(__rank_count<0, extents_type::rank()>(), idxs...); + } + + + + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return true; } + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return true; } + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return true; } + + MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return true; } + MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return true; } + MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return true; } + + MDSPAN_INLINE_FUNCTION + constexpr index_type stride(rank_type i) const noexcept { + index_type value = 1; + for(rank_type r=0; r<i; r++) value*=__extents.extent(r); + return value; + } + + template<class OtherExtents> + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator==(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept { + return lhs.extents() == rhs.extents(); + } + + // In C++ 20 the not equal exists if equal is found +#if MDSPAN_HAS_CXX_20 + template<class OtherExtents> + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator!=(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept { + return lhs.extents() != rhs.extents(); + } +#endif + + // Not really public, but currently needed to implement fully constexpr useable submdspan: + template<size_t N, class SizeType, size_t ... E, size_t ... Idx> + constexpr index_type __get_stride(std::experimental::extents<SizeType, E...>,integer_sequence<size_t, Idx...>) const { + return _MDSPAN_FOLD_TIMES_RIGHT((Idx<N? __extents.template __extent<Idx>():1),1); + } + template<size_t N> + constexpr index_type __stride() const noexcept { + return __get_stride<N>(__extents, make_index_sequence<extents_type::rank()>()); + } + +private: + _MDSPAN_NO_UNIQUE_ADDRESS extents_type __extents{}; + +}; + + +} // end namespace experimental +} // end namespace std + diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_right.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_right.hpp new file mode 100644 index 0000000000000000000000000000000000000000..118f3632c009d19eb0ef763329478c12a1444d8c --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_right.hpp @@ -0,0 +1,240 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "macros.hpp" +#include "trait_backports.hpp" +#include "extents.hpp" +#include <stdexcept> +#include "layout_stride.hpp" + +namespace std { +namespace experimental { + +//============================================================================== +template <class Extents> +class layout_right::mapping { + public: + using extents_type = Extents; + using index_type = typename extents_type::index_type; + using size_type = typename extents_type::size_type; + using rank_type = typename extents_type::rank_type; + using layout_type = layout_right; + private: + + static_assert(detail::__is_extents_v<extents_type>, "std::experimental::layout_right::mapping must be instantiated with a specialization of std::experimental::extents."); + + template <class> + friend class mapping; + + // i0+(i1 + E(1)*(i2 + E(2)*i3)) + template <size_t r, size_t Rank> + struct __rank_count {}; + + template <size_t r, size_t Rank, class I, class... Indices> + constexpr index_type __compute_offset( + index_type offset, __rank_count<r,Rank>, const I& i, Indices... idx) const { + return __compute_offset(offset * __extents.template __extent<r>() + i,__rank_count<r+1,Rank>(), idx...); + } + + template<class I, class ... Indices> + constexpr index_type __compute_offset( + __rank_count<0,extents_type::rank()>, const I& i, Indices... idx) const { + return __compute_offset(i,__rank_count<1,extents_type::rank()>(),idx...); + } + + constexpr index_type __compute_offset(size_t offset, __rank_count<extents_type::rank(), extents_type::rank()>) const { + return static_cast<index_type>(offset); + } + + constexpr index_type __compute_offset(__rank_count<0,0>) const { return 0; } + + public: + + //-------------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(mapping const&) noexcept = default; + + constexpr mapping(extents_type const& __exts) noexcept + :__extents(__exts) + { } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherExtents, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) + ) + ) + MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma + MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + mapping(mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor) + :__extents(other.extents()) + { + /* + * TODO: check precondition + * other.required_span_size() is a representable value of type index_type + */ + } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherExtents, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) && + (extents_type::rank() <= 1) + ) + ) + MDSPAN_CONDITIONAL_EXPLICIT((!is_convertible<OtherExtents, extents_type>::value)) // needs two () due to comma + MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + mapping(layout_left::mapping<OtherExtents> const& other) noexcept // NOLINT(google-explicit-constructor) + :__extents(other.extents()) + { + /* + * TODO: check precondition + * other.required_span_size() is a representable value of type index_type + */ + } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherExtents, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents) + ) + ) + MDSPAN_CONDITIONAL_EXPLICIT((extents_type::rank() > 0)) + MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + mapping(layout_stride::mapping<OtherExtents> const& other) // NOLINT(google-explicit-constructor) + :__extents(other.extents()) + { + /* + * TODO: check precondition + * other.required_span_size() is a representable value of type index_type + */ + #ifndef __CUDA_ARCH__ + size_t stride = 1; + for(rank_type r=__extents.rank(); r>0; r--) { + if(stride != other.stride(r-1)) + throw std::runtime_error("Assigning layout_stride to layout_right with invalid strides."); + stride *= __extents.extent(r-1); + } + #endif + } + + MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mapping& operator=(mapping const&) noexcept = default; + + MDSPAN_INLINE_FUNCTION + constexpr const extents_type& extents() const noexcept { + return __extents; + } + + MDSPAN_INLINE_FUNCTION + constexpr index_type required_span_size() const noexcept { + index_type value = 1; + for(rank_type r=0; r != extents_type::rank(); ++r) value*=__extents.extent(r); + return value; + } + + //-------------------------------------------------------------------------------- + + MDSPAN_TEMPLATE_REQUIRES( + class... Indices, + /* requires */ ( + (sizeof...(Indices) == extents_type::rank()) && + _MDSPAN_FOLD_AND( + (_MDSPAN_TRAIT(is_convertible, Indices, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices)) + ) + ) + ) + constexpr index_type operator()(Indices... idxs) const noexcept { + return __compute_offset(__rank_count<0, extents_type::rank()>(), idxs...); + } + + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return true; } + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return true; } + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return true; } + MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return true; } + MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return true; } + MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return true; } + + MDSPAN_INLINE_FUNCTION + constexpr index_type stride(rank_type i) const noexcept { + index_type value = 1; + for(rank_type r=extents_type::rank()-1; r>i; r--) value*=__extents.extent(r); + return value; + } + + template<class OtherExtents> + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator==(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept { + return lhs.extents() == rhs.extents(); + } + + // In C++ 20 the not equal exists if equal is found +#if MDSPAN_HAS_CXX_20 + template<class OtherExtents> + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator!=(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept { + return lhs.extents() != rhs.extents(); + } +#endif + + // Not really public, but currently needed to implement fully constexpr useable submdspan: + template<size_t N, class SizeType, size_t ... E, size_t ... Idx> + constexpr index_type __get_stride(std::experimental::extents<SizeType, E...>,integer_sequence<size_t, Idx...>) const { + return _MDSPAN_FOLD_TIMES_RIGHT((Idx>N? __extents.template __extent<Idx>():1),1); + } + template<size_t N> + constexpr index_type __stride() const noexcept { + return __get_stride<N>(__extents, make_index_sequence<extents_type::rank()>()); + } + +private: + _MDSPAN_NO_UNIQUE_ADDRESS extents_type __extents{}; + +}; + +} // end namespace experimental +} // end namespace std + diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_stride.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_stride.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c04c0c45aee8433f1a734be4fcc5215e414101ea --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/layout_stride.hpp @@ -0,0 +1,553 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "macros.hpp" +#include "static_array.hpp" +#include "extents.hpp" +#include "trait_backports.hpp" +#include "compressed_pair.hpp" + +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) +# include "no_unique_address.hpp" +#endif + +#include <algorithm> +#include <numeric> +#include <array> +#if _MDSPAN_USE_CONCEPTS && MDSPAN_HAS_CXX_20 +#include<concepts> +#endif + +namespace std { +namespace experimental { + +struct layout_left { + template<class Extents> + class mapping; +}; +struct layout_right { + template<class Extents> + class mapping; +}; + +namespace detail { + template<class Layout, class Mapping> + constexpr bool __is_mapping_of = + is_same<typename Layout::template mapping<typename Mapping::extents_type>, Mapping>::value; + +#if _MDSPAN_USE_CONCEPTS && MDSPAN_HAS_CXX_20 + template<class M> + concept __layout_mapping_alike = requires { + requires __is_extents<typename M::extents_type>::value; + { M::is_always_strided() } -> same_as<bool>; + { M::is_always_exhaustive() } -> same_as<bool>; + { M::is_always_unique() } -> same_as<bool>; + bool_constant<M::is_always_strided()>::value; + bool_constant<M::is_always_exhaustive()>::value; + bool_constant<M::is_always_unique()>::value; + }; +#endif +} // namespace detail + +struct layout_stride { + template <class Extents> + class mapping +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : private detail::__no_unique_address_emulation< + detail::__compressed_pair< + Extents, + std::array<typename Extents::index_type, Extents::rank()> + > + > +#endif + { + public: + using extents_type = Extents; + using index_type = typename extents_type::index_type; + using size_type = typename extents_type::size_type; + using rank_type = typename extents_type::rank_type; + using layout_type = layout_stride; + + // This could be a `requires`, but I think it's better and clearer as a `static_assert`. + static_assert(detail::__is_extents_v<Extents>, "std::experimental::layout_stride::mapping must be instantiated with a specialization of std::experimental::extents."); + + + private: + + //---------------------------------------------------------------------------- + + using __strides_storage_t = array<index_type, extents_type::rank()>;//::std::experimental::dextents<index_type, extents_type::rank()>; + using __member_pair_t = detail::__compressed_pair<extents_type, __strides_storage_t>; + +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + _MDSPAN_NO_UNIQUE_ADDRESS __member_pair_t __members; +#else + using __base_t = detail::__no_unique_address_emulation<__member_pair_t>; +#endif + + MDSPAN_FORCE_INLINE_FUNCTION constexpr __strides_storage_t const& + __strides_storage() const noexcept { +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + return __members.__second(); +#else + return this->__base_t::__ref().__second(); +#endif + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 __strides_storage_t& + __strides_storage() noexcept { +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + return __members.__second(); +#else + return this->__base_t::__ref().__second(); +#endif + } + + //---------------------------------------------------------------------------- + + template <class> + friend class mapping; + + //---------------------------------------------------------------------------- + + // Workaround for non-deducibility of the index sequence template parameter if it's given at the top level + template <class> + struct __deduction_workaround; + + template <size_t... Idxs> + struct __deduction_workaround<index_sequence<Idxs...>> + { + template <class OtherExtents> + MDSPAN_INLINE_FUNCTION + static constexpr bool _eq_impl(mapping const& self, mapping<OtherExtents> const& other) noexcept { + return _MDSPAN_FOLD_AND((self.stride(Idxs) == other.stride(Idxs)) /* && ... */); + } + template <class OtherExtents> + MDSPAN_INLINE_FUNCTION + static constexpr bool _not_eq_impl(mapping const& self, mapping<OtherExtents> const& other) noexcept { + return _MDSPAN_FOLD_OR((self.stride(Idxs) != other.stride(Idxs)) /* || ... */); + } + + template <class... Integral> + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr size_t _call_op_impl(mapping const& self, Integral... idxs) noexcept { + return _MDSPAN_FOLD_PLUS_RIGHT((idxs * self.stride(Idxs)), /* + ... + */ 0); + } + + MDSPAN_INLINE_FUNCTION + static constexpr size_t _req_span_size_impl(mapping const& self) noexcept { + // assumes no negative strides; not sure if I'm allowed to assume that or not + return __impl::_call_op_impl(self, (self.extents().template __extent<Idxs>() - 1)...) + 1; + } + + template<class OtherMapping> + MDSPAN_INLINE_FUNCTION + static constexpr const __strides_storage_t fill_strides(const OtherMapping& map) { + return __strides_storage_t{static_cast<index_type>(map.stride(Idxs))...}; + } + + MDSPAN_INLINE_FUNCTION + static constexpr const __strides_storage_t& fill_strides(const __strides_storage_t& s) { + return s; + } + + template<class IntegralType> + MDSPAN_INLINE_FUNCTION + static constexpr const __strides_storage_t fill_strides(const array<IntegralType,extents_type::rank()>& s) { + return __strides_storage_t{static_cast<index_type>(s[Idxs])...}; + } + + MDSPAN_INLINE_FUNCTION + static constexpr const __strides_storage_t fill_strides( + detail::__extents_to_partially_static_sizes_t< + ::std::experimental::dextents<index_type, extents_type::rank()>>&& s) { + return __strides_storage_t{static_cast<index_type>(s.template __get_n<Idxs>())...}; + } + + template<size_t K> + MDSPAN_INLINE_FUNCTION + static constexpr size_t __return_zero() { return 0; } + + template<class Mapping> + MDSPAN_INLINE_FUNCTION + static constexpr typename Mapping::index_type + __OFFSET(const Mapping& m) { return m(__return_zero<Idxs>()...); } + }; + + // Can't use defaulted parameter in the __deduction_workaround template because of a bug in MSVC warning C4348. + using __impl = __deduction_workaround<make_index_sequence<Extents::rank()>>; + + + //---------------------------------------------------------------------------- + +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + MDSPAN_INLINE_FUNCTION constexpr explicit + mapping(__member_pair_t&& __m) : __members(::std::move(__m)) {} +#else + MDSPAN_INLINE_FUNCTION constexpr explicit + mapping(__base_t&& __b) : __base_t(::std::move(__b)) {} +#endif + + public: // but not really + MDSPAN_INLINE_FUNCTION + static constexpr mapping + __make_mapping( + detail::__extents_to_partially_static_sizes_t<Extents>&& __exts, + detail::__extents_to_partially_static_sizes_t< + ::std::experimental::dextents<index_type, Extents::rank()>>&& __strs + ) noexcept { + // call the private constructor we created for this purpose + return mapping( +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + __base_t{ +#endif + __member_pair_t( + extents_type::__make_extents_impl(::std::move(__exts)), + __strides_storage_t{__impl::fill_strides(::std::move(__strs))} + ) +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#endif + ); + } + //---------------------------------------------------------------------------- + + + public: + + //-------------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mapping(mapping const&) noexcept = default; + + MDSPAN_TEMPLATE_REQUIRES( + class IntegralTypes, + /* requires */ ( + // MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type + // error C2641: cannot deduce template arguments for 'std::experimental::layout_stride::mapping' + _MDSPAN_TRAIT(is_convertible, const remove_const_t<IntegralTypes>&, typename Extents::index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, typename Extents::index_type, const remove_const_t<IntegralTypes>&) + ) + ) + MDSPAN_INLINE_FUNCTION + constexpr + mapping( + extents_type const& e, + array<IntegralTypes, extents_type::rank()> const& s + ) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __members{ +#else + : __base_t(__base_t{__member_pair_t( +#endif + e, __strides_storage_t(__impl::fill_strides(s)) +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { + /* + * TODO: check preconditions + * - s[i] > 0 is true for all i in the range [0, rank_ ). + * - REQUIRED-SPAN-SIZE(e, s) is a representable value of type index_type ([basic.fundamental]). + * - If rank_ is greater than 0, then there exists a permutation P of the integers in the + * range [0, rank_), such that s[ pi ] >= s[ pi − 1 ] * e.extent( pi − 1 ) is true for + * all i in the range [1, rank_ ), where pi is the ith element of P. + */ + } + +#ifdef __cpp_lib_span + MDSPAN_TEMPLATE_REQUIRES( + class IntegralTypes, + /* requires */ ( + // MSVC 19.32 does not like using index_type here, requires the typename Extents::index_type + // error C2641: cannot deduce template arguments for 'std::experimental::layout_stride::mapping' + _MDSPAN_TRAIT(is_convertible, const remove_const_t<IntegralTypes>&, typename Extents::index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, typename Extents::index_type, const remove_const_t<IntegralTypes>&) + ) + ) + MDSPAN_INLINE_FUNCTION + constexpr + mapping( + extents_type const& e, + span<IntegralTypes, extents_type::rank()> const& s + ) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __members{ +#else + : __base_t(__base_t{__member_pair_t( +#endif + e, __strides_storage_t(__impl::fill_strides(s)) +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { + /* + * TODO: check preconditions + * - s[i] > 0 is true for all i in the range [0, rank_ ). + * - REQUIRED-SPAN-SIZE(e, s) is a representable value of type index_type ([basic.fundamental]). + * - If rank_ is greater than 0, then there exists a permutation P of the integers in the + * range [0, rank_), such that s[ pi ] >= s[ pi − 1 ] * e.extent( pi − 1 ) is true for + * all i in the range [1, rank_ ), where pi is the ith element of P. + */ + } +#endif // __cpp_lib_span + +#if !(_MDSPAN_USE_CONCEPTS && MDSPAN_HAS_CXX_20) + MDSPAN_TEMPLATE_REQUIRES( + class StridedLayoutMapping, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, extents_type, typename StridedLayoutMapping::extents_type) && + detail::__is_mapping_of<typename StridedLayoutMapping::layout_type, StridedLayoutMapping> && + StridedLayoutMapping::is_always_unique() && + StridedLayoutMapping::is_always_strided() + ) + ) +#else + template<class StridedLayoutMapping> + requires( + detail::__layout_mapping_alike<StridedLayoutMapping> && + _MDSPAN_TRAIT(is_constructible, extents_type, typename StridedLayoutMapping::extents_type) && + StridedLayoutMapping::is_always_unique() && + StridedLayoutMapping::is_always_strided() + ) +#endif + MDSPAN_CONDITIONAL_EXPLICIT( + (!is_convertible<typename StridedLayoutMapping::extents_type, extents_type>::value) && + (detail::__is_mapping_of<layout_left, StridedLayoutMapping> || + detail::__is_mapping_of<layout_right, StridedLayoutMapping> || + detail::__is_mapping_of<layout_stride, StridedLayoutMapping>) + ) // needs two () due to comma + MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + mapping(StridedLayoutMapping const& other) noexcept // NOLINT(google-explicit-constructor) +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __members{ +#else + : __base_t(__base_t{__member_pair_t( +#endif + other.extents(), __strides_storage_t(__impl::fill_strides(other)) +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { + /* + * TODO: check preconditions + * - other.stride(i) > 0 is true for all i in the range [0, rank_ ). + * - other.required_span_size() is a representable value of type index_type ([basic.fundamental]). + * - OFFSET(other) == 0 + */ + } + + //-------------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED + mapping& operator=(mapping const&) noexcept = default; + + MDSPAN_INLINE_FUNCTION constexpr const extents_type& extents() const noexcept { +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + return __members.__first(); +#else + return this->__base_t::__ref().__first(); +#endif + }; + + MDSPAN_INLINE_FUNCTION + constexpr array< index_type, extents_type::rank() > strides() const noexcept { + return __strides_storage(); + } + + MDSPAN_INLINE_FUNCTION + constexpr index_type required_span_size() const noexcept { + index_type span_size = 1; + for(unsigned r = 0; r < extents_type::rank(); r++) { + // Return early if any of the extents are zero + if(extents().extent(r)==0) return 0; + span_size = std::max(span_size, static_cast<index_type>(extents().extent(r) * __strides_storage()[r])); + } + return span_size; + } + + + MDSPAN_TEMPLATE_REQUIRES( + class... Indices, + /* requires */ ( + sizeof...(Indices) == Extents::rank() && + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, Indices, index_type) /*&& ...*/ ) && + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, Indices) /*&& ...*/) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr size_t operator()(Indices... idxs) const noexcept { + return __impl::_call_op_impl(*this, static_cast<index_type>(idxs)...); + } + + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return true; } + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { + return false; + } + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return true; } + + MDSPAN_INLINE_FUNCTION static constexpr bool is_unique() noexcept { return true; } + MDSPAN_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 bool is_exhaustive() const noexcept { +// TODO @testing test layout_stride is_exhaustive() +// FIXME CUDA +#ifdef __CUDA_ARCH__ + return false; +#else + auto rem = array<size_t, Extents::rank()>{ }; + std::iota(rem.begin(), rem.end(), size_t(0)); + auto next_idx_iter = std::find_if( + rem.begin(), rem.end(), + [&](size_t i) { return this->stride(i) == 1; } + ); + if(next_idx_iter != rem.end()) { + size_t prev_stride_times_prev_extent = + this->extents().extent(*next_idx_iter) * this->stride(*next_idx_iter); + // "remove" the index + constexpr auto removed_index_sentinel = static_cast<size_t>(-1); + *next_idx_iter = removed_index_sentinel; + size_t found_count = 1; + while (found_count != Extents::rank()) { + next_idx_iter = std::find_if( + rem.begin(), rem.end(), + [&](size_t i) { + return i != removed_index_sentinel + && static_cast<size_t>(this->extents().extent(i)) == prev_stride_times_prev_extent; + } + ); + if (next_idx_iter != rem.end()) { + // "remove" the index + *next_idx_iter = removed_index_sentinel; + ++found_count; + prev_stride_times_prev_extent = stride(*next_idx_iter) * this->extents().extent(*next_idx_iter); + } else { break; } + } + return found_count == Extents::rank(); + } + return false; +#endif + } + MDSPAN_INLINE_FUNCTION static constexpr bool is_strided() noexcept { return true; } + + + MDSPAN_INLINE_FUNCTION + constexpr index_type stride(rank_type r) const noexcept { + return __strides_storage()[r]; + } + +#if !(_MDSPAN_USE_CONCEPTS && MDSPAN_HAS_CXX_20) + MDSPAN_TEMPLATE_REQUIRES( + class StridedLayoutMapping, + /* requires */ ( + detail::__is_mapping_of<typename StridedLayoutMapping::layout_type, StridedLayoutMapping> && + (extents_type::rank() == StridedLayoutMapping::extents_type::rank()) && + StridedLayoutMapping::is_always_strided() + ) + ) +#else + template<class StridedLayoutMapping> + requires( + detail::__layout_mapping_alike<StridedLayoutMapping> && + (extents_type::rank() == StridedLayoutMapping::extents_type::rank()) && + StridedLayoutMapping::is_always_strided() + ) +#endif + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator==(const mapping& x, const StridedLayoutMapping& y) noexcept { + bool strides_match = true; + for(rank_type r = 0; r < extents_type::rank(); r++) + strides_match = strides_match && (x.stride(r) == y.stride(r)); + return (x.extents() == y.extents()) && + (__impl::__OFFSET(y)== static_cast<typename StridedLayoutMapping::index_type>(0)) && + strides_match; + } + + // This one is not technically part of the proposal. Just here to make implementation a bit more optimal hopefully + MDSPAN_TEMPLATE_REQUIRES( + class OtherExtents, + /* requires */ ( + (extents_type::rank() == OtherExtents::rank()) + ) + ) + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator==(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept { + return __impl::_eq_impl(lhs, rhs); + } + +#if !MDSPAN_HAS_CXX_20 + MDSPAN_TEMPLATE_REQUIRES( + class StridedLayoutMapping, + /* requires */ ( + detail::__is_mapping_of<typename StridedLayoutMapping::layout_type, StridedLayoutMapping> && + (extents_type::rank() == StridedLayoutMapping::extents_type::rank()) && + StridedLayoutMapping::is_always_strided() + ) + ) + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator!=(const mapping& x, const StridedLayoutMapping& y) noexcept { + return not (x == y); + } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherExtents, + /* requires */ ( + (extents_type::rank() == OtherExtents::rank()) + ) + ) + MDSPAN_INLINE_FUNCTION + friend constexpr bool operator!=(mapping const& lhs, mapping<OtherExtents> const& rhs) noexcept { + return __impl::_not_eq_impl(lhs, rhs); + } +#endif + + }; +}; + +} // end namespace experimental +} // end namespace std diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/macros.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/macros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..848dcf91a74a0859de18debae545b59333840428 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/macros.hpp @@ -0,0 +1,647 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + + +#pragma once + +#include "config.hpp" + +#include <type_traits> // std::is_void + +#ifndef _MDSPAN_HOST_DEVICE +# if defined(_MDSPAN_HAS_CUDA) || defined(_MDSPAN_HAS_HIP) +# define _MDSPAN_HOST_DEVICE __host__ __device__ +# else +# define _MDSPAN_HOST_DEVICE +# endif +#endif + +#ifndef MDSPAN_FORCE_INLINE_FUNCTION +# ifdef _MDSPAN_COMPILER_MSVC // Microsoft compilers +# define MDSPAN_FORCE_INLINE_FUNCTION __forceinline _MDSPAN_HOST_DEVICE +# else +# define MDSPAN_FORCE_INLINE_FUNCTION __attribute__((always_inline)) _MDSPAN_HOST_DEVICE +# endif +#endif + +#ifndef MDSPAN_INLINE_FUNCTION +# define MDSPAN_INLINE_FUNCTION inline _MDSPAN_HOST_DEVICE +#endif + +// In CUDA defaulted functions do not need host device markup +#ifndef MDSPAN_INLINE_FUNCTION_DEFAULTED +# define MDSPAN_INLINE_FUNCTION_DEFAULTED +#endif + +//============================================================================== +// <editor-fold desc="Preprocessor helpers"> {{{1 + +#define MDSPAN_PP_COUNT(...) \ + _MDSPAN_PP_INTERNAL_EXPAND_ARGS_PRIVATE( \ + _MDSPAN_PP_INTERNAL_ARGS_AUGMENTER(__VA_ARGS__) \ + ) + +#define _MDSPAN_PP_INTERNAL_ARGS_AUGMENTER(...) unused, __VA_ARGS__ +#define _MDSPAN_PP_INTERNAL_EXPAND(x) x +#define _MDSPAN_PP_INTERNAL_EXPAND_ARGS_PRIVATE(...) \ + _MDSPAN_PP_INTERNAL_EXPAND( \ + _MDSPAN_PP_INTERNAL_COUNT_PRIVATE( \ + __VA_ARGS__, 69, 68, 67, 66, 65, 64, 63, 62, 61, \ + 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, \ + 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, \ + 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, \ + 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, \ + 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 \ + ) \ + ) +# define _MDSPAN_PP_INTERNAL_COUNT_PRIVATE( \ + _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_, \ + _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, \ + _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, \ + _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, \ + _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, \ + _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, \ + _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, \ + _70, count, ...) count \ + /**/ + +#define MDSPAN_PP_STRINGIFY_IMPL(x) #x +#define MDSPAN_PP_STRINGIFY(x) MDSPAN_PP_STRINGIFY_IMPL(x) + +#define MDSPAN_PP_CAT_IMPL(x, y) x ## y +#define MDSPAN_PP_CAT(x, y) MDSPAN_PP_CAT_IMPL(x, y) + +#define MDSPAN_PP_EVAL(X, ...) X(__VA_ARGS__) + +#define MDSPAN_PP_REMOVE_PARENS_IMPL(...) __VA_ARGS__ +#define MDSPAN_PP_REMOVE_PARENS(...) MDSPAN_PP_REMOVE_PARENS_IMPL __VA_ARGS__ + +// </editor-fold> end Preprocessor helpers }}}1 +//============================================================================== + +//============================================================================== +// <editor-fold desc="Concept emulation"> {{{1 + +// These compatibility macros don't help with partial ordering, but they should do the trick +// for what we need to do with concepts in mdspan +#ifdef _MDSPAN_USE_CONCEPTS +# define MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) > requires REQ +# define MDSPAN_FUNCTION_REQUIRES(PAREN_PREQUALS, FNAME, PAREN_PARAMS, QUALS, REQ) \ + MDSPAN_PP_REMOVE_PARENS(PAREN_PREQUALS) FNAME PAREN_PARAMS QUALS requires REQ \ + /**/ +#else +# define MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) , typename ::std::enable_if<(REQ), int>::type = 0> +# define MDSPAN_FUNCTION_REQUIRES(PAREN_PREQUALS, FNAME, PAREN_PARAMS, QUALS, REQ) \ + MDSPAN_TEMPLATE_REQUIRES( \ + class __function_requires_ignored=void, \ + (std::is_void<__function_requires_ignored>::value && REQ) \ + ) MDSPAN_PP_REMOVE_PARENS(PAREN_PREQUALS) FNAME PAREN_PARAMS QUALS \ + /**/ +#endif + + +#if defined(_MDSPAN_COMPILER_MSVC) +# define MDSPAN_TEMPLATE_REQUIRES(...) \ + MDSPAN_PP_CAT( \ + MDSPAN_PP_CAT(MDSPAN_TEMPLATE_REQUIRES_, MDSPAN_PP_COUNT(__VA_ARGS__))\ + (__VA_ARGS__), \ + ) \ + /**/ +#else +# define MDSPAN_TEMPLATE_REQUIRES(...) \ + MDSPAN_PP_EVAL( \ + MDSPAN_PP_CAT(MDSPAN_TEMPLATE_REQUIRES_, MDSPAN_PP_COUNT(__VA_ARGS__)), \ + __VA_ARGS__ \ + ) \ + /**/ +#endif + +#define MDSPAN_TEMPLATE_REQUIRES_2(TP1, REQ) \ + template<TP1 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_3(TP1, TP2, REQ) \ + template<TP1, TP2 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_4(TP1, TP2, TP3, REQ) \ + template<TP1, TP2, TP3 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_5(TP1, TP2, TP3, TP4, REQ) \ + template<TP1, TP2, TP3, TP4 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_6(TP1, TP2, TP3, TP4, TP5, REQ) \ + template<TP1, TP2, TP3, TP4, TP5 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_7(TP1, TP2, TP3, TP4, TP5, TP6, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_8(TP1, TP2, TP3, TP4, TP5, TP6, TP7, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_9(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_10(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_11(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_12(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_13(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_14(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_15(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_16(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_17(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_18(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_19(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ +#define MDSPAN_TEMPLATE_REQUIRES_20(TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18, TP19, REQ) \ + template<TP1, TP2, TP3, TP4, TP5, TP6, TP7, TP8, TP9, TP10, TP11, TP12, TP13, TP14, TP15, TP16, TP17, TP18, TP19 \ + MDSPAN_CLOSE_ANGLE_REQUIRES(REQ) \ + /**/ + +#define MDSPAN_INSTANTIATE_ONLY_IF_USED \ + MDSPAN_TEMPLATE_REQUIRES( \ + class __instantiate_only_if_used_tparam=void, \ + ( _MDSPAN_TRAIT(std::is_void, __instantiate_only_if_used_tparam) ) \ + ) \ + /**/ + +// </editor-fold> end Concept emulation }}}1 +//============================================================================== + +//============================================================================== +// <editor-fold desc="inline variables"> {{{1 + +#ifdef _MDSPAN_USE_INLINE_VARIABLES +# define _MDSPAN_INLINE_VARIABLE inline +#else +# define _MDSPAN_INLINE_VARIABLE +#endif + +// </editor-fold> end inline variables }}}1 +//============================================================================== + +//============================================================================== +// <editor-fold desc="Return type deduction"> {{{1 + +#if _MDSPAN_USE_RETURN_TYPE_DEDUCTION +# define _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ + auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) { return MDSPAN_PP_REMOVE_PARENS(BODY); } +# define _MDSPAN_DEDUCE_DECLTYPE_AUTO_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ + decltype(auto) MDSPAN_PP_REMOVE_PARENS(SIGNATURE) { return MDSPAN_PP_REMOVE_PARENS(BODY); } +#else +# define _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ + auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) \ + -> std::remove_cv_t<std::remove_reference_t<decltype(BODY)>> \ + { return MDSPAN_PP_REMOVE_PARENS(BODY); } +# define _MDSPAN_DEDUCE_DECLTYPE_AUTO_RETURN_TYPE_SINGLE_LINE(SIGNATURE, BODY) \ + auto MDSPAN_PP_REMOVE_PARENS(SIGNATURE) \ + -> decltype(BODY) \ + { return MDSPAN_PP_REMOVE_PARENS(BODY); } + +#endif + +// </editor-fold> end Return type deduction }}}1 +//============================================================================== + +//============================================================================== +// <editor-fold desc="fold expressions"> {{{1 + +struct __mdspan_enable_fold_comma { }; + +#ifdef _MDSPAN_USE_FOLD_EXPRESSIONS +# define _MDSPAN_FOLD_AND(...) ((__VA_ARGS__) && ...) +# define _MDSPAN_FOLD_AND_TEMPLATE(...) ((__VA_ARGS__) && ...) +# define _MDSPAN_FOLD_OR(...) ((__VA_ARGS__) || ...) +# define _MDSPAN_FOLD_ASSIGN_LEFT(INIT, ...) (INIT = ... = (__VA_ARGS__)) +# define _MDSPAN_FOLD_ASSIGN_RIGHT(PACK, ...) (PACK = ... = (__VA_ARGS__)) +# define _MDSPAN_FOLD_TIMES_RIGHT(PACK, ...) (PACK * ... * (__VA_ARGS__)) +# define _MDSPAN_FOLD_PLUS_RIGHT(PACK, ...) (PACK + ... + (__VA_ARGS__)) +# define _MDSPAN_FOLD_COMMA(...) ((__VA_ARGS__), ...) +#else + +namespace std { + +namespace __fold_compatibility_impl { + +// We could probably be more clever here, but at the (small) risk of losing some compiler understanding. For the +// few operations we need, it's not worth generalizing over the operation + +#if _MDSPAN_USE_RETURN_TYPE_DEDUCTION + +MDSPAN_FORCE_INLINE_FUNCTION +constexpr decltype(auto) __fold_right_and_impl() { + return true; +} + +template <class Arg, class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr decltype(auto) __fold_right_and_impl(Arg&& arg, Args&&... args) { + return ((Arg&&)arg) && __fold_compatibility_impl::__fold_right_and_impl((Args&&)args...); +} + +MDSPAN_FORCE_INLINE_FUNCTION +constexpr decltype(auto) __fold_right_or_impl() { + return false; +} + +template <class Arg, class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_right_or_impl(Arg&& arg, Args&&... args) { + return ((Arg&&)arg) || __fold_compatibility_impl::__fold_right_or_impl((Args&&)args...); +} + +template <class Arg1> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_left_assign_impl(Arg1&& arg1) { + return (Arg1&&)arg1; +} + +template <class Arg1, class Arg2, class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_left_assign_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { + return __fold_compatibility_impl::__fold_left_assign_impl((((Arg1&&)arg1) = ((Arg2&&)arg2)), (Args&&)args...); +} + +template <class Arg1> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_right_assign_impl(Arg1&& arg1) { + return (Arg1&&)arg1; +} + +template <class Arg1, class Arg2, class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_right_assign_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { + return ((Arg1&&)arg1) = __fold_compatibility_impl::__fold_right_assign_impl((Arg2&&)arg2, (Args&&)args...); +} + +template <class Arg1> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_right_plus_impl(Arg1&& arg1) { + return (Arg1&&)arg1; +} + +template <class Arg1, class Arg2, class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_right_plus_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { + return ((Arg1&&)arg1) + __fold_compatibility_impl::__fold_right_plus_impl((Arg2&&)arg2, (Args&&)args...); +} + +template <class Arg1> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_right_times_impl(Arg1&& arg1) { + return (Arg1&&)arg1; +} + +template <class Arg1, class Arg2, class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr auto __fold_right_times_impl(Arg1&& arg1, Arg2&& arg2, Args&&... args) { + return ((Arg1&&)arg1) * __fold_compatibility_impl::__fold_right_times_impl((Arg2&&)arg2, (Args&&)args...); +} + +#else + +//------------------------------------------------------------------------------ +// <editor-fold desc="right and"> {{{2 + +template <class... Args> +struct __fold_right_and_impl_; +template <> +struct __fold_right_and_impl_<> { + using __rv = bool; + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl() noexcept { + return true; + } +}; +template <class Arg, class... Args> +struct __fold_right_and_impl_<Arg, Args...> { + using __next_t = __fold_right_and_impl_<Args...>; + using __rv = decltype(std::declval<Arg>() && std::declval<typename __next_t::__rv>()); + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg&& arg, Args&&... args) noexcept { + return ((Arg&&)arg) && __next_t::__impl((Args&&)args...); + } +}; + +template <class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr typename __fold_right_and_impl_<Args...>::__rv +__fold_right_and_impl(Args&&... args) { + return __fold_right_and_impl_<Args...>::__impl((Args&&)args...); +} + +// </editor-fold> end right and }}}2 +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// <editor-fold desc="right or"> {{{2 + +template <class... Args> +struct __fold_right_or_impl_; +template <> +struct __fold_right_or_impl_<> { + using __rv = bool; + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl() noexcept { + return false; + } +}; +template <class Arg, class... Args> +struct __fold_right_or_impl_<Arg, Args...> { + using __next_t = __fold_right_or_impl_<Args...>; + using __rv = decltype(std::declval<Arg>() || std::declval<typename __next_t::__rv>()); + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg&& arg, Args&&... args) noexcept { + return ((Arg&&)arg) || __next_t::__impl((Args&&)args...); + } +}; + +template <class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr typename __fold_right_or_impl_<Args...>::__rv +__fold_right_or_impl(Args&&... args) { + return __fold_right_or_impl_<Args...>::__impl((Args&&)args...); +} + +// </editor-fold> end right or }}}2 +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// <editor-fold desc="right plus"> {{{2 + +template <class... Args> +struct __fold_right_plus_impl_; +template <class Arg> +struct __fold_right_plus_impl_<Arg> { + using __rv = Arg&&; + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg&& arg) noexcept { + return (Arg&&)arg; + } +}; +template <class Arg1, class Arg2, class... Args> +struct __fold_right_plus_impl_<Arg1, Arg2, Args...> { + using __next_t = __fold_right_plus_impl_<Arg2, Args...>; + using __rv = decltype(std::declval<Arg1>() + std::declval<typename __next_t::__rv>()); + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { + return ((Arg1&&)arg) + __next_t::__impl((Arg2&&)arg2, (Args&&)args...); + } +}; + +template <class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr typename __fold_right_plus_impl_<Args...>::__rv +__fold_right_plus_impl(Args&&... args) { + return __fold_right_plus_impl_<Args...>::__impl((Args&&)args...); +} + +// </editor-fold> end right plus }}}2 +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// <editor-fold desc="right times"> {{{2 + +template <class... Args> +struct __fold_right_times_impl_; +template <class Arg> +struct __fold_right_times_impl_<Arg> { + using __rv = Arg&&; + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg&& arg) noexcept { + return (Arg&&)arg; + } +}; +template <class Arg1, class Arg2, class... Args> +struct __fold_right_times_impl_<Arg1, Arg2, Args...> { + using __next_t = __fold_right_times_impl_<Arg2, Args...>; + using __rv = decltype(std::declval<Arg1>() * std::declval<typename __next_t::__rv>()); + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { + return ((Arg1&&)arg) * __next_t::__impl((Arg2&&)arg2, (Args&&)args...); + } +}; + +template <class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr typename __fold_right_times_impl_<Args...>::__rv +__fold_right_times_impl(Args&&... args) { + return __fold_right_times_impl_<Args...>::__impl((Args&&)args...); +} + +// </editor-fold> end right times }}}2 +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// <editor-fold desc="right assign"> {{{2 + +template <class... Args> +struct __fold_right_assign_impl_; +template <class Arg> +struct __fold_right_assign_impl_<Arg> { + using __rv = Arg&&; + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg&& arg) noexcept { + return (Arg&&)arg; + } +}; +template <class Arg1, class Arg2, class... Args> +struct __fold_right_assign_impl_<Arg1, Arg2, Args...> { + using __next_t = __fold_right_assign_impl_<Arg2, Args...>; + using __rv = decltype(std::declval<Arg1>() = std::declval<typename __next_t::__rv>()); + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { + return ((Arg1&&)arg) = __next_t::__impl((Arg2&&)arg2, (Args&&)args...); + } +}; + +template <class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr typename __fold_right_assign_impl_<Args...>::__rv +__fold_right_assign_impl(Args&&... args) { + return __fold_right_assign_impl_<Args...>::__impl((Args&&)args...); +} + +// </editor-fold> end right assign }}}2 +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// <editor-fold desc="left assign"> {{{2 + +template <class... Args> +struct __fold_left_assign_impl_; +template <class Arg> +struct __fold_left_assign_impl_<Arg> { + using __rv = Arg&&; + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg&& arg) noexcept { + return (Arg&&)arg; + } +}; +template <class Arg1, class Arg2, class... Args> +struct __fold_left_assign_impl_<Arg1, Arg2, Args...> { + using __assign_result_t = decltype(std::declval<Arg1>() = std::declval<Arg2>()); + using __next_t = __fold_left_assign_impl_<__assign_result_t, Args...>; + using __rv = typename __next_t::__rv; + MDSPAN_FORCE_INLINE_FUNCTION + static constexpr __rv + __impl(Arg1&& arg, Arg2&& arg2, Args&&... args) noexcept { + return __next_t::__impl(((Arg1&&)arg) = (Arg2&&)arg2, (Args&&)args...); + } +}; + +template <class... Args> +MDSPAN_FORCE_INLINE_FUNCTION +constexpr typename __fold_left_assign_impl_<Args...>::__rv +__fold_left_assign_impl(Args&&... args) { + return __fold_left_assign_impl_<Args...>::__impl((Args&&)args...); +} + +// </editor-fold> end left assign }}}2 +//------------------------------------------------------------------------------ + +#endif + + +template <class... Args> +constexpr __mdspan_enable_fold_comma __fold_comma_impl(Args&&... args) noexcept { return { }; } + +template <bool... Bs> +struct __bools; + +} // __fold_compatibility_impl + +} // end namespace std + +# define _MDSPAN_FOLD_AND(...) std::__fold_compatibility_impl::__fold_right_and_impl((__VA_ARGS__)...) +# define _MDSPAN_FOLD_OR(...) std::__fold_compatibility_impl::__fold_right_or_impl((__VA_ARGS__)...) +# define _MDSPAN_FOLD_ASSIGN_LEFT(INIT, ...) std::__fold_compatibility_impl::__fold_left_assign_impl(INIT, (__VA_ARGS__)...) +# define _MDSPAN_FOLD_ASSIGN_RIGHT(PACK, ...) std::__fold_compatibility_impl::__fold_right_assign_impl((PACK)..., __VA_ARGS__) +# define _MDSPAN_FOLD_TIMES_RIGHT(PACK, ...) std::__fold_compatibility_impl::__fold_right_times_impl((PACK)..., __VA_ARGS__) +# define _MDSPAN_FOLD_PLUS_RIGHT(PACK, ...) std::__fold_compatibility_impl::__fold_right_plus_impl((PACK)..., __VA_ARGS__) +# define _MDSPAN_FOLD_COMMA(...) std::__fold_compatibility_impl::__fold_comma_impl((__VA_ARGS__)...) + +# define _MDSPAN_FOLD_AND_TEMPLATE(...) \ + _MDSPAN_TRAIT(std::is_same, __fold_compatibility_impl::__bools<(__VA_ARGS__)..., true>, __fold_compatibility_impl::__bools<true, (__VA_ARGS__)...>) + +#endif + +// </editor-fold> end fold expressions }}}1 +//============================================================================== + +//============================================================================== +// <editor-fold desc="Variable template compatibility"> {{{1 + +#if _MDSPAN_USE_VARIABLE_TEMPLATES +# define _MDSPAN_TRAIT(TRAIT, ...) TRAIT##_v<__VA_ARGS__> +#else +# define _MDSPAN_TRAIT(TRAIT, ...) TRAIT<__VA_ARGS__>::value +#endif + +// </editor-fold> end Variable template compatibility }}}1 +//============================================================================== + +//============================================================================== +// <editor-fold desc="Pre-C++14 constexpr"> {{{1 + +#if _MDSPAN_USE_CONSTEXPR_14 +# define _MDSPAN_CONSTEXPR_14 constexpr +// Workaround for a bug (I think?) in EDG frontends +# ifdef __EDG__ +# define _MDSPAN_CONSTEXPR_14_DEFAULTED +# else +# define _MDSPAN_CONSTEXPR_14_DEFAULTED constexpr +# endif +#else +# define _MDSPAN_CONSTEXPR_14 +# define _MDSPAN_CONSTEXPR_14_DEFAULTED +#endif + +// </editor-fold> end Pre-C++14 constexpr }}}1 +//============================================================================== diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/maybe_static_value.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/maybe_static_value.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7abb1d5d65f7ee73d1cb949d0b7c0ce3665603c7 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/maybe_static_value.hpp @@ -0,0 +1,152 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#include "macros.hpp" + +#include "dynamic_extent.hpp" + +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) +# include "no_unique_address.hpp" +#endif + +// This is only needed for the non-standard-layout version of partially +// static array. +// Needs to be after the includes above to work with the single header generator +#if !_MDSPAN_PRESERVE_STANDARD_LAYOUT +namespace std { +namespace experimental { + +//============================================================================== + +namespace detail { + +// static case +template <class _dynamic_t, class static_t, _static_t __v, + _static_t __is_dynamic_sentinal = dynamic_extent, + size_t __array_entry_index = 0> +struct __maybe_static_value { + static constexpr _static_t __static_value = __v; + MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept { + return static_cast<_dynamic_t>(__v); + } + template <class _U> + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + __mdspan_enable_fold_comma + __set_value(_U&& /*__rhs*/) noexcept { + // Should we assert that the value matches the static value here? + return {}; + } + + //-------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __maybe_static_value() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __maybe_static_value(__maybe_static_value const&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __maybe_static_value(__maybe_static_value&&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __maybe_static_value& operator=(__maybe_static_value const&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __maybe_static_value& operator=(__maybe_static_value&&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__maybe_static_value() noexcept = default; + + MDSPAN_INLINE_FUNCTION + constexpr explicit __maybe_static_value(_dynamic_t const&) noexcept { + // Should we assert that the value matches the static value here? + } + + //-------------------------------------------------------------------------- + +}; + +// dynamic case +template <class _dynamic_t, class _static_t, _static_t __is_dynamic_sentinal, size_t __array_entry_index> +struct __maybe_static_value<_dynamic_t, _static_t, __is_dynamic_sentinal, __is_dynamic_sentinal, + __array_entry_index> +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __no_unique_address_emulation<_T> +#endif +{ + static constexpr _static_t __static_value = __is_dynamic_sentinal; +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + _MDSPAN_NO_UNIQUE_ADDRESS _dynamic_t __v = {}; + MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept { + return __v; + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _dynamic_t &__ref() noexcept { + return __v; + } + template <class _U> + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + __mdspan_enable_fold_comma + __set_value(_U&& __rhs) noexcept { + __v = (_U &&)rhs; + return {}; + } +#else + MDSPAN_FORCE_INLINE_FUNCTION constexpr _dynamic_t __value() const noexcept { + return this->__no_unique_address_emulation<_dynamic_t>::__ref(); + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _dynamic_t &__ref() noexcept { + return this->__no_unique_address_emulation<_dynamic_t>::__ref(); + } + template <class _U> + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 + __mdspan_enable_fold_comma + __set_value(_U&& __rhs) noexcept { + this->__no_unique_address_emulation<_dynamic_t>::__ref() = (_U &&)__rhs; + return {}; + } +#endif +}; + +} // namespace detail + +//============================================================================== + +} // end namespace experimental +} // end namespace std + +#endif // !_MDSPAN_PRESERVE_STANDARD_LAYOUT diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/mdspan.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/mdspan.hpp new file mode 100644 index 0000000000000000000000000000000000000000..374444c0535038f37dce9f829243bc0e6ac78bf6 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/mdspan.hpp @@ -0,0 +1,444 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + + +#pragma once + +#include "default_accessor.hpp" +#include "layout_right.hpp" +#include "extents.hpp" +#include "trait_backports.hpp" +#include "compressed_pair.hpp" + +namespace std { +namespace experimental { + +template < + class ElementType, + class Extents, + class LayoutPolicy = layout_right, + class AccessorPolicy = default_accessor<ElementType> +> +class mdspan +{ +private: + static_assert(detail::__is_extents_v<Extents>, "std::experimental::mdspan's Extents template parameter must be a specialization of std::experimental::extents."); + + // Workaround for non-deducibility of the index sequence template parameter if it's given at the top level + template <class> + struct __deduction_workaround; + + template <size_t... Idxs> + struct __deduction_workaround<index_sequence<Idxs...>> + { + MDSPAN_FORCE_INLINE_FUNCTION static constexpr + size_t __size(mdspan const& __self) noexcept { + return _MDSPAN_FOLD_TIMES_RIGHT((__self.__mapping_ref().extents().template __extent<Idxs>()), /* * ... * */ size_t(1)); + } + MDSPAN_FORCE_INLINE_FUNCTION static constexpr + bool __empty(mdspan const& __self) noexcept { + return (__self.rank()>0) && _MDSPAN_FOLD_OR((__self.__mapping_ref().extents().template __extent<Idxs>()==index_type(0))); + } + template <class ReferenceType, class SizeType, size_t N> + MDSPAN_FORCE_INLINE_FUNCTION static constexpr + ReferenceType __callop(mdspan const& __self, const array<SizeType, N>& indices) noexcept { + return __self.__accessor_ref().access(__self.__ptr_ref(), __self.__mapping_ref()(indices[Idxs]...)); + } + }; + +public: + + //-------------------------------------------------------------------------------- + // Domain and codomain types + + using extents_type = Extents; + using layout_type = LayoutPolicy; + using accessor_type = AccessorPolicy; + using mapping_type = typename layout_type::template mapping<extents_type>; + using element_type = ElementType; + using value_type = remove_cv_t<element_type>; + using index_type = typename extents_type::index_type; + using size_type = typename extents_type::size_type; + using rank_type = typename extents_type::rank_type; + using data_handle_type = typename accessor_type::data_handle_type; + using reference = typename accessor_type::reference; + + MDSPAN_INLINE_FUNCTION static constexpr size_t rank() noexcept { return extents_type::rank(); } + MDSPAN_INLINE_FUNCTION static constexpr size_t rank_dynamic() noexcept { return extents_type::rank_dynamic(); } + MDSPAN_INLINE_FUNCTION static constexpr size_t static_extent(size_t r) noexcept { return extents_type::static_extent(r); } + MDSPAN_INLINE_FUNCTION constexpr index_type extent(size_t r) const noexcept { return __mapping_ref().extents().extent(r); }; + +private: + + // Can't use defaulted parameter in the __deduction_workaround template because of a bug in MSVC warning C4348. + using __impl = __deduction_workaround<make_index_sequence<extents_type::rank()>>; + + using __map_acc_pair_t = detail::__compressed_pair<mapping_type, accessor_type>; + +public: + + //-------------------------------------------------------------------------------- + // [mdspan.basic.cons], mdspan constructors, assignment, and destructor + +#if !MDSPAN_HAS_CXX_20 + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan() = default; +#else + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan() + requires( + (rank_dynamic() > 0) && + _MDSPAN_TRAIT(is_default_constructible, data_handle_type) && + _MDSPAN_TRAIT(is_default_constructible, mapping_type) && + _MDSPAN_TRAIT(is_default_constructible, accessor_type) + ) = default; +#endif + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan(const mdspan&) = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdspan(mdspan&&) = default; + + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeTypes) /* && ... */) && + ((sizeof...(SizeTypes) == rank()) || (sizeof...(SizeTypes) == rank_dynamic())) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) && + _MDSPAN_TRAIT(is_default_constructible, accessor_type) + ) + ) + MDSPAN_INLINE_FUNCTION + explicit constexpr mdspan(data_handle_type p, SizeTypes... dynamic_extents) + // TODO @proposal-bug shouldn't I be allowed to do `move(p)` here? + : __members(std::move(p), __map_acc_pair_t(mapping_type(extents_type(static_cast<index_type>(std::move(dynamic_extents))...)), accessor_type())) + { } + + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType) && + ((N == rank()) || (N == rank_dynamic())) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) && + _MDSPAN_TRAIT(is_default_constructible, accessor_type) + ) + ) + MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic()) + MDSPAN_INLINE_FUNCTION + constexpr mdspan(data_handle_type p, const array<SizeType, N>& dynamic_extents) + : __members(std::move(p), __map_acc_pair_t(mapping_type(extents_type(dynamic_extents)), accessor_type())) + { } + +#ifdef __cpp_lib_span + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType) && + ((N == rank()) || (N == rank_dynamic())) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) && + _MDSPAN_TRAIT(is_default_constructible, accessor_type) + ) + ) + MDSPAN_CONDITIONAL_EXPLICIT(N != rank_dynamic()) + MDSPAN_INLINE_FUNCTION + constexpr mdspan(data_handle_type p, span<SizeType, N> dynamic_extents) + : __members(std::move(p), __map_acc_pair_t(mapping_type(extents_type(as_const(dynamic_extents))), accessor_type())) + { } +#endif + + MDSPAN_FUNCTION_REQUIRES( + (MDSPAN_INLINE_FUNCTION constexpr), + mdspan, (data_handle_type p, const extents_type& exts), , + /* requires */ (_MDSPAN_TRAIT(is_default_constructible, accessor_type) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)) + ) : __members(std::move(p), __map_acc_pair_t(mapping_type(exts), accessor_type())) + { } + + MDSPAN_FUNCTION_REQUIRES( + (MDSPAN_INLINE_FUNCTION constexpr), + mdspan, (data_handle_type p, const mapping_type& m), , + /* requires */ (_MDSPAN_TRAIT(is_default_constructible, accessor_type)) + ) : __members(std::move(p), __map_acc_pair_t(m, accessor_type())) + { } + + MDSPAN_INLINE_FUNCTION + constexpr mdspan(data_handle_type p, const mapping_type& m, const accessor_type& a) + : __members(std::move(p), __map_acc_pair_t(m, a)) + { } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherAccessor, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping<OtherExtents>) && + _MDSPAN_TRAIT(is_constructible, accessor_type, OtherAccessor) + ) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdspan(const mdspan<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherAccessor>& other) + : __members(other.__ptr_ref(), __map_acc_pair_t(other.__mapping_ref(), other.__accessor_ref())) + { + static_assert(_MDSPAN_TRAIT(is_constructible, data_handle_type, typename OtherAccessor::data_handle_type),"Incompatible data_handle_type for mdspan construction"); + static_assert(_MDSPAN_TRAIT(is_constructible, extents_type, OtherExtents),"Incompatible extents for mdspan construction"); + /* + * TODO: Check precondition + * For each rank index r of extents_type, static_extent(r) == dynamic_extent || static_extent(r) == other.extent(r) is true. + */ + } + + /* Might need this on NVIDIA? + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~mdspan() = default; + */ + + MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mdspan& operator=(const mdspan&) = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED _MDSPAN_CONSTEXPR_14_DEFAULTED mdspan& operator=(mdspan&&) = default; + + + //-------------------------------------------------------------------------------- + // [mdspan.basic.mapping], mdspan mapping domain multidimensional index to access codomain element + + #if MDSPAN_USE_BRACKET_OPERATOR + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeTypes) /* && ... */) && + (rank() == sizeof...(SizeTypes)) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator[](SizeTypes... indices) const + { + return __accessor_ref().access(__ptr_ref(), __mapping_ref()(index_type(indices)...)); + } + #endif + + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator[](const array<SizeType, rank()>& indices) const + { + return __impl::template __callop<reference>(*this, indices); + } + + #ifdef __cpp_lib_span + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator[](span<SizeType, rank()> indices) const + { + return __impl::template __callop<reference>(*this, indices); + } + #endif // __cpp_lib_span + + #if !MDSPAN_USE_BRACKET_OPERATOR + MDSPAN_TEMPLATE_REQUIRES( + class Index, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, Index, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, Index) && + extents_type::rank() == 1 + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator[](Index idx) const + { + return __accessor_ref().access(__ptr_ref(), __mapping_ref()(index_type(idx))); + } + #endif + + #if MDSPAN_USE_PAREN_OPERATOR + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeTypes) /* && ... */) && + extents_type::rank() == sizeof...(SizeTypes) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator()(SizeTypes... indices) const + { + return __accessor_ref().access(__ptr_ref(), __mapping_ref()(indices...)); + } + + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator()(const array<SizeType, rank()>& indices) const + { + return __impl::template __callop<reference>(*this, indices); + } + + #ifdef __cpp_lib_span + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + _MDSPAN_TRAIT(is_nothrow_constructible, index_type, SizeType) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator()(span<SizeType, rank()> indices) const + { + return __impl::template __callop<reference>(*this, indices); + } + #endif // __cpp_lib_span + #endif // MDSPAN_USE_PAREN_OPERATOR + + MDSPAN_INLINE_FUNCTION constexpr size_t size() const noexcept { + return __impl::__size(*this); + }; + + MDSPAN_INLINE_FUNCTION constexpr bool empty() const noexcept { + return __impl::__empty(*this); + }; + + MDSPAN_INLINE_FUNCTION + friend constexpr void swap(mdspan& x, mdspan& y) noexcept { + swap(x.__ptr_ref(), y.__ptr_ref()); + swap(x.__mapping_ref(), y.__mapping_ref()); + swap(x.__accessor_ref(), y.__accessor_ref()); + } + + //-------------------------------------------------------------------------------- + // [mdspan.basic.domobs], mdspan observers of the domain multidimensional index space + + + MDSPAN_INLINE_FUNCTION constexpr const extents_type& extents() const noexcept { return __mapping_ref().extents(); }; + MDSPAN_INLINE_FUNCTION constexpr const data_handle_type& data_handle() const noexcept { return __ptr_ref(); }; + MDSPAN_INLINE_FUNCTION constexpr const mapping_type& mapping() const noexcept { return __mapping_ref(); }; + MDSPAN_INLINE_FUNCTION constexpr const accessor_type& accessor() const noexcept { return __accessor_ref(); }; + + //-------------------------------------------------------------------------------- + // [mdspan.basic.obs], mdspan observers of the mapping + + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return mapping_type::is_always_unique(); }; + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return mapping_type::is_always_exhaustive(); }; + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return mapping_type::is_always_strided(); }; + + MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return __mapping_ref().is_unique(); }; + MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return __mapping_ref().is_exhaustive(); }; + MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return __mapping_ref().is_strided(); }; + MDSPAN_INLINE_FUNCTION constexpr index_type stride(size_t r) const { return __mapping_ref().stride(r); }; + +private: + + detail::__compressed_pair<data_handle_type, __map_acc_pair_t> __members{}; + + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 data_handle_type& __ptr_ref() noexcept { return __members.__first(); } + MDSPAN_FORCE_INLINE_FUNCTION constexpr data_handle_type const& __ptr_ref() const noexcept { return __members.__first(); } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 mapping_type& __mapping_ref() noexcept { return __members.__second().__first(); } + MDSPAN_FORCE_INLINE_FUNCTION constexpr mapping_type const& __mapping_ref() const noexcept { return __members.__second().__first(); } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 accessor_type& __accessor_ref() noexcept { return __members.__second().__second(); } + MDSPAN_FORCE_INLINE_FUNCTION constexpr accessor_type const& __accessor_ref() const noexcept { return __members.__second().__second(); } + + template <class, class, class, class> + friend class mdspan; + +}; + +#if defined(_MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION) +MDSPAN_TEMPLATE_REQUIRES( + class ElementType, class... SizeTypes, + /* requires */ _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_integral, SizeTypes) /* && ... */) && + (sizeof...(SizeTypes) > 0) +) +explicit mdspan(ElementType*, SizeTypes...) + -> mdspan<ElementType, ::std::experimental::dextents<size_t, sizeof...(SizeTypes)>>; + +MDSPAN_TEMPLATE_REQUIRES( + class Pointer, + (_MDSPAN_TRAIT(is_pointer, std::remove_reference_t<Pointer>)) +) +mdspan(Pointer&&) -> mdspan<std::remove_pointer_t<std::remove_reference_t<Pointer>>, extents<size_t>>; + +MDSPAN_TEMPLATE_REQUIRES( + class CArray, + (_MDSPAN_TRAIT(is_array, CArray) && (rank_v<CArray> == 1)) +) +mdspan(CArray&) -> mdspan<std::remove_all_extents_t<CArray>, extents<size_t, ::std::extent_v<CArray,0>>>; + +template <class ElementType, class SizeType, size_t N> +mdspan(ElementType*, const ::std::array<SizeType, N>&) + -> mdspan<ElementType, ::std::experimental::dextents<size_t, N>>; + +#ifdef __cpp_lib_span +template <class ElementType, class SizeType, size_t N> +mdspan(ElementType*, ::std::span<SizeType, N>) + -> mdspan<ElementType, ::std::experimental::dextents<size_t, N>>; +#endif + +// This one is necessary because all the constructors take `data_handle_type`s, not +// `ElementType*`s, and `data_handle_type` is taken from `accessor_type::data_handle_type`, which +// seems to throw off automatic deduction guides. +template <class ElementType, class SizeType, size_t... ExtentsPack> +mdspan(ElementType*, const extents<SizeType, ExtentsPack...>&) + -> mdspan<ElementType, ::std::experimental::extents<SizeType, ExtentsPack...>>; + +template <class ElementType, class MappingType> +mdspan(ElementType*, const MappingType&) + -> mdspan<ElementType, typename MappingType::extents_type, typename MappingType::layout_type>; + +template <class MappingType, class AccessorType> +mdspan(const typename AccessorType::data_handle_type, const MappingType&, const AccessorType&) + -> mdspan<typename AccessorType::element_type, typename MappingType::extents_type, typename MappingType::layout_type, AccessorType>; +#endif + + + +} // end namespace experimental +} // end namespace std diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/no_unique_address.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/no_unique_address.hpp new file mode 100644 index 0000000000000000000000000000000000000000..904dd40a7590155e745c2549381e59f63c63a8af --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/no_unique_address.hpp @@ -0,0 +1,127 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "macros.hpp" +#include "trait_backports.hpp" + +namespace std { +namespace experimental { +namespace detail { + +//============================================================================== + +template <class _T, size_t _Disambiguator = 0, class _Enable = void> +struct __no_unique_address_emulation { + using __stored_type = _T; + _T __v; + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__ref() const noexcept { + return __v; + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__ref() noexcept { + return __v; + } +}; + +// Empty case +// This doesn't work if _T is final, of course, but we're not using anything +// like that currently. That kind of thing could be added pretty easily though +template <class _T, size_t _Disambiguator> +struct __no_unique_address_emulation< + _T, _Disambiguator, + enable_if_t<_MDSPAN_TRAIT(is_empty, _T) && + // If the type isn't trivially destructible, its destructor + // won't be called at the right time, so don't use this + // specialization + _MDSPAN_TRAIT(is_trivially_destructible, _T)>> : +#ifdef _MDSPAN_COMPILER_MSVC + // MSVC doesn't allow you to access public static member functions of a type + // when you *happen* to privately inherit from that type. + protected +#else + // But we still want this to be private if possible so that we don't accidentally + // access members of _T directly rather than calling __ref() first, which wouldn't + // work if _T happens to be stateful and thus we're using the unspecialized definition + // of __no_unique_address_emulation above. + private +#endif + _T { + using __stored_type = _T; + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__ref() const noexcept { + return *static_cast<_T const *>(this); + } + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 _T &__ref() noexcept { + return *static_cast<_T *>(this); + } + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __no_unique_address_emulation() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __no_unique_address_emulation( + __no_unique_address_emulation const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __no_unique_address_emulation( + __no_unique_address_emulation &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation & + operator=(__no_unique_address_emulation const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __no_unique_address_emulation & + operator=(__no_unique_address_emulation &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__no_unique_address_emulation() noexcept = default; + + // Explicitly make this not a reference so that the copy or move + // constructor still gets called. + MDSPAN_INLINE_FUNCTION + explicit constexpr __no_unique_address_emulation(_T const& __v) noexcept : _T(__v) {} + MDSPAN_INLINE_FUNCTION + explicit constexpr __no_unique_address_emulation(_T&& __v) noexcept : _T(::std::move(__v)) {} +}; + +//============================================================================== + +} // end namespace detail +} // end namespace experimental +} // end namespace std diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/standard_layout_static_array.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/standard_layout_static_array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1c543b08051b57ba45fb1e8abe71e7875db366b1 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/standard_layout_static_array.hpp @@ -0,0 +1,685 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "macros.hpp" +#include "dynamic_extent.hpp" +#include "trait_backports.hpp" // enable_if +#include "compressed_pair.hpp" + +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) +# include "no_unique_address.hpp" +#endif + +#include <array> +#ifdef __cpp_lib_span +#include <span> +#endif +#include <utility> // integer_sequence +#include <cstddef> + +namespace std { +namespace experimental { +namespace detail { + +//============================================================================== + +_MDSPAN_INLINE_VARIABLE constexpr struct + __construct_psa_from_dynamic_exts_values_tag_t { +} __construct_psa_from_dynamic_exts_values_tag = {}; + +_MDSPAN_INLINE_VARIABLE constexpr struct + __construct_psa_from_all_exts_values_tag_t { +} __construct_psa_from_all_exts_values_tag = {}; + +struct __construct_psa_from_all_exts_array_tag_t {}; +template <size_t _N = 0> struct __construct_psa_from_dynamic_exts_array_tag_t {}; + +//============================================================================== + +template <size_t _I, class _T> using __repeated_with_idxs = _T; + +//============================================================================== + +#if _MDSPAN_PRESERVE_STANDARD_LAYOUT + +/** + * PSA = "partially static array" + * + * @tparam _T + * @tparam _ValsSeq + * @tparam __sentinal + */ +template <class _Tag, class _T, class _static_t, class _ValsSeq, _static_t __sentinal = static_cast<_static_t>(dynamic_extent), + class _IdxsSeq = make_index_sequence<_ValsSeq::size()>> +struct __standard_layout_psa; + +//============================================================================== +// Static case +template <class _Tag, class _T, class _static_t, _static_t __value, _static_t... __values_or_sentinals, + _static_t __sentinal, size_t _Idx, size_t... _Idxs> +struct __standard_layout_psa< + _Tag, _T, _static_t, integer_sequence<_static_t, __value, __values_or_sentinals...>, + __sentinal, integer_sequence<size_t, _Idx, _Idxs...>> +#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : private __no_unique_address_emulation<__standard_layout_psa< + _Tag, _T, _static_t, integer_sequence<_static_t, __values_or_sentinals...>, __sentinal, + integer_sequence<size_t, _Idxs...>>> +#endif +{ + + //-------------------------------------------------------------------------- + + using __next_t = + __standard_layout_psa<_Tag, _T, _static_t, + integer_sequence<_static_t, __values_or_sentinals...>, + __sentinal, integer_sequence<size_t, _Idxs...>>; + +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + _MDSPAN_NO_UNIQUE_ADDRESS __next_t __next_; +#else + using __base_t = __no_unique_address_emulation<__next_t>; +#endif + + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 __next_t &__next() noexcept { +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + return __next_; +#else + return this->__base_t::__ref(); +#endif + } + MDSPAN_FORCE_INLINE_FUNCTION constexpr __next_t const &__next() const noexcept { +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + return __next_; +#else + return this->__base_t::__ref(); +#endif + } + + static constexpr auto __size = sizeof...(_Idxs) + 1; + static constexpr auto __size_dynamic = __next_t::__size_dynamic; + + //-------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa(__standard_layout_psa const &) noexcept = + default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa(__standard_layout_psa &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa & + operator=(__standard_layout_psa const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa & + operator=(__standard_layout_psa &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__standard_layout_psa() noexcept = default; + + //-------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION + constexpr __standard_layout_psa( + __construct_psa_from_all_exts_values_tag_t, _T const & /*__val*/, + __repeated_with_idxs<_Idxs, _T> const &... __vals) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __construct_psa_from_all_exts_values_tag, __vals... +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } + + template <class... _Ts> + MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa( + __construct_psa_from_dynamic_exts_values_tag_t, + _Ts const &... __vals) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __construct_psa_from_dynamic_exts_values_tag, __vals... +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } + + template <class _U, size_t _N> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + array<_U, _N> const &__vals) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __vals +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } + + template <class _U, size_t _NStatic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_all_exts_array_tag_t const & __tag, + array<_U, _NStatic> const &__vals) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __tag, __vals +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } + + template <class _U, size_t _IDynamic, size_t _NDynamic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic> __tag, + array<_U, _NDynamic> const &__vals) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __tag, __vals +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } + +#ifdef __cpp_lib_span + template <class _U, size_t _N> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + span<_U, _N> const &__vals) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __vals +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } + + template <class _U, size_t _NStatic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_all_exts_array_tag_t const & __tag, + span<_U, _NStatic> const &__vals) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __tag, __vals +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } + + template <class _U, size_t _IDynamic, size_t _NDynamic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic> __tag, + span<_U, _NDynamic> const &__vals) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __tag, __vals +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } +#endif + + template <class _UTag, class _U, class _static_U, class _UValsSeq, _static_U __u_sentinal, + class _IdxsSeq> + MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa( + __standard_layout_psa<_UTag, _U, _static_U, _UValsSeq, __u_sentinal, _IdxsSeq> const + &__rhs) noexcept +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + : __next_{ +#else + : __base_t(__base_t{__next_t( +#endif + __rhs.__next() +#if defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS) + } +#else + )}) +#endif + { } + + //-------------------------------------------------------------------------- + + // See https://godbolt.org/z/_KSDNX for a summary-by-example of why this is + // necessary. We're using inheritance here instead of an alias template + // because we have to deduce __values_or_sentinals in several places, and + // alias templates don't permit that in this context. + MDSPAN_FORCE_INLINE_FUNCTION + constexpr __standard_layout_psa const &__enable_psa_conversion() const + noexcept { + return *this; + } + + template <size_t _I, enable_if_t<_I != _Idx, int> = 0> + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept { + return __next().template __get_n<_I>(); + } + template <size_t _I, enable_if_t<_I == _Idx, int> = 1> + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept { + return __value; + } + template <size_t _I, enable_if_t<_I != _Idx, int> = 0> + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void + __set_n(_T const &__rhs) noexcept { + __next().__set_value(__rhs); + } + template <size_t _I, enable_if_t<_I == _Idx, int> = 1> + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void + __set_n(_T const &) noexcept { + // Don't assert here because that would break constexpr. This better + // not change anything, though + } + template <size_t _I, enable_if_t<_I == _Idx, _static_t> = __sentinal> + MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t __get_static_n() noexcept { + return __value; + } + template <size_t _I, enable_if_t<_I != _Idx, _static_t> __default = __sentinal> + MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t __get_static_n() noexcept { + return __next_t::template __get_static_n<_I, __default>(); + } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get(size_t __n) const noexcept { + return __value * (_T(_Idx == __n)) + __next().__get(__n); + } + + //-------------------------------------------------------------------------- +}; + +//============================================================================== + +// Dynamic case, __next_t may or may not be empty +template <class _Tag, class _T, class _static_t, _static_t __sentinal, _static_t... __values_or_sentinals, + size_t _Idx, size_t... _Idxs> +struct __standard_layout_psa< + _Tag, _T, _static_t, integer_sequence<_static_t, __sentinal, __values_or_sentinals...>, + __sentinal, integer_sequence<size_t, _Idx, _Idxs...>> { + //-------------------------------------------------------------------------- + + using __next_t = + __standard_layout_psa<_Tag, _T, _static_t, + integer_sequence<_static_t, __values_or_sentinals...>, + __sentinal, integer_sequence<size_t, _Idxs...>>; + + using __value_pair_t = __compressed_pair<_T, __next_t>; + __value_pair_t __value_pair; + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 __next_t &__next() noexcept { + return __value_pair.__second(); + } + MDSPAN_FORCE_INLINE_FUNCTION constexpr __next_t const &__next() const noexcept { + return __value_pair.__second(); + } + + static constexpr auto __size = sizeof...(_Idxs) + 1; + static constexpr auto __size_dynamic = 1 + __next_t::__size_dynamic; + + //-------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa() noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa(__standard_layout_psa const &) noexcept = + default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa(__standard_layout_psa &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa & + operator=(__standard_layout_psa const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa & + operator=(__standard_layout_psa &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__standard_layout_psa() noexcept = default; + + //-------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION + constexpr __standard_layout_psa( + __construct_psa_from_all_exts_values_tag_t, _T const &__val, + __repeated_with_idxs<_Idxs, _T> const &... __vals) noexcept + : __value_pair(__val, + __next_t(__construct_psa_from_all_exts_values_tag, + __vals...)) {} + + template <class... _Ts> + MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa( + __construct_psa_from_dynamic_exts_values_tag_t, _T const &__val, + _Ts const &... __vals) noexcept + : __value_pair(__val, + __next_t(__construct_psa_from_dynamic_exts_values_tag, + __vals...)) {} + + template <class _U, size_t _N> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + array<_U, _N> const &__vals) noexcept + : __value_pair(::std::get<_Idx>(__vals), __vals) {} + + template <class _U, size_t _NStatic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_all_exts_array_tag_t __tag, + array<_U, _NStatic> const &__vals) noexcept + : __value_pair( + ::std::get<_Idx>(__vals), + __next_t(__tag, + __vals)) {} + + template <class _U, size_t _IDynamic, size_t _NDynamic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic>, + array<_U, _NDynamic> const &__vals) noexcept + : __value_pair( + ::std::get<_IDynamic>(__vals), + __next_t(__construct_psa_from_dynamic_exts_array_tag_t<_IDynamic + 1>{}, + __vals)) {} + +#ifdef __cpp_lib_span + template <class _U, size_t _N> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + span<_U, _N> const &__vals) noexcept + : __value_pair(__vals[_Idx], __vals) {} + + template <class _U, size_t _NStatic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_all_exts_array_tag_t __tag, + span<_U, _NStatic> const &__vals) noexcept + : __value_pair( + __vals[_Idx], + __next_t(__tag, + __vals)) {} + + template <class _U, size_t _IDynamic, size_t _NDynamic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic>, + span<_U, _NDynamic> const &__vals) noexcept + : __value_pair( + __vals[_IDynamic], + __next_t(__construct_psa_from_dynamic_exts_array_tag_t<_IDynamic + 1>{}, + __vals)) {} +#endif + + template <class _UTag, class _U, class _static_U, class _UValsSeq, _static_U __u_sentinal, + class _UIdxsSeq> + MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa( + __standard_layout_psa<_UTag, _U, _static_U, _UValsSeq, __u_sentinal, _UIdxsSeq> const + &__rhs) noexcept + : __value_pair(__rhs.template __get_n<_Idx>(), __rhs.__next()) {} + + //-------------------------------------------------------------------------- + + // See comment in the previous partial specialization for why this is + // necessary. Or just trust me that it's messy. + MDSPAN_FORCE_INLINE_FUNCTION + constexpr __standard_layout_psa const &__enable_psa_conversion() const + noexcept { + return *this; + } + + template <size_t _I, enable_if_t<_I != _Idx, int> = 0> + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept { + return __next().template __get_n<_I>(); + } + template <size_t _I, enable_if_t<_I == _Idx, int> = 1> + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept { + return __value_pair.__first(); + } + template <size_t _I, enable_if_t<_I != _Idx, int> = 0> + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void + __set_n(_T const &__rhs) noexcept { + __next().__set_value(__rhs); + } + template <size_t _I, enable_if_t<_I == _Idx, int> = 1> + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void + __set_n(_T const &__rhs) noexcept { + __value_pair.__first() = __rhs; + } + template <size_t _I, enable_if_t<_I == _Idx, _static_t> __default = __sentinal> + MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t __get_static_n() noexcept { + return __default; + } + template <size_t _I, enable_if_t<_I != _Idx, _static_t> __default = __sentinal> + MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t __get_static_n() noexcept { + return __next_t::template __get_static_n<_I, __default>(); + } + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get(size_t __n) const noexcept { + return __value_pair.__first() * (_T(_Idx == __n)) + __next().__get(__n); + } + + //-------------------------------------------------------------------------- +}; + +// empty/terminal case +template <class _Tag, class _T, class _static_t, _static_t __sentinal> +struct __standard_layout_psa<_Tag, _T, _static_t, integer_sequence<_static_t>, __sentinal, + integer_sequence<size_t>> { + //-------------------------------------------------------------------------- + + static constexpr auto __size = 0; + static constexpr auto __size_dynamic = 0; + + //-------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa() noexcept +#if defined(__clang__) || defined(_MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND) + // As far as I can tell, there appears to be a bug in clang that's causing + // this to be non-constexpr when it's defaulted. + { } +#else + = default; +#endif + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa(__standard_layout_psa const &) noexcept = + default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __standard_layout_psa(__standard_layout_psa &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa & + operator=(__standard_layout_psa const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __standard_layout_psa & + operator=(__standard_layout_psa &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__standard_layout_psa() noexcept = default; + + MDSPAN_INLINE_FUNCTION + constexpr __standard_layout_psa( + __construct_psa_from_all_exts_values_tag_t) noexcept {} + + template <class... _Ts> + MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa( + __construct_psa_from_dynamic_exts_values_tag_t) noexcept {} + + template <class _U, size_t _N> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + array<_U, _N> const &) noexcept {} + + template <class _U, size_t _NStatic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_all_exts_array_tag_t, + array<_U, _NStatic> const &) noexcept {} + + template <class _U, size_t _IDynamic, size_t _NDynamic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic>, + array<_U, _NDynamic> const &) noexcept {} + +#ifdef __cpp_lib_span + template <class _U, size_t _N> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + span<_U, _N> const &) noexcept {} + + template <class _U, size_t _NStatic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_all_exts_array_tag_t, + span<_U, _NStatic> const &) noexcept {} + + template <class _U, size_t _IDynamic, size_t _NDynamic> + MDSPAN_INLINE_FUNCTION constexpr explicit __standard_layout_psa( + __construct_psa_from_dynamic_exts_array_tag_t<_IDynamic>, + span<_U, _NDynamic> const &) noexcept {} +#endif + + template <class _UTag, class _U, class _static_U, class _UValsSeq, _static_U __u_sentinal, + class _UIdxsSeq> + MDSPAN_INLINE_FUNCTION constexpr __standard_layout_psa( + __standard_layout_psa<_UTag, _U, _static_U, _UValsSeq, __u_sentinal, _UIdxsSeq> const&) noexcept {} + + // See comment in the previous partial specialization for why this is + // necessary. Or just trust me that it's messy. + MDSPAN_FORCE_INLINE_FUNCTION + constexpr __standard_layout_psa const &__enable_psa_conversion() const + noexcept { + return *this; + } + + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get(size_t /*n*/) const noexcept { + return 0; + } +}; + +// Same thing, but with a disambiguator so that same-base issues doesn't cause +// a loss of standard-layout-ness. +template <class _Tag, class T, class _static_t, _static_t... __values_or_sentinals> +struct __partially_static_sizes_tagged + : __standard_layout_psa< + _Tag, T, _static_t, + integer_sequence<_static_t, __values_or_sentinals...>> { + using __tag_t = _Tag; + using __psa_impl_t = __standard_layout_psa< + _Tag, T, _static_t, integer_sequence<_static_t, __values_or_sentinals...>>; + using __psa_impl_t::__psa_impl_t; +#ifdef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND + MDSPAN_INLINE_FUNCTION +#endif + constexpr __partially_static_sizes_tagged() noexcept +#ifdef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND + : __psa_impl_t() { } +#else + = default; +#endif + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __partially_static_sizes_tagged( + __partially_static_sizes_tagged const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __partially_static_sizes_tagged( + __partially_static_sizes_tagged &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __partially_static_sizes_tagged & + operator=(__partially_static_sizes_tagged const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __partially_static_sizes_tagged & + operator=(__partially_static_sizes_tagged &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__partially_static_sizes_tagged() noexcept = default; + + template <class _UTag> + MDSPAN_FORCE_INLINE_FUNCTION constexpr explicit __partially_static_sizes_tagged( + __partially_static_sizes_tagged<_UTag, T, _static_t, __values_or_sentinals...> const& __vals + ) noexcept : __psa_impl_t(__vals.__enable_psa_conversion()) { } +}; + +struct __no_tag {}; +template <class T, class _static_t, _static_t... __values_or_sentinals> +struct __partially_static_sizes + : __partially_static_sizes_tagged<__no_tag, T, _static_t, __values_or_sentinals...> { +private: + using __base_t = + __partially_static_sizes_tagged<__no_tag, T, _static_t, __values_or_sentinals...>; + template <class _UTag> + MDSPAN_FORCE_INLINE_FUNCTION constexpr __partially_static_sizes( + __partially_static_sizes_tagged<_UTag, T, _static_t, __values_or_sentinals...>&& __vals + ) noexcept : __base_t(::std::move(__vals)) { } +public: + using __base_t::__base_t; + +#ifdef _MDSPAN_DEFAULTED_CONSTRUCTORS_INHERITANCE_WORKAROUND + MDSPAN_INLINE_FUNCTION + constexpr __partially_static_sizes() noexcept : __base_t() { } +#endif + template <class _UTag> + MDSPAN_FORCE_INLINE_FUNCTION constexpr __partially_static_sizes_tagged< + _UTag, T, _static_t, __values_or_sentinals...> + __with_tag() const noexcept { + return __partially_static_sizes_tagged<_UTag, T, _static_t, __values_or_sentinals...>(*this); + } +}; + +#endif // _MDSPAN_PRESERVE_STATIC_LAYOUT + +} // end namespace detail +} // end namespace experimental +} // end namespace std diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/static_array.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/static_array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..548bd8c8a75074e39d93f2a2ad38bbc1509198a6 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/static_array.hpp @@ -0,0 +1,286 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "macros.hpp" + +#include "dynamic_extent.hpp" +#include "trait_backports.hpp" +#include "maybe_static_value.hpp" +#include "standard_layout_static_array.hpp" +#include "type_list.hpp" + +// Needs to be after the includes above to work with the single header generator +#if !_MDSPAN_PRESERVE_STANDARD_LAYOUT +#include <cstddef> // size_t +#include <utility> // integer_sequence +#include <array> + +namespace std { +namespace experimental { +namespace detail { + +//============================================================================== + +template <class _T, _T _Val, bool _Mask> struct __mask_element {}; + +template <class _T, _T... _Result> +struct __mask_sequence_assign_op { + template <_T _V> + __mask_sequence_assign_op<_T, _Result..., _V> + operator=(__mask_element<_T, _V, true>&&); + template <_T _V> + __mask_sequence_assign_op<_T, _Result...> + operator=(__mask_element<_T, _V, false>&&); + using __result = integer_sequence<_T, _Result...>; +}; + +template <class _Seq, class _Mask> +struct __mask_sequence; + +template <class _T, _T... _Vals, bool... _Masks> +struct __mask_sequence<integer_sequence<_T, _Vals...>, integer_sequence<bool, _Masks...>> +{ + using type = typename decltype( + _MDSPAN_FOLD_ASSIGN_LEFT( + __mask_sequence_assign_op<_T>{}, /* = ... = */ __mask_element<_T, _Vals, _Masks>{} + ) + )::__result; +}; + +//============================================================================== + +template <class _T, class _static_t, class _Vals, _static_t __sentinal, + class _Idxs, class _IdxsDynamic, class _IdxsDynamicIdxs> +class __partially_static_array_impl; + +template < + class _T, class _static_t, + _static_t... __values_or_sentinals, _static_t __sentinal, + size_t... _Idxs, + size_t... _IdxsDynamic, + size_t... _IdxsDynamicIdxs +> +class __partially_static_array_impl< + _T, + _static_t, + integer_sequence<_static_t, __values_or_sentinals...>, + __sentinal, + integer_sequence<size_t, _Idxs...>, + integer_sequence<size_t, _IdxsDynamic...>, + integer_sequence<size_t, _IdxsDynamicIdxs...> +> + : private __maybe_static_value<_T, _static_t, __values_or_sentinals, __sentinal, + _Idxs>... { +private: + + template <size_t _N> + using __base_n = typename __type_at<_N, + __type_list<__maybe_static_value<_T, _static_t, __values_or_sentinals, __sentinal, _Idxs>...> + >::type; + +public: + + static constexpr auto __size = sizeof...(_Idxs); + static constexpr auto __size_dynamic = + _MDSPAN_FOLD_PLUS_RIGHT(static_cast<int>((__values_or_sentinals == __sentinal)), /* + ... + */ 0); + + //-------------------------------------------------------------------------- + + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __partially_static_array_impl() = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __partially_static_array_impl( + __partially_static_array_impl const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + constexpr __partially_static_array_impl( + __partially_static_array_impl &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __partially_static_array_impl & + operator=(__partially_static_array_impl const &) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + _MDSPAN_CONSTEXPR_14_DEFAULTED __partially_static_array_impl & + operator=(__partially_static_array_impl &&) noexcept = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~__partially_static_array_impl() noexcept = default; + + MDSPAN_INLINE_FUNCTION + constexpr __partially_static_array_impl( + __construct_psa_from_all_exts_values_tag_t, + __repeated_with_idxs<_Idxs, _T> const &... __vals) noexcept + : __base_n<_Idxs>(__base_n<_Idxs>{{__vals}})... {} + + MDSPAN_INLINE_FUNCTION + constexpr __partially_static_array_impl( + __construct_psa_from_dynamic_exts_values_tag_t, + __repeated_with_idxs<_IdxsDynamicIdxs, _T> const &... __vals) noexcept + : __base_n<_IdxsDynamic>(__base_n<_IdxsDynamic>{{__vals}})... {} + + MDSPAN_INLINE_FUNCTION constexpr explicit __partially_static_array_impl( + array<_T, sizeof...(_Idxs)> const& __vals) noexcept + : __partially_static_array_impl( + __construct_psa_from_all_exts_values_tag, + ::std::get<_Idxs>(__vals)...) {} + + // clang-format off + MDSPAN_FUNCTION_REQUIRES( + (MDSPAN_INLINE_FUNCTION constexpr explicit), + __partially_static_array_impl, + (array<_T, __size_dynamic> const &__vals), noexcept, + /* requires */ + (sizeof...(_Idxs) != __size_dynamic) + ): __partially_static_array_impl( + __construct_psa_from_dynamic_exts_values_tag, + ::std::get<_IdxsDynamicIdxs>(__vals)...) {} + // clang-format on + + template <class _U, class _static_u, class _UValsSeq, _static_u __u_sentinal, class _UIdxsSeq, + class _UIdxsDynamicSeq, class _UIdxsDynamicIdxsSeq> + MDSPAN_INLINE_FUNCTION constexpr __partially_static_array_impl( + __partially_static_array_impl< + _U, _static_u, _UValsSeq, __u_sentinal, _UIdxsSeq, + _UIdxsDynamicSeq, _UIdxsDynamicIdxsSeq> const &__rhs) noexcept + : __partially_static_array_impl( + __construct_psa_from_all_exts_values_tag, + __rhs.template __get_n<_Idxs>()...) {} + + //-------------------------------------------------------------------------- + + // See comment in the previous partial specialization for why this is + // necessary. Or just trust me that it's messy. + MDSPAN_FORCE_INLINE_FUNCTION + constexpr __partially_static_array_impl const &__enable_psa_conversion() const + noexcept { + return *this; + } + + template <size_t _I> + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T __get_n() const noexcept { + return static_cast<__base_n<_I> const*>(this)->__value(); + } + + template <class _U, size_t _I> + MDSPAN_FORCE_INLINE_FUNCTION _MDSPAN_CONSTEXPR_14 void __set_n(_U&& __rhs) noexcept { + static_cast<__base_n<_I>*>(this)->__set_value((_U&&)__rhs); + } + + template <size_t _I, _static_t __default = __sentinal> + MDSPAN_FORCE_INLINE_FUNCTION static constexpr _static_t + __get_static_n() noexcept { + return __base_n<_I>::__static_value == __sentinal ? + __default : __base_n<_I>::__static_value; + } + + MDSPAN_FORCE_INLINE_FUNCTION constexpr _T + __get(size_t __n) const noexcept { + return _MDSPAN_FOLD_PLUS_RIGHT( + (_T(_Idxs == __n) * __get_n<_Idxs>()), /* + ... + */ _T(0) + ); + } + +}; + +//============================================================================== + +template <class _T, class _static_t, class _ValSeq, _static_t __sentinal, class _Idxs = make_index_sequence<_ValSeq::size()>> +struct __partially_static_array_impl_maker; + +template < + class _T, class _static_t, _static_t... _Vals, _static_t __sentinal, size_t... _Idxs +> +struct __partially_static_array_impl_maker< + _T, _static_t, integer_sequence<_static_t, _Vals...>, __sentinal, integer_sequence<size_t, _Idxs...> +> +{ + using __dynamic_idxs = typename __mask_sequence< + integer_sequence<size_t, _Idxs...>, + integer_sequence<bool, (_Vals == __sentinal)...> + >::type; + using __impl_base = + __partially_static_array_impl<_T, _static_t, + integer_sequence<_static_t, _Vals...>, + __sentinal, integer_sequence<size_t, _Idxs...>, + __dynamic_idxs, + make_index_sequence<__dynamic_idxs::size()> + >; +}; + +template <class _T, class _static_t, class _ValsSeq, _static_t __sentinal = dynamic_extent> +class __partially_static_array_with_sentinal + : public __partially_static_array_impl_maker<_T, _static_t, _ValsSeq, __sentinal>::__impl_base +{ +private: + using __base_t = typename __partially_static_array_impl_maker<_T, _static_t, _ValsSeq, __sentinal>::__impl_base; +public: + using __base_t::__base_t; +}; + +//============================================================================== + +template <class T, class _static_t, _static_t... __values_or_sentinals> +struct __partially_static_sizes : + __partially_static_array_with_sentinal< + T, _static_t, ::std::integer_sequence<_static_t, __values_or_sentinals...>> +{ +private: + using __base_t = __partially_static_array_with_sentinal< + T, _static_t, ::std::integer_sequence<_static_t, __values_or_sentinals...>>; +public: + using __base_t::__base_t; + template <class _UTag> + MDSPAN_FORCE_INLINE_FUNCTION constexpr __partially_static_sizes<T, _static_t, __values_or_sentinals...> + __with_tag() const noexcept { + return *this; + } +}; + +// Tags are needed for the standard layout version, but not here +template <class T, class _static_t, _static_t... __values_or_sentinals> +using __partially_static_sizes_tagged = __partially_static_sizes<T, _static_t, __values_or_sentinals...>; + +} // end namespace detail +} // end namespace experimental +} // end namespace std + +#endif // !_MDSPAN_PRESERVE_STANDARD_LAYOUT diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/submdspan.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/submdspan.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dde1ab15bf39f8190a326a9dadc4acfe968db0dc --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/submdspan.hpp @@ -0,0 +1,586 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + + +#pragma once + +#include "mdspan.hpp" +#include "full_extent_t.hpp" +#include "dynamic_extent.hpp" +#include "layout_left.hpp" +#include "layout_right.hpp" +#include "layout_stride.hpp" +#include "macros.hpp" +#include "trait_backports.hpp" + +#include <tuple> // std::apply +#include <utility> // std::pair + +namespace std { +namespace experimental { + +namespace detail { + +template <size_t OldExtent, size_t OldStaticStride, class T> +struct __slice_wrap { + T slice; + size_t old_extent; + size_t old_stride; +}; + +//-------------------------------------------------------------------------------- + +template <size_t OldExtent, size_t OldStaticStride> +MDSPAN_INLINE_FUNCTION constexpr +__slice_wrap<OldExtent, OldStaticStride, size_t> +__wrap_slice(size_t val, size_t ext, size_t stride) { return { val, ext, stride }; } + +template <size_t OldExtent, size_t OldStaticStride, class IntegerType, IntegerType Value0> +MDSPAN_INLINE_FUNCTION constexpr +__slice_wrap<OldExtent, OldStaticStride, std::integral_constant<IntegerType, Value0>> +__wrap_slice(size_t val, size_t ext, std::integral_constant<IntegerType, Value0> stride) +{ +#if MDSPAN_HAS_CXX_17 + if constexpr (std::is_signed_v<IntegerType>) { + static_assert(Value0 >= IntegerType(0), "Invalid slice specifier"); + } +#endif // MDSPAN_HAS_CXX_17 + + return { val, ext, stride }; +} + +template <size_t OldExtent, size_t OldStaticStride> +MDSPAN_INLINE_FUNCTION constexpr +__slice_wrap<OldExtent, OldStaticStride, full_extent_t> +__wrap_slice(full_extent_t val, size_t ext, size_t stride) { return { val, ext, stride }; } + +// TODO generalize this to anything that works with std::get<0> and std::get<1> +template <size_t OldExtent, size_t OldStaticStride> +MDSPAN_INLINE_FUNCTION constexpr +__slice_wrap<OldExtent, OldStaticStride, std::tuple<size_t, size_t>> +__wrap_slice(std::tuple<size_t, size_t> const& val, size_t ext, size_t stride) +{ + return { val, ext, stride }; +} + +template <size_t OldExtent, size_t OldStaticStride, + class IntegerType0, IntegerType0 Value0, + class IntegerType1, IntegerType1 Value1> +MDSPAN_INLINE_FUNCTION constexpr + __slice_wrap<OldExtent, OldStaticStride, + std::tuple<std::integral_constant<IntegerType0, Value0>, + std::integral_constant<IntegerType1, Value1>>> +__wrap_slice(std::tuple<std::integral_constant<IntegerType0, Value0>, std::integral_constant<IntegerType1, Value1>> const& val, size_t ext, size_t stride) +{ + static_assert(Value1 >= Value0, "Invalid slice tuple"); + return { val, ext, stride }; +} + +//-------------------------------------------------------------------------------- + + +// a layout right remains a layout right if it is indexed by 0 or more scalars, +// then optionally a pair and finally 0 or more all +template < + // what we encountered until now preserves the layout right + bool result=true, + // we only encountered 0 or more scalars, no pair or all + bool encountered_only_scalar=true +> +struct preserve_layout_right_analysis : integral_constant<bool, result> { + using layout_type_if_preserved = layout_right; + using encounter_pair = preserve_layout_right_analysis< + // if we encounter a pair, the layout remains a layout right only if it was one before + // and that only scalars were encountered until now + result && encountered_only_scalar, + // if we encounter a pair, we didn't encounter scalars only + false + >; + using encounter_all = preserve_layout_right_analysis< + // if we encounter a all, the layout remains a layout right if it was one before + result, + // if we encounter a all, we didn't encounter scalars only + false + >; + using encounter_scalar = preserve_layout_right_analysis< + // if we encounter a scalar, the layout remains a layout right only if it was one before + // and that only scalars were encountered until now + result && encountered_only_scalar, + // if we encounter a scalar, the fact that we encountered scalars only doesn't change + encountered_only_scalar + >; +}; + +// a layout left remains a layout left if it is indexed by 0 or more all, +// then optionally a pair and finally 0 or more scalars +template < + bool result=true, + bool encountered_only_all=true +> +struct preserve_layout_left_analysis : integral_constant<bool, result> { + using layout_type_if_preserved = layout_left; + using encounter_pair = preserve_layout_left_analysis< + // if we encounter a pair, the layout remains a layout left only if it was one before + // and that only all were encountered until now + result && encountered_only_all, + // if we encounter a pair, we didn't encounter all only + false + >; + using encounter_all = preserve_layout_left_analysis< + // if we encounter a all, the layout remains a layout left only if it was one before + // and that only all were encountered until now + result && encountered_only_all, + // if we encounter a all, the fact that we encountered scalars all doesn't change + encountered_only_all + >; + using encounter_scalar = preserve_layout_left_analysis< + // if we encounter a scalar, the layout remains a layout left if it was one before + result, + // if we encounter a scalar, we didn't encounter scalars only + false + >; +}; + +struct ignore_layout_preservation : std::integral_constant<bool, false> { + using layout_type_if_preserved = void; + using encounter_pair = ignore_layout_preservation; + using encounter_all = ignore_layout_preservation; + using encounter_scalar = ignore_layout_preservation; +}; + +template <class Layout> +struct preserve_layout_analysis + : ignore_layout_preservation { }; +template <> +struct preserve_layout_analysis<layout_right> + : preserve_layout_right_analysis<> { }; +template <> +struct preserve_layout_analysis<layout_left> + : preserve_layout_left_analysis<> { }; + +//-------------------------------------------------------------------------------- + +template < + class _IndexT, + class _PreserveLayoutAnalysis, + class _OffsetsArray=__partially_static_sizes<_IndexT, size_t>, + class _ExtsArray=__partially_static_sizes<_IndexT, size_t>, + class _StridesArray=__partially_static_sizes<_IndexT, size_t>, + class = make_index_sequence<_OffsetsArray::__size>, + class = make_index_sequence<_ExtsArray::__size>, + class = make_index_sequence<_StridesArray::__size> +> +struct __assign_op_slice_handler; + +/* clang-format: off */ +template < + class _IndexT, + class _PreserveLayoutAnalysis, + size_t... _Offsets, + size_t... _Exts, + size_t... _Strides, + size_t... _OffsetIdxs, + size_t... _ExtIdxs, + size_t... _StrideIdxs> +struct __assign_op_slice_handler< + _IndexT, + _PreserveLayoutAnalysis, + __partially_static_sizes<_IndexT, size_t, _Offsets...>, + __partially_static_sizes<_IndexT, size_t, _Exts...>, + __partially_static_sizes<_IndexT, size_t, _Strides...>, + integer_sequence<size_t, _OffsetIdxs...>, + integer_sequence<size_t, _ExtIdxs...>, + integer_sequence<size_t, _StrideIdxs...>> +{ + // TODO remove this for better compiler performance + static_assert( + _MDSPAN_FOLD_AND((_Strides == dynamic_extent || _Strides > 0) /* && ... */), + " " + ); + static_assert( + _MDSPAN_FOLD_AND((_Offsets == dynamic_extent || _Offsets >= 0) /* && ... */), + " " + ); + + using __offsets_storage_t = __partially_static_sizes<_IndexT, size_t, _Offsets...>; + using __extents_storage_t = __partially_static_sizes<_IndexT, size_t, _Exts...>; + using __strides_storage_t = __partially_static_sizes<_IndexT, size_t, _Strides...>; + __offsets_storage_t __offsets; + __extents_storage_t __exts; + __strides_storage_t __strides; + +#ifdef __INTEL_COMPILER +#if __INTEL_COMPILER <= 1800 + MDSPAN_INLINE_FUNCTION constexpr __assign_op_slice_handler(__assign_op_slice_handler&& __other) noexcept + : __offsets(::std::move(__other.__offsets)), __exts(::std::move(__other.__exts)), __strides(::std::move(__other.__strides)) + { } + MDSPAN_INLINE_FUNCTION constexpr __assign_op_slice_handler( + __offsets_storage_t&& __o, + __extents_storage_t&& __e, + __strides_storage_t&& __s + ) noexcept + : __offsets(::std::move(__o)), __exts(::std::move(__e)), __strides(::std::move(__s)) + { } +#endif +#endif + +// Don't define this unless we need it; they have a cost to compile +#ifndef _MDSPAN_USE_RETURN_TYPE_DEDUCTION + using __extents_type = ::std::experimental::extents<_IndexT, _Exts...>; +#endif + + // For size_t slice, skip the extent and stride, but add an offset corresponding to the value + template <size_t _OldStaticExtent, size_t _OldStaticStride> + MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator) + _MDSPAN_CONSTEXPR_14 auto + operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, size_t>&& __slice) noexcept + -> __assign_op_slice_handler< + _IndexT, + typename _PreserveLayoutAnalysis::encounter_scalar, + __partially_static_sizes<_IndexT, size_t, _Offsets..., dynamic_extent>, + __partially_static_sizes<_IndexT, size_t, _Exts...>, + __partially_static_sizes<_IndexT, size_t, _Strides...>/* intentional space here to work around ICC bug*/> { + return { + __partially_static_sizes<_IndexT, size_t, _Offsets..., dynamic_extent>( + __construct_psa_from_all_exts_values_tag, + __offsets.template __get_n<_OffsetIdxs>()..., __slice.slice), + ::std::move(__exts), + ::std::move(__strides) + }; + } + + // Treat integral_constant slice like size_t slice, but with a compile-time offset. + // The result's extents_type can't take advantage of that, + // but it might help for specialized layouts. + template <size_t _OldStaticExtent, size_t _OldStaticStride, class IntegerType, IntegerType Value0> + MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator) + _MDSPAN_CONSTEXPR_14 auto + operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, std::integral_constant<IntegerType, Value0>>&&) noexcept + -> __assign_op_slice_handler< + _IndexT, + typename _PreserveLayoutAnalysis::encounter_scalar, + __partially_static_sizes<_IndexT, size_t, _Offsets..., Value0>, + __partially_static_sizes<_IndexT, size_t, _Exts...>, + __partially_static_sizes<_IndexT, size_t, _Strides...>/* intentional space here to work around ICC bug*/> { +#if MDSPAN_HAS_CXX_17 + if constexpr (std::is_signed_v<IntegerType>) { + static_assert(Value0 >= IntegerType(0), "Invalid slice specifier"); + } +#endif // MDSPAN_HAS_CXX_17 + return { + __partially_static_sizes<_IndexT, size_t, _Offsets..., Value0>( + __construct_psa_from_all_exts_values_tag, + __offsets.template __get_n<_OffsetIdxs>()..., size_t(Value0)), + ::std::move(__exts), + ::std::move(__strides) + }; + } + + // For a std::full_extent, offset 0 and old extent + template <size_t _OldStaticExtent, size_t _OldStaticStride> + MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator) + _MDSPAN_CONSTEXPR_14 auto + operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, full_extent_t>&& __slice) noexcept + -> __assign_op_slice_handler< + _IndexT, + typename _PreserveLayoutAnalysis::encounter_all, + __partially_static_sizes<_IndexT, size_t, _Offsets..., 0>, + __partially_static_sizes<_IndexT, size_t, _Exts..., _OldStaticExtent>, + __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>/* intentional space here to work around ICC bug*/> { + return { + __partially_static_sizes<_IndexT, size_t, _Offsets..., 0>( + __construct_psa_from_all_exts_values_tag, + __offsets.template __get_n<_OffsetIdxs>()..., size_t(0)), + __partially_static_sizes<_IndexT, size_t, _Exts..., _OldStaticExtent>( + __construct_psa_from_all_exts_values_tag, + __exts.template __get_n<_ExtIdxs>()..., __slice.old_extent), + __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>( + __construct_psa_from_all_exts_values_tag, + __strides.template __get_n<_StrideIdxs>()..., __slice.old_stride) + }; + } + + // For a std::tuple, add an offset and add a new dynamic extent (strides still preserved) + template <size_t _OldStaticExtent, size_t _OldStaticStride> + MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator) + _MDSPAN_CONSTEXPR_14 auto + operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, tuple<size_t, size_t>>&& __slice) noexcept + -> __assign_op_slice_handler< + _IndexT, + typename _PreserveLayoutAnalysis::encounter_pair, + __partially_static_sizes<_IndexT, size_t, _Offsets..., dynamic_extent>, + __partially_static_sizes<_IndexT, size_t, _Exts..., dynamic_extent>, + __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>/* intentional space here to work around ICC bug*/> { + return { + __partially_static_sizes<_IndexT, size_t, _Offsets..., dynamic_extent>( + __construct_psa_from_all_exts_values_tag, + __offsets.template __get_n<_OffsetIdxs>()..., ::std::get<0>(__slice.slice)), + __partially_static_sizes<_IndexT, size_t, _Exts..., dynamic_extent>( + __construct_psa_from_all_exts_values_tag, + __exts.template __get_n<_ExtIdxs>()..., ::std::get<1>(__slice.slice) - ::std::get<0>(__slice.slice)), + __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>( + __construct_psa_from_all_exts_values_tag, + __strides.template __get_n<_StrideIdxs>()..., __slice.old_stride) + }; + } + + // For a std::tuple of two std::integral_constant, do something like + // we did above for a tuple of two size_t, but make sure the + // result's extents type make the values compile-time constants. + template <size_t _OldStaticExtent, size_t _OldStaticStride, + class IntegerType0, IntegerType0 Value0, + class IntegerType1, IntegerType1 Value1> + MDSPAN_FORCE_INLINE_FUNCTION // NOLINT (misc-unconventional-assign-operator) + _MDSPAN_CONSTEXPR_14 auto + operator=(__slice_wrap<_OldStaticExtent, _OldStaticStride, tuple<std::integral_constant<IntegerType0, Value0>, std::integral_constant<IntegerType1, Value1>>>&& __slice) noexcept + -> __assign_op_slice_handler< + _IndexT, + typename _PreserveLayoutAnalysis::encounter_pair, + __partially_static_sizes<_IndexT, size_t, _Offsets..., size_t(Value0)>, + __partially_static_sizes<_IndexT, size_t, _Exts..., size_t(Value1 - Value0)>, + __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>/* intentional space here to work around ICC bug*/> { + static_assert(Value1 >= Value0, "Invalid slice specifier"); + return { + // We're still turning the template parameters Value0 and Value1 + // into (constexpr) run-time values here. + __partially_static_sizes<_IndexT, size_t, _Offsets..., size_t(Value0) > ( + __construct_psa_from_all_exts_values_tag, + __offsets.template __get_n<_OffsetIdxs>()..., Value0), + __partially_static_sizes<_IndexT, size_t, _Exts..., size_t(Value1 - Value0) > ( + __construct_psa_from_all_exts_values_tag, + __exts.template __get_n<_ExtIdxs>()..., Value1 - Value0), + __partially_static_sizes<_IndexT, size_t, _Strides..., _OldStaticStride>( + __construct_psa_from_all_exts_values_tag, + __strides.template __get_n<_StrideIdxs>()..., __slice.old_stride) + }; + } + + // TODO defer instantiation of this? + using layout_type = typename conditional< + _PreserveLayoutAnalysis::value, + typename _PreserveLayoutAnalysis::layout_type_if_preserved, + layout_stride + >::type; + + // TODO noexcept specification + template <class NewLayout> + MDSPAN_INLINE_FUNCTION + _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE( + ( + _MDSPAN_CONSTEXPR_14 /* auto */ + _make_layout_mapping_impl(NewLayout) noexcept + ), + ( + /* not layout stride, so don't pass dynamic_strides */ + /* return */ typename NewLayout::template mapping<::std::experimental::extents<_IndexT, _Exts...>>( + experimental::extents<_IndexT, _Exts...>::__make_extents_impl(::std::move(__exts)) + ) /* ; */ + ) + ) + + MDSPAN_INLINE_FUNCTION + _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE( + ( + _MDSPAN_CONSTEXPR_14 /* auto */ + _make_layout_mapping_impl(layout_stride) noexcept + ), + ( + /* return */ layout_stride::template mapping<::std::experimental::extents<_IndexT, _Exts...>> + ::__make_mapping(::std::move(__exts), ::std::move(__strides)) /* ; */ + ) + ) + + template <class OldLayoutMapping> // mostly for deferred instantiation, but maybe we'll use this in the future + MDSPAN_INLINE_FUNCTION + _MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE( + ( + _MDSPAN_CONSTEXPR_14 /* auto */ + make_layout_mapping(OldLayoutMapping const&) noexcept + ), + ( + /* return */ this->_make_layout_mapping_impl(layout_type{}) /* ; */ + ) + ) +}; + +//============================================================================== + +#if _MDSPAN_USE_RETURN_TYPE_DEDUCTION +// Forking this because the C++11 version will be *completely* unreadable +template <class ET, class ST, size_t... Exts, class LP, class AP, class... SliceSpecs, size_t... Idxs> +MDSPAN_INLINE_FUNCTION +constexpr auto _submdspan_impl( + integer_sequence<size_t, Idxs...>, + mdspan<ET, std::experimental::extents<ST, Exts...>, LP, AP> const& src, + SliceSpecs&&... slices +) noexcept +{ + using _IndexT = ST; + auto _handled = + _MDSPAN_FOLD_ASSIGN_LEFT( + ( + detail::__assign_op_slice_handler< + _IndexT, + detail::preserve_layout_analysis<LP> + >{ + __partially_static_sizes<_IndexT, size_t>{}, + __partially_static_sizes<_IndexT, size_t>{}, + __partially_static_sizes<_IndexT, size_t>{} + } + ), + /* = ... = */ + detail::__wrap_slice< + Exts, dynamic_extent + >( + slices, src.extents().template __extent<Idxs>(), + src.mapping().stride(Idxs) + ) + ); + + size_t offset_size = src.mapping()(_handled.__offsets.template __get_n<Idxs>()...); + auto offset_ptr = src.accessor().offset(src.data_handle(), offset_size); + auto map = _handled.make_layout_mapping(src.mapping()); + auto acc_pol = typename AP::offset_policy(src.accessor()); + return mdspan< + ET, remove_const_t<remove_reference_t<decltype(map.extents())>>, + typename decltype(_handled)::layout_type, remove_const_t<remove_reference_t<decltype(acc_pol)>> + >( + std::move(offset_ptr), std::move(map), std::move(acc_pol) + ); +} +#else + +template <class ET, class AP, class Src, class Handled, size_t... Idxs> +auto _submdspan_impl_helper(Src&& src, Handled&& h, std::integer_sequence<size_t, Idxs...>) + -> mdspan< + ET, typename Handled::__extents_type, typename Handled::layout_type, typename AP::offset_policy + > +{ + return { + src.accessor().offset(src.data_handle(), src.mapping()(h.__offsets.template __get_n<Idxs>()...)), + h.make_layout_mapping(src.mapping()), + typename AP::offset_policy(src.accessor()) + }; +} + +template <class ET, class ST, size_t... Exts, class LP, class AP, class... SliceSpecs, size_t... Idxs> +MDSPAN_INLINE_FUNCTION +_MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE( + ( + constexpr /* auto */ _submdspan_impl( + std::integer_sequence<size_t, Idxs...> seq, + mdspan<ET, std::experimental::extents<ST, Exts...>, LP, AP> const& src, + SliceSpecs&&... slices + ) noexcept + ), + ( + /* return */ _submdspan_impl_helper<ET, AP>( + src, + _MDSPAN_FOLD_ASSIGN_LEFT( + ( + detail::__assign_op_slice_handler< + size_t, + detail::preserve_layout_analysis<LP> + >{ + __partially_static_sizes<ST, size_t>{}, + __partially_static_sizes<ST, size_t>{}, + __partially_static_sizes<ST, size_t>{} + } + ), + /* = ... = */ + detail::__wrap_slice< + Exts, dynamic_extent + >( + slices, src.extents().template __extent<Idxs>(), src.mapping().stride(Idxs) + ) + ), + seq + ) /* ; */ + ) +) + +#endif + +template <class T> struct _is_layout_stride : std::false_type { }; +template<> +struct _is_layout_stride< + layout_stride +> : std::true_type +{ }; + +} // namespace detail + +//============================================================================== + +MDSPAN_TEMPLATE_REQUIRES( + class ET, class EXT, class LP, class AP, class... SliceSpecs, + /* requires */ ( + ( + _MDSPAN_TRAIT(is_same, LP, layout_left) + || _MDSPAN_TRAIT(is_same, LP, layout_right) + || detail::_is_layout_stride<LP>::value + ) && + _MDSPAN_FOLD_AND(( + _MDSPAN_TRAIT(is_convertible, SliceSpecs, size_t) + || _MDSPAN_TRAIT(is_convertible, SliceSpecs, tuple<size_t, size_t>) + || _MDSPAN_TRAIT(is_convertible, SliceSpecs, full_extent_t) + ) /* && ... */) && + sizeof...(SliceSpecs) == EXT::rank() + ) +) +MDSPAN_INLINE_FUNCTION +_MDSPAN_DEDUCE_RETURN_TYPE_SINGLE_LINE( + ( + constexpr submdspan( + mdspan<ET, EXT, LP, AP> const& src, SliceSpecs... slices + ) noexcept + ), + ( + /* return */ + detail::_submdspan_impl(std::make_index_sequence<sizeof...(SliceSpecs)>{}, src, slices...) /*;*/ + ) +) +/* clang-format: on */ + +} // end namespace experimental +} // namespace std diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/trait_backports.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/trait_backports.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a94e1a1e031d8248965493c95eba798123aad3e0 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/trait_backports.hpp @@ -0,0 +1,160 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#ifndef MDSPAN_INCLUDE_EXPERIMENTAL_BITS_TRAIT_BACKPORTS_HPP_ +#define MDSPAN_INCLUDE_EXPERIMENTAL_BITS_TRAIT_BACKPORTS_HPP_ + +#include "macros.hpp" +#include "config.hpp" + +#include <type_traits> +#include <utility> // integer_sequence + +//============================================================================== +// <editor-fold desc="Variable template trait backports (e.g., is_void_v)"> {{{1 + +#ifdef _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS + +#if _MDSPAN_USE_VARIABLE_TEMPLATES +namespace std { + +#define _MDSPAN_BACKPORT_TRAIT(TRAIT) \ + template <class... Args> _MDSPAN_INLINE_VARIABLE constexpr auto TRAIT##_v = TRAIT<Args...>::value; + +_MDSPAN_BACKPORT_TRAIT(is_assignable) +_MDSPAN_BACKPORT_TRAIT(is_constructible) +_MDSPAN_BACKPORT_TRAIT(is_convertible) +_MDSPAN_BACKPORT_TRAIT(is_default_constructible) +_MDSPAN_BACKPORT_TRAIT(is_trivially_destructible) +_MDSPAN_BACKPORT_TRAIT(is_same) +_MDSPAN_BACKPORT_TRAIT(is_empty) +_MDSPAN_BACKPORT_TRAIT(is_void) + +#undef _MDSPAN_BACKPORT_TRAIT + +} // end namespace std + +#endif // _MDSPAN_USE_VARIABLE_TEMPLATES + +#endif // _MDSPAN_NEEDS_TRAIT_VARIABLE_TEMPLATE_BACKPORTS + +// </editor-fold> end Variable template trait backports (e.g., is_void_v) }}}1 +//============================================================================== + +//============================================================================== +// <editor-fold desc="integer sequence (ugh...)"> {{{1 + +#if !defined(_MDSPAN_USE_INTEGER_SEQUENCE) || !_MDSPAN_USE_INTEGER_SEQUENCE + +namespace std { + +template <class T, T... Vals> +struct integer_sequence { + static constexpr std::size_t size() noexcept { return sizeof...(Vals); } + using value_type = T; +}; + +template <std::size_t... Vals> +using index_sequence = std::integer_sequence<std::size_t, Vals...>; + +namespace __detail { + +template <class T, T N, T I, class Result> +struct __make_int_seq_impl; + +template <class T, T N, T... Vals> +struct __make_int_seq_impl<T, N, N, integer_sequence<T, Vals...>> +{ + using type = integer_sequence<T, Vals...>; +}; + +template <class T, T N, T I, T... Vals> +struct __make_int_seq_impl< + T, N, I, integer_sequence<T, Vals...> +> : __make_int_seq_impl<T, N, I+1, integer_sequence<T, Vals..., I>> +{ }; + +} // end namespace __detail + +template <class T, T N> +using make_integer_sequence = typename __detail::__make_int_seq_impl<T, N, 0, integer_sequence<T>>::type; + +template <std::size_t N> +using make_index_sequence = typename __detail::__make_int_seq_impl<size_t, N, 0, integer_sequence<size_t>>::type; + +template <class... T> +using index_sequence_for = make_index_sequence<sizeof...(T)>; + +} // end namespace std + +#endif + +// </editor-fold> end integer sequence (ugh...) }}}1 +//============================================================================== + +//============================================================================== +// <editor-fold desc="standard trait aliases"> {{{1 + +#if !defined(_MDSPAN_USE_STANDARD_TRAIT_ALIASES) || !_MDSPAN_USE_STANDARD_TRAIT_ALIASES + +namespace std { + +#define _MDSPAN_BACKPORT_TRAIT_ALIAS(TRAIT) \ + template <class... Args> using TRAIT##_t = typename TRAIT<Args...>::type; + +_MDSPAN_BACKPORT_TRAIT_ALIAS(remove_cv) +_MDSPAN_BACKPORT_TRAIT_ALIAS(remove_reference) + +template <bool _B, class _T=void> +using enable_if_t = typename enable_if<_B, _T>::type; + +#undef _MDSPAN_BACKPORT_TRAIT_ALIAS + +} // end namespace std + +#endif + +// </editor-fold> end standard trait aliases }}}1 +//============================================================================== + +#endif //MDSPAN_INCLUDE_EXPERIMENTAL_BITS_TRAIT_BACKPORTS_HPP_ diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/type_list.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/type_list.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7de72e65374cb7efda519bd0cfc8e9c99cebad62 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p0009_bits/type_list.hpp @@ -0,0 +1,117 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#include "macros.hpp" + +#include "trait_backports.hpp" // make_index_sequence + +namespace std { +namespace experimental { + +//============================================================================== + +namespace detail { + +template <class... _Ts> struct __type_list { static constexpr auto __size = sizeof...(_Ts); }; + +// Implementation of type_list at() that's heavily optimized for small typelists +template <size_t, class> struct __type_at; +template <size_t, class _Seq, class=make_index_sequence<_Seq::__size>> struct __type_at_large_impl; + +template <size_t _I, size_t _Idx, class _T> +struct __type_at_entry { }; + +template <class _Result> +struct __type_at_assign_op_ignore_rest { + template <class _T> + __type_at_assign_op_ignore_rest<_Result> operator=(_T&&); + using type = _Result; +}; + +struct __type_at_assign_op_impl { + template <size_t _I, size_t _Idx, class _T> + __type_at_assign_op_impl operator=(__type_at_entry<_I, _Idx, _T>&&); + template <size_t _I, class _T> + __type_at_assign_op_ignore_rest<_T> operator=(__type_at_entry<_I, _I, _T>&&); +}; + +template <size_t _I, class... _Ts, size_t... _Idxs> +struct __type_at_large_impl<_I, __type_list<_Ts...>, integer_sequence<size_t, _Idxs...>> + : decltype( + _MDSPAN_FOLD_ASSIGN_LEFT(__type_at_assign_op_impl{}, /* = ... = */ __type_at_entry<_I, _Idxs, _Ts>{}) + ) +{ }; + +template <size_t _I, class... _Ts> +struct __type_at<_I, __type_list<_Ts...>> + : __type_at_large_impl<_I, __type_list<_Ts...>> +{ }; + +template <class _T0, class... _Ts> +struct __type_at<0, __type_list<_T0, _Ts...>> { + using type = _T0; +}; + +template <class _T0, class _T1, class... _Ts> +struct __type_at<1, __type_list<_T0, _T1, _Ts...>> { + using type = _T1; +}; + +template <class _T0, class _T1, class _T2, class... _Ts> +struct __type_at<2, __type_list<_T0, _T1, _T2, _Ts...>> { + using type = _T2; +}; + +template <class _T0, class _T1, class _T2, class _T3, class... _Ts> +struct __type_at<3, __type_list<_T0, _T1, _T2, _T3, _Ts...>> { + using type = _T3; +}; + + +} // namespace detail + +//============================================================================== + +} // end namespace experimental +} // end namespace std + diff --git a/packages/kokkos/tpls/mdspan/include/experimental/__p1684_bits/mdarray.hpp b/packages/kokkos/tpls/mdspan/include/experimental/__p1684_bits/mdarray.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b27a25c9fe4c407a1a7c0ce6750c8a2a4310c931 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/__p1684_bits/mdarray.hpp @@ -0,0 +1,463 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + + +#pragma once + +#include "../mdspan" +#include <cassert> +#include <vector> + +namespace std { +namespace experimental { + +namespace { + template<class Extents> + struct size_of_extents; + + template<class IndexType, size_t ... Extents> + struct size_of_extents<extents<IndexType, Extents...>> { + constexpr static size_t value() { + size_t size = 1; + for(size_t r=0; r<extents<IndexType, Extents...>::rank(); r++) + size *= extents<IndexType, Extents...>::static_extent(r); + return size; + } + }; +} + +namespace { + template<class C> + struct container_is_array : false_type { + template<class M> + static constexpr C construct(const M& m) { return C(m.required_span_size()); } + }; + template<class T, size_t N> + struct container_is_array<array<T,N>> : true_type { + template<class M> + static constexpr array<T,N> construct(const M&) { return array<T,N>(); } + }; +} + +template < + class ElementType, + class Extents, + class LayoutPolicy = layout_right, + class Container = vector<ElementType> +> +class mdarray { +private: + static_assert(detail::__is_extents_v<Extents>, "std::experimental::mdspan's Extents template parameter must be a specialization of std::experimental::extents."); + + +public: + + //-------------------------------------------------------------------------------- + // Domain and codomain types + + using extents_type = Extents; + using layout_type = LayoutPolicy; + using container_type = Container; + using mapping_type = typename layout_type::template mapping<extents_type>; + using element_type = ElementType; + using value_type = remove_cv_t<element_type>; + using index_type = typename Extents::index_type; + using pointer = typename container_type::pointer; + using reference = typename container_type::reference; + using const_pointer = typename container_type::const_pointer; + using const_reference = typename container_type::const_reference; + +public: + + //-------------------------------------------------------------------------------- + // [mdspan.basic.cons], mdspan constructors, assignment, and destructor + +#if !(MDSPAN_HAS_CXX_20) + MDSPAN_FUNCTION_REQUIRES( + (MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr), + mdarray, (), , + /* requires */ (extents_type::rank_dynamic()!=0)) {} +#else + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdarray() requires(extents_type::rank_dynamic()!=0) = default; +#endif + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdarray(const mdarray&) = default; + MDSPAN_INLINE_FUNCTION_DEFAULTED constexpr mdarray(mdarray&&) = default; + + // Constructors for container types constructible from a size + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + _MDSPAN_TRAIT(is_constructible, extents_type, SizeTypes...) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) && + (_MDSPAN_TRAIT(is_constructible, container_type, size_t) || + container_is_array<container_type>::value) && + (extents_type::rank()>0 || extents_type::rank_dynamic()==0) + ) + ) + MDSPAN_INLINE_FUNCTION + explicit constexpr mdarray(SizeTypes... dynamic_extents) + : map_(extents_type(dynamic_extents...)), ctr_(container_is_array<container_type>::construct(map_)) + { } + + MDSPAN_FUNCTION_REQUIRES( + (MDSPAN_INLINE_FUNCTION constexpr), + mdarray, (const extents_type& exts), , + /* requires */ ((_MDSPAN_TRAIT(is_constructible, container_type, size_t) || + container_is_array<container_type>::value) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)) + ) : map_(exts), ctr_(container_is_array<container_type>::construct(map_)) + { } + + MDSPAN_FUNCTION_REQUIRES( + (MDSPAN_INLINE_FUNCTION constexpr), + mdarray, (const mapping_type& m), , + /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t) || + container_is_array<container_type>::value) + ) : map_(m), ctr_(container_is_array<container_type>::construct(map_)) + { } + + // Constructors from container + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + _MDSPAN_TRAIT(is_constructible, extents_type, SizeTypes...) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) + ) + ) + MDSPAN_INLINE_FUNCTION + explicit constexpr mdarray(const container_type& ctr, SizeTypes... dynamic_extents) + : map_(extents_type(dynamic_extents...)), ctr_(ctr) + { assert(ctr.size() >= static_cast<size_t>(map_.required_span_size())); } + + + MDSPAN_FUNCTION_REQUIRES( + (MDSPAN_INLINE_FUNCTION constexpr), + mdarray, (const container_type& ctr, const extents_type& exts), , + /* requires */ (_MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)) + ) : map_(exts), ctr_(ctr) + { assert(ctr.size() >= static_cast<size_t>(map_.required_span_size())); } + + constexpr mdarray(const container_type& ctr, const mapping_type& m) + : map_(m), ctr_(ctr) + { assert(ctr.size() >= static_cast<size_t>(map_.required_span_size())); } + + + // Constructors from container + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + _MDSPAN_TRAIT(is_constructible, extents_type, SizeTypes...) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type) + ) + ) + MDSPAN_INLINE_FUNCTION + explicit constexpr mdarray(container_type&& ctr, SizeTypes... dynamic_extents) + : map_(extents_type(dynamic_extents...)), ctr_(std::move(ctr)) + { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); } + + + MDSPAN_FUNCTION_REQUIRES( + (MDSPAN_INLINE_FUNCTION constexpr), + mdarray, (container_type&& ctr, const extents_type& exts), , + /* requires */ (_MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)) + ) : map_(exts), ctr_(std::move(ctr)) + { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); } + + constexpr mdarray(container_type&& ctr, const mapping_type& m) + : map_(m), ctr_(std::move(ctr)) + { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); } + + + + MDSPAN_TEMPLATE_REQUIRES( + class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherContainer, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping<OtherExtents>) && + _MDSPAN_TRAIT(is_constructible, container_type, OtherContainer) + ) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdarray(const mdarray<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherContainer>& other) + : map_(other.mapping()), ctr_(other.container()) + { + static_assert(is_constructible<extents_type, OtherExtents>::value, ""); + } + + // Constructors for container types constructible from a size and allocator + MDSPAN_TEMPLATE_REQUIRES( + class Alloc, + /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t, Alloc) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdarray(const extents_type& exts, const Alloc& a) + : map_(exts), ctr_(map_.required_span_size(), a) + { } + + MDSPAN_TEMPLATE_REQUIRES( + class Alloc, + /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t, Alloc)) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdarray(const mapping_type& map, const Alloc& a) + : map_(map), ctr_(map_.required_span_size(), a) + { } + + // Constructors for container types constructible from a container and allocator + MDSPAN_TEMPLATE_REQUIRES( + class Alloc, + /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, container_type, Alloc) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdarray(const container_type& ctr, const extents_type& exts, const Alloc& a) + : map_(exts), ctr_(ctr, a) + { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); } + + MDSPAN_TEMPLATE_REQUIRES( + class Alloc, + /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t, Alloc)) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdarray(const container_type& ctr, const mapping_type& map, const Alloc& a) + : map_(map), ctr_(ctr, a) + { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); } + + MDSPAN_TEMPLATE_REQUIRES( + class Alloc, + /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, container_type, Alloc) && + _MDSPAN_TRAIT(is_constructible, mapping_type, extents_type)) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdarray(container_type&& ctr, const extents_type& exts, const Alloc& a) + : map_(exts), ctr_(std::move(ctr), a) + { assert(ctr_.size() >= static_cast<size_t>(map_.required_span_size())); } + + MDSPAN_TEMPLATE_REQUIRES( + class Alloc, + /* requires */ (_MDSPAN_TRAIT(is_constructible, container_type, size_t, Alloc)) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdarray(container_type&& ctr, const mapping_type& map, const Alloc& a) + : map_(map), ctr_(std::move(ctr), a) + { assert(ctr_.size() >= map_.required_span_size()); } + + MDSPAN_TEMPLATE_REQUIRES( + class OtherElementType, class OtherExtents, class OtherLayoutPolicy, class OtherContainer, class Alloc, + /* requires */ ( + _MDSPAN_TRAIT(is_constructible, mapping_type, typename OtherLayoutPolicy::template mapping<OtherExtents>) && + _MDSPAN_TRAIT(is_constructible, container_type, OtherContainer, Alloc) + ) + ) + MDSPAN_INLINE_FUNCTION + constexpr mdarray(const mdarray<OtherElementType, OtherExtents, OtherLayoutPolicy, OtherContainer>& other, const Alloc& a) + : map_(other.mapping()), ctr_(other.container(), a) + { + static_assert(is_constructible<extents_type, OtherExtents>::value, ""); + } + + MDSPAN_INLINE_FUNCTION_DEFAULTED + ~mdarray() = default; + + //-------------------------------------------------------------------------------- + // [mdspan.basic.mapping], mdspan mapping domain multidimensional index to access codomain element + + #if MDSPAN_USE_BRACKET_OPERATOR + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + extents_type::rank() == sizeof...(SizeTypes) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr const_reference operator[](SizeTypes... indices) const noexcept + { + return ctr_[map_(index_type(indices)...)]; + } + + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + extents_type::rank() == sizeof...(SizeTypes) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator[](SizeTypes... indices) noexcept + { + return ctr_[map_(index_type(indices)...)]; + } + #endif + +#if 0 + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + N == extents_type::rank() + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr const_reference operator[](const array<SizeType, N>& indices) const noexcept + { + return __impl::template __callop<reference>(*this, indices); + } + + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + N == extents_type::rank() + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator[](const array<SizeType, N>& indices) noexcept + { + return __impl::template __callop<reference>(*this, indices); + } +#endif + + + #if MDSPAN_USE_PAREN_OPERATOR + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + extents_type::rank() == sizeof...(SizeTypes) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr const_reference operator()(SizeTypes... indices) const noexcept + { + return ctr_[map_(index_type(indices)...)]; + } + MDSPAN_TEMPLATE_REQUIRES( + class... SizeTypes, + /* requires */ ( + _MDSPAN_FOLD_AND(_MDSPAN_TRAIT(is_convertible, SizeTypes, index_type) /* && ... */) && + extents_type::rank() == sizeof...(SizeTypes) + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator()(SizeTypes... indices) noexcept + { + return ctr_[map_(index_type(indices)...)]; + } + +#if 0 + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + N == extents_type::rank() + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr const_reference operator()(const array<SizeType, N>& indices) const noexcept + { + return __impl::template __callop<reference>(*this, indices); + } + + MDSPAN_TEMPLATE_REQUIRES( + class SizeType, size_t N, + /* requires */ ( + _MDSPAN_TRAIT(is_convertible, SizeType, index_type) && + N == extents_type::rank() + ) + ) + MDSPAN_FORCE_INLINE_FUNCTION + constexpr reference operator()(const array<SizeType, N>& indices) noexcept + { + return __impl::template __callop<reference>(*this, indices); + } +#endif + #endif + + MDSPAN_INLINE_FUNCTION constexpr pointer data() noexcept { return ctr_.data(); }; + MDSPAN_INLINE_FUNCTION constexpr const_pointer data() const noexcept { return ctr_.data(); }; + MDSPAN_INLINE_FUNCTION constexpr container_type& container() noexcept { return ctr_; }; + MDSPAN_INLINE_FUNCTION constexpr const container_type& container() const noexcept { return ctr_; }; + + //-------------------------------------------------------------------------------- + // [mdspan.basic.domobs], mdspan observers of the domain multidimensional index space + + MDSPAN_INLINE_FUNCTION static constexpr size_t rank() noexcept { return extents_type::rank(); } + MDSPAN_INLINE_FUNCTION static constexpr size_t rank_dynamic() noexcept { return extents_type::rank_dynamic(); } + MDSPAN_INLINE_FUNCTION static constexpr index_type static_extent(size_t r) noexcept { return extents_type::static_extent(r); } + + MDSPAN_INLINE_FUNCTION constexpr extents_type extents() const noexcept { return map_.extents(); }; + MDSPAN_INLINE_FUNCTION constexpr index_type extent(size_t r) const noexcept { return map_.extents().extent(r); }; + MDSPAN_INLINE_FUNCTION constexpr index_type size() const noexcept { +// return __impl::__size(*this); + return ctr_.size(); + }; + + + //-------------------------------------------------------------------------------- + // [mdspan.basic.obs], mdspan observers of the mapping + + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_unique() noexcept { return mapping_type::is_always_unique(); }; + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_exhaustive() noexcept { return mapping_type::is_always_exhaustive(); }; + MDSPAN_INLINE_FUNCTION static constexpr bool is_always_strided() noexcept { return mapping_type::is_always_strided(); }; + + MDSPAN_INLINE_FUNCTION constexpr mapping_type mapping() const noexcept { return map_; }; + MDSPAN_INLINE_FUNCTION constexpr bool is_unique() const noexcept { return map_.is_unique(); }; + MDSPAN_INLINE_FUNCTION constexpr bool is_exhaustive() const noexcept { return map_.is_exhaustive(); }; + MDSPAN_INLINE_FUNCTION constexpr bool is_strided() const noexcept { return map_.is_strided(); }; + MDSPAN_INLINE_FUNCTION constexpr index_type stride(size_t r) const { return map_.stride(r); }; + +private: + mapping_type map_; + container_type ctr_; + + template <class, class, class, class> + friend class mdarray; +}; + + +} // end namespace experimental +} // end namespace std diff --git a/packages/kokkos/core/src/Kokkos_TaskPolicy.hpp b/packages/kokkos/tpls/mdspan/include/experimental/mdarray similarity index 76% rename from packages/kokkos/core/src/Kokkos_TaskPolicy.hpp rename to packages/kokkos/tpls/mdspan/include/experimental/mdarray index 9751fab460d4495b1683a94fc0e9d7f879c9a412..fa710a59b66616665d94dd11bb7e83ce7bddfe0a 100644 --- a/packages/kokkos/core/src/Kokkos_TaskPolicy.hpp +++ b/packages/kokkos/tpls/mdspan/include/experimental/mdarray @@ -2,11 +2,10 @@ //@HEADER // ************************************************************************ // -// Kokkos v. 3.0 -// Copyright (2020) National Technology & Engineering -// Solutions of Sandia, LLC (NTESS). +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation // -// Under the terms of Contract DE-NA0003525 with NTESS, +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without @@ -24,10 +23,10 @@ // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // -// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NTESS OR THE +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -42,10 +41,8 @@ //@HEADER */ -// For backward compatibility: -#include <Kokkos_Macros.hpp> +#pragma once -KOKKOS_IMPL_WARNING( - "This file is deprecated. Use <Kokkos_TaskScheduler.hpp> instead.") +#include "mdspan" +#include "__p1684_bits/mdarray.hpp" -#include <Kokkos_TaskScheduler.hpp> diff --git a/packages/kokkos/tpls/mdspan/include/experimental/mdspan b/packages/kokkos/tpls/mdspan/include/experimental/mdspan new file mode 100644 index 0000000000000000000000000000000000000000..ca6f6b8686cd19fa0142aa158cb55b204aef7760 --- /dev/null +++ b/packages/kokkos/tpls/mdspan/include/experimental/mdspan @@ -0,0 +1,56 @@ +/* +//@HEADER +// ************************************************************************ +// +// Kokkos v. 2.0 +// Copyright (2019) Sandia Corporation +// +// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, +// the U.S. Government retains certain rights in this software. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. Neither the name of the Corporation nor the names of the +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Questions? Contact Christian R. Trott (crtrott@sandia.gov) +// +// ************************************************************************ +//@HEADER +*/ + +#pragma once + +#include "__p0009_bits/default_accessor.hpp" +#include "__p0009_bits/full_extent_t.hpp" +#include "__p0009_bits/mdspan.hpp" +#include "__p0009_bits/dynamic_extent.hpp" +#include "__p0009_bits/extents.hpp" +#include "__p0009_bits/layout_stride.hpp" +#include "__p0009_bits/layout_left.hpp" +#include "__p0009_bits/layout_right.hpp" +#include "__p0009_bits/macros.hpp" +#include "__p0009_bits/static_array.hpp" +#include "__p0009_bits/submdspan.hpp" diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp index 8e0bbd4db39f20977afa3725177f728d7094710d..94590ff656784d018e9ca57991674da773d64568 100644 --- a/src/algebra/TinyMatrix.hpp +++ b/src/algebra/TinyMatrix.hpp @@ -262,15 +262,6 @@ class [[nodiscard]] TinyMatrix return *this; } - PUGS_INLINE - constexpr void - operator+=(const volatile TinyMatrix& A) volatile - { - for (size_t i = 0; i < M * N; ++i) { - m_values[i] += A.m_values[i]; - } - } - PUGS_INLINE constexpr TinyMatrix& operator-=(const TinyMatrix& A) diff --git a/src/algebra/TinyVector.hpp b/src/algebra/TinyVector.hpp index e39dcec6e9834e5cb5eb80e1e845de1054beb1b2..2bc9c79c36ebe2caef6cf63ac6dc653d3a8b0bcb 100644 --- a/src/algebra/TinyVector.hpp +++ b/src/algebra/TinyVector.hpp @@ -23,7 +23,8 @@ class [[nodiscard]] TinyVector static_assert((N > 0), "TinyVector size must be strictly positive"); template <typename... Args> - PUGS_FORCEINLINE constexpr void _unpackVariadicInput(const T& t, Args&&... args) noexcept + PUGS_FORCEINLINE constexpr void + _unpackVariadicInput(const T& t, Args&&... args) noexcept { m_values[N - 1 - sizeof...(args)] = t; if constexpr (sizeof...(args) > 0) { @@ -33,7 +34,8 @@ class [[nodiscard]] TinyVector public: PUGS_INLINE - constexpr TinyVector operator-() const + constexpr TinyVector + operator-() const { TinyVector opposite; for (size_t i = 0; i < N; ++i) { @@ -42,12 +44,14 @@ class [[nodiscard]] TinyVector return opposite; } - [[nodiscard]] PUGS_INLINE constexpr size_t dimension() const + [[nodiscard]] PUGS_INLINE constexpr size_t + dimension() const { return N; } - [[nodiscard]] PUGS_INLINE constexpr bool operator==(const TinyVector& v) const + [[nodiscard]] PUGS_INLINE constexpr bool + operator==(const TinyVector& v) const { for (size_t i = 0; i < N; ++i) { if (m_values[i] != v.m_values[i]) @@ -56,12 +60,14 @@ class [[nodiscard]] TinyVector return true; } - [[nodiscard]] PUGS_INLINE constexpr bool operator!=(const TinyVector& v) const + [[nodiscard]] PUGS_INLINE constexpr bool + operator!=(const TinyVector& v) const { return not this->operator==(v); } - [[nodiscard]] PUGS_INLINE constexpr friend T dot(const TinyVector& u, const TinyVector& v) + [[nodiscard]] PUGS_INLINE constexpr friend T + dot(const TinyVector& u, const TinyVector& v) { T t = u.m_values[0] * v.m_values[0]; for (size_t i = 1; i < N; ++i) { @@ -71,7 +77,8 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr TinyVector& operator*=(const T& t) + constexpr TinyVector& + operator*=(const T& t) { for (size_t i = 0; i < N; ++i) { m_values[i] *= t; @@ -80,21 +87,24 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr friend TinyVector operator*(const T& t, const TinyVector& v) + constexpr friend TinyVector + operator*(const T& t, const TinyVector& v) { TinyVector w = v; return w *= t; } PUGS_INLINE - constexpr friend TinyVector operator*(const T& t, TinyVector&& v) + constexpr friend TinyVector + operator*(const T& t, TinyVector&& v) { v *= t; return std::move(v); } PUGS_INLINE - constexpr friend std::ostream& operator<<(std::ostream& os, const TinyVector& v) + constexpr friend std::ostream& + operator<<(std::ostream& os, const TinyVector& v) { os << '[' << NaNHelper(v.m_values[0]); for (size_t i = 1; i < N; ++i) { @@ -105,7 +115,8 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr TinyVector operator+(const TinyVector& v) const + constexpr TinyVector + operator+(const TinyVector& v) const { TinyVector sum; for (size_t i = 0; i < N; ++i) { @@ -115,7 +126,8 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr TinyVector operator+(TinyVector&& v) const + constexpr TinyVector + operator+(TinyVector&& v) const { for (size_t i = 0; i < N; ++i) { v.m_values[i] += m_values[i]; @@ -124,7 +136,8 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr TinyVector operator-(const TinyVector& v) const + constexpr TinyVector + operator-(const TinyVector& v) const { TinyVector difference; for (size_t i = 0; i < N; ++i) { @@ -134,7 +147,8 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr TinyVector operator-(TinyVector&& v) const + constexpr TinyVector + operator-(TinyVector&& v) const { for (size_t i = 0; i < N; ++i) { v.m_values[i] = m_values[i] - v.m_values[i]; @@ -143,7 +157,8 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr TinyVector& operator+=(const TinyVector& v) + constexpr TinyVector& + operator+=(const TinyVector& v) { for (size_t i = 0; i < N; ++i) { m_values[i] += v.m_values[i]; @@ -152,15 +167,8 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr void operator+=(const volatile TinyVector& v) volatile - { - for (size_t i = 0; i < N; ++i) { - m_values[i] += v.m_values[i]; - } - } - - PUGS_INLINE - constexpr TinyVector& operator-=(const TinyVector& v) + constexpr TinyVector& + operator-=(const TinyVector& v) { for (size_t i = 0; i < N; ++i) { m_values[i] -= v.m_values[i]; @@ -169,21 +177,24 @@ class [[nodiscard]] TinyVector } PUGS_INLINE - constexpr T& operator[](size_t i) noexcept(NO_ASSERT) + constexpr T& + operator[](size_t i) noexcept(NO_ASSERT) { Assert(i < N); return m_values[i]; } PUGS_INLINE - constexpr const T& operator[](size_t i) const noexcept(NO_ASSERT) + constexpr const T& + operator[](size_t i) const noexcept(NO_ASSERT) { Assert(i < N); return m_values[i]; } PUGS_INLINE - constexpr TinyVector& operator=(ZeroType) noexcept + constexpr TinyVector& + operator=(ZeroType) noexcept { static_assert(std::is_arithmetic<T>(), "Cannot assign 'zero' value for non-arithmetic types"); for (size_t i = 0; i < N; ++i) { @@ -231,7 +242,7 @@ class [[nodiscard]] TinyVector constexpr TinyVector(const TinyVector&) noexcept = default; PUGS_INLINE - constexpr TinyVector(TinyVector && v) noexcept = default; + constexpr TinyVector(TinyVector&& v) noexcept = default; PUGS_INLINE ~TinyVector() noexcept = default; diff --git a/src/language/ast/ASTNodeBuiltinFunctionExpressionBuilder.cpp b/src/language/ast/ASTNodeBuiltinFunctionExpressionBuilder.cpp index e2b4a947f1f93fff1060e6fab3f578265b37526c..169540df28558e1b25a54acbf751bac4488a9449 100644 --- a/src/language/ast/ASTNodeBuiltinFunctionExpressionBuilder.cpp +++ b/src/language/ast/ASTNodeBuiltinFunctionExpressionBuilder.cpp @@ -13,9 +13,7 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData const ASTNodeSubDataType& argument_node_sub_data_type, const size_t argument_number) { - auto get_function_argument_converter_for = - [&](const auto& parameter_v) -> std::unique_ptr<IFunctionArgumentConverter> { - using ParameterT = std::decay_t<decltype(parameter_v)>; + auto get_function_argument_converter_for = [&]<typename ParameterT>() -> std::unique_ptr<IFunctionArgumentConverter> { switch (argument_node_sub_data_type.m_data_type) { case ASTNodeDataType::bool_t: { return std::make_unique<FunctionArgumentConverter<ParameterT, bool>>(argument_number); @@ -39,9 +37,7 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData }; auto get_function_argument_converter_for_vector = - [&](const auto& parameter_v) -> std::unique_ptr<IFunctionArgumentConverter> { - using ParameterT = std::decay_t<decltype(parameter_v)>; - + [&]<typename ParameterT>() -> std::unique_ptr<IFunctionArgumentConverter> { if constexpr (std::is_same_v<ParameterT, TinyVector<1>>) { switch (argument_node_sub_data_type.m_data_type) { case ASTNodeDataType::vector_t: { @@ -76,7 +72,7 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData } else { switch (argument_node_sub_data_type.m_data_type) { case ASTNodeDataType::vector_t: { - if (argument_node_sub_data_type.m_data_type.dimension() == parameter_v.dimension()) { + if (argument_node_sub_data_type.m_data_type.dimension() == ParameterT::Dimension) { return std::make_unique<FunctionTinyVectorArgumentConverter<ParameterT, ParameterT>>(argument_number); } else { // LCOV_EXCL_START @@ -104,9 +100,7 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData }; auto get_function_argument_converter_for_matrix = - [&](const auto& parameter_v) -> std::unique_ptr<IFunctionArgumentConverter> { - using ParameterT = std::decay_t<decltype(parameter_v)>; - + [&]<typename ParameterT>() -> std::unique_ptr<IFunctionArgumentConverter> { if constexpr (std::is_same_v<ParameterT, TinyMatrix<1>>) { switch (argument_node_sub_data_type.m_data_type) { case ASTNodeDataType::matrix_t: { @@ -142,8 +136,8 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData } else { switch (argument_node_sub_data_type.m_data_type) { case ASTNodeDataType::matrix_t: { - if ((argument_node_sub_data_type.m_data_type.numberOfRows() == parameter_v.numberOfRows()) and - (argument_node_sub_data_type.m_data_type.numberOfColumns() == parameter_v.numberOfColumns())) { + if ((argument_node_sub_data_type.m_data_type.numberOfRows() == ParameterT::NumberOfRows) and + (argument_node_sub_data_type.m_data_type.numberOfColumns() == ParameterT::NumberOfColumns)) { return std::make_unique<FunctionTinyMatrixArgumentConverter<ParameterT, ParameterT>>(argument_number); } else { // LCOV_EXCL_START @@ -189,8 +183,7 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData }; auto get_function_argument_to_tuple_converter = - [&](const auto& parameter_content_v) -> std::unique_ptr<IFunctionArgumentConverter> { - using ParameterContentT = std::decay_t<decltype(parameter_content_v)>; + [&]<typename ParameterContentT>() -> std::unique_ptr<IFunctionArgumentConverter> { const auto& arg_data_type = argument_node_sub_data_type.m_data_type; switch (arg_data_type) { case ASTNodeDataType::tuple_t: { @@ -321,27 +314,27 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData auto get_function_argument_converter_for_argument_type = [&]() { switch (parameter_type) { case ASTNodeDataType::bool_t: { - return get_function_argument_converter_for(bool{}); + return get_function_argument_converter_for.template operator()<bool>(); } case ASTNodeDataType::unsigned_int_t: { - return get_function_argument_converter_for(uint64_t{}); + return get_function_argument_converter_for.template operator()<uint64_t>(); } case ASTNodeDataType::int_t: { - return get_function_argument_converter_for(int64_t{}); + return get_function_argument_converter_for.template operator()<int64_t>(); } case ASTNodeDataType::double_t: { - return get_function_argument_converter_for(double{}); + return get_function_argument_converter_for.template operator()<double>(); } case ASTNodeDataType::vector_t: { switch (parameter_type.dimension()) { case 1: { - return get_function_argument_converter_for_vector(TinyVector<1>{}); + return get_function_argument_converter_for_vector.template operator()<TinyVector<1>>(); } case 2: { - return get_function_argument_converter_for_vector(TinyVector<2>{}); + return get_function_argument_converter_for_vector.template operator()<TinyVector<2>>(); } case 3: { - return get_function_argument_converter_for_vector(TinyVector<3>{}); + return get_function_argument_converter_for_vector.template operator()<TinyVector<3>>(); } // LCOV_EXCL_START default: { @@ -355,13 +348,13 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData Assert(parameter_type.numberOfRows() == parameter_type.numberOfColumns()); switch (parameter_type.numberOfRows()) { case 1: { - return get_function_argument_converter_for_matrix(TinyMatrix<1>{}); + return get_function_argument_converter_for_matrix.template operator()<TinyMatrix<1>>(); } case 2: { - return get_function_argument_converter_for_matrix(TinyMatrix<2>{}); + return get_function_argument_converter_for_matrix.template operator()<TinyMatrix<2>>(); } case 3: { - return get_function_argument_converter_for_matrix(TinyMatrix<3>{}); + return get_function_argument_converter_for_matrix.template operator()<TinyMatrix<3>>(); } // LCOV_EXCL_START default: { @@ -383,33 +376,33 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData case ASTNodeDataType::tuple_t: { switch (parameter_type.contentType()) { case ASTNodeDataType::type_id_t: { - return get_function_argument_to_tuple_converter(EmbeddedData{}); + return get_function_argument_to_tuple_converter.template operator()<EmbeddedData>(); } case ASTNodeDataType::bool_t: { - return get_function_argument_to_tuple_converter(bool{}); + return get_function_argument_to_tuple_converter.template operator()<bool>(); } case ASTNodeDataType::unsigned_int_t: { - return get_function_argument_to_tuple_converter(uint64_t{}); + return get_function_argument_to_tuple_converter.template operator()<uint64_t>(); } case ASTNodeDataType::int_t: { - return get_function_argument_to_tuple_converter(int64_t{}); + return get_function_argument_to_tuple_converter.template operator()<int64_t>(); } case ASTNodeDataType::double_t: { - return get_function_argument_to_tuple_converter(double{}); + return get_function_argument_to_tuple_converter.template operator()<double>(); } case ASTNodeDataType::function_t: { - return get_function_argument_to_tuple_converter(FunctionSymbolId{}); + return get_function_argument_to_tuple_converter.template operator()<FunctionSymbolId>(); } case ASTNodeDataType::vector_t: { switch (parameter_type.contentType().dimension()) { case 1: { - return get_function_argument_to_tuple_converter(TinyVector<1>{}); + return get_function_argument_to_tuple_converter.template operator()<TinyVector<1>>(); } case 2: { - return get_function_argument_to_tuple_converter(TinyVector<2>{}); + return get_function_argument_to_tuple_converter.template operator()<TinyVector<2>>(); } case 3: { - return get_function_argument_to_tuple_converter(TinyVector<3>{}); + return get_function_argument_to_tuple_converter.template operator()<TinyVector<3>>(); } // LCOV_EXCL_START default: { @@ -424,13 +417,13 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData Assert(parameter_type.contentType().numberOfRows() == parameter_type.contentType().numberOfColumns()); switch (parameter_type.contentType().numberOfRows()) { case 1: { - return get_function_argument_to_tuple_converter(TinyMatrix<1>{}); + return get_function_argument_to_tuple_converter.template operator()<TinyMatrix<1>>(); } case 2: { - return get_function_argument_to_tuple_converter(TinyMatrix<2>{}); + return get_function_argument_to_tuple_converter.template operator()<TinyMatrix<2>>(); } case 3: { - return get_function_argument_to_tuple_converter(TinyMatrix<3>{}); + return get_function_argument_to_tuple_converter.template operator()<TinyMatrix<3>>(); } // LCOV_EXCL_START default: { @@ -442,7 +435,7 @@ ASTNodeBuiltinFunctionExpressionBuilder::_getArgumentConverter(const ASTNodeData } } case ASTNodeDataType::string_t: { - return get_function_argument_to_tuple_converter(std::string{}); + return get_function_argument_to_tuple_converter.template operator()<std::string>(); } // LCOV_EXCL_START default: { diff --git a/src/language/ast/ASTNodeFunctionExpressionBuilder.cpp b/src/language/ast/ASTNodeFunctionExpressionBuilder.cpp index 7e0d981c33a6d2c9bcd9c8caf79ea7ea95407f4e..ade27471688bbceb24d39168d0d903d46c8ecaf6 100644 --- a/src/language/ast/ASTNodeFunctionExpressionBuilder.cpp +++ b/src/language/ast/ASTNodeFunctionExpressionBuilder.cpp @@ -17,9 +17,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy ASTNodeNaturalConversionChecker<AllowRToR1Conversion>{node_sub_data_type, parameter_symbol.attributes().dataType()}; - auto get_function_argument_converter_for = - [&](const auto& parameter_v) -> std::unique_ptr<IFunctionArgumentConverter> { - using ParameterT = std::decay_t<decltype(parameter_v)>; + auto get_function_argument_converter_for = [&]<typename ParameterT>() -> std::unique_ptr<IFunctionArgumentConverter> { switch (node_sub_data_type.m_data_type) { case ASTNodeDataType::bool_t: { return std::make_unique<FunctionArgumentConverter<ParameterT, bool>>(parameter_id); @@ -65,11 +63,10 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy }; auto get_function_argument_converter_for_vector = - [&](const auto& parameter_v) -> std::unique_ptr<IFunctionArgumentConverter> { - using ParameterT = std::decay_t<decltype(parameter_v)>; + [&]<typename ParameterT>() -> std::unique_ptr<IFunctionArgumentConverter> { switch (node_sub_data_type.m_data_type) { case ASTNodeDataType::vector_t: { - if (node_sub_data_type.m_data_type.dimension() == parameter_v.dimension()) { + if (node_sub_data_type.m_data_type.dimension() == ParameterT::Dimension) { return std::make_unique<FunctionTinyVectorArgumentConverter<ParameterT, ParameterT>>(parameter_id); } else { // LCOV_EXCL_START @@ -79,7 +76,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy } } case ASTNodeDataType::bool_t: { - if ((parameter_v.dimension() == 1)) { + if constexpr (ParameterT::Dimension == 1) { return std::make_unique<FunctionTinyVectorArgumentConverter<ParameterT, bool>>(parameter_id); } else { // LCOV_EXCL_START @@ -89,7 +86,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy } } case ASTNodeDataType::int_t: { - if ((parameter_v.dimension() == 1)) { + if constexpr (ParameterT::Dimension == 1) { return std::make_unique<FunctionTinyVectorArgumentConverter<ParameterT, int64_t>>(parameter_id); } else if (node_sub_data_type.m_parent_node.is_type<language::integer>()) { if (std::stoi(node_sub_data_type.m_parent_node.string()) == 0) { @@ -102,7 +99,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy // LCOV_EXCL_STOP } case ASTNodeDataType::unsigned_int_t: { - if ((parameter_v.dimension() == 1)) { + if constexpr (ParameterT::Dimension == 1) { return std::make_unique<FunctionTinyVectorArgumentConverter<ParameterT, uint64_t>>(parameter_id); } else { // LCOV_EXCL_START @@ -112,7 +109,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy } } case ASTNodeDataType::double_t: { - if ((parameter_v.dimension() == 1)) { + if constexpr (ParameterT::Dimension == 1) { return std::make_unique<FunctionTinyVectorArgumentConverter<ParameterT, double>>(parameter_id); } else { // LCOV_EXCL_START @@ -131,12 +128,11 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy }; auto get_function_argument_converter_for_matrix = - [&](const auto& parameter_v) -> std::unique_ptr<IFunctionArgumentConverter> { - using ParameterT = std::decay_t<decltype(parameter_v)>; + [&]<typename ParameterT>() -> std::unique_ptr<IFunctionArgumentConverter> { switch (node_sub_data_type.m_data_type) { case ASTNodeDataType::matrix_t: { - if ((node_sub_data_type.m_data_type.numberOfRows() == parameter_v.numberOfRows()) and - (node_sub_data_type.m_data_type.numberOfColumns() == parameter_v.numberOfColumns())) { + if ((node_sub_data_type.m_data_type.numberOfRows() == ParameterT::NumberOfRows) and + (node_sub_data_type.m_data_type.numberOfColumns() == ParameterT::NumberOfColumns)) { return std::make_unique<FunctionTinyMatrixArgumentConverter<ParameterT, ParameterT>>(parameter_id); } else { // LCOV_EXCL_START @@ -146,7 +142,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy } } case ASTNodeDataType::bool_t: { - if ((parameter_v.numberOfRows() == 1) and (parameter_v.numberOfColumns() == 1)) { + if constexpr ((ParameterT::NumberOfRows == 1) and (ParameterT::NumberOfColumns == 1)) { return std::make_unique<FunctionTinyMatrixArgumentConverter<ParameterT, bool>>(parameter_id); } else { // LCOV_EXCL_START @@ -156,7 +152,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy } } case ASTNodeDataType::int_t: { - if ((parameter_v.numberOfRows() == 1) and (parameter_v.numberOfColumns() == 1)) { + if constexpr ((ParameterT::NumberOfRows == 1) and (ParameterT::NumberOfColumns == 1)) { return std::make_unique<FunctionTinyMatrixArgumentConverter<ParameterT, int64_t>>(parameter_id); } else if (node_sub_data_type.m_parent_node.is_type<language::integer>()) { if (std::stoi(node_sub_data_type.m_parent_node.string()) == 0) { @@ -169,7 +165,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy // LCOV_EXCL_STOP } case ASTNodeDataType::unsigned_int_t: { - if ((parameter_v.numberOfRows() == 1) and (parameter_v.numberOfColumns() == 1)) { + if constexpr ((ParameterT::NumberOfRows == 1) and (ParameterT::NumberOfColumns == 1)) { return std::make_unique<FunctionTinyMatrixArgumentConverter<ParameterT, uint64_t>>(parameter_id); } else { // LCOV_EXCL_START @@ -179,7 +175,7 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy } } case ASTNodeDataType::double_t: { - if ((parameter_v.numberOfRows() == 1) and (parameter_v.numberOfColumns() == 1)) { + if constexpr ((ParameterT::NumberOfRows == 1) and (ParameterT::NumberOfColumns == 1)) { return std::make_unique<FunctionTinyMatrixArgumentConverter<ParameterT, double>>(parameter_id); } else { // LCOV_EXCL_START @@ -204,16 +200,16 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy auto get_function_argument_converter_for_parameter_type = [&]() { switch (parameter_symbol.attributes().dataType()) { case ASTNodeDataType::bool_t: { - return get_function_argument_converter_for(bool{}); + return get_function_argument_converter_for.template operator()<bool>(); } case ASTNodeDataType::unsigned_int_t: { - return get_function_argument_converter_for(uint64_t{}); + return get_function_argument_converter_for.template operator()<uint64_t>(); } case ASTNodeDataType::int_t: { - return get_function_argument_converter_for(int64_t{}); + return get_function_argument_converter_for.template operator()<int64_t>(); } case ASTNodeDataType::double_t: { - return get_function_argument_converter_for(double{}); + return get_function_argument_converter_for.template operator()<double>(); } case ASTNodeDataType::string_t: { return get_function_argument_converter_for_string(); @@ -221,13 +217,13 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy case ASTNodeDataType::vector_t: { switch (parameter_symbol.attributes().dataType().dimension()) { case 1: { - return get_function_argument_converter_for_vector(TinyVector<1>{}); + return get_function_argument_converter_for_vector.template operator()<TinyVector<1>>(); } case 2: { - return get_function_argument_converter_for_vector(TinyVector<2>{}); + return get_function_argument_converter_for_vector.template operator()<TinyVector<2>>(); } case 3: { - return get_function_argument_converter_for_vector(TinyVector<3>{}); + return get_function_argument_converter_for_vector.template operator()<TinyVector<3>>(); } } // LCOV_EXCL_START @@ -240,13 +236,13 @@ ASTNodeFunctionExpressionBuilder::_getArgumentConverter(SymbolType& parameter_sy switch (parameter_symbol.attributes().dataType().numberOfRows()) { case 1: { - return get_function_argument_converter_for_matrix(TinyMatrix<1>{}); + return get_function_argument_converter_for_matrix.template operator()<TinyMatrix<1>>(); } case 2: { - return get_function_argument_converter_for_matrix(TinyMatrix<2>{}); + return get_function_argument_converter_for_matrix.template operator()<TinyMatrix<2>>(); } case 3: { - return get_function_argument_converter_for_matrix(TinyMatrix<3>{}); + return get_function_argument_converter_for_matrix.template operator()<TinyMatrix<3>>(); } } // LCOV_EXCL_START @@ -335,8 +331,7 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r ASTNode& node, ASTNode& function_component_expression) { - auto get_function_processor_for_expression_value = [&](const auto& return_v) -> std::unique_ptr<INodeProcessor> { - using ReturnT = std::decay_t<decltype(return_v)>; + auto get_function_processor_for_expression_value = [&]<typename ReturnT>() -> std::unique_ptr<INodeProcessor> { switch (function_component_expression.m_data_type) { case ASTNodeDataType::bool_t: { return std::make_unique<FunctionExpressionProcessor<ReturnT, bool>>(function_component_expression); @@ -368,11 +363,10 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r } }; - auto get_function_processor_for_expression_vector = [&](const auto& return_v) -> std::unique_ptr<INodeProcessor> { - using ReturnT = std::decay_t<decltype(return_v)>; + auto get_function_processor_for_expression_vector = [&]<typename ReturnT>() -> std::unique_ptr<INodeProcessor> { switch (function_component_expression.m_data_type) { case ASTNodeDataType::vector_t: { - if (function_component_expression.m_data_type.dimension() == return_v.dimension()) { + if (function_component_expression.m_data_type.dimension() == ReturnT::Dimension) { return std::make_unique<FunctionExpressionProcessor<ReturnT, ReturnT>>(function_component_expression); } else { // LCOV_EXCL_START @@ -401,12 +395,11 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r } }; - auto get_function_processor_for_expression_matrix = [&](const auto& return_v) -> std::unique_ptr<INodeProcessor> { - using ReturnT = std::decay_t<decltype(return_v)>; + auto get_function_processor_for_expression_matrix = [&]<typename ReturnT>() -> std::unique_ptr<INodeProcessor> { switch (function_component_expression.m_data_type) { case ASTNodeDataType::matrix_t: { - if ((function_component_expression.m_data_type.numberOfRows() == return_v.numberOfRows()) and - (function_component_expression.m_data_type.numberOfColumns() == return_v.numberOfColumns())) { + if ((function_component_expression.m_data_type.numberOfRows() == ReturnT::NumberOfRows) and + (function_component_expression.m_data_type.numberOfColumns() == ReturnT::NumberOfColumns)) { return std::make_unique<FunctionExpressionProcessor<ReturnT, ReturnT>>(function_component_expression); } else { // LCOV_EXCL_START @@ -458,8 +451,7 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r }; auto get_function_processor_for_expression_tuple_of_value = - [&](const auto& tuple_content_v) -> std::unique_ptr<INodeProcessor> { - using TupleContentT = std::decay_t<decltype(tuple_content_v)>; + [&]<typename TupleContentT>() -> std::unique_ptr<INodeProcessor> { switch (function_component_expression.m_data_type) { case ASTNodeDataType::bool_t: { return std::make_unique<FunctionExpressionProcessor<std::vector<TupleContentT>, bool>>( @@ -632,8 +624,7 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r }; auto get_function_processor_for_expression_tuple_of_vector = - [&](const auto& tuple_content_v) -> std::unique_ptr<INodeProcessor> { - using TupleContentT = std::decay_t<decltype(tuple_content_v)>; + [&]<typename TupleContentT>() -> std::unique_ptr<INodeProcessor> { if constexpr (TupleContentT::Dimension == 1) { switch (function_component_expression.m_data_type) { case ASTNodeDataType::bool_t: { @@ -774,8 +765,7 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r }; auto get_function_processor_for_expression_tuple_of_matrix = - [&](const auto& tuple_content_v) -> std::unique_ptr<INodeProcessor> { - using TupleContentT = std::decay_t<decltype(tuple_content_v)>; + [&]<typename TupleContentT>() -> std::unique_ptr<INodeProcessor> { static_assert(TupleContentT::NumberOfColumns == TupleContentT::NumberOfRows); if constexpr (TupleContentT::NumberOfRows == 1) { @@ -930,13 +920,13 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r case ASTNodeDataType::vector_t: { switch (tuple_content_v.dimension()) { case 1: { - return get_function_processor_for_expression_tuple_of_vector(TinyVector<1>{}); + return get_function_processor_for_expression_tuple_of_vector.template operator()<TinyVector<1>>(); } case 2: { - return get_function_processor_for_expression_tuple_of_vector(TinyVector<2>{}); + return get_function_processor_for_expression_tuple_of_vector.template operator()<TinyVector<2>>(); } case 3: { - return get_function_processor_for_expression_tuple_of_vector(TinyVector<3>{}); + return get_function_processor_for_expression_tuple_of_vector.template operator()<TinyVector<3>>(); } // LCOV_EXCL_START default: { @@ -950,13 +940,13 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r if (tuple_content_v.numberOfRows() == tuple_content_v.numberOfColumns()) { switch (tuple_content_v.numberOfRows()) { case 1: { - return get_function_processor_for_expression_tuple_of_matrix(TinyMatrix<1>{}); + return get_function_processor_for_expression_tuple_of_matrix.template operator()<TinyMatrix<1>>(); } case 2: { - return get_function_processor_for_expression_tuple_of_matrix(TinyMatrix<2>{}); + return get_function_processor_for_expression_tuple_of_matrix.template operator()<TinyMatrix<2>>(); } case 3: { - return get_function_processor_for_expression_tuple_of_matrix(TinyMatrix<3>{}); + return get_function_processor_for_expression_tuple_of_matrix.template operator()<TinyMatrix<3>>(); } // LCOV_EXCL_START default: { @@ -973,22 +963,22 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r } } case ASTNodeDataType::bool_t: { - return get_function_processor_for_expression_tuple_of_value(bool{}); + return get_function_processor_for_expression_tuple_of_value.template operator()<bool>(); } case ASTNodeDataType::unsigned_int_t: { - return get_function_processor_for_expression_tuple_of_value(uint64_t{}); + return get_function_processor_for_expression_tuple_of_value.template operator()<uint64_t>(); } case ASTNodeDataType::int_t: { - return get_function_processor_for_expression_tuple_of_value(int64_t{}); + return get_function_processor_for_expression_tuple_of_value.template operator()<int64_t>(); } case ASTNodeDataType::double_t: { - return get_function_processor_for_expression_tuple_of_value(double{}); + return get_function_processor_for_expression_tuple_of_value.template operator()<double>(); } case ASTNodeDataType::type_id_t: { - return get_function_processor_for_expression_tuple_of_value(EmbeddedData{}); + return get_function_processor_for_expression_tuple_of_value.template operator()<EmbeddedData>(); } case ASTNodeDataType::string_t: { - return get_function_processor_for_expression_tuple_of_value(std::string{}); + return get_function_processor_for_expression_tuple_of_value.template operator()<std::string>(); } // LCOV_EXCL_START default: { @@ -1001,31 +991,31 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r auto get_function_processor_for_value = [&]() { switch (return_value_type) { case ASTNodeDataType::bool_t: { - return get_function_processor_for_expression_value(bool{}); + return get_function_processor_for_expression_value.template operator()<bool>(); } case ASTNodeDataType::unsigned_int_t: { - return get_function_processor_for_expression_value(uint64_t{}); + return get_function_processor_for_expression_value.template operator()<uint64_t>(); } case ASTNodeDataType::int_t: { - return get_function_processor_for_expression_value(int64_t{}); + return get_function_processor_for_expression_value.template operator()<int64_t>(); } case ASTNodeDataType::double_t: { - return get_function_processor_for_expression_value(double{}); + return get_function_processor_for_expression_value.template operator()<double>(); } case ASTNodeDataType::vector_t: { switch (return_value_type.dimension()) { case 1: { if (function_component_expression.m_data_type == ASTNodeDataType::vector_t) { - return get_function_processor_for_expression_vector(TinyVector<1>{}); + return get_function_processor_for_expression_vector.template operator()<TinyVector<1>>(); } else { - return get_function_processor_for_expression_value(TinyVector<1>{}); + return get_function_processor_for_expression_value.template operator()<TinyVector<1>>(); } } case 2: { - return get_function_processor_for_expression_vector(TinyVector<2>{}); + return get_function_processor_for_expression_vector.template operator()<TinyVector<2>>(); } case 3: { - return get_function_processor_for_expression_vector(TinyVector<3>{}); + return get_function_processor_for_expression_vector.template operator()<TinyVector<3>>(); } // LCOV_EXCL_START default: { @@ -1040,16 +1030,16 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r switch (return_value_type.numberOfRows()) { case 1: { if (function_component_expression.m_data_type == ASTNodeDataType::matrix_t) { - return get_function_processor_for_expression_matrix(TinyMatrix<1>{}); + return get_function_processor_for_expression_matrix.template operator()<TinyMatrix<1>>(); } else { - return get_function_processor_for_expression_value(TinyMatrix<1>{}); + return get_function_processor_for_expression_value.template operator()<TinyMatrix<1>>(); } } case 2: { - return get_function_processor_for_expression_matrix(TinyMatrix<2>{}); + return get_function_processor_for_expression_matrix.template operator()<TinyMatrix<2>>(); } case 3: { - return get_function_processor_for_expression_matrix(TinyMatrix<3>{}); + return get_function_processor_for_expression_matrix.template operator()<TinyMatrix<3>>(); } // LCOV_EXCL_START default: { @@ -1059,7 +1049,7 @@ ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& r } } case ASTNodeDataType::string_t: { - return get_function_processor_for_expression_value(std::string{}); + return get_function_processor_for_expression_value.template operator()<std::string>(); } case ASTNodeDataType::type_id_t: { return get_function_processor_for_expression_type_id(return_value_type.nameOfTypeId()); diff --git a/src/language/ast/ASTNodeListAffectationExpressionBuilder.cpp b/src/language/ast/ASTNodeListAffectationExpressionBuilder.cpp index ec499edb30589824b5578dbc0701db0b3639166b..fc3df0d17e795f11950055ea82009729894d967f 100644 --- a/src/language/ast/ASTNodeListAffectationExpressionBuilder.cpp +++ b/src/language/ast/ASTNodeListAffectationExpressionBuilder.cpp @@ -381,8 +381,7 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( ASTNode& value_node, std::unique_ptr<ListAffectationProcessor<OperatorT>>& list_affectation_processor) { - auto add_affectation_processor_for_data = [&](const auto& value, const ASTNodeSubDataType& node_sub_data_type) { - using ValueT = std::decay_t<decltype(value)>; + auto add_affectation_processor_for_data = [&]<typename ValueT>(const ASTNodeSubDataType& node_sub_data_type) { switch (node_sub_data_type.m_data_type) { case ASTNodeDataType::bool_t: { list_affectation_processor->template add<ValueT, bool>(value_node); @@ -408,19 +407,17 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( } }; - auto add_affectation_processor_for_vector_data = [&](const auto& value, - const ASTNodeSubDataType& node_sub_data_type) { - using ValueT = std::decay_t<decltype(value)>; + auto add_affectation_processor_for_vector_data = [&]<typename ValueT>(const ASTNodeSubDataType& node_sub_data_type) { if constexpr (std::is_same_v<ValueT, TinyVector<1>>) { if ((node_sub_data_type.m_data_type == ASTNodeDataType::vector_t) and - (node_sub_data_type.m_data_type.dimension() == value.dimension())) { + (node_sub_data_type.m_data_type.dimension() == ValueT::Dimension)) { list_affectation_processor->template add<ValueT, ValueT>(value_node); } else { - add_affectation_processor_for_data(value, node_sub_data_type); + add_affectation_processor_for_data.template operator()<TinyVector<1>>(node_sub_data_type); } } else if constexpr (std::is_same_v<ValueT, TinyVector<2>> or std::is_same_v<ValueT, TinyVector<3>>) { if ((node_sub_data_type.m_data_type == ASTNodeDataType::vector_t) and - (node_sub_data_type.m_data_type.dimension() == value.dimension())) { + (node_sub_data_type.m_data_type.dimension() == ValueT::Dimension)) { list_affectation_processor->template add<ValueT, ValueT>(value_node); } else if (node_sub_data_type.m_parent_node.is_type<language::integer>()) { if (std::stoi(node_sub_data_type.m_parent_node.string()) == 0) { @@ -440,21 +437,19 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( } }; - auto add_affectation_processor_for_matrix_data = [&](const auto& value, - const ASTNodeSubDataType& node_sub_data_type) { - using ValueT = std::decay_t<decltype(value)>; + auto add_affectation_processor_for_matrix_data = [&]<typename ValueT>(const ASTNodeSubDataType& node_sub_data_type) { if constexpr (std::is_same_v<ValueT, TinyMatrix<1>>) { if ((node_sub_data_type.m_data_type == ASTNodeDataType::matrix_t) and - (node_sub_data_type.m_data_type.numberOfRows() == value.numberOfRows()) and - (node_sub_data_type.m_data_type.numberOfColumns() == value.numberOfColumns())) { + (node_sub_data_type.m_data_type.numberOfRows() == ValueT::NumberOfRows) and + (node_sub_data_type.m_data_type.numberOfColumns() == ValueT::NumberOfColumns)) { list_affectation_processor->template add<ValueT, ValueT>(value_node); } else { - add_affectation_processor_for_data(value, node_sub_data_type); + add_affectation_processor_for_data.template operator()<TinyMatrix<1>>(node_sub_data_type); } } else if constexpr (std::is_same_v<ValueT, TinyMatrix<2>> or std::is_same_v<ValueT, TinyMatrix<3>>) { if ((node_sub_data_type.m_data_type == ASTNodeDataType::matrix_t) and - (node_sub_data_type.m_data_type.numberOfRows() == value.numberOfRows()) and - (node_sub_data_type.m_data_type.numberOfColumns() == value.numberOfColumns())) { + (node_sub_data_type.m_data_type.numberOfRows() == ValueT::NumberOfRows) and + (node_sub_data_type.m_data_type.numberOfColumns() == ValueT::NumberOfColumns)) { list_affectation_processor->template add<ValueT, ValueT>(value_node); } else if (node_sub_data_type.m_parent_node.is_type<language::integer>()) { if (std::stoi(node_sub_data_type.m_parent_node.string()) == 0) { @@ -1140,19 +1135,19 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( const ASTNodeSubDataType& node_sub_data_type) { switch (value_type) { case ASTNodeDataType::bool_t: { - add_affectation_processor_for_data(bool{}, node_sub_data_type); + add_affectation_processor_for_data.template operator()<bool>(node_sub_data_type); break; } case ASTNodeDataType::unsigned_int_t: { - add_affectation_processor_for_data(uint64_t{}, node_sub_data_type); + add_affectation_processor_for_data.template operator()<uint64_t>(node_sub_data_type); break; } case ASTNodeDataType::int_t: { - add_affectation_processor_for_data(int64_t{}, node_sub_data_type); + add_affectation_processor_for_data.template operator()<int64_t>(node_sub_data_type); break; } case ASTNodeDataType::double_t: { - add_affectation_processor_for_data(double{}, node_sub_data_type); + add_affectation_processor_for_data.template operator()<double>(node_sub_data_type); break; } case ASTNodeDataType::type_id_t: { @@ -1162,15 +1157,15 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( case ASTNodeDataType::vector_t: { switch (value_type.dimension()) { case 1: { - add_affectation_processor_for_vector_data(TinyVector<1>{}, node_sub_data_type); + add_affectation_processor_for_vector_data.template operator()<TinyVector<1>>(node_sub_data_type); break; } case 2: { - add_affectation_processor_for_vector_data(TinyVector<2>{}, node_sub_data_type); + add_affectation_processor_for_vector_data.template operator()<TinyVector<2>>(node_sub_data_type); break; } case 3: { - add_affectation_processor_for_vector_data(TinyVector<3>{}, node_sub_data_type); + add_affectation_processor_for_vector_data.template operator()<TinyVector<3>>(node_sub_data_type); break; } // LCOV_EXCL_START @@ -1185,15 +1180,15 @@ ASTNodeListAffectationExpressionBuilder::_buildAffectationProcessor( Assert(value_type.numberOfRows() == value_type.numberOfColumns()); switch (value_type.numberOfRows()) { case 1: { - add_affectation_processor_for_matrix_data(TinyMatrix<1>{}, node_sub_data_type); + add_affectation_processor_for_matrix_data.template operator()<TinyMatrix<1>>(node_sub_data_type); break; } case 2: { - add_affectation_processor_for_matrix_data(TinyMatrix<2>{}, node_sub_data_type); + add_affectation_processor_for_matrix_data.template operator()<TinyMatrix<2>>(node_sub_data_type); break; } case 3: { - add_affectation_processor_for_matrix_data(TinyMatrix<3>{}, node_sub_data_type); + add_affectation_processor_for_matrix_data.template operator()<TinyMatrix<3>>(node_sub_data_type); break; } // LCOV_EXCL_START diff --git a/src/language/utils/ASTNodeDataType.cpp b/src/language/utils/ASTNodeDataType.cpp index b89afd13493929a463f4585abb892e7937548906..6007b2b0641ec4ecb21005f9d86201b509a449be 100644 --- a/src/language/utils/ASTNodeDataType.cpp +++ b/src/language/utils/ASTNodeDataType.cpp @@ -163,32 +163,37 @@ getTupleDataType(const ASTNode& type_node) std::string dataTypeName(const ASTNodeDataType& data_type) { - std::string name; switch (data_type) { - case ASTNodeDataType::undefined_t: - name = "undefined"; - break; - case ASTNodeDataType::bool_t: - name = "B"; - break; - case ASTNodeDataType::unsigned_int_t: - name = "N"; - break; - case ASTNodeDataType::int_t: - name = "Z"; - break; - case ASTNodeDataType::double_t: - name = "R"; - break; - case ASTNodeDataType::vector_t: - name = "R^" + stringify(data_type.dimension()); - break; - case ASTNodeDataType::matrix_t: - name = "R^" + stringify(data_type.numberOfRows()) + "x" + stringify(data_type.numberOfColumns()); - break; - case ASTNodeDataType::tuple_t: - name = "(" + dataTypeName(data_type.contentType()) + ")"; - break; + case ASTNodeDataType::undefined_t: { + return "undefined"; + } + case ASTNodeDataType::bool_t: { + return "B"; + } + case ASTNodeDataType::unsigned_int_t: { + return "N"; + } + case ASTNodeDataType::int_t: { + return "Z"; + } + case ASTNodeDataType::double_t: { + return "R"; + } + case ASTNodeDataType::vector_t: { + std::ostringstream data_type_name_vector; + data_type_name_vector << "R^" << data_type.dimension(); + return data_type_name_vector.str(); + } + case ASTNodeDataType::matrix_t: { + std::ostringstream data_type_name_matrix; + data_type_name_matrix << "R^" << data_type.numberOfRows() << "x" << data_type.numberOfColumns(); + return data_type_name_matrix.str(); + } + case ASTNodeDataType::tuple_t: { + std::ostringstream data_type_name_tuple; + data_type_name_tuple << "(" << dataTypeName(data_type.contentType()) << ")"; + return data_type_name_tuple.str(); + } case ASTNodeDataType::list_t: { std::ostringstream data_type_name_list; const auto& data_type_list = data_type.contentTypeList(); @@ -205,35 +210,38 @@ dataTypeName(const ASTNodeDataType& data_type) data_type_name_list << '*' << dataTypeName(*data_type_list[i]); } } - name = data_type_name_list.str(); + return data_type_name_list.str(); } else { - name = "void"; + return "void"; } - break; - } - case ASTNodeDataType::string_t: - name = "string"; - break; - case ASTNodeDataType::typename_t: - name = dataTypeName(data_type.contentType()); - break; - case ASTNodeDataType::type_name_id_t: - name = "type_name_id"; - break; - case ASTNodeDataType::type_id_t: - name = data_type.nameOfTypeId(); - break; - case ASTNodeDataType::function_t: - name = "function"; - break; - case ASTNodeDataType::builtin_function_t: - name = "builtin_function"; - break; - case ASTNodeDataType::void_t: - name = "void"; - break; - } - return name; + } + case ASTNodeDataType::string_t: { + return "string"; + } + case ASTNodeDataType::typename_t: { + return dataTypeName(data_type.contentType()); + } + case ASTNodeDataType::type_name_id_t: { + return "type_name_id"; + } + case ASTNodeDataType::type_id_t: { + return data_type.nameOfTypeId(); + } + case ASTNodeDataType::function_t: { + return "function"; + } + case ASTNodeDataType::builtin_function_t: { + return "builtin_function"; + } + case ASTNodeDataType::void_t: { + return "void"; + } + // LCOV_EXCL_START + default: { + throw UnexpectedError("unknown data type"); + } + // LCOV_EXCL_STOP + } } std::string diff --git a/src/mesh/ItemArrayUtils.hpp b/src/mesh/ItemArrayUtils.hpp index abba5cfe2631bf6c472f3a4c60a5c0eec8703acb..b1c3ba8cdad569f73f91029c24fb1333e05037ee 100644 --- a/src/mesh/ItemArrayUtils.hpp +++ b/src/mesh/ItemArrayUtils.hpp @@ -53,7 +53,7 @@ min(const ItemArray<DataType, item_type, ConnectivityPtr>& item_value) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src < dst) { // cannot be reached if initial value is the min @@ -152,7 +152,7 @@ max(const ItemArray<DataType, item_type, ConnectivityPtr>& item_value) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src > dst) { // cannot be reached if initial value is the max @@ -248,7 +248,7 @@ sum(const ItemArray<DataType, item_type, ConnectivityPtr>& item_value) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { dst += src; } diff --git a/src/mesh/ItemValueUtils.hpp b/src/mesh/ItemValueUtils.hpp index 3bff4868c30677ef8d11db3a94cb493c5bcb07a0..9ef745b550e42add842ac1c822cf65b07e34dc2b 100644 --- a/src/mesh/ItemValueUtils.hpp +++ b/src/mesh/ItemValueUtils.hpp @@ -49,7 +49,7 @@ min(const ItemValue<DataType, item_type, ConnectivityPtr>& item_value) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src < dst) { // cannot be reached if initial value is the min @@ -143,7 +143,7 @@ max(const ItemValue<DataType, item_type, ConnectivityPtr>& item_value) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src > dst) { // cannot be reached if initial value is the max @@ -236,7 +236,7 @@ sum(const ItemValue<DataType, item_type, ConnectivityPtr>& item_value) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { dst += src; } diff --git a/src/mesh/SubItemArrayPerItemUtils.hpp b/src/mesh/SubItemArrayPerItemUtils.hpp index 1c5ad24683c5527e8028896348ba73ff8160af74..d2553590ab0f0dad219cdfa82491c05a70b5edbe 100644 --- a/src/mesh/SubItemArrayPerItemUtils.hpp +++ b/src/mesh/SubItemArrayPerItemUtils.hpp @@ -57,7 +57,7 @@ min(const SubItemArrayPerItem<DataType, ItemOfItem, ConnectivityPtr>& sub_item_a PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src < dst) { // cannot be reached if initial array is the min @@ -159,7 +159,7 @@ max(const SubItemArrayPerItem<DataType, ItemOfItem, ConnectivityPtr>& sub_item_a PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src > dst) { // cannot be reached if initial array is the max @@ -258,7 +258,7 @@ sum(const SubItemArrayPerItem<DataType, ItemOfItem, ConnectivityPtr>& item_array PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { dst += src; } diff --git a/src/mesh/SubItemValuePerItemUtils.hpp b/src/mesh/SubItemValuePerItemUtils.hpp index 8443047745680161747998a8cd114ffac8fe2647..304acae23a31e610695a2b309e72e7d8035d01a5 100644 --- a/src/mesh/SubItemValuePerItemUtils.hpp +++ b/src/mesh/SubItemValuePerItemUtils.hpp @@ -55,7 +55,7 @@ min(const SubItemValuePerItem<DataType, ItemOfItem, ConnectivityPtr>& sub_item_v PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src < dst) { // cannot be reached if initial value is the min @@ -155,7 +155,7 @@ max(const SubItemValuePerItem<DataType, ItemOfItem, ConnectivityPtr>& sub_item_v PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src > dst) { // cannot be reached if initial value is the max @@ -252,7 +252,7 @@ sum(const SubItemValuePerItem<DataType, ItemOfItem, ConnectivityPtr>& item_value PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { dst += src; } diff --git a/src/scheme/DiscreteFunctionP0.hpp b/src/scheme/DiscreteFunctionP0.hpp index 1fb2ce14cee3f42e6c27c262e3ba6deefb5b555d..6587a19f2c77d1f063f38765b4e768d92798f7a4 100644 --- a/src/scheme/DiscreteFunctionP0.hpp +++ b/src/scheme/DiscreteFunctionP0.hpp @@ -743,7 +743,7 @@ class DiscreteFunctionP0 PUGS_INLINE void - join(volatile std::decay_t<data_type>& dst, const volatile std::decay_t<data_type>& src) const + join(std::decay_t<data_type>& dst, const std::decay_t<data_type>& src) const { dst += src; } diff --git a/src/utils/Array.hpp b/src/utils/Array.hpp index 3ee64824a650e18714a9b4b8523afb78cc89f643..4943d4c08d983f67d1550262e34aa80030d49bf1 100644 --- a/src/utils/Array.hpp +++ b/src/utils/Array.hpp @@ -279,7 +279,7 @@ min(const Array<DataType>& array) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src < dst) { dst = src; @@ -342,7 +342,7 @@ max(const Array<DataType>& array) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { if (src > dst) { dst = src; @@ -402,7 +402,7 @@ sum(const Array<DataType>& array) PUGS_INLINE void - join(volatile data_type& dst, const volatile data_type& src) const + join(data_type& dst, const data_type& src) const { dst += src; } diff --git a/src/utils/PugsUtils.cpp b/src/utils/PugsUtils.cpp index 3677d5c8fded780fcb2a468809443e0e26131ccf..60380902556f88f774b698c4f7f196ea5192930e 100644 --- a/src/utils/PugsUtils.cpp +++ b/src/utils/PugsUtils.cpp @@ -140,11 +140,10 @@ initialize(int& argc, char* argv[]) setDefaultOMPEnvironment(); { - Kokkos::InitArguments args; - args.num_threads = nb_threads; - args.num_numa = -1; - args.device_id = -1; - args.disable_warnings = true; + Kokkos::InitializationSettings args; + args.set_num_threads(nb_threads); + args.set_device_id(-1); + args.set_disable_warnings(true); Kokkos::initialize(args); } diff --git a/src/utils/PugsUtils.hpp b/src/utils/PugsUtils.hpp index 76d8ffd3feafd53d6fa2d5326fa18e8e65d95ca6..cf4c680099d8d115a090a9485a23afbb424ae25a 100644 --- a/src/utils/PugsUtils.hpp +++ b/src/utils/PugsUtils.hpp @@ -8,16 +8,16 @@ template <typename FunctionType> PUGS_FORCEINLINE void -parallel_for(size_t size, const FunctionType& lambda, const std::string& label = "") +parallel_for(size_t size, const FunctionType& lambda) { - Kokkos::parallel_for(size, lambda, label); + Kokkos::parallel_for(size, lambda); } template <typename FunctorType, typename ReturnType> PUGS_FORCEINLINE void -parallel_reduce(size_t size, const FunctorType& functor, ReturnType& value, const std::string& label = "") +parallel_reduce(size_t size, const FunctorType& functor, ReturnType& value) { - Kokkos::parallel_reduce(label, size, functor, value); + Kokkos::parallel_reduce(size, functor, value); } void setDefaultOMPEnvironment(); diff --git a/tests/mpi_test_main.cpp b/tests/mpi_test_main.cpp index eeaf00129829c33fd5e54cdcb44e09bb2419e91f..1692bd7aca6edafd683fe7351c104cea8283a81c 100644 --- a/tests/mpi_test_main.cpp +++ b/tests/mpi_test_main.cpp @@ -29,11 +29,10 @@ main(int argc, char* argv[]) const int nb_threads = std::max(nb_max_threads / parallel::Messenger::getInstance().size(), 1ul); { - Kokkos::InitArguments args; - args.num_threads = nb_threads; - args.num_numa = -1; - args.device_id = -1; - args.disable_warnings = true; + Kokkos::InitializationSettings args; + args.set_num_threads(nb_threads); + args.set_device_id(-1); + args.set_disable_warnings(true); Kokkos::initialize(args); } diff --git a/tests/test_ASTNode.cpp b/tests/test_ASTNode.cpp index 468a27a89dbe3be40c20ad386cd82434e52f2807..cda39283b3848f893a8bae7955d9ef57efc70839 100644 --- a/tests/test_ASTNode.cpp +++ b/tests/test_ASTNode.cpp @@ -54,8 +54,8 @@ TEST_CASE("ASTNode", "[language]") ASTNode ast_node; ast_node.source = "content"; const char* const start = &ast_node.source[0]; - ast_node.m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{start}; - ast_node.m_end = TAO_PEGTL_NAMESPACE::internal::iterator{start + 7}; + ast_node.m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{start}; + ast_node.m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{start + 7}; REQUIRE(ast_node.string() == "content"); REQUIRE(ast_node.string_view() == "content"); @@ -66,13 +66,13 @@ TEST_CASE("ASTNode", "[language]") ASTNode ast_node; ast_node.source = "content"; const char* const start = &ast_node.source[0]; - ast_node.m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{start + 2}; + ast_node.m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{start + 2}; { std::unique_ptr<ASTNode> child0_node = std::make_unique<ASTNode>(); - child0_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{start}; - child0_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{start + 3}; + child0_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{start}; + child0_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{start + 3}; ast_node.children.emplace_back(std::move(child0_node)); } @@ -80,8 +80,8 @@ TEST_CASE("ASTNode", "[language]") { std::unique_ptr<ASTNode> child1_node = std::make_unique<ASTNode>(); - child1_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{start + 4}; - child1_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{start + 7}; + child1_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{start + 4}; + child1_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{start + 7}; ast_node.children.emplace_back(std::move(child1_node)); } diff --git a/tests/test_ASTNodeAffectationExpressionBuilder.cpp b/tests/test_ASTNodeAffectationExpressionBuilder.cpp index f52a33c297bdea413b9f728498eecf8d67e96b30..39fcf659b208ac75ebbf198bddfe01b4c6ed06a1 100644 --- a/tests/test_ASTNodeAffectationExpressionBuilder.cpp +++ b/tests/test_ASTNodeAffectationExpressionBuilder.cpp @@ -173,6 +173,11 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou #ifdef __clang__ #pragma clang optimize off +#else // __clang__ +#ifdef __GNUG__ +#pragma GCC push_options +#pragma GCC optimize("O0") +#endif // __GNUG__ #endif // __clang__ // clazy:excludeall=non-pod-global-static @@ -7530,4 +7535,8 @@ let a:void, a = 3; #ifdef __clang__ #pragma clang optimize on +#else // __clang__ +#ifdef __GNUG__ +#pragma GCC pop_options +#endif // __GNUG__ #endif // __clang__ diff --git a/tests/test_ASTNodeDataType.cpp b/tests/test_ASTNodeDataType.cpp index 420ca58f6b366b8d41f14eafb5b22f43b52e6c99..b58ffe19772faef4de5b00e784207b806d101d00 100644 --- a/tests/test_ASTNodeDataType.cpp +++ b/tests/test_ASTNodeDataType.cpp @@ -116,8 +116,8 @@ TEST_CASE("ASTNodeDataType", "[language]") dimension_node->set_type<language::integer>(); dimension_node->source = "3"; const char* const beginning = &dimension_node->source[0]; - dimension_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - dimension_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + dimension_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + dimension_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; type_node->emplace_back(std::move(dimension_node)); } @@ -156,8 +156,8 @@ TEST_CASE("ASTNodeDataType", "[language]") { type_node->children[1]->source = "0"; const char* const beginning = &type_node->children[1]->source[0]; - type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; REQUIRE_THROWS_WITH(getVectorDataType(*type_node), "invalid dimension (must be 1, 2 or 3)"); } @@ -165,8 +165,8 @@ TEST_CASE("ASTNodeDataType", "[language]") { type_node->children[1]->source = "1"; const char* const beginning = &type_node->children[1]->source[0]; - type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; REQUIRE_NOTHROW(getVectorDataType(*type_node)); } @@ -174,8 +174,8 @@ TEST_CASE("ASTNodeDataType", "[language]") { type_node->children[1]->source = "4"; const char* const beginning = &type_node->children[1]->source[0]; - type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; REQUIRE_THROWS_WITH(getVectorDataType(*type_node), "invalid dimension (must be 1, 2 or 3)"); } @@ -257,8 +257,8 @@ TEST_CASE("ASTNodeDataType", "[language]") dimension0_node->set_type<language::integer>(); dimension0_node->source = "3"; const char* const beginning = &dimension0_node->source[0]; - dimension0_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - dimension0_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + dimension0_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + dimension0_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; type_node->emplace_back(std::move(dimension0_node)); } { @@ -266,8 +266,8 @@ TEST_CASE("ASTNodeDataType", "[language]") dimension1_node->set_type<language::integer>(); dimension1_node->source = "3"; const char* const beginning = &dimension1_node->source[0]; - dimension1_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - dimension1_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + dimension1_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + dimension1_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; type_node->emplace_back(std::move(dimension1_node)); } } @@ -314,14 +314,14 @@ TEST_CASE("ASTNodeDataType", "[language]") { type_node->children[1]->source = "0"; const char* const beginning = &type_node->children[1]->source[0]; - type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; } { type_node->children[2]->source = "0"; const char* const beginning = &type_node->children[2]->source[0]; - type_node->children[2]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[2]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[2]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[2]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; } REQUIRE_THROWS_WITH(getMatrixDataType(*type_node), "invalid dimension (must be 1, 2 or 3)"); @@ -329,14 +329,14 @@ TEST_CASE("ASTNodeDataType", "[language]") { type_node->children[1]->source = "4"; const char* const beginning = &type_node->children[1]->source[0]; - type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; } { type_node->children[2]->source = "4"; const char* const beginning = &type_node->children[2]->source[0]; - type_node->children[2]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[2]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[2]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[2]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; } REQUIRE_THROWS_WITH(getMatrixDataType(*type_node), "invalid dimension (must be 1, 2 or 3)"); @@ -347,14 +347,14 @@ TEST_CASE("ASTNodeDataType", "[language]") { type_node->children[1]->source = "1"; const char* const beginning = &type_node->children[1]->source[0]; - type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[1]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[1]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; } { type_node->children[2]->source = "2"; const char* const beginning = &type_node->children[2]->source[0]; - type_node->children[2]->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - type_node->children[2]->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + type_node->children[2]->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + type_node->children[2]->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; } REQUIRE_THROWS_WITH(getMatrixDataType(*type_node), "only square matrices are supported"); } diff --git a/tests/test_ASTNodeFunctionExpressionBuilder.cpp b/tests/test_ASTNodeFunctionExpressionBuilder.cpp index 7d760d2224fe4bbfb836b409a035830efd18b6fa..f26ee8ad39eac1c79150d3283ef71d45eba4ca71 100644 --- a/tests/test_ASTNodeFunctionExpressionBuilder.cpp +++ b/tests/test_ASTNodeFunctionExpressionBuilder.cpp @@ -111,6 +111,14 @@ const auto builtin_data_type = ast_node_data_type_from<std::shared_ptr<const dou REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, error); \ } +#ifdef __clang__ +#else // __clang__ +#ifdef __GNUG__ +#pragma GCC push_options +#pragma GCC optimize("O0") +#endif // __GNUG__ +#endif // __clang__ + // clazy:excludeall=non-pod-global-static TEST_CASE("ASTNodeFunctionExpressionBuilder", "[language]") @@ -4065,3 +4073,10 @@ let h:R*void -> R, (x,void) -> 2.5; } } } + +#ifdef __clang__ +#else // __clang__ +#ifdef __GNUG__ +#pragma GCC pop_options +#endif // __GNUG__ +#endif // __clang__ diff --git a/tests/test_ASTNodeNaturalConversionChecker.cpp b/tests/test_ASTNodeNaturalConversionChecker.cpp index 0d6dbd3d60550dcfae86e32398c987f8b2d4583b..161b934cb68b1825b5878f380e7cd395a7c612c0 100644 --- a/tests/test_ASTNodeNaturalConversionChecker.cpp +++ b/tests/test_ASTNodeNaturalConversionChecker.cpp @@ -100,8 +100,8 @@ TEST_CASE("ASTNodeNaturalConversionChecker", "[language]") data_node->set_type<language::integer>(); data_node->source = "0"; const char* const beginning = &data_node->source[0]; - data_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - data_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + data_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + data_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; SECTION("d = 1") { @@ -150,8 +150,8 @@ TEST_CASE("ASTNodeNaturalConversionChecker", "[language]") data_node->set_type<language::integer>(); data_node->source = "0"; const char* const beginning = &data_node->source[0]; - data_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - data_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + data_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + data_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; SECTION("d = 1") { @@ -924,8 +924,8 @@ TEST_CASE("ASTNodeNaturalConversionChecker", "[language]") data_node->set_type<language::integer>(); data_node->source = "1"; const char* const beginning = &data_node->source[0]; - data_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - data_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + data_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + data_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; SECTION("d=1") { @@ -1382,8 +1382,8 @@ TEST_CASE("ASTNodeNaturalConversionChecker", "[language]") data_node->set_type<language::integer>(); data_node->source = "1"; const char* const beginning = &data_node->source[0]; - data_node->m_begin = TAO_PEGTL_NAMESPACE::internal::iterator{beginning}; - data_node->m_end = TAO_PEGTL_NAMESPACE::internal::iterator{beginning + 1}; + data_node->m_begin = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning}; + data_node->m_end = TAO_PEGTL_NAMESPACE::internal::frobnicator{beginning + 1}; SECTION("d=1") { diff --git a/tests/test_ASTSymbolInitializationChecker.cpp b/tests/test_ASTSymbolInitializationChecker.cpp index b9bcef85937ee0563bb1d7f51e55ceaa00eaa93a..52b49d7c90ef3183a1cb6bd984493320f7484495 100644 --- a/tests/test_ASTSymbolInitializationChecker.cpp +++ b/tests/test_ASTSymbolInitializationChecker.cpp @@ -27,8 +27,8 @@ let p:N; ASTSymbolTableBuilder{*ast}; ASTSymbolInitializationChecker{*ast}; - position position{internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + position position{data.size(), 1, 1, "fixture"}; auto [symbol_m, found_m] = ast->m_symbol_table->find("m", position); REQUIRE(found_m); @@ -59,8 +59,8 @@ m = n; ASTSymbolTableBuilder{*ast}; ASTSymbolInitializationChecker{*ast}; - position position{internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + position position{data.size(), 1, 1, "fixture"}; auto [symbol_m, found_m] = ast->m_symbol_table->find("m", position); REQUIRE(found_m); @@ -87,8 +87,8 @@ let f: R->R, x->x+1; ASTSymbolTableBuilder{*ast}; ASTSymbolInitializationChecker{*ast}; - position position{internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + position position{data.size(), 1, 1, "fixture"}; auto [symbol_m, found_m] = ast->m_symbol_table->find("f", position); REQUIRE(found_m); @@ -109,8 +109,8 @@ let (x,y):R*R, (x,y) = (2.3, 4.1); ASTSymbolTableBuilder{*ast}; ASTSymbolInitializationChecker{*ast}; - position position{internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + position position{data.size(), 1, 1, "fixture"}; auto [symbol_x, found_x] = ast->m_symbol_table->find("x", position); REQUIRE(found_x); @@ -133,8 +133,8 @@ let x:R^2, x = (2.3, 4.1); ASTSymbolTableBuilder{*ast}; ASTSymbolInitializationChecker{*ast}; - position position{internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + position position{data.size(), 1, 1, "fixture"}; auto [symbol_x, found_x] = ast->m_symbol_table->find("x", position); REQUIRE(found_x); @@ -154,8 +154,8 @@ y = 3; ASTSymbolTableBuilder{*ast}; ASTSymbolInitializationChecker{*ast}; - position position{internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + position position{data.size(), 1, 1, "fixture"}; auto [symbol_x, found_x] = ast->m_symbol_table->find("x", position); REQUIRE(found_x); @@ -179,8 +179,8 @@ let (x,y):R*R; ASTSymbolTableBuilder{*ast}; ASTSymbolInitializationChecker{*ast}; - position position{internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + position position{data.size(), 1, 1, "fixture"}; auto [symbol_x, found_x] = ast->m_symbol_table->find("x", position); REQUIRE(found_x); @@ -204,8 +204,8 @@ let (x,y):R^3*R; ASTSymbolTableBuilder{*ast}; ASTSymbolInitializationChecker{*ast}; - position position{internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + position position{data.size(), 1, 1, "fixture"}; auto [symbol_x, found_x] = ast->m_symbol_table->find("x", position); REQUIRE(found_x); diff --git a/tests/test_AffectationProcessor.cpp b/tests/test_AffectationProcessor.cpp index 03781088ae664cff01ebde37314e0af1b15826ca..599a9457f4cb940f08409d47ebb7ef2c792e7478 100644 --- a/tests/test_AffectationProcessor.cpp +++ b/tests/test_AffectationProcessor.cpp @@ -45,8 +45,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ @@ -106,8 +105,7 @@ ASTBacktrace::destroy(); \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table.find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_AffectationToStringProcessor.cpp b/tests/test_AffectationToStringProcessor.cpp index 8e15ddc66cb379b841232ad377d244833aa618a6..68f97dfedd38da47c31a3aef9e64364e31e29a97 100644 --- a/tests/test_AffectationToStringProcessor.cpp +++ b/tests/test_AffectationToStringProcessor.cpp @@ -40,7 +40,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ + position use_position{10000, 1000, 10, "fixture"}; \ use_position.byte = 10000; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ diff --git a/tests/test_AffectationToTupleProcessor.cpp b/tests/test_AffectationToTupleProcessor.cpp index ca6a6294b77f14ed8846a60823fdf8d8632a56ba..b8e7010c9bcd748b168f048163619b7c61622edc 100644 --- a/tests/test_AffectationToTupleProcessor.cpp +++ b/tests/test_AffectationToTupleProcessor.cpp @@ -40,8 +40,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_ArraySubscriptProcessor.cpp b/tests/test_ArraySubscriptProcessor.cpp index 949951c226c55ee77234885175e5f0f9a42f287f..48998c7d39999b5c45590a80054377d5057c4355 100644 --- a/tests/test_ArraySubscriptProcessor.cpp +++ b/tests/test_ArraySubscriptProcessor.cpp @@ -41,8 +41,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_BinaryExpressionProcessor_arithmetic.cpp b/tests/test_BinaryExpressionProcessor_arithmetic.cpp index c93face344864f42e968322ce86f0f03efeabae9..c1ce3de0e03f5d9b0b14e43ba71cc06fd4c70359 100644 --- a/tests/test_BinaryExpressionProcessor_arithmetic.cpp +++ b/tests/test_BinaryExpressionProcessor_arithmetic.cpp @@ -81,8 +81,7 @@ ASTBacktrace::destroy(); \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table.find("r", use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_BinaryExpressionProcessor_utils.hpp b/tests/test_BinaryExpressionProcessor_utils.hpp index 5983cda355f76c7ed58d47fa544dc5fd82ba3b09..4b5deff94b6cab09ccdb72e6113dd5c2cc83d2e5 100644 --- a/tests/test_BinaryExpressionProcessor_utils.hpp +++ b/tests/test_BinaryExpressionProcessor_utils.hpp @@ -38,8 +38,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 1, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_BuiltinFunctionProcessor.cpp b/tests/test_BuiltinFunctionProcessor.cpp index 67812b0a4442e4d336dd20d5d579137804fe190b..de04b76016ad02a78130574129b74d95ca38ba94 100644 --- a/tests/test_BuiltinFunctionProcessor.cpp +++ b/tests/test_BuiltinFunctionProcessor.cpp @@ -39,8 +39,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ REQUIRE_THAT(found, Catch::Matchers::Predicate<bool>([](bool found) -> bool { return found; }, \ diff --git a/tests/test_ConcatExpressionProcessor.cpp b/tests/test_ConcatExpressionProcessor.cpp index e7779f0bc3296773915de07d529b126b5380674c..315f89d518e0262cdc6b44d3d99f13673d803168 100644 --- a/tests/test_ConcatExpressionProcessor.cpp +++ b/tests/test_ConcatExpressionProcessor.cpp @@ -38,8 +38,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_DiscreteFunctionIntegrator.cpp b/tests/test_DiscreteFunctionIntegrator.cpp index 26a14385f67501c8f9145d5bfa6756517726849e..8970a360d6c0bf96feae69f17df05ba806cc44ef 100644 --- a/tests/test_DiscreteFunctionIntegrator.cpp +++ b/tests/test_DiscreteFunctionIntegrator.cpp @@ -87,8 +87,8 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_1d") { @@ -323,8 +323,8 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_2d") { @@ -559,8 +559,8 @@ let R3x3_non_linear_3d: R^3 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_3d") { diff --git a/tests/test_DiscreteFunctionIntegratorByZone.cpp b/tests/test_DiscreteFunctionIntegratorByZone.cpp index 0b550b063fd14ec53df39f9395c4061ef997f17e..4027507e4c06ab7b97acec7a42707a03536f79c8 100644 --- a/tests/test_DiscreteFunctionIntegratorByZone.cpp +++ b/tests/test_DiscreteFunctionIntegratorByZone.cpp @@ -90,8 +90,8 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_1d") { @@ -419,8 +419,8 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_2d") { @@ -748,8 +748,8 @@ let R3x3_non_linear_3d: R^3 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_3d") { diff --git a/tests/test_DiscreteFunctionInterpoler.cpp b/tests/test_DiscreteFunctionInterpoler.cpp index fd3f3b6724e3ff8efd1cd3446d261cd06de448fb..ed28e8f929d3b640395a17981c3b86abb57018bd 100644 --- a/tests/test_DiscreteFunctionInterpoler.cpp +++ b/tests/test_DiscreteFunctionInterpoler.cpp @@ -85,8 +85,8 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_1d") { @@ -374,8 +374,8 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_2d") { @@ -664,8 +664,8 @@ let R3x3_non_linear_3d: R^3 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_3d") { diff --git a/tests/test_DiscreteFunctionInterpolerByZone.cpp b/tests/test_DiscreteFunctionInterpolerByZone.cpp index 8a0297d3ef1de251c23a66107303aa02f3d23fb8..dd242220e3eb17b8d45c8cbf8a83ada5b10acd83 100644 --- a/tests/test_DiscreteFunctionInterpolerByZone.cpp +++ b/tests/test_DiscreteFunctionInterpolerByZone.cpp @@ -93,8 +93,8 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_1d") { @@ -426,8 +426,8 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_2d") { @@ -760,8 +760,8 @@ let R3x3_non_linear_3d: R^3 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_3d") { diff --git a/tests/test_DiscreteFunctionVectorIntegrator.cpp b/tests/test_DiscreteFunctionVectorIntegrator.cpp index 60afd2dbcf3e1e730cbaf273166e0258d8ae40f2..e5712786254c42723778e05cc37e2a3158f90bda 100644 --- a/tests/test_DiscreteFunctionVectorIntegrator.cpp +++ b/tests/test_DiscreteFunctionVectorIntegrator.cpp @@ -90,8 +90,8 @@ let R_scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -179,8 +179,8 @@ let R_scalar_non_linear_2d: R^2 -> R, x -> 2 * exp(x[0] + x[1]) + 3; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -268,8 +268,8 @@ let R_scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0] + x[1]) + 3 * x[2]; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -356,8 +356,8 @@ let R2_scalar_non_linear_3d: R^3 -> R^2, x -> [2 * exp(x[0] + x[1]) + 3 * x[2], ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; diff --git a/tests/test_DiscreteFunctionVectorIntegratorByZone.cpp b/tests/test_DiscreteFunctionVectorIntegratorByZone.cpp index 01297d03df6cbadc0a7cff50546aa2737444e4d8..c6526f0c14880cfe7e918053ded8acbb48b92eeb 100644 --- a/tests/test_DiscreteFunctionVectorIntegratorByZone.cpp +++ b/tests/test_DiscreteFunctionVectorIntegratorByZone.cpp @@ -93,8 +93,8 @@ let R_scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -221,8 +221,8 @@ let R_scalar_non_linear_2d: R^2 -> R, x -> 2 * exp(x[0] + x[1]) + 3; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -349,8 +349,8 @@ let R_scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0] + x[1]) + 3 * x[2]; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; diff --git a/tests/test_DiscreteFunctionVectorInterpoler.cpp b/tests/test_DiscreteFunctionVectorInterpoler.cpp index 3a4871076739a3fc873bd0cd69547099f9f67c67..2069db16cbd638dadc093fa02bde505f342db768 100644 --- a/tests/test_DiscreteFunctionVectorInterpoler.cpp +++ b/tests/test_DiscreteFunctionVectorInterpoler.cpp @@ -87,8 +87,8 @@ let R_scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -191,8 +191,8 @@ let R_scalar_non_linear_2d: R^2 -> R, x -> 2 * exp(x[0] + x[1]) + 3; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -295,8 +295,8 @@ let R_scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0] + x[1]) + 3 * x[2]; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -398,8 +398,8 @@ let R2_scalar_non_linear_3d: R^3 -> R^2, x -> [2 * exp(x[0] + x[1]) + 3 * x[2], ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; diff --git a/tests/test_DiscreteFunctionVectorInterpolerByZone.cpp b/tests/test_DiscreteFunctionVectorInterpolerByZone.cpp index 0547aa3cf6bfe74a27b44630a34bb1d6f9e7724b..b486cd528743a337c7a127499c62c7bd71748db4 100644 --- a/tests/test_DiscreteFunctionVectorInterpolerByZone.cpp +++ b/tests/test_DiscreteFunctionVectorInterpolerByZone.cpp @@ -95,8 +95,8 @@ let R_scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -220,8 +220,8 @@ let R_scalar_non_linear_2d: R^2 -> R, x -> 2 * exp(x[0] + x[1]) + 3; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -345,8 +345,8 @@ let R_scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0] + x[1]) + 3 * x[2]; ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; @@ -463,8 +463,8 @@ let R2_scalar_non_linear_3d: R^3 -> R^2, x -> [2 * exp(x[0] + x[1]) + 3 * x[2], ASTNodeTypeCleaner<language::fct_declaration>{*ast}; ASTNodeExpressionBuilder{*ast}; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; diff --git a/tests/test_DoWhileProcessor.cpp b/tests/test_DoWhileProcessor.cpp index 13942906c78cc81abde2ba40b64c1adb91756434..ca8138191bf37e963d56492adb682b3cc66fe161 100644 --- a/tests/test_DoWhileProcessor.cpp +++ b/tests/test_DoWhileProcessor.cpp @@ -37,8 +37,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_ForProcessor.cpp b/tests/test_ForProcessor.cpp index a83482550be288ed2104c6f28ed348955aee2914..b55de095c9335178bd0dcc92543218a1bde9c14e 100644 --- a/tests/test_ForProcessor.cpp +++ b/tests/test_ForProcessor.cpp @@ -37,8 +37,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_FunctionProcessor.cpp b/tests/test_FunctionProcessor.cpp index 500998b50f1729e9416b26cef7462bcc101b3151..2a11caff89e418956cea81a8f4f64276c93c5756 100644 --- a/tests/test_FunctionProcessor.cpp +++ b/tests/test_FunctionProcessor.cpp @@ -37,8 +37,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 1, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_IfProcessor.cpp b/tests/test_IfProcessor.cpp index 461f3a98f8279a55e098e22fc5b63cec8276cc35..8c0ee437d76585d3a0381d136ed70de136ed0cba 100644 --- a/tests/test_IfProcessor.cpp +++ b/tests/test_IfProcessor.cpp @@ -35,8 +35,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_IncDecExpressionProcessor.cpp b/tests/test_IncDecExpressionProcessor.cpp index ba04c7ab259797b49ca6a9ffd1eb57f5d1a72b38..960845cf229abb9f436e6016e6202d5b0d8dcb99 100644 --- a/tests/test_IncDecExpressionProcessor.cpp +++ b/tests/test_IncDecExpressionProcessor.cpp @@ -35,8 +35,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_IntegrateCellArray.cpp b/tests/test_IntegrateCellArray.cpp index 0b64ca10e057803c4b8bd0befd06a27277239c9c..8a3692ca56bb0c04bbbb4417e4d6ccac6a57b707 100644 --- a/tests/test_IntegrateCellArray.cpp +++ b/tests/test_IntegrateCellArray.cpp @@ -78,8 +78,8 @@ let g: R^1 -> R, x -> 2 * exp(x[0]) + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -164,8 +164,8 @@ let g: R^2 -> R, x -> 2*exp(x[0])*sin(x[1])+3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -261,8 +261,8 @@ let g: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -372,8 +372,8 @@ let g: R^1 -> R, x -> 2 * exp(x[0]) + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -467,8 +467,8 @@ let g: R^2 -> R, x -> 2*exp(x[0])*sin(x[1])+3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -573,8 +573,8 @@ let g: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; diff --git a/tests/test_IntegrateCellValue.cpp b/tests/test_IntegrateCellValue.cpp index c109c227c35eeb10362a339dd9aaa5e8a947114f..a230b9530056f764f0061abaa8dcd151087d6f44 100644 --- a/tests/test_IntegrateCellValue.cpp +++ b/tests/test_IntegrateCellValue.cpp @@ -74,8 +74,8 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; using R2x2 = TinyMatrix<2>; auto [i_symbol, found] = symbol_table->find("R2x2_1d", position); @@ -132,8 +132,8 @@ let R3_2d: R^2 -> R^3, x -> [2*exp(x[0])*sin(x[1])+3, x[0]-2*x[1], 3]; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; using R3 = TinyVector<3>; auto [i_symbol, found] = symbol_table->find("R3_2d", position); @@ -201,8 +201,8 @@ let scalar_3d: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; auto [i_symbol, found] = symbol_table->find("scalar_3d", position); REQUIRE(found); @@ -279,8 +279,8 @@ let scalar_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; auto [i_symbol, found] = symbol_table->find("scalar_1d", position); REQUIRE(found); @@ -344,8 +344,8 @@ let R3_2d: R^2 -> R^3, x -> [2*exp(x[0])*sin(x[1])+3, x[0]-2*x[1], 3]; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; using R3 = TinyVector<3>; auto [i_symbol, found] = symbol_table->find("R3_2d", position); @@ -423,8 +423,8 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; using R2x2 = TinyMatrix<2>; auto [i_symbol, found] = symbol_table->find("R2x2_3d", position); diff --git a/tests/test_IntegrateOnCells.cpp b/tests/test_IntegrateOnCells.cpp index 5207325e8a4d36c1b8dd66ea24d3ddfa3be3af9f..2104bcbf364b8aa039bbb896e56e958188c5f96d 100644 --- a/tests/test_IntegrateOnCells.cpp +++ b/tests/test_IntegrateOnCells.cpp @@ -78,8 +78,8 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 1d") { @@ -179,8 +179,8 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 2d") { @@ -292,8 +292,8 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 3d") { @@ -419,8 +419,8 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 1d") { @@ -530,8 +530,8 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 2d") { @@ -653,8 +653,8 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 3d") { @@ -774,8 +774,8 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 1d") { @@ -875,8 +875,8 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 2d") { @@ -988,8 +988,8 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 3d") { @@ -1115,8 +1115,8 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 1d") { @@ -1226,8 +1226,8 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 2d") { @@ -1349,8 +1349,8 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 3d") { @@ -1470,8 +1470,8 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 1d") { @@ -1571,8 +1571,8 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 2d") { @@ -1684,8 +1684,8 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 3d") { @@ -1811,8 +1811,8 @@ let R2x2_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin(x[0] - 2 * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 1d") { @@ -1922,8 +1922,8 @@ let R2x2_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2*x[1])], [3 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 2d") { @@ -2045,8 +2045,8 @@ let R2x2_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos(x[2]), sin std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar 3d") { diff --git a/tests/test_InterpolateItemArray.cpp b/tests/test_InterpolateItemArray.cpp index 61674ce2d3d5e105fb7f8f1b6322ccc0f6ff4dcd..01720b617888bda30674993a42a0dc78ef951cc6 100644 --- a/tests/test_InterpolateItemArray.cpp +++ b/tests/test_InterpolateItemArray.cpp @@ -81,8 +81,8 @@ let scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -149,8 +149,8 @@ let f_1d: R^1 -> (R), x -> (2*x[0] + 2, 2 * exp(x[0]) + 3); std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -208,8 +208,8 @@ let f_1d: R^1 -> (R^1), x -> (2*x[0] + 2, [2 * exp(x[0]) + 3]); std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -277,8 +277,8 @@ let scalar_non_linear_2d: R^2 -> R, x -> 2*exp(x[0])*sin(x[1])+3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -345,8 +345,8 @@ let f_2d: R^2 -> (R), x -> (2*x[0] + 3*x[1] + 2, 2*exp(x[0])*sin(x[1])+3); std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -412,8 +412,8 @@ let scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -480,8 +480,8 @@ let f_3d: R^3 -> (R), x -> (2 * x[0] + 3 * x[1] + 2 * x[2] - 1, 2 * exp(x[0]) * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -569,8 +569,8 @@ let scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -646,8 +646,8 @@ let f_1d: R^1 -> (R), x -> (2*x[0] + 2, 2 * exp(x[0]) + 3); std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -719,8 +719,8 @@ let scalar_non_linear_2d: R^2 -> R, x -> 2*exp(x[0])*sin(x[1])+3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -793,8 +793,8 @@ let f_2d: R^2 -> (R), x -> (2*x[0] + 3*x[1] + 2, 2*exp(x[0])*sin(x[1])+3); std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -858,8 +858,8 @@ let f_2d: R^2 -> (R^2x2), x -> ([[x[0],0],[2-x[1], x[0]*x[1]]], [[2*x[0], x[1]], std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -936,8 +936,8 @@ let scalar_non_linear_3d: R^3 -> R, x -> 2 * exp(x[0]) * sin(x[1]) * x[2] + 3; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -1010,8 +1010,8 @@ let f_3d: R^3 -> (R), x -> (2 * x[0] + 3 * x[1] + 2 * x[2] - 1, 2 * exp(x[0]) * std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; @@ -1075,8 +1075,8 @@ let f_3d: R^3 -> (R^3), x -> (2*x, [2*x[0]-x[1], 3*x[2]-x[0], x[1]+x[2]], 0); std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; std::vector<FunctionSymbolId> function_symbol_id_list; diff --git a/tests/test_InterpolateItemValue.cpp b/tests/test_InterpolateItemValue.cpp index 9ee0a324f01728d54f88c0d864dd5950c7cb2339..a06eee8ca72584903c73b28defdba220ca7dadf7 100644 --- a/tests/test_InterpolateItemValue.cpp +++ b/tests/test_InterpolateItemValue.cpp @@ -80,8 +80,8 @@ let R2x2_non_linear_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar_affine_1d") { @@ -251,8 +251,8 @@ let R2x2_non_linear_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar_affine_2d") { @@ -416,8 +416,8 @@ let R2x2_non_linear_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar_affine_3d") { @@ -603,8 +603,8 @@ let R2x2_non_linear_1d: R^1 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar_affine_1d") { @@ -782,8 +782,8 @@ let R2x2_non_linear_2d: R^2 -> R^2x2, x -> [[2*exp(x[0])*sin(x[1])+3, sin(x[0]-2 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar_affine_2d") { @@ -956,8 +956,8 @@ let R2x2_non_linear_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3 * cos std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("scalar_affine_3d") { diff --git a/tests/test_ItemArrayVariantFunctionInterpoler.cpp b/tests/test_ItemArrayVariantFunctionInterpoler.cpp index 3a2c4aadaaba0794a3ebca697739e093e712ef3e..05d0ab6a7a0d96d7913b8949f2256fb494b465b4 100644 --- a/tests/test_ItemArrayVariantFunctionInterpoler.cpp +++ b/tests/test_ItemArrayVariantFunctionInterpoler.cpp @@ -104,8 +104,8 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_1d") { @@ -460,8 +460,8 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_2d") { @@ -592,8 +592,8 @@ let R2x2_non_linear_3d: R^3 -> R^2x2, std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("R_scalar_non_linear_3d") { diff --git a/tests/test_ItemValueVariantFunctionInterpoler.cpp b/tests/test_ItemValueVariantFunctionInterpoler.cpp index be1d4272b8019d493760d228735fa5d08985ef04..bd05f94e9ade781d2e36fdc075a977166597ffaf 100644 --- a/tests/test_ItemValueVariantFunctionInterpoler.cpp +++ b/tests/test_ItemValueVariantFunctionInterpoler.cpp @@ -83,8 +83,8 @@ let R3x3_non_linear_1d: R^1 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[0]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_1d") { @@ -355,8 +355,8 @@ let R3x3_non_linear_2d: R^2 -> R^3x3, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("B_scalar_non_linear_2d") { @@ -474,8 +474,8 @@ let R2x2_non_linear_3d: R^3 -> R^2x2, x -> [[2 * exp(x[0]) * sin(x[1]) + 3, sin( std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this point + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; SECTION("R_scalar_non_linear_3d") { diff --git a/tests/test_ListAffectationProcessor.cpp b/tests/test_ListAffectationProcessor.cpp index 2c28e6e0b0e6a8c8ae8c61d4b5778c8e3617af58..5910b3b4967acb846c11ff768ae4aa043772be57 100644 --- a/tests/test_ListAffectationProcessor.cpp +++ b/tests/test_ListAffectationProcessor.cpp @@ -35,8 +35,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 1, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_NameProcessor.cpp b/tests/test_NameProcessor.cpp index 3e607bb52eded2c70d411ed4298951b95585311b..1433eff93265614a36dfd0dcb16d4d9c7db13257 100644 --- a/tests/test_NameProcessor.cpp +++ b/tests/test_NameProcessor.cpp @@ -45,10 +45,9 @@ n = 2; auto symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position use_position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - use_position.byte = 100; // after declarative position - auto symbol_n = symbol_table->find("n", use_position).first->attributes(); - auto value_n = std::get<long unsigned int>(symbol_n.value()); + TAO_PEGTL_NAMESPACE::position use_position{100, 1, 1, "fixture"}; + auto symbol_n = symbol_table->find("n", use_position).first->attributes(); + auto value_n = std::get<long unsigned int>(symbol_n.value()); REQUIRE(value_n == 2); diff --git a/tests/test_ParseError.cpp b/tests/test_ParseError.cpp index 9555711966d2a37121d4afa223f193a3441455ad..12ee1ff1332affa22a9e13a2333781d4fa6648c1 100644 --- a/tests/test_ParseError.cpp +++ b/tests/test_ParseError.cpp @@ -15,7 +15,7 @@ TEST_CASE("ParseError", "[language]") a first line a second line )"; - TAO_PEGTL_NAMESPACE::internal::iterator i(&source[0], 3, 1, 2); + TAO_PEGTL_NAMESPACE::internal::frobnicator i(&source[0], 3, 1, 2); TAO_PEGTL_NAMESPACE::position p{i, source}; ParseError parse_error("error message", p); REQUIRE(parse_error.positions() == std::vector{p}); @@ -28,9 +28,9 @@ a second line a first line a second line )"; - TAO_PEGTL_NAMESPACE::internal::iterator i0(&source[0], 3, 1, 2); + TAO_PEGTL_NAMESPACE::internal::frobnicator i0(&source[0], 3, 1, 2); TAO_PEGTL_NAMESPACE::position p0{i0, source}; - TAO_PEGTL_NAMESPACE::internal::iterator i1(&source[0], 4, 1, 3); + TAO_PEGTL_NAMESPACE::internal::frobnicator i1(&source[0], 4, 1, 3); TAO_PEGTL_NAMESPACE::position p1{i1, source}; ParseError parse_error("error message", std::vector{p0, p1}); diff --git a/tests/test_PugsFunctionAdapter.cpp b/tests/test_PugsFunctionAdapter.cpp index 9e645802fde6e286abfeb57e7c4c35dd584583c4..68d02133b26e07382dac7f6588f4554093bd2151 100644 --- a/tests/test_PugsFunctionAdapter.cpp +++ b/tests/test_PugsFunctionAdapter.cpp @@ -102,8 +102,8 @@ let R33toR33zero: R^3x3 -> R^3x3, x -> 0; std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; { auto [i_symbol, found] = symbol_table->find("Rtimes2", position); @@ -390,8 +390,8 @@ let R33toR22: R^3x3 -> R^2x2, x -> [[x[0,0], x[0,1]+x[0,2]], [x[2,0]*x[1,1], x[2 std::shared_ptr<SymbolTable> symbol_table = ast->m_symbol_table; - TAO_PEGTL_NAMESPACE::position position{TAO_PEGTL_NAMESPACE::internal::iterator{"fixture"}, "fixture"}; - position.byte = data.size(); // ensure that variables are declared at this + // ensure that variables are declared at this point + TAO_PEGTL_NAMESPACE::position position{data.size(), 1, 1, "fixture"}; { auto [i_symbol, found] = symbol_table->find("R1toR1", position); diff --git a/tests/test_SymbolTable.cpp b/tests/test_SymbolTable.cpp index 78cd4373b9901aa69a65bc8bceaa4a7e68c1ad0b..ed93b4d21c48499f455d4fe5544608e2fea9324d 100644 --- a/tests/test_SymbolTable.cpp +++ b/tests/test_SymbolTable.cpp @@ -5,7 +5,7 @@ #include <language/utils/SymbolTable.hpp> #include <language/utils/TypeDescriptor.hpp> -#include <pegtl/internal/iterator.hpp> +#include <pegtl/internal/frobnicator.hpp> #include <sstream> @@ -18,7 +18,7 @@ TEST_CASE("SymbolTable", "[language]") std::shared_ptr root_st = std::make_shared<SymbolTable>(); using namespace TAO_PEGTL_NAMESPACE; - position begin_position{internal::iterator{"fixture"}, "fixture"}; + position begin_position{internal::frobnicator{"fixture"}, "fixture"}; begin_position.byte = 2; auto [i_symbol_a, created_a] = root_st->add("a", begin_position); @@ -29,7 +29,7 @@ TEST_CASE("SymbolTable", "[language]") // Check that one cannot build another "a" in this table REQUIRE(not root_st->add("a", begin_position).second); - position use_position{internal::iterator{"fixture"}, "fixture"}; + position use_position{internal::frobnicator{"fixture"}, "fixture"}; use_position.byte = 3; // after declarative position auto [i_search_a, found_a] = root_st->find("a", use_position); @@ -106,15 +106,15 @@ TEST_CASE("SymbolTable", "[language]") std::shared_ptr root_st = std::make_shared<SymbolTable>(); using namespace TAO_PEGTL_NAMESPACE; - position begin_position{internal::iterator{"fixture"}, "fixture"}; - position end_declaration{internal::iterator{"fixture"}, "fixture"}; + position begin_position{internal::frobnicator{"fixture"}, "fixture"}; + position end_declaration{internal::frobnicator{"fixture"}, "fixture"}; auto [i_root_symbol_a, created_root_a] = root_st->add("a", begin_position); REQUIRE(created_root_a); std::shared_ptr nested_st = std::make_shared<SymbolTable>(root_st); - position use_position{internal::iterator{"fixture"}, "fixture"}; + position use_position{internal::frobnicator{"fixture"}, "fixture"}; auto [i_search_a, found_a] = nested_st->find("a", use_position); REQUIRE(found_a); // symbol "a" is the one defined in root_st @@ -139,13 +139,13 @@ TEST_CASE("SymbolTable", "[language]") std::shared_ptr root_st = std::make_shared<SymbolTable>(); using namespace TAO_PEGTL_NAMESPACE; - position begin_position{internal::iterator{"fixture"}, "fixture"}; + position begin_position{internal::frobnicator{"fixture"}, "fixture"}; begin_position.byte = 2; auto [i_symbol_a, created_a] = root_st->add("a", begin_position); REQUIRE(i_symbol_a->attributes().position().byte == 2); - position use_position{internal::iterator{"fixture"}, "fixture"}; + position use_position{internal::frobnicator{"fixture"}, "fixture"}; use_position.byte = 3; // after declarative position auto [i_search_a, found_a] = root_st->find("a", use_position); diff --git a/tests/test_TupleToVectorProcessor.cpp b/tests/test_TupleToVectorProcessor.cpp index 74865d2ce1019e19e2474f059fde4708a2e5e735..0eab5884c6a590a8adf8ee656bd62cf3b528deb5 100644 --- a/tests/test_TupleToVectorProcessor.cpp +++ b/tests/test_TupleToVectorProcessor.cpp @@ -36,8 +36,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_UnaryExpressionProcessor.cpp b/tests/test_UnaryExpressionProcessor.cpp index 2c3f6acb8eb7f8280e8717cdf495abd341dec5d0..235ba29d9f370b53abbf82a5d027797bd834e672 100644 --- a/tests/test_UnaryExpressionProcessor.cpp +++ b/tests/test_UnaryExpressionProcessor.cpp @@ -45,8 +45,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ @@ -126,8 +125,7 @@ TEST_CASE("UnaryExpressionProcessor", "[language]") ast->execute(exec_policy); using namespace TAO_PEGTL_NAMESPACE; - position use_position{internal::iterator{"fixture"}, "fixture"}; - use_position.byte = 10000; + position use_position{10000, 1000, 10, "fixture"}; auto [symbol, found] = symbol_table.find("r", use_position); auto attributes = symbol->attributes(); diff --git a/tests/test_WhileProcessor.cpp b/tests/test_WhileProcessor.cpp index 1de4c6c5c4a7aa8b356a2fb77d4c211b521eedf5..69fa63d729c669dd4aba67f29887699147f428db 100644 --- a/tests/test_WhileProcessor.cpp +++ b/tests/test_WhileProcessor.cpp @@ -36,8 +36,7 @@ auto symbol_table = ast->m_symbol_table; \ \ using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ + position use_position{10000, 1000, 10, "fixture"}; \ auto [symbol, found] = symbol_table->find(variable_name, use_position); \ \ auto attributes = symbol->attributes(); \ diff --git a/tests/test_main.cpp b/tests/test_main.cpp index 0dcf46cfe0e22d9bce9572b27b072a4a58c16b98..0e334f92c8a73ca526e905c1c5d6e82236f2d1ea 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -24,11 +24,10 @@ main(int argc, char* argv[]) const int nb_threads = std::max(std::thread::hardware_concurrency(), 1u); { - Kokkos::InitArguments args; - args.num_threads = nb_threads; - args.num_numa = -1; - args.device_id = -1; - args.disable_warnings = true; + Kokkos::InitializationSettings args; + args.set_num_threads(nb_threads); + args.set_device_id(-1); + args.set_disable_warnings(true); Kokkos::initialize(args); }